xref: /haiku/src/apps/icon-o-matic/transformable/PerspectiveBoxStates.cpp (revision c9afad22682e9f15753db4e9ca8684e2d4a643a9)
1 /*
2  * Copyright 2006-2009, 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 #include "PerspectiveBoxStates.h"
11 
12 #include <Cursor.h>
13 #include <View.h>
14 
15 #include "cursors.h"
16 #include "PerspectiveBox.h"
17 
18 
19 using namespace PerspectiveBoxStates;
20 
21 
22 DragState::DragState(PerspectiveBox* parent)
23 	:
24 	fOrigin(0.0, 0.0),
25 	fParent(parent)
26 {
27 }
28 
29 
30 void
31 DragState::_SetViewCursor(BView* view, const uchar* cursorData) const
32 {
33 	BCursor cursor(cursorData);
34 	view->SetViewCursor(&cursor);
35 }
36 
37 
38 // #pragma mark - DragCornerState
39 
40 
41 DragCornerState::DragCornerState(PerspectiveBox* parent, BPoint* point)
42 	:
43 	DragState(parent),
44 	fPoint(point)
45 {
46 }
47 
48 
49 void
50 DragCornerState::SetOrigin(BPoint origin)
51 {
52 	DragState::SetOrigin(origin);
53 }
54 
55 
56 void
57 DragCornerState::DragTo(BPoint current, uint32 modifiers)
58 {
59 	*fPoint = current;
60 	fParent->Update(true);
61 }
62 
63 
64 void
65 DragCornerState::UpdateViewCursor(BView* view, BPoint current) const
66 {
67 	_SetViewCursor(view, kPathMoveCursor);
68 }
69