36 #include "KDGanttViewTaskItem.h"
37 #include "KDGanttViewSubwidgets.h"
39 #include "itemAttributeDialog.h"
70 const TQString& lvtext,
71 const TQString& name ) :
88 const TQString& lvtext,
89 const TQString& name ) :
107 const TQString& lvtext,
108 const TQString& name ) :
126 const TQString& lvtext,
127 const TQString& name ) :
173 if (! start.isValid() ) {
174 tqDebug(
"KDGanttViewTaskItem::setStartTime():Invalid parameter-no time set");
189 void KDGanttViewTaskItem::hideMe()
192 progressShape->hide();
194 floatStartShape->hide();
195 floatEndShape->hide();
199 void KDGanttViewTaskItem::showItem(
bool show,
int coordY)
204 invalidateHeight () ;
209 bool takedefaultHeight = true ;
210 float prio = ((float) (
priority() - 100 )) / 100.0;
213 progressShape->hide();
215 floatStartShape->hide();
217 floatEndShape->hide();
230 KDCanvasRectangle* temp = (KDCanvasRectangle*)
startShape;
231 KDCanvasRectangle* progtemp = (KDCanvasRectangle*) progressShape;
232 int startX, endX, midX = 0,allY, progX=0;
240 if (myProgress > 0) {
241 progX = (endX - startX) * myProgress / 100;
244 if ( ! isVisible() ) {
246 while ( par != 0 && !par->isVisible() )
251 if (
myGanttView->myListView->itemAt( TQPoint(2, allY)))
252 hei =
myGanttView->myListView->itemAt( TQPoint(2, allY))->height();
253 if ( takedefaultHeight )
263 if (hei < myGanttView->myTimeTable->pendingHeight )
265 temp->setSize(5, hei );
266 temp->move(startX, 0);
269 temp->setSize( 1, hei -3 );
270 temp->move(startX, allY-hei/2 +2);
276 if ( startX +3 >= endX )
277 temp->setSize( 3, hei-3 );
279 temp->setSize(endX-startX, hei-3 );
280 temp->move(startX, allY-hei/2 +2);
284 TQColor c = temp->brush().color();
286 c.getHsv(&h, &s, &v);
287 h > 359/2 ? h -= 359/2 : h += 359/2;
289 progtemp->setBrush(TQBrush(c));
291 progtemp->setSize(progX, hei-3);
292 progtemp->move(temp->x(), temp->y());
295 if (myFloatStartTime.isValid()) {
296 KDCanvasRectangle* floatStartTemp = (KDCanvasRectangle*) floatStartShape;
297 int floatStartX =
myGanttView->myTimeHeader->getCoordX(myFloatStartTime);
299 TQBrush b(temp->brush().color(), Dense4Pattern);
300 floatStartTemp->setBrush(b);
301 floatStartTemp->setPen(TQPen(gray));
302 if (floatStartX < startX) {
303 floatStartTemp->setSize(startX - floatStartX, temp->size().height()/2);
304 floatStartTemp->move(floatStartX, temp->y() + temp->size().height()/4);
306 floatStartTemp->setSize(floatStartX - startX, temp->size().height()/2);
307 floatStartTemp->move(startX, temp->y() + temp->size().height()/4);
309 floatStartTemp->show();
311 if (myFloatEndTime.isValid()) {
312 KDCanvasRectangle* floatEndTemp = (KDCanvasRectangle*) floatEndShape;
313 int floatEndX =
myGanttView->myTimeHeader->getCoordX(myFloatEndTime);
315 TQBrush b(temp->brush().color(), Dense4Pattern);
316 floatEndTemp->setBrush(b);
317 floatEndTemp->setPen(TQPen(gray));
318 int ex = startX + temp->size().width();
319 if (floatEndX > ex) {
320 floatEndTemp->setSize(floatEndX - ex, temp->size().height()/2);
321 floatEndTemp->move(ex, temp->y() + temp->size().height()/4);
323 floatEndTemp->setSize(ex - floatEndX, temp->size().height()/2);
324 floatEndTemp->move(floatEndX, temp->y() + temp->size().height()/4);
326 floatEndTemp->show();
329 int wid = endX-startX - 4;
340 int len = temp.length();
341 while (
textCanvas->boundingRect().width() > wid ) {
342 temp.truncate(--len);
355 void KDGanttViewTaskItem::initItem()
361 parent()->setVisible(
true );
KDCanvasText * textCanvas
KDCanvasPolygonItem * startShape
void moveTextCanvas(int x, int y)
KDGanttViewItem * parent() const
TQDateTime myChildStartTime()
TQDateTime endTime() const
KDGanttView * myGanttView
bool displaySubitemsAsGroup() const
KDGanttViewItem * firstChild() const
bool isVisibleInGanttView
TQDateTime myChildEndTime()
TQDateTime startTime() const
void setStartTime(const TQDateTime &start)
KDGanttViewTaskItem(KDGanttView *view, const TQString &lvtext=TQString(), const TQString &name=TQString())
void setEndTime(const TQDateTime &end)
virtual ~KDGanttViewTaskItem()
bool calendarMode() const
bool displayEmptyTasksAsLine() const