xref: /haiku/src/apps/haikudepot/edits_generic/CompoundEdit.h (revision 1403313c7fab3f265ed48b14f18a82f08aaeca78)
1651e8326SStephan Aßmus /*
2651e8326SStephan Aßmus  * Copyright 2006-2112, Stephan Aßmus <superstippi@gmx.de>
3*1403313cSAndrew Lindesay  * Copyright 2021, Andrew Lindesay <apl@lindesay.co.nz>
4651e8326SStephan Aßmus  * Distributed under the terms of the MIT License.
5651e8326SStephan Aßmus  */
6651e8326SStephan Aßmus 
7651e8326SStephan Aßmus #ifndef COMPOUND_EDIT_H
8651e8326SStephan Aßmus #define COMPOUND_EDIT_H
9651e8326SStephan Aßmus 
10*1403313cSAndrew Lindesay #include <vector>
11*1403313cSAndrew Lindesay 
12651e8326SStephan Aßmus #include <String.h>
13651e8326SStephan Aßmus 
14651e8326SStephan Aßmus #include "UndoableEdit.h"
15651e8326SStephan Aßmus 
16651e8326SStephan Aßmus class CompoundEdit : public UndoableEdit {
17651e8326SStephan Aßmus public:
18651e8326SStephan Aßmus 								CompoundEdit(const char* name);
19651e8326SStephan Aßmus 	virtual						~CompoundEdit();
20651e8326SStephan Aßmus 
21651e8326SStephan Aßmus 	virtual	status_t			InitCheck();
22651e8326SStephan Aßmus 
23651e8326SStephan Aßmus 	virtual	status_t			Perform(EditContext& context);
24651e8326SStephan Aßmus 	virtual status_t			Undo(EditContext& context);
25651e8326SStephan Aßmus 	virtual status_t			Redo(EditContext& context);
26651e8326SStephan Aßmus 
27651e8326SStephan Aßmus 	virtual void				GetName(BString& name);
28651e8326SStephan Aßmus 
29*1403313cSAndrew Lindesay 			void				AppendEdit(const UndoableEditRef& edit);
30651e8326SStephan Aßmus 
31651e8326SStephan Aßmus private:
32*1403313cSAndrew Lindesay 			std::vector<UndoableEditRef>
33*1403313cSAndrew Lindesay 								fEdits;
34651e8326SStephan Aßmus 			BString				fName;
35651e8326SStephan Aßmus };
36651e8326SStephan Aßmus 
37651e8326SStephan Aßmus #endif // COMPOUND_EDIT_H
38