xref: /haiku/src/apps/icon-o-matic/transformable/PerspectiveCommand.h (revision e1c4049fed1047bdb957b0529e1921e97ef94770)
1 /*
2  * Copyright 2006, 2023, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  *		Zardshard
8  */
9 
10 #ifndef PERSPECTIVE_COMMAND_H
11 #define PERSPECTIVE_COMMAND_H
12 
13 
14 #include <Point.h>
15 
16 #include "Command.h"
17 #include "PerspectiveBox.h"
18 
19 
20 class PerspectiveTransformer;
21 
22 
23 class PerspectiveCommand : public Command, public PerspectiveBoxListener {
24 public:
25 								PerspectiveCommand(PerspectiveBox* box,
26 									PerspectiveTransformer* transformer,
27 									BPoint leftTop, BPoint rightTop,
28 									BPoint leftBottom, BPoint rightBottom);
29 	virtual						~PerspectiveCommand();
30 
31 	// Command interface
32 	virtual	status_t			InitCheck();
33 
34 	virtual	status_t			Perform();
35 	virtual status_t			Undo();
36 	virtual status_t			Redo();
37 
38 	virtual void				GetName(BString& name);
39 
40 	// TransformBoxListener interface
41 	virtual	void				PerspectiveBoxDeleted(const PerspectiveBox* box);
42 
43 	// PerspectiveCommand
44 			void				SetNewPerspective(
45 									BPoint leftTop, BPoint rightTop,
46 									BPoint leftBottom, BPoint rightBottom);
47 
48 private:
49 			PerspectiveBox*		fTransformBox;
50 			PerspectiveTransformer*	fTransformer;
51 
52 			BPoint				fOldLeftTop;
53 			BPoint				fOldRightTop;
54 			BPoint				fOldLeftBottom;
55 			BPoint				fOldRightBottom;
56 
57 			BPoint				fNewLeftTop;
58 			BPoint				fNewRightTop;
59 			BPoint				fNewLeftBottom;
60 			BPoint				fNewRightBottom;
61 };
62 
63 #endif // PERSPECTIVE_COMMAND_H
64