1
//------------------------------------------------------------------------------
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1996, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
//-----------------------------------------------------------------------------
27
/// (abstract) box with two compartments: 1st for name, 2nd for a label list.
28
class DoubleBox: public Box {
29
/*@Doc: {\large {\bf scope:} diagram} */
32
DoubleBox(ShapeView *v, Grafport *g, double x, double y,
35
DoubleBox(const DoubleBox &s);
37
DoubleBox(const NodeShape &s);
41
Shape *Clone() {return new DoubleBox(*this);}
43
/* virtual */ int GetClassType() const { return Code::DOUBLE_BOX; }
45
// void SetSize(int w, int h);
47
// void SetPosition(const Point *p, bool snap=True);
49
void SetFont(XFont *ft);
51
void SetTextColor(const string *color);
53
TextShape *ChooseTextShape(int x, int y);
55
bool HasTextShape(TextShape *t) const;
58
/// update or insert string of n-th label.
59
void UpdateLabel(const string *s, unsigned n, bool update);
61
TextShape *GetLabel(unsigned n);
63
unsigned NrLabels() {return labels->count();}
65
bool SetAssocSubject(AssocList *);
69
void SetGrafport(Grafport *g);
71
void SetView(ShapeView *v);
72
/// contains s as string (case sensitive, substring).
73
bool HasString(const string *s, bool sens, bool sub) const;
75
bool HasString(const string*, bool, bool, List<TextShape *> *list);
77
LineStyle::Type GetSeparatorLineStyle() const
78
{return separatorLineStyle;}
80
void SetSeparatorLineStyle(LineStyle::Type x)
81
{separatorLineStyle=x;}
83
int GetInitialHeight() const {return initialHeight;}
88
void DrawTextShapes();
90
virtual int RequiredHeight();
91
/// calculates name position in 1st compartiment, labels in 2nd.
92
virtual void CalcPositionLabels();
94
virtual void AdjustSizes(const string *s);
96
List<TextShape *> *GetLabels() {return labels;}
98
static const int TEXTMARGIN;
100
string labelDescription;
104
/// the list of labels in the second compartiment.
105
List<TextShape *> *labels;
106
/// line style of separator line (between name and labels).
107
LineStyle::Type separatorLineStyle;