| 1 | // Aseprite | 
|---|
| 2 | // Copyright (C) 2001-2015  David Capello | 
|---|
| 3 | // | 
|---|
| 4 | // This program is distributed under the terms of | 
|---|
| 5 | // the End-User License Agreement for Aseprite. | 
|---|
| 6 |  | 
|---|
| 7 | #ifndef APP_CMD_SEQUENCE_H_INCLUDED | 
|---|
| 8 | #define APP_CMD_SEQUENCE_H_INCLUDED | 
|---|
| 9 | #pragma once | 
|---|
| 10 |  | 
|---|
| 11 | #include "app/cmd.h" | 
|---|
| 12 |  | 
|---|
| 13 | #include <vector> | 
|---|
| 14 |  | 
|---|
| 15 | namespace app { | 
|---|
| 16 |  | 
|---|
| 17 | class CmdSequence : public Cmd { | 
|---|
| 18 | public: | 
|---|
| 19 | CmdSequence(); | 
|---|
| 20 | ~CmdSequence(); | 
|---|
| 21 |  | 
|---|
| 22 | void add(Cmd* cmd); | 
|---|
| 23 |  | 
|---|
| 24 | // Helper to create a CmdSequence in the same onExecute() member | 
|---|
| 25 | // function. | 
|---|
| 26 | void executeAndAdd(Cmd* cmd); | 
|---|
| 27 |  | 
|---|
| 28 | protected: | 
|---|
| 29 | void onExecute() override; | 
|---|
| 30 | void onUndo() override; | 
|---|
| 31 | void onRedo() override; | 
|---|
| 32 | size_t onMemSize() const override; | 
|---|
| 33 |  | 
|---|
| 34 | private: | 
|---|
| 35 | std::vector<Cmd*> m_cmds; | 
|---|
| 36 | }; | 
|---|
| 37 |  | 
|---|
| 38 | } // namespace app | 
|---|
| 39 |  | 
|---|
| 40 | #endif | 
|---|
| 41 |  | 
|---|