kgantt

KGanttRelation.h
1 #ifndef _KGANTTRELATION_H_
2 #define _KGANTTRELATION_H_
3 
4 /*
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  author : jh, jochen@ifb.bv.tu-berlin.de
22 
23  file : KGanttRelation.h
24  date : 17.02.2001
25 
26  changelog :
27 
28 */
29 
30 
31 #include <tqobject.h>
32 #include <tqdatetime.h>
33 #include <tqtextstream.h>
34 #include <tqptrlist.h>
35 #include <tqpainter.h>
36 
37 
38 class KGanttItem;
39 
40 
42 
48 class KGanttRelation : public TQObject
50 {
51 
52  TQ_OBJECT
53 
54 
55  friend class KGanttItem;
56 
57 public:
58 
59  enum Change {
60 
61  NoChange = 0,
62  TextChanged = 32,
63 
65  Selected = 2048,
66 
68  Unselected = 4096
69  };
70 
71 
72 
73 
75  /*
76  * Emits signal destroyed(KGanttRelation* this).
77  */
79 
80 
81 
82 
84 
87  void select(bool f);
88 
89 
91 
97  void setEditable(bool f) {
98  _editable = f;
99  }
100 
101 
102 
104 
107  bool isEditable() {
108  return _editable;
109  }
110 
111 
112 
114 
117  TQPen& getSelectPen() {
118  return _selectPen;
119  }
120 
121 
122 
124 
127  void setPen(const TQPen& pen);
128 
129 
130 
132 
135  TQPen& getPen() {
136  return _pen;
137  }
138 
139 
140 
142 
145  void setTextPen(const TQPen& pen) {
146  _textPen = pen;
147  }
148 
149 
150 
152 
155  TQPen& getTextPen() {
156  return _textPen;
157  }
158 
159 
160 
162 
165  void setText(const TQString& text);
166 
167 
168 
170 
173  TQString getText() { return _text; }
174 
175 
176 
178 
183  KGanttItem* getFrom();
184 
185 
186 
188 
191  KGanttItem* getTo();
192 
193 
194 
196 
199  void dump(TQTextOStream& cout, const TQString& pre);
200 
201 
202  TQString ChangeAsString(Change c);
203 
204 
205 signals:
206 
208 
213 
214 
215 
217 
222 
223 
224 public slots:
225 
226  void itemDestroyed(KGanttItem* item);
227 
228 
229 protected:
230 
232 
236  const TQString& text );
237 
238 
239 private:
240 
241 
242  bool _selected;
243 
244  bool _editable;
245 
246  KGanttItem* _from;
247  KGanttItem* _to;
248 
249  TQString _text;
250 
251  TQPen _pen, _textPen;
252 
253  static TQPen _selectPen;
254 
255 };
256 
257 #endif
KGanttItem.
Definition: KGanttItem.h:56
static TQString ChangeAsString(Change c)
Return a given change as a string.
Definition: KGanttItem.cpp:599
KGanttRelation.
void changed(KGanttRelation *, KGanttRelation::Change)
Item has changed.
KGanttRelation(KGanttItem *from, KGanttItem *to, const TQString &text)
Constructor.
void setEditable(bool f)
Set item editable or not.
void setPen(const TQPen &pen)
Set pen for border.
bool isEditable()
Returns if item is editable.
void dump(TQTextOStream &cout, const TQString &pre)
Dump to cout.
KGanttItem * getFrom()
Get date of starting.
void select(bool f)
Select/unselect item.
@ Selected
Item has been selected.
@ Unselected
Item has been unselected.
TQString getText()
Get text.
void setText(const TQString &text)
Set text.
void destroyed(KGanttRelation *)
Item will be deleted.
~KGanttRelation()
Destructor.
KGanttItem * getTo()
Get date of ending.
TQPen & getSelectPen()
Get brush which has to be used for drawing this item as selected.