blob: 8959721186010bd0a72e305ba2cc8c7466245291 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2004-2006 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef TOOLBARSTATEARROW_H
#define TOOLBARSTATEARROW_H
#include "toolbarstate.h"
#include "worktoolbar.h"
class TQMouseEvent;
class UMLView;
class TQCanvasLine;
/**
* Arrow tool for select, move and resize widgets and associations.
* Arrow tool delegates the event handling in the widgets and associations. When
* no widget nor association is being used,the arrow tool acts as a selecting
* tool that selects all the elements in the rectangle created when dragging the
* mouse.
*
* This is the default tool.
*/
class ToolBarStateArrow : public ToolBarState {
Q_OBJECT
public:
/**
* Creates a new ToolBarStateArrow.
*
* @param umlView The UMLView to use.
*/
ToolBarStateArrow(UMLView *umlView);
/**
* Destroys this ToolBarStateArrow.
*/
virtual ~ToolBarStateArrow();
/**
* Goes back to the inital state.
*/
virtual void init();
protected:
/**
* Called when the press event happened on an association.
* Delivers the event to the association.
*/
virtual void mousePressAssociation();
/**
* Called when the press event happened on a widget.
* Delivers the event to the widget.
*/
virtual void mousePressWidget();
/**
* Called when the press event happened on an empty space.
* Calls base method and, if left button was pressed, prepares the selection
* rectangle.
*/
virtual void mousePressEmpty();
/**
* Called when the release event happened on an association.
* Delivers the event to the association.
*/
virtual void mouseReleaseAssociation();
/**
* Called when the release event happened on a widget.
* Delivers the event to the widget.
*/
virtual void mouseReleaseWidget();
/**
* Called when the release event happened on an empty space.
* If selection rectangle is active, it is cleared. Else, if the right
* button was released, it shows the pop up menu for the diagram.
*/
virtual void mouseReleaseEmpty();
/**
* Called when the double click event happened on an association.
* Delivers the event to the association.
*/
virtual void mouseDoubleClickAssociation();
/**
* Called when the double click event happened on a widget.
* Delivers the event to the widget.
*/
virtual void mouseDoubleClickWidget();
/**
* Called when the move event happened when an association is
* currently available.
* Delivers the event to the association.
*/
virtual void mouseMoveAssociation();
/**
* Called when the move event happened when a widget is
* currently available.
* Delivers the event to the widget.
*/
virtual void mouseMoveWidget();
/**
* Called when the move event happened when no association nor
* widget are currently available.
* Updates the selection rectangle to the new position and selectes all the
* widgets in the rectangle.
*
* @todo Fix selection
*/
virtual void mouseMoveEmpty();
/**
* Sets the widget currently in use.
* It ensures that the widget is only set if there is no other widget set
* already.
* It avoids things like moving a big widget over a little one, clicking
* right button to cancel the movement and the little widget getting the
* event, thus not cancelling the movement in the big widget.
*/
virtual void setCurrentWidget(UMLWidget* currentWidget);
/**
* Overriden from base class to do nothing, as arrow is the default tool.
*/
virtual void changeTool();
/**
* The selection rectangle that contains the four lines of its borders.
*/
TQPtrList<TQCanvasLine> m_selectionRect;
/**
* The start position of the selection rectangle.
*/
TQPoint m_startPosition;
};
#endif //TOOLBARSTATEARROW_H
|