kgantt

KGantt.h
1 #ifndef _KGANTT_H_
2 #define _KGANTT_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 : KGantt.h
24  date : 26 oct 2000
25 
26 
27  changelog : 23 nov 2000, jh
28 
29  24 nov 2000, jh
30 
31  10 jan 2001m jh, changed to KDE :
32  xQGantt -> KGantt
33 
34 */
35 
36 
37 #include <tqwidget.h>
38 #include <tqsplitter.h>
39 
40 #include <tdepopupmenu.h>
41 #include <kdemacros.h>
42 
43 #include "KGanttItem.h"
44 #include "xQGanttListView.h"
45 #include "xQGanttBarView.h"
46 
47 
48 
85 
90 class TDE_EXPORT KGantt : public TQWidget
92 {
93 
94  TQ_OBJECT
95 
96 
97 
98 public:
99 
100 
102 
105  KGantt(KGanttItem* toplevelitem = 0,
106  TQWidget* parent = 0, const char * name=0, WFlags f=0 );
107 
108 
110 
113  ~KGantt();
114 
115 
116 
118 
125  if(_deleteItem)
126  delete _toplevelitem;
127  _toplevelitem = item;
128  }
129 
130 
131 
133 
137  return _toplevelitem;
138  }
139 
140 
141 
143 
147  return _ganttbar;
148  }
149 
150 
151 
153 
157  return _ganttlist;
158  }
159 
160 
161 
162  TQSplitter* splitter() {
163  return _splitter;
164  }
165 
166 
167 
169 
172  void zoom(double factor) {
173  barView()->viewport()->zoom(factor);
174  }
175 
176 
177 
179 
182  TDEPopupMenu* menu() {
183  return _ganttbar->viewport()->menu();
184  }
185 
186 
187 
189 
198  TDEToolBar* toolbar(TQMainWindow* mw = 0) {
199  return _ganttbar->viewport()->toolbar(mw);
200  }
201 
202 
203 
205  /*
206  *
207  */
208  void dumpItems();
209 
210 
211 
213 
216  void getSelectedItems(TQPtrList<KGanttItem>& list) {
217  _ganttbar->viewport()->getSelectedItems(list);
218  }
219 
220 
221 
222  void addHoliday(int y, int m, int d) {
223  _ganttbar->viewport()->addHoliday(y,m,d);
224  }
225 
226 
227 
228  void removeHoliday(int y, int m, int d) {
229  _ganttbar->viewport()->addHoliday(y,m,d);
230  }
231 
232 
233 
234 public slots:
235 
236 
237  void setSelect() {
238  _ganttbar->viewport()->setSelect();
239  }
240 
241  void setZoom() {
242  _ganttbar->viewport()->setZoom();
243  }
244 
245  void setMove() {
246  _ganttbar->viewport()->setMove();
247  }
248 
249 
250  void zoomIn() {
251  _ganttbar->viewport()->zoomIn();
252  }
253 
254  void zoomOut() {
255  _ganttbar->viewport()->zoomOut();
256  }
257 
258  void zoomAll() {
259  _ganttbar->viewport()->zoomAll();
260  }
261 
262  void selectAll() {
263  _ganttbar->viewport()->selectAll();
264  }
265 
266  void unselectAll() {
267  _ganttbar->viewport()->unselectAll();
268  }
269 
270  void deleteSelectedItems() {
271  _ganttbar->viewport()->deleteSelectedItems();
272  }
273 
274  void insertIntoSelectedItem() {
275  _ganttbar->viewport()->insertIntoSelectedItem();
276  }
277 
278 
280 
283  void showList() {
284  _ganttlist->show();
285  }
286 
287 
289  /*
290  *
291  */
292  void hideList() {
293  _ganttlist->hide();
294  }
295 
296 
297 protected:
298 
299 
300  void resizeEvent(TQResizeEvent* /*e*/) {
301  _splitter->resize(width(),height());
302  };
303 
304 
305 private:
306 
307  KGanttItem* _toplevelitem;
308 
309  TQSplitter *_splitter;
310 
311  xQGanttBarView* _ganttbar;
312  xQGanttListView* _ganttlist;
313 
314  bool _deleteItem;
315 
316 };
317 
318 
319 #endif
KGanttItem.
Definition: KGanttItem.h:56
Gantt Widget.
Definition: KGantt.h:92
void getSelectedItems(TQPtrList< KGanttItem > &list)
Get all selected items.
Definition: KGantt.h:216
void setToplevelItem(KGanttItem *item)
Set toplevel item.
Definition: KGantt.h:124
TDEToolBar * toolbar(TQMainWindow *mw=0)
Add gantt toolbar to main window.
Definition: KGantt.h:198
void hideList()
Hide list view.
Definition: KGantt.h:292
xQGanttListView * listView()
Get list view of items.
Definition: KGantt.h:156
KGanttItem * getToplevelItem()
Get toplevel item.
Definition: KGantt.h:136
void showList()
Show list view.
Definition: KGantt.h:283
xQGanttBarView * barView()
Get bar view of items.
Definition: KGantt.h:146
TDEPopupMenu * menu()
Get popup menu.
Definition: KGantt.h:182
Gantt view.
GanttListView Widget.