forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.h
57 lines (42 loc) · 1.06 KB
/
cmd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 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