8 #include "xQGanttListViewPort.h"
13 int xQGanttListViewPort::_ListViewCounter = 0;
17 const char * name, WFlags f )
18 : TQFrame(parent,name,f)
20 _toplevelitem = toplevelitem;
22 setBackgroundColor(TQColor(white));
28 brush1 = TQBrush(TQColor(200,200,230));
29 brush2 = TQBrush(TQColor(240,240,240));
49 resize(500, _barviewport->height());
51 printf(
"setBarViewPort()\n");
53 connect(_barviewport, TQ_SIGNAL(resized()),
54 this, TQ_SLOT(barViewResized()));
57 connect(_barviewport, TQ_SIGNAL(recalculated()),
69 xQGanttListViewPort::barViewResized()
72 printf(
"xQGanttListViewPort::barViewResized()\n");
76 int h = _barviewport->height();
88 xQGanttListViewPort::drawContents(TQPainter* p,
int x1,
int y1,
int x2,
int y2)
98 drawItem(_toplevelitem, p, TQRect(x1, y1, x2-x1, y2-y1), 5 );
106 xQGanttListViewPort::drawItem(
KGanttItem* item, TQPainter* p,
const TQRect& rect,
110 static int margin = 2;
112 xTQTaskPosition* tpos = _barviewport->_gItemList[item];
116 if( (tpos->_screenY+5 >= rect.y() &&
117 tpos->_screenY-5 <= rect.y() + rect.height()) ||
118 ((tpos->_screenY + tpos->_screenH)+5 >= rect.y() &&
119 (tpos->_screenY + tpos->_screenH)-5 <= rect.y() + rect.height() ) ) {
121 p->setPen(TQPen(TQColor(black)));
123 int y = tpos->_screenY;
124 int h = tpos->_screenH;
126 if(tpos->_nr % 2 == 0)
127 p->fillRect(0 + margin, y + margin ,
128 _width - 2 * margin, h - 2 * margin, brush1);
130 p->fillRect(0 + margin, y + margin,
131 _width - 2* margin, h - 2* margin, brush2);
133 TQString str = item->
getText() +
" [" +
134 item->
getStart().toString() +
" / " +
135 item->
getEnd().toString() +
"]";
137 p->drawText(offsetX, tpos->_textPosY, str );
148 drawItem(subitem, p, rect, offsetX + 20);
152 p->setPen(TQPen(TQColor(blue),2));
153 p->drawLine(offsetX + 3, tpos->_textPosY + 3,
154 offsetX + 3, tpos->_screenY + tpos->_screenHS - 3);
171 drawContents(&p, x1, y1, x2, y2);
175 #include "xQGanttListViewPort.moc"
TQDateTime getStart()
Get date of starting.
TQPtrList< KGanttItem > & getSubItems()
Get list of subitems.
bool isOpen()
Returns true if item is open (subitems has to be drawn)
TQDateTime getEnd()
Get date of ending.
TQString getText()
Get text.
~xQGanttListViewPort()
Destructor.
xQGanttListViewPort(KGanttItem *toplevelitem, TQWidget *parent=0, const char *name=0, WFlags f=0)
Constructor.
void update(int x1, int y1, int x2, int y2)
Update widget.