xref: /haiku/src/apps/icon-o-matic/transformable/PerspectiveBoxStates.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 #ifndef PERSPECTIVE_BOX_STATES_H
10 #define PERSPECTIVE_BOX_STATES_H
11 
12 #include <Point.h>
13 
14 
15 class BView;
16 class PerspectiveBox;
17 
18 
19 namespace PerspectiveBoxStates {
20 
21 class DragState {
22  public:
23 									DragState(PerspectiveBox* parent);
24 	virtual							~DragState() {}
25 
26 	virtual	void					SetOrigin(BPoint origin)
27 										{ fOrigin = origin; }
28 	virtual	void					DragTo(BPoint current, uint32 modifiers) = 0;
29 	virtual	void					UpdateViewCursor(BView* view, BPoint current) const = 0;
30 
31  protected:
32 			void					_SetViewCursor(BView* view,
33 												   const uchar* cursorData) const;
34 
35 			BPoint					fOrigin;
36 			PerspectiveBox*	fParent;
37 };
38 
39 
40 class DragCornerState : public DragState {
41  public:
42 								DragCornerState(
43 									PerspectiveBox* parent, BPoint* point);
44 	virtual						~DragCornerState() {}
45 
46 	virtual	void				SetOrigin(BPoint origin);
47 	virtual	void				DragTo(BPoint current, uint32 modifiers);
48 	virtual	void				UpdateViewCursor(BView* view, BPoint current) const;
49 
50  private:
51 			BPoint*				fPoint;
52 
53 			BPoint				fOldOffset;
54 };
55 
56 } // PerspectiveBoxStates namespace
57 
58 #endif // PERSPECTIVE_BOX_STATES_H
59