kgantt

KGantt.cpp
1 //
2 // file : KGantt.C
3 // date : 26 oct 2000
4 // changed : 10 jan 2001
5 // author : jh
6 //
7 
8 
9 #include "KGantt.h"
10 
11 
12 #include <tqcolor.h>
13 #include <tqstylefactory.h>
14 #include <tqscrollview.h>
15 
16 
17 KGantt::KGantt(KGanttItem* toplevelitem,
18  TQWidget* parent, const char * name, WFlags f)
19  : TQWidget(parent,name,f)
20 {
21 #ifdef _DEBUG_
22  printf("KGantt::KGantt()\n");
23 #endif
24 
25  if(toplevelitem == 0) {
26  _toplevelitem = new KGanttItem(0, "toplevelitem",
27  TQDateTime::currentDateTime(),
28  TQDateTime::currentDateTime() );
29  _toplevelitem->setMode(KGanttItem::Rubberband);
30  _deleteItem = true;
31  }
32  else {
33  _toplevelitem = toplevelitem;
34  _deleteItem = false;
35  }
36 
37  setBackgroundColor(TQColor(white));
38 
39  _splitter = new TQSplitter(this);
40 /*
41 // TQStyle *cdestyle=TQStyleFactory::create("CDE");
42 // if(cdestyle)
43 // _splitter->setStyle(cdestyle);
44 */
45  TQPalette pal1(_splitter->palette());
46 /* TQPalette pal(_splitter->palette());
47  TQColorGroup cg(pal.active());
48  cg.setColor( TQColorGroup::Foreground, blue );
49  cg.setColor( TQColorGroup::Background, white );
50  pal.setActive( cg );
51 
52  _splitter->setPalette(pal);*/
53 
54  _ganttlist = new xQGanttListView(_toplevelitem, _splitter);
55  _ganttlist->setMinimumWidth(1);
56  _ganttlist->setPalette(pal1);
57 
58  _ganttbar = new xQGanttBarView(_toplevelitem, _splitter);
59  _ganttbar->setPalette(pal1);
60 
61  connect(_ganttbar, TQ_SIGNAL(contentsMoving(int,int)),
62  _ganttlist, TQ_SLOT(contentsMoved(int,int)));
63 
64  _ganttlist->setBarView(_ganttbar);
65 
66 }
67 
68 
69 
72 {
73  if(_deleteItem)
74  delete _toplevelitem;
75 }
76 
77 
78 
79 
80 void
83 {
84  TQTextOStream cout(stdout);
85 
86  cout << "\n<Gantt>\n";
87  cout << " start : " << _toplevelitem->getStart().toString() << endl;
88  cout << " end : " << _toplevelitem->getEnd().toString() << endl;
89 
90  _toplevelitem->dump(cout, " ");
91 
92  cout << "</Gantt>\n\n";
93 
94 }
95 
96 
97 
98 #include "KGantt.moc"
KGanttItem.
Definition: KGanttItem.h:56
TQDateTime getStart()
Get date of starting.
Definition: KGanttItem.cpp:208
TQDateTime getEnd()
Get date of ending.
Definition: KGanttItem.cpp:220
void dump(TQTextOStream &cout, const TQString &pre)
Dump to cout.
Definition: KGanttItem.cpp:565
void setMode(Mode flag)
Set mode.
Definition: KGanttItem.cpp:466
void dumpItems()
Print to stdout.
Definition: KGantt.cpp:81
~KGantt()
Destructor.
Definition: KGantt.cpp:70
KGantt(KGanttItem *toplevelitem=0, TQWidget *parent=0, const char *name=0, WFlags f=0)
Constructor.
Definition: KGantt.cpp:17
Gantt view.
GanttListView Widget.
void setBarView(xQGanttBarView *v)
Connect barview to this listview.