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
|
/***************************************************************************
* *
* 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) 2002-2006 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef ACTIVITYWIDGET_H
#define ACTIVITYWIDGET_H
#include "umlwidget.h"
#include "worktoolbar.h"
#define ACTIVITY_MARGIN 5
#define ACTIVITY_WIDTH 30
#define ACTIVITY_HEIGHT 10
/**
* This class is the graphical version of a UML Activity. A ActivityWidget is created
* by a @ref UMLView. An ActivityWidget belongs to only one @ref UMLView instance.
* When the @ref UMLView instance that this class belongs to, it will be automatically deleted.
*
* The ActivityWidget class inherits from the @ref UMLWidget class which adds most of the functionality
* to this class.
*
* @short A graphical version of a UML Activity.
* @author Paul Hensgen <phensgen@techie.com>
* Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
*/
class ActivityWidget : public UMLWidget {
Q_OBJECT
public:
enum ActivityType
{
Initial = 0,
Normal,
End,
Branch
};
/**
* Creates a Activity widget.
*
* @param view The parent of the widget.
* @param activityType The type of activity.
* @param id The ID to assign (-1 will prompt a new ID.)
*/
explicit ActivityWidget( UMLView * view, ActivityType activityType = Normal, Uml::IDType id = Uml::id_None );
/**
* destructor
*/
virtual ~ActivityWidget();
/**
* Overrides the standard paint event.
*/
void draw(TQPainter & p, int offsetX, int offsetY);
/**
* Overrides Method from UMLWidget.
*/
void constrain(int& width, int& height);
/**
* Returns the type of activity.
*/
ActivityType getActivityType() const;
/**
* Sets the type of activity.
*/
void setActivityType( ActivityType activityType );
/**
* Show a properties dialog for an ActivityWidget.
*/
void showProperties();
/**
* Determines whether a toolbar button represents an Activity.
* CHECK: currently unused - can this be removed?
*
* @param tbb The toolbar button enum input value.
* @param resultType The ActivityType corresponding to tbb.
* This is only set if tbb is an Activity.
* @return True if tbb represents an Activity.
*/
static bool isActivity( WorkToolBar::ToolBar_Buttons tbb,
ActivityType& resultType );
/**
* Saves the widget to the "activitywidget" XMI element.
*/
void saveToXMI( TQDomDocument & qDoc, TQDomElement & qElement );
/**
* Loads the widget from the "activitywidget" XMI element.
*/
bool loadFromXMI( TQDomElement & qElement );
protected:
/**
* Overrides method from UMLWidget
*/
TQSize calculateSize();
/**
* Type of activity.
*/
ActivityType m_ActivityType;
public slots:
/**
* Captures any popup menu signals for menus it created.
*/
void slotMenuSelection(int sel);
};
#endif
|