aseprite/src/app/cmd.h
David Capello 457a9999b5 Move doc::Context to app::Context (#378)
We've moved everything related to Context/active site/observable
documents from "doc" namespace to "app" namespace.
2018-07-07 02:47:42 -03:00

58 lines
1.1 KiB
C++

// Aseprite
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef APP_CMD_H_INCLUDED
#define APP_CMD_H_INCLUDED
#pragma once
#include "base/disable_copying.h"
#include "undo/undo_command.h"
#include <string>
namespace app {
class Context;
class Cmd : public undo::UndoCommand {
public:
Cmd();
virtual ~Cmd();
void execute(Context* ctx);
// undo::UndoCommand impl
void undo() override;
void redo() override;
void dispose() override;
std::string label() const;
size_t memSize() const;
Context* context() const { return m_ctx; }
protected:
virtual void onExecute();
virtual void onUndo();
virtual void onRedo();
virtual void onFireNotifications();
virtual std::string onLabel() const;
virtual size_t onMemSize() const;
private:
Context* m_ctx;
#if _DEBUG
enum class State { NotExecuted, Executed, Undone, Redone };
State m_state;
#endif
DISABLE_COPYING(Cmd);
};
} // namespace app
#endif