20#ifndef KPTCANVASITEM_H
21#define KPTCANVASITEM_H
24#include "KDGanttView.h"
25#include "KDGanttViewItem.h"
26#include "KDGanttViewSummaryItem.h"
27#include "KDGanttViewTaskItem.h"
28#include "KDGanttViewEventItem.h"
41class PertRelationItem;
45class PertNodeItem :
public TQCanvasPolygon
48 class PertNodeRelation
51 PertNodeRelation(Relation *r, PertNodeItem *n) { relation = r; childItem = n; }
52 ~PertNodeRelation() {}
54 PertNodeItem * childItem;
58 PertNodeItem( PertCanvas *view, Node &node,
int row,
int col );
59 virtual ~PertNodeItem();
61 virtual int rtti()
const;
64 void setVisible(
bool yes);
65 void move(PertCanvas *view,
int row,
int col);
67 TQPoint exitPoint(Relation::Type type)
const;
68 TQPoint entryPoint(Relation::Type type)
const;
70 Node &node()
const {
return m_node; }
72 TQRect rect()
const {
return TQRect(m_left, m_right); }
73 void setRow(
int row) { m_row = row; }
74 int row()
const {
return m_row; }
75 void setColumn(
int col) { m_col = col; }
76 int column()
const {
return m_col; }
77 int x()
const {
return m_x; }
78 int x(
int col)
const {
return m_wgap + col*(m_width+m_wgap); }
79 int y()
const {
return m_y; }
80 int y(
int row)
const {
return m_hgap + row*(m_height+m_hgap); }
81 int width()
const {
return m_width; }
82 int height()
const {
return m_height; }
84 void addChildRelation(Relation *relation, PertNodeItem *node)
85 { m_childRelations.append(
new PertNodeRelation(relation, node)); }
87 bool hasParent() {
return m_node.numDependParentNodes(); }
88 bool hasChild() {
return m_node.numDependChildNodes(); }
91 void drawShape(TQPainter & p);
100 TQPtrList<PertNodeRelation> m_childRelations;
107 TQCanvasText *m_name;
108 TQCanvasText *m_leader;
111 void printDebug(
int );
116class PertProjectItem :
public PertNodeItem
119 PertProjectItem( PertCanvas *view, Node &node,
int row=-1,
int col=-1 );
120 virtual ~PertProjectItem();
122 virtual int rtti()
const;
126 void printDebug(
int );
131class PertTaskItem :
public PertNodeItem
134 PertTaskItem( PertCanvas *view, Node &node,
int row=-1,
int col=-1 );
135 virtual ~PertTaskItem();
137 virtual int rtti()
const;
141 void printDebug(
int );
146class PertMilestoneItem :
public PertNodeItem
149 PertMilestoneItem( PertCanvas *view, Node &node,
int row=-1,
int col=-1 );
150 virtual ~PertMilestoneItem();
152 virtual int rtti()
const;
158 void printDebug(
int );
165class PertRelationItem :
public TQCanvasPolygon
168 PertRelationItem(PertCanvas *view, PertNodeItem *parent, PertNodeItem *child, Relation *rel);
169 virtual ~PertRelationItem();
171 virtual int rtti()
const;
174 Relation::Type type() {
return m_rel->type(); }
177 void setFinishStartPoints();
178 void setFinishFinishPoints();
179 void setStartStartPoints();
180 TQPointArray areaPoints()
const;
182 bool rowFree(
int row,
int startCol,
int endCol);
185 void drawShape(TQPainter &p);
190 PertNodeItem *m_parentItem;
191 PertNodeItem *m_childItem;
192 int left, top, right, bottom;
208 void printDebug(
int );
216 KDGanttViewTaskLink::LinkType kdLinkType(
int relationType);
222class GanttViewSummaryItem :
public KDGanttViewSummaryItem,
public ItemBase
225 GanttViewSummaryItem(KDGanttView *parent, Node *node);
226 GanttViewSummaryItem(KDGanttViewItem *parent, Node *node);
228 Node *getNode() {
return m_node; }
229 void insertRelations(GanttView *view);
230 KDGanttViewItem *find(Node *node);
231 KDGanttViewItem *find(KDGanttViewItem *item, Node *node);
232 KDGanttView *ganttView()
const {
return m_view; }
233 bool isDrawn()
const {
return m_drawn; }
234 void setDrawn(
bool drawn) { m_drawn = drawn; }
244class GanttViewTaskItem :
public KDGanttViewTaskItem,
public ItemBase
247 GanttViewTaskItem(KDGanttView *parent, KPlato::Task *task);
248 GanttViewTaskItem(KDGanttViewItem *parent, KPlato::Task *task);
250 KPlato::Task *getTask()
const {
return m_task; }
251 void insertRelations(GanttView *view);
252 KDGanttViewItem *find(Node *node);
253 KDGanttViewItem *find(KDGanttViewItem *item, Node *node);
254 KDGanttView *ganttView()
const {
return m_view; }
255 bool isDrawn()
const {
return m_drawn; }
256 void setDrawn(
bool drawn) { m_drawn = drawn; }
259 KPlato::Task *m_task;
266class GanttViewEventItem :
public KDGanttViewEventItem,
public ItemBase
269 GanttViewEventItem(KDGanttView *parent, KPlato::Task *task);
270 GanttViewEventItem(KDGanttViewItem *parent, KPlato::Task *task);
272 KPlato::Task *getTask() {
return m_task; }
273 void insertRelations(GanttView *view);
274 KDGanttViewItem *find(Node *node);
275 KDGanttViewItem *find(KDGanttViewItem *item, Node *node);
276 KDGanttView *ganttView()
const {
return m_view; }
277 bool isDrawn()
const {
return m_drawn; }
278 void setDrawn(
bool drawn) { m_drawn = drawn; }
281 KPlato::Task *m_task;
The relation class couples a 2 nodes together which are dependent on each other.
A task in the scheduling software is represented by this class.