summaryrefslogtreecommitdiffstats
path: root/kgantt/kgantt/xQGanttListView.cpp
blob: 01b4ac2464c107d68965e86115fce1e36c56f116 (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
//
//  file    : xQGanttListView.C
//  date    : 23 nov 2000
//  changed : 
//  author  : jh
//

#include "xQGanttListView.h"

#include <qcolor.h>
#include <klocale.h>

xQGanttListView::xQGanttListView(KGanttItem* toplevelitem, QWidget* parent, 
				 const char * name, WFlags f)
  : QScrollView(parent,name,f)
/////////////////////////////////////////////////////////
{ 
  _toplevelitem = toplevelitem;

  setFrameStyle(QFrame::Sunken);
  setLineWidth(1);

  _headerBackBrush = QBrush(QColor(230,230,230));

  setMargins( 1, TOPMARGIN , 1, 1 );
  
  setVScrollBarMode( AlwaysOff );
    
  _viewport = new xQGanttListViewPort(toplevelitem,viewport());
  addChild(_viewport);
 
  viewport()->setBackgroundColor(QColor(white));

}



xQGanttListView::~xQGanttListView()
///////////////////////////////////
{
}


void
xQGanttListView::drawHeader()
///////////////////////////////
{
  // printf("xQGanttListView::drawHeader()\n");

  QPainter p(this);
  p.setPen( QPen(QColor(black)) );
  p.fillRect(0,0,width(),TOPMARGIN, _headerBackBrush );

  p.drawText(5, (int)(0.8 * TOPMARGIN), i18n("Items"));

}



void
xQGanttListView::contentsMoved(int x, int y)
////////////////////////////////////////////
{
  printf("xQGanttListView::contentsMoved(%d,%d)\n", x, y);
  setContentsPos( 0, y );
}



void 
xQGanttListView::paintEvent(QPaintEvent * /*e*/)
{      
  drawHeader();
}
#include "xQGanttListView.moc"