xref: /haiku/src/apps/haikudepot/edits_generic/UndoableEdit.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2006-2012 Stephan Aßmus <superstippi@gmx.de>
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef UNDOABLE_EDIT_H
7 #define UNDOABLE_EDIT_H
8 
9 #include <Referenceable.h>
10 
11 class BString;
12 class EditContext;
13 
14 class UndoableEdit : public BReferenceable {
15 public:
16 								UndoableEdit();
17 	virtual						~UndoableEdit();
18 
19 	virtual	status_t			InitCheck();
20 
21 	virtual	status_t			Perform(EditContext& context);
22 	virtual status_t			Undo(EditContext& context);
23 	virtual status_t			Redo(EditContext& context);
24 
25 	virtual void				GetName(BString& name);
26 
27 	virtual	bool				UndoesPrevious(const UndoableEdit* previous);
28 	virtual	bool				CombineWithNext(const UndoableEdit* next);
29 	virtual	bool				CombineWithPrevious(
30 									const UndoableEdit* previous);
31 
32 	inline	bigtime_t			TimeStamp() const
33 									{ return fTimeStamp; }
34 
35 protected:
36 			bigtime_t			fTimeStamp;
37 };
38 
39 typedef BReference<UndoableEdit> UndoableEditRef;
40 
41 #endif // UNDOABLE_EDIT_H
42