~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to umbrello/umbrello/preconditionwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *                                                                         *
 
3
 *   This program is free software; you can redistribute it and/or modify  *
 
4
 *   it under the terms of the GNU General Public License as published by  *
 
5
 *   the Free Software Foundation; either version 2 of the License, or     *
 
6
 *   (at your option) any later version.                                   *
 
7
 *                                                                         *
 
8
 *   copyright (C) 2002-2006                                               *
 
9
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 
10
 ***************************************************************************/
 
11
 
 
12
#ifndef PRECONDITIONWIDGET_H
 
13
#define PRECONDITIONWIDGET_H
 
14
 
 
15
#include "umlwidget.h"
 
16
#include "worktoolbar.h"
 
17
 
 
18
#define PRECONDITION_MARGIN 5
 
19
#define PRECONDITION_WIDTH 30
 
20
#define PRECONDITION_HEIGHT 10
 
21
 
 
22
class ObjectWidget;
 
23
 
 
24
/**
 
25
 * This class is the graphical version of a UML Precondition.  A PreconditionWidget is created
 
26
 * by a @ref UMLView.  An PreconditionWidget belongs to only one @ref UMLView instance.
 
27
 * When the @ref UMLView instance that this class belongs to, it will be automatically deleted.
 
28
 *
 
29
 * The PreconditionWidget class inherits from the @ref UMLWidget class which adds most of the functionality
 
30
 * to this class.
 
31
 *
 
32
 * @short  A graphical version of a UML Precondition (new in UML 2.0).
 
33
 * @author Florence Mattler <florence.mattler@libertysurf.fr>
 
34
 * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
 
35
 */
 
36
class PreconditionWidget : public UMLWidget {
 
37
    Q_OBJECT
 
38
 
 
39
public:
 
40
 
 
41
    /**
 
42
     * Creates a Precondition widget.
 
43
     *
 
44
     * @param view              The parent of the widget.
 
45
     * @param a                 The role A widget for this precondition.
 
46
     * @param id                The ID to assign (-1 will prompt a new ID.)
 
47
     */
 
48
    PreconditionWidget( UMLView * view, ObjectWidget* a, Uml::IDType id = Uml::id_None );
 
49
 
 
50
 
 
51
    /**
 
52
     *  destructor
 
53
     */
 
54
    virtual ~PreconditionWidget();
 
55
 
 
56
    /**
 
57
     * Initializes key variables of the class.
 
58
     */
 
59
    void init();
 
60
 
 
61
    /**
 
62
     * Overrides the standard paint event.
 
63
     */
 
64
    void draw(QPainter & p, int offsetX, int offsetY);
 
65
 
 
66
 
 
67
    /**
 
68
     * Calculate the geometry of the widget.
 
69
     */
 
70
    void calculateWidget();
 
71
 
 
72
    /**
 
73
     * Activates a PreconditionWidget.  Connects the WidgetMoved signal from
 
74
     * its m_pOw pointer so that PreconditionWidget can adjust to the move of
 
75
     * the object widget.
 
76
     */
 
77
    bool activate(IDChangeLog * Log = 0);
 
78
 
 
79
    /**
 
80
     * Calculates the size of the widget
 
81
     */
 
82
     void calculateDimensions();
 
83
 
 
84
 
 
85
    /**
 
86
     * Returns the minimum height this widget should be set at on
 
87
     * a sequence diagrams.  Takes into account the widget positions
 
88
     * it is related to.
 
89
     */
 
90
    int getMinY();
 
91
 
 
92
    /**
 
93
     * Returns the maximum height this widget should be set at on
 
94
     * a sequence diagrams.  Takes into account the widget positions
 
95
     * it is related to.
 
96
     */
 
97
    int getMaxY();
 
98
 
 
99
    /**
 
100
     * Saves the widget to the "preconditionwidget" XMI element.
 
101
     */
 
102
    void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
 
103
 
 
104
    /**
 
105
     * Loads the widget from the "preconditionwidget" XMI element.
 
106
     */
 
107
    bool loadFromXMI( QDomElement & qElement );
 
108
 
 
109
protected:
 
110
    /**
 
111
     * Overrides method from UMLWidget
 
112
     */
 
113
    QSize calculateSize();
 
114
 
 
115
 
 
116
public slots:
 
117
 
 
118
    /**
 
119
     * Captures any popup menu signals for menus it created.
 
120
     */
 
121
    void slotMenuSelection(QAction* action);
 
122
    void slotWidgetMoved(Uml::IDType id);
 
123
 
 
124
private:
 
125
    ObjectWidget * m_pOw;
 
126
    int m_nY;
 
127
};
 
128
 
 
129
#endif