summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/classifierlistitem.h
blob: c7333150890b5e5ff0cbac02b634875843a87671 (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
/***************************************************************************
 *                                                                         *
 *   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) 2003-2006                                               *
 *   Umbrello UML Modeller Authors <[email protected]>                  *
 ***************************************************************************/

#ifndef CLASSIFIERLISTITEM_H
#define CLASSIFIERLISTITEM_H

#include "umlobject.h"

// forward declaration
class UMLClassifier;

/**
 * Classifiers (classes, interfaces) have lists of operations,
 * attributes, templates and others.  This is a base class for
 * the items in this list.  This abstraction should remove
 * duplication of dialogs and allow for stereotypes in lists.
 *
 * @short A base class for classifier list items (e.g. attributes)
 * @author Jonathan Riddell
 * Bugs and comments to [email protected] or http://bugs.kde.org
 */

class UMLClassifierListItem : public UMLObject {
    Q_OBJECT
  TQ_OBJECT
public:
    /**
     * Constructor.  Empty.
     *
     * @param parent    The parent to this operation.
     *          At first sight it would appear that the type of the
     *          parent should be UMLClassifier. However, the class
     *          UMLAttribute is also used for the parameters of
     *          operations, and in this case the UMLOperation is the
     *          parent.
     * @param name              The name of the operation.
     * @param id                The id of the operation.
     */
    UMLClassifierListItem(const UMLObject *parent,
                          const TQString& name,
                          Uml::IDType id = Uml::id_None);

    /**
     * Constructor.  Empty.
     *
     * @param parent    The parent to this operation.
     *          At first sight it would appear that the type of the
     *          parent should be UMLClassifier. However, the class
     *          UMLAttribute is also used for the parameters of
     *          operations, and in this case the UMLOperation is the
     *          parent.
     */
    UMLClassifierListItem(const UMLObject *parent);

    /**
     * Destructor.  Empty.
     */
    virtual ~UMLClassifierListItem();

    /**
     * Returns the type of the UMLClassifierListItem.
     *
     * @return  The type of the UMLClassifierListItem.
     */
    UMLClassifier * getType() const;

    /**
     * Returns the type name of the UMLClassifierListItem.
     *
     * @return  The type name of the UMLClassifierListItem.
     */
    virtual TQString getTypeName() const;

    /**
     * Sets the type name of the UMLClassifierListItem.
     * DEPRECATED - use setType() instead.
     *
     * @param type      The type name of the UMLClassifierListItem.
     */
    void setTypeName( const TQString &type );

    /**
     * Sets the type of the UMLAttribute.
     *
     * @param type      Pointer to the UMLObject of the type.
     */
    virtual void setType(UMLObject *type);

    /**
     * Returns a string representation of the list item.
     *
     * @param sig               What type of operation string to show.
     * @return  The string representation of the operation.
     */
    virtual TQString toString(Uml::Signature_Type sig = Uml::st_NoSig);

    /**
     * Display the properties configuration dialog for the list item.
     *
     * @param parent    The parent widget.
     * @return  True for success of this operation.
     */
    virtual bool showPropertiesDialog(TQWidget* parent) = 0;

    /**
     * Copy the internal presentation of this object into the new
     * object.
     */
    virtual void copyInto(UMLClassifierListItem *rhs) const;

    /**
     * The abstract method UMLObject::clone() must be implemented
     * by the classes inheriting from UMLClassifierListItem.
     */
    virtual UMLObject* clone() const = 0;

};

#endif