summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/linkwidget.h
blob: 310a52480c7e402ead61d6874eaa17935694711c (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
/***************************************************************************
 *                                                                         *
 *   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 LINKWIDGET_H
#define LINKWIDGET_H

#include <tqfont.h>

#include "umlnamespace.h"

// forward declarations
class UMLClassifier;
class UMLOperation;
class FloatingTextWidget;
class UMLView;

/**
 * This is an interface realized by AssociationWidget and MessageWidget.
 * The design of this interface was driven by the requirements of
 * class FloatingTextWidget.  As the architecture of Umbrello evolves (for
 * example, if the class FloatingTextWidget is redesigned), it can be
 * cleaned up.
 *
 * @short       Interface to FloatingTextWidget for AssociationWidget and MessageWidget.
 * @author      Oliver Kellogg <okellogg@users.sourceforge.net>
 * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
 */
class LinkWidget {
public:
    LinkWidget();
    virtual ~LinkWidget();

    /**
     * Sets the font the widget is to use.
     * Abstract operation implemented by inheriting classes.
     * Motivated by FloatingTextWidget::slotMenuSelection(mt_Operation)
     *
     * @param font              Font to be set.
     */
    virtual void lwSetFont(TQFont font) = 0;

    /**
     * Motivated by FloatingTextWidget::slotMenuSelection(mt_Operation)
     */
    virtual UMLClassifier *getOperationOwner();

    /**
     * Motivated by FloatingTextWidget::slotMenuSelection(mt_Operation)
     */
    virtual UMLOperation *getOperation() = 0;

    /**
     * Motivated by FloatingTextWidget::slotMenuSelection(mt_Operation)
     */
    virtual void setOperation(UMLOperation *op) = 0;

    /**
     * Motivated by getOperationText()
     */
    virtual TQString getCustomOpText() = 0;

    /**
     * Motivated by FloatingTextWidget::slotMenuSelection(mt_Operation)
     */
    virtual void setCustomOpText(const TQString &opText) = 0;

    /**
     * Uses getOperation() if set, else calls getCustomOpText().
     */
    TQString getOperationText(UMLView *view = NULL);

    /**
     * Motivated by FloatingTextWidget::slotMenuSelection(mt_Reset_Label_Positions)
     * Only applies to AssociationWidget.
     */
    virtual void resetTextPositions();

    /**
     * Motivated by FloatingTextWidget::setMessageText()
     */
    virtual void setMessageText(FloatingTextWidget *ft) = 0;

    /**
     * Motivated by FloatingTextWidget::handleRename()
     */
    virtual void setText(FloatingTextWidget *ft, const TQString &newText) = 0;

    /**
     * Motivated by FloatingTextWidget::mouseDoubleClickEvent()
     * Only applies to AssociationWidget.
     */
    virtual bool showDialog();

    /**
     * Motivated by FloatingTextWidget::showOpDlg()
     */
    virtual UMLClassifier *getSeqNumAndOp(TQString& seqNum, TQString& op) = 0;

    /**
     * Motivated by FloatingTextWidget::showOpDlg()
     */
    virtual void setSeqNumAndOp(const TQString &seqNum, const TQString &op) = 0;

    /**
     * Abstract operation implemented by inheriting classes.
     * Motivated by FloatingTextWidget::mouseMoveEvent()
     */
    virtual void constrainTextPos(int &textX, int &textY,
                                  int textWidth, int textHeight,
                                  Uml::Text_Role tr) = 0;

    /**
     * Motivated by FloatingTextWidget::setLink().
     * Only applies to AssociationWidget.
     */
    virtual void calculateNameTextSegment();

};

#endif