summaryrefslogtreecommitdiffstats
path: root/kgantt/kgantt/KGantt.cpp
blob: 249f11ad9fa168f0e6ddb9d175a614a21ad1dfee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//
//  file    : KGantt.C
//  date    : 26 oct 2000
//  changed : 10 jan 2001
//  author  : jh
//


#include "KGantt.h"


#include <tqcolor.h>
#include <tqstylefactory.h>
#include <tqscrollview.h> 


KGantt::KGantt(KGanttItem* toplevelitem,
	       TQWidget* parent, const char * name, WFlags f)
  : TQWidget(parent,name,f)
{ 
#ifdef _DEBUG_
  printf("KGantt::KGantt()\n");
#endif

  if(toplevelitem == 0) {
    _toplevelitem = new KGanttItem(0, "toplevelitem",
			   TQDateTime::tqcurrentDateTime(),
			   TQDateTime::tqcurrentDateTime() );
    _toplevelitem->setMode(KGanttItem::Rubberband);
    _deleteItem = true;
  }
  else {
    _toplevelitem = toplevelitem;
    _deleteItem = false;
  }

  setBackgroundColor(TQColor(white));

  _splitter = new TQSplitter(this);
/*
//  TQStyle *cdestyle=TQStyleFactory::create("CDE");
//  if(cdestyle)
//	  _splitter->setStyle(cdestyle);
*/
  TQPalette pal1(_splitter->palette());
/*  TQPalette pal(_splitter->palette());
  TQColorGroup cg(pal.active());
  cg.setColor( TQColorGroup::Foreground, blue );
  cg.setColor( TQColorGroup::Background, white );
  pal.setActive( cg );

  _splitter->setPalette(pal);*/
  
  _ganttlist = new xQGanttListView(_toplevelitem, _splitter); 
  _ganttlist->setMinimumWidth(1);
  _ganttlist->setPalette(pal1);

  _ganttbar = new xQGanttBarView(_toplevelitem, _splitter);
  _ganttbar->setPalette(pal1);

  connect(_ganttbar, TQT_SIGNAL(contentsMoving(int,int)),
	  _ganttlist, TQT_SLOT(contentsMoved(int,int)));

  _ganttlist->setBarView(_ganttbar);

}



KGantt::~KGantt()
///////////////////
{
  if(_deleteItem)
    delete _toplevelitem;
}




void 
KGantt::dumpItems()
/////////////////////////
{
  TQTextOStream cout(stdout);

  cout << "\n<Gantt>\n";
  cout << " start : " << _toplevelitem->getStart().toString() << endl;
  cout << " end :   " << _toplevelitem->getEnd().toString() << endl;

  _toplevelitem->dump(cout, "  ");

  cout << "</Gantt>\n\n";

}



#include "KGantt.moc"