blob: 8ee869ea3ffd02ee9930bea302696ab20fbecc8a (
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
|
/***************************************************************************
* *
* 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) 2005-2006 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef FORKJOINWIDGET_H
#define FORKJOINWIDGET_H
//qt includes
#include <tqpainter.h>
//app includes
#include "boxwidget.h"
// fwd decl.
class UMLView;
/**
* @short Displays a fork/join plate in a state diagram.
* @author Oliver Kellogg <okellogg@users.sourceforge.net>
* @see UMLWidget
* Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
*/
class ForkJoinWidget : public BoxWidget {
public:
/**
* Constructs a ForkJoinWidget.
*
* @param view The parent to this widget.
* @param drawVertical Whether to draw the plate horizontally or vertically.
* @param id The ID to assign (-1 will prompt a new ID.)
*/
explicit ForkJoinWidget(UMLView * view, bool drawVertical = false, Uml::IDType id = Uml::id_None);
/**
* destructor
*/
virtual ~ForkJoinWidget();
/**
* Set whether to draw the plate vertically.
*/
void setDrawVertical(bool to);
/**
* Get whether to draw the plate vertically.
*/
bool getDrawVertical() const;
/**
* Overrides the function from UMLWidget.
*
* @param sel The command to be executed.
*/
void slotMenuSelection(int sel);
/**
* Draws a slim solid black rectangle.
*/
void draw(TQPainter & p, int offsetX, int offsetY);
/**
* Saves the widget to the "forkjoinwidget" XMI element.
*/
void saveToXMI(TQDomDocument& qDoc, TQDomElement& qElement);
/**
* Loads the widget from the "forkjoinwidget" XMI element.
*/
bool loadFromXMI(TQDomElement & qElement);
protected:
/**
* Reimplement method from UMLWidget to suppress the resize corner.
* Although the ForkJoinWidget supports resizing, we suppress the
* resize corner because it is too large for this very slim widget.
*/
void drawSelected(TQPainter * p, int offsetX, int offsetY);
/**
* Overrides the function from UMLWidget.
*/
TQSize calculateSize();
/**
* Reimplement method from UMLWidget.
*/
void constrain(int& width, int& height);
private:
/**
* Initializes key variables for the class.
*/
void init();
bool m_drawVertical; ///< whether to draw the plate horizontally or vertically
};
#endif
|