My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
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
#ifndef FORM_EDITOR_COMMON__I_HISTORY_H
#define FORM_EDITOR_COMMON__I_HISTORY_H

#include <Core/Core.h>
using namespace Upp;

class IHistoryItem
{
public:
virtual ~IHistoryItem() {}

virtual String SetDesc(const char* desc) { return String(); }
virtual String GetDesc() const = 0;
virtual void Undo() = 0;
virtual void Do() = 0;
};

// Group action
class HBatchAction : public IHistoryItem
{
Array<IHistoryItem*> _Actions;
String _Desc;

public:
virtual HBatchAction& Add(IHistoryItem* item) { _Actions.Add(item); return *this; }
virtual ~HBatchAction()
{
for (int i = 0; i < _Actions.GetCount(); ++i)
if (_Actions[i])
delete _Actions[i];
}

virtual String SetDesc(const char* desc) { return _Desc = String(desc); }
virtual String GetDesc() const { return _Desc; }

virtual void Undo()
{
for (int i = _Actions.GetCount() - 1; i >= 0; --i)
if (_Actions[i])
_Actions[i]->Undo();
}

virtual void Do()
{
for (int i = 0; i < _Actions.GetCount(); ++i)
if (_Actions[i])
_Actions[i]->Do();
}
};

#endif

Change log

r4180 by Sc0rch on Nov 17, 2011   Diff
MapRender: First release
(FormEditorCommon, FormEditorProperties,
Map, MapBG, MapCommon, MapEditor,
MapRenderTest.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1097 bytes, 51 lines
Powered by Google Project Hosting