blob: ea94feae35a2ae79ea8eff96ec8c55aec0a54ea0 (
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
|
/***************************************************************************
* *
* 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 TOOLBARSTATEOTHER_H
#define TOOLBARSTATEOTHER_H
#include "toolbarstatepool.h"
/**
* Other tool creates almost all the objects (except associations and messages).
* Objects are created when left button is released, no matter if it was
* released on an association, on a widget or on an empty space.
*
* Associations and widgets aren't taken into account, and are treated as empty
* spaces.
*/
class ToolBarStateOther : public ToolBarStatePool {
Q_OBJECT
TQ_OBJECT
public:
/**
* Creates a new ToolBarStateOther.
*
* @param umlView The UMLView to use.
*/
ToolBarStateOther(UMLView *umlView);
/**
* Destroys this ToolBarStateOther.
*/
virtual ~ToolBarStateOther();
private:
/**
* Sets nothing.
* Overriden from base class to ignore associations and widgets and treat
* them as empty spaces to create widgets on it.
*/
virtual void setCurrentElement();
/**
* Called when the release event happened on an empty space.
* Associations, widgets and actual empty spaces are all treated as empty
* spaces. It creates a new widget if the left button was released.
* The widget to create depends on the type of the toolbar button selected.
* If the widget is the visual representation of an UMLObject, the object
* factory handles its creation. Otherwise, the widget is created using
* newWidget().
* The UMLView is resized to fit on all the items.
*/
virtual void mouseReleaseEmpty();
/**
* Returns the object type of this tool.
*
* @return The object type of this tool.
*/
Uml::Object_Type getObjectType();
/**
* Creates and adds a new widget to the UMLView (if widgets of that type
* don't have an associated UMLObject).
* If the type of the widget doesn't use an UMLObject (for example, a note
* or a box), it creates the widget, adds it to the view and returns true.
* Otherwise, it returns false.
*
* @return True if the widget was created, false otherwise.
* @todo rename to something more clear
*/
bool newWidget();
};
#endif //TOOLBARSTATEOTHER_H
|