~ubuntu-branches/ubuntu/utopic/tcm/utopic

« back to all changes in this revision

Viewing changes to src/sd/dv/ssdsingleclassbox.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2003-07-03 20:08:21 UTC
  • Revision ID: james.westby@ubuntu.com-20030703200821-se4xtqx25e5miczi
Tags: upstream-2.20
ImportĀ upstreamĀ versionĀ 2.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------------
 
2
//
 
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
 
4
// (c) copyright 1999, Vrije Universiteit Amsterdam and University of Twente.
 
5
// Author: Henk van de Zandschulp (henkz@cs.utwente.nl).
 
6
// Author: Frank Dehne (frank@cs.vu.nl).
 
7
//
 
8
// TCM is free software; you can redistribute it and/or modify
 
9
// it under the terms of the GNU General Public License as published by
 
10
// the Free Software Foundation; either version 2 of the License, or
 
11
// (at your option) any later version.
 
12
//
 
13
// TCM is distributed in the hope that it will be useful,
 
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
// GNU General Public License for more details.
 
17
//
 
18
// You should have received a copy of the GNU General Public License
 
19
// along with TCM; if not, write to the Free Software Foundation, Inc.,
 
20
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
21
//-----------------------------------------------------------------------------
 
22
#ifndef _SSDSINGLECLASSBOX_H
 
23
#define _SSDSINGLECLASSBOX_H
 
24
 
 
25
#include "box.h"
 
26
#include "stickman.h"
 
27
class SSDDoubleClassBox;
 
28
class SSDTripleClassBox;
 
29
 
 
30
/// Box for representing object classes in a SSD.
 
31
class SSDSingleClassBox: public Box {
 
32
/*@Doc: {\large {\bf scope:} TSSD} */
 
33
public:
 
34
        ///
 
35
        SSDSingleClassBox(ShapeView *v, Grafport *g, double x, double y);
 
36
        ///
 
37
        SSDSingleClassBox(const SSDSingleClassBox &s);
 
38
        ///
 
39
        SSDSingleClassBox(const SSDDoubleClassBox &s);
 
40
        ///
 
41
        SSDSingleClassBox(const SSDTripleClassBox &s);
 
42
        ///
 
43
        SSDSingleClassBox(const StickMan &s);
 
44
        ///
 
45
        ~SSDSingleClassBox();
 
46
        ///
 
47
        Shape *Clone() {return new SSDSingleClassBox(*this);}
 
48
        ///
 
49
        int GetClassType() const {return Code::SSD_SINGLE_CLASS_BOX;}
 
50
 
 
51
        ///
 
52
//      void SetSize(int w, int h);
 
53
        ///
 
54
//      void SetPosition(const Point *p, bool snap);
 
55
        ///
 
56
        void SetFont(XFont *ft);
 
57
        ///
 
58
        void SetTextColor(const string *color);
 
59
        ///
 
60
        void SetGrafport(Grafport *g);
 
61
        ///
 
62
        void SetView(ShapeView *v);
 
63
        ///
 
64
        TextShape *ChooseTextShape(int x, int y);
 
65
        ///
 
66
        bool HasTextShape(TextShape *t) const;
 
67
        ///
 
68
        void AdjustSize();
 
69
 
 
70
        ///
 
71
        void UpdateShowStereotype(bool b);
 
72
        ///
 
73
        void UpdateShowProperties(bool b);
 
74
 
 
75
        /// update string of stereotype text shape and redraw.
 
76
        void UpdateStereotypeLabelString(const string *s);
 
77
        ///
 
78
        const string *GetStereotypeLabelString() {
 
79
                                        return stereotypeLabel->GetString();}
 
80
        ///
 
81
        TextShape *GetStereotypeLabel() const {return stereotypeLabel;}
 
82
 
 
83
        /// update string of properties text shape and redraw.
 
84
        virtual void UpdatePropertiesLabelString(const string *s);
 
85
        ///
 
86
        const string *GetPropertiesLabelString() {
 
87
                                        return propertiesLabel->GetString();}
 
88
        ///
 
89
        TextShape *GetPropertiesLabel() const {return propertiesLabel;}
 
90
 
 
91
        ///
 
92
        bool SetAssocSubject(AssocList *);
 
93
        ///
 
94
        void SetTextShape();
 
95
 
 
96
        /// contains s as string (case sensitive, substring).
 
97
        bool HasString(const string *s, bool sens, bool sub) const;
 
98
        ///
 
99
        bool HasString(const string*, bool, bool, List<TextShape *> *list);
 
100
 
 
101
        ///
 
102
        void SetShowStereotype(bool b) {showStereotype=b;}
 
103
        ///
 
104
        void SetShowProperties(bool b) {showProperties=b;}
 
105
        ///
 
106
        bool IsShowStereotype() const {return showStereotype;}
 
107
        ///
 
108
        bool IsShowProperties() const {return showProperties;}
 
109
 
 
110
        ///
 
111
        void WriteMembers(OutputFile *f);
 
112
        ///
 
113
        bool ReadMembers(InputFile *f, double format);
 
114
protected:
 
115
        ///
 
116
        virtual void CalcPositionLabels();
 
117
private:
 
118
        ///
 
119
        void DrawTextShapes();
 
120
        ///
 
121
        int RequiredHeight();
 
122
        ///
 
123
        int RequiredWidth();
 
124
        ///
 
125
        void SetStereotypeLabelString(const string *s) {
 
126
                                                stereotypeLabel->SetString(s);}
 
127
        ///
 
128
        void SetPropertiesLabelString(const string *s) {
 
129
                                                propertiesLabel->SetString(s);}
 
130
        ///
 
131
        void CalcPositionStereotypeLabel();
 
132
        ///
 
133
        void CalcPositionPropertiesLabel();
 
134
 
 
135
        ///
 
136
        static const int TEXTMARGIN;
 
137
        ///
 
138
        TextShape *stereotypeLabel;
 
139
        ///
 
140
        TextShape *propertiesLabel;
 
141
        ///
 
142
        bool showStereotype;
 
143
        ///
 
144
        bool showProperties;
 
145
};
 
146
#endif