Last change
on this file since 0012e6 was 0012e6, checked in by Tillmann Crueger <crueger@…>, 15 years ago |
Added methods that allow bookkeeping of actions for undo/redo methods
|
-
Property mode
set to
100644
|
File size:
825 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * Action.cpp
|
---|
3 | *
|
---|
4 | * Created on: Dec 8, 2009
|
---|
5 | * Author: crueger
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include <string>
|
---|
9 |
|
---|
10 | #include "Actions/Action.hpp"
|
---|
11 | #include "Actions/ActionRegistry.hpp"
|
---|
12 |
|
---|
13 | using namespace std;
|
---|
14 |
|
---|
15 | // this object is only ever used as indicator.
|
---|
16 | ActionState success_val;
|
---|
17 |
|
---|
18 | ActionState *Action::success = &success_val;
|
---|
19 |
|
---|
20 | Action::Action(std::string _name,bool _doRegister) :
|
---|
21 | name(_name)
|
---|
22 | {
|
---|
23 | if(_doRegister){
|
---|
24 | ActionRegistry::getInstance().registerAction(this);
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | Action::~Action()
|
---|
29 | {}
|
---|
30 |
|
---|
31 | const string Action::getName(){
|
---|
32 | return name;
|
---|
33 | }
|
---|
34 |
|
---|
35 | void Action::call(){
|
---|
36 | // forward to private virtual
|
---|
37 | performCall();
|
---|
38 | }
|
---|
39 | ActionState* Action::undo(ActionState* _state) {
|
---|
40 | // forward to private virtual
|
---|
41 | return performUndo(_state);
|
---|
42 | }
|
---|
43 | ActionState* Action::redo(ActionState* _state) {
|
---|
44 | // forward to private virtual
|
---|
45 | return performRedo(_state);
|
---|
46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.