summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/docwindow.h
blob: 14f2d00b9e361db65a76921d52fe8d8539e0e276 (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
160
161
162
163
164
165
166
167
168
169
/***************************************************************************
 *                                                                         *
 *   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 DOCWINDOW_H
#define DOCWINDOW_H

#include <tqwidget.h>

class AssociationWidget;
class TQGroupBox;
class TQMultiLineEdit;
class UMLObject;
class UMLDoc;
class UMLView;
class UMLWidget;

/**
 * @author Paul Hensgen
 * Bugs and comments to uml-devel@lists.sf.net or http://bugs.trinitydesktop.org
 */

class DocWindow : public TQWidget {
    Q_OBJECT
  
public:
    /**
     * Constructor
     */
    explicit DocWindow( UMLDoc * doc, TQWidget *parent = 0, const char *name = 0 );

    /**
     * Deconstructor
     */
    ~DocWindow();

    /**
     * Called when a widget wishes to display its documentation in the
     * doc window.  If there was already documentation there, that will
     * be updated before being removed from the view.
     *
     * Also call this function if you update the documentation in another
     * place, such as a properties dialog.  Just set overwrite to true.
     *
     * Overwrite is used when you believe that the documentation window
     * is already displaying documentation for the widget you wish to
     * display.
     * Overwrite just determines whose version is more up to date.
     */
    void showDocumentation( UMLObject * object, bool overwrite = false );

    /**
     * This method is the same as the one for UMLObjects except it
     * displays documentation for a diagram.
     */
    void showDocumentation( UMLView * view, bool overwrite = false );

    /**
     * This method is the same as the one for UMLObjects except it
     * displays documentation for an object instance (StateWidget/
     * ObjectWidget).
     */
    void showDocumentation( UMLWidget * widget, bool overwrite = false );

    /**
     * This method is the same as the one for UMLObjects except it
     * displays documentation for an association instance
     * (AssociationWidget).
     */
    void showDocumentation( AssociationWidget * widget, bool overwrite = false );

    /**
     * Call when you wish move changes in the doc window back into the
     * members documentation.
     *
     * If clear is true the doc window will display the documentation
     * for the current project instead of the widget documentation.
     *
     * This is usually called before displaying a properties dialog.
     *
     * @param clear     If true, show the documentation of current project
     * @param startup   If true, no setModified(true) calls will be done and nothing is pushed to the undo stack
     */
    void updateDocumentation( bool clear = false, bool startup = false );


    /**
     *  Re-initializes the class for a new document.
     */
    void newDocumentation( );

    /**
     * Checks if the user is typing in the documentation edit window
     */
    bool isTyping();

public slots:

    /**
     * An association was removed from the UMLView.
     * If the association removed was the association which documentation is
     * being shown, m_pAssocWidget is set to 0.
     */
    void slotAssociationRemoved(AssociationWidget* association);

    /**
     * A widget was removed from the UMLView.
     * If the association removed was the association which documentation is
     * being shown, m_pUMLWidget is set to 0.
     */
    void slotWidgetRemoved(UMLWidget* widget);

private:
    /**
     * Used internally to know which type of object we are showing
     * documentation for.
     */
    enum Showing_Type {
        st_Project,
        st_UMLView,
        st_UMLObject,
        st_UMLWidget,
        st_Association
    };

    /**
     * A pointer to the UMLObject we are going to show documentation.
     */
    UMLObject * m_pUMLObject;

    /**
     * A pointer to the UMLView we are going to show documentation.
     */
    UMLView * m_pUMLView;

    /**
     * A pointer to the Project we are going to show documentation.
     */
    UMLDoc * m_pUMLDoc;

    /**
     * A pointer to the UMLWidget we are going to show documentation.
     */
    UMLWidget * m_pUMLWidget;

    /**
     * A pointer to the association we are going to show documentation.
     */
    AssociationWidget * m_pAssocWidget;

    /**
     * Which type of documentation we are showing.
     */
    Showing_Type m_Showing;

    //visual widgets
    TQMultiLineEdit      * m_pDocMLE;
    TQGroupBox   * m_pDocGB;

};

#endif