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

« back to all changes in this revision

Viewing changes to src/sd/bv/transitionarrow.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 _TRANSITION_ARROW_H
 
23
#define _TRANSITION_ARROW_H
 
24
 
 
25
#include "line.h"
 
26
 
 
27
/// arrow having extra horiz. line separating event and list of actions (STD).
 
28
class TransitionArrow: public Line {
 
29
/*@Doc: {\large {\bf scope:} TSTD} */
 
30
public:
 
31
        ///
 
32
        TransitionArrow(ShapeView *v, Grafport *g, GShape *n1, GShape *n2, 
 
33
                List<Point *> *line, bool Curved);
 
34
        ///
 
35
        TransitionArrow(ShapeView *v, Grafport *g, GShape *n1, GShape *n2, 
 
36
                bool Curved);
 
37
        ///
 
38
        TransitionArrow(const TransitionArrow &line);
 
39
        ///
 
40
        virtual ~TransitionArrow();
 
41
        ///
 
42
        Shape *Clone() {return new TransitionArrow(*this);}
 
43
        ///
 
44
        int GetClassType() const {return Code::TRANSITION_ARROW;}
 
45
        ///
 
46
        bool InTextArea(int x, int y); 
 
47
        ///
 
48
        TextShape *HitTextShape(int x, int y);
 
49
        ///
 
50
        TextShape *ChooseTextShape(int x, int y);
 
51
        ///
 
52
        bool HasTextShape(TextShape *t) const;
 
53
        ///
 
54
        bool ContainsPt(int x, int y);
 
55
        ///
 
56
        void SetSelect(bool s);
 
57
        ///
 
58
        bool HitHLine(int x, int y);
 
59
        ///
 
60
        const Point *GetHLineFrom() const {return &hlineFrom;}
 
61
        ///
 
62
        const Point *GetHLineTo() const {return &hlineTo;}
 
63
        ///
 
64
        void UpdateAnchor(const Point *delta, const Point *position);
 
65
        ///
 
66
        void UpdateEvent(const string *s);
 
67
        ///
 
68
        void UpdateAction(const string *s, unsigned n, bool update);
 
69
        ///
 
70
        void CalcPosition();
 
71
        /// as line, but event and actions are also considered.
 
72
        int GetLeftMost() const; 
 
73
        ///
 
74
        int GetTopMost() const;
 
75
        ///
 
76
        int GetRightMost() const;
 
77
        ///
 
78
        int GetBottomMost() const;
 
79
        ///
 
80
        void WriteMembers(OutputFile *f);
 
81
        ///
 
82
        bool ReadMembers(InputFile *f, double format);
 
83
        ///
 
84
        bool SetAssocSubject(AssocList *);
 
85
        ///
 
86
        void SetTextShape();
 
87
        ///
 
88
        void SetTextColor(const string *color);
 
89
        ///
 
90
        void SetFont(XFont *ft);
 
91
        ///
 
92
        void SetGrafport(Grafport *g);
 
93
        ///
 
94
        void SetView(ShapeView *v);
 
95
        ///
 
96
        bool HasString(const string *s, bool sens, bool sub) const;
 
97
        ///
 
98
        bool HasNameString(const string *, bool, bool) const{return False;}
 
99
        ///
 
100
        bool HasString(const string*, bool, bool, List<TextShape *> *);
 
101
        ///
 
102
        enum SepType {LEFT, RIGHT, UP, DOWN}; 
 
103
        ///
 
104
        void MoveRaw(const Point *delta);
 
105
private:
 
106
        ///
 
107
        TextShape *event;
 
108
        ///
 
109
        List<TextShape *> *actions;
 
110
        ///
 
111
        Point hlineFrom;
 
112
        ///
 
113
        Point hlineTo;
 
114
        ///
 
115
        Point anchorPoint;
 
116
        ///
 
117
        SepType separator;
 
118
        ///
 
119
        const char *Sep2String(SepType sep);
 
120
        ///
 
121
        TransitionArrow::SepType String2Sep(const string *s);
 
122
        ///
 
123
        int HLineLength();
 
124
        ///
 
125
        void CalcSeparator();
 
126
        ///
 
127
        void CalcHLinePart();
 
128
        ///
 
129
        void CalcPositionEvent();
 
130
        ///
 
131
        void CalcPositionActions();
 
132
        /// calculate line position and action and event.
 
133
        void CalcPositionHLine(); 
 
134
        ///
 
135
        void SetAction(const string *s, unsigned n, bool update);
 
136
        /// draw arrow + all labels + 1 horiz line.
 
137
        void DrawShape(); 
 
138
        /// minimal length hline.
 
139
        static const int HLINELEN;
 
140
        ///
 
141
        static const int HLINEXOFFSET;
 
142
        ///
 
143
        static const int HLINEYOFFSET;
 
144
        /// distance to horizontal line.
 
145
        static const int HLINEDIST;
 
146
};
 
147
#endif