~ubuntu-branches/ubuntu/intrepid/tcm/intrepid

« back to all changes in this revision

Viewing changes to src/dg/doublebox.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 1996, Vrije Universiteit Amsterdam.
 
5
// Author: Frank Dehne (frank@cs.vu.nl).
 
6
//
 
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.
 
11
//
 
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.
 
16
//
 
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
 
20
// 02111-1307, USA.
 
21
//-----------------------------------------------------------------------------
 
22
#ifndef _DOUBLEBOX_H
 
23
#define _DOUBLEBOX_H
 
24
 
 
25
#include "box.h"
 
26
 
 
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} */
 
30
public:
 
31
        ///
 
32
        DoubleBox(ShapeView *v, Grafport *g, double x, double y,
 
33
                double w, double h);
 
34
        ///
 
35
        DoubleBox(const DoubleBox &s);
 
36
        ///
 
37
        DoubleBox(const NodeShape &s);
 
38
        ///
 
39
        virtual ~DoubleBox();
 
40
        ///
 
41
        Shape *Clone() {return new DoubleBox(*this);}
 
42
        ///
 
43
        /* virtual */ int GetClassType() const { return Code::DOUBLE_BOX; }
 
44
        ///
 
45
//      void SetSize(int w, int h);
 
46
        ///
 
47
//      void SetPosition(const Point *p, bool snap=True);
 
48
        ///
 
49
        void SetFont(XFont *ft);
 
50
        ///
 
51
        void SetTextColor(const string *color);
 
52
        ///
 
53
        TextShape *ChooseTextShape(int x, int y);
 
54
        ///
 
55
        bool HasTextShape(TextShape *t) const;
 
56
        ///
 
57
        void AdjustSize();
 
58
        /// update or insert string of n-th label.
 
59
        void UpdateLabel(const string *s, unsigned n, bool update);
 
60
        ///
 
61
        TextShape *GetLabel(unsigned n);
 
62
        ///
 
63
        unsigned NrLabels() {return labels->count();}
 
64
        ///
 
65
        bool SetAssocSubject(AssocList *);
 
66
        ///
 
67
        void SetTextShape();
 
68
        ///
 
69
        void SetGrafport(Grafport *g);
 
70
        ///
 
71
        void SetView(ShapeView *v);
 
72
        /// contains s as string (case sensitive, substring).
 
73
        bool HasString(const string *s, bool sens, bool sub) const;
 
74
        ///
 
75
        bool HasString(const string*, bool, bool, List<TextShape *> *list);
 
76
        ///
 
77
        LineStyle::Type GetSeparatorLineStyle() const 
 
78
                {return separatorLineStyle;}
 
79
        ///
 
80
        void SetSeparatorLineStyle(LineStyle::Type x) 
 
81
                {separatorLineStyle=x;}
 
82
        ///
 
83
        int GetInitialHeight() const {return initialHeight;}
 
84
protected:
 
85
        ///
 
86
//      void DrawShape();
 
87
        ///
 
88
        void DrawTextShapes();
 
89
        ///
 
90
        virtual int RequiredHeight();
 
91
        /// calculates name position in 1st compartiment, labels in 2nd.
 
92
        virtual void CalcPositionLabels(); 
 
93
        ///
 
94
        virtual void AdjustSizes(const string *s);
 
95
        /// 
 
96
        List<TextShape *> *GetLabels() {return labels;} 
 
97
        ///
 
98
        static const int TEXTMARGIN;
 
99
        ///
 
100
        string labelDescription;
 
101
        ///
 
102
        int initialHeight;
 
103
private:
 
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;
 
108
        ///
 
109
        void Init();
 
110
};
 
111
#endif