kdgantt

KDGanttViewTaskLink.h
1 /*
2  $Id$
3  KDGantt - a multi-platform charting engine
4 */
5 
6 /****************************************************************************
7  ** Copyright (C) 2002-2004 Klarälvdalens Datakonsult AB. All rights reserved.
8  **
9  ** This file is part of the KDGantt library.
10  **
11  ** This file may be distributed and/or modified under the terms of the
12  ** GNU General Public License version 2 as published by the Free Software
13  ** Foundation and appearing in the file LICENSE.GPL included in the
14  ** packaging of this file.
15  **
16  ** Licensees holding valid commercial KDGantt licenses may use this file in
17  ** accordance with the KDGantt Commercial License Agreement provided with
18  ** the Software.
19  **
20  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22  **
23  ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
24  ** information about KDGantt Commercial License Agreements.
25  **
26  ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
27  ** licensing are not clear to you.
28  **
29  ** As a special exception, permission is given to link this program
30  ** with any edition of TQt, and distribute the resulting executable,
31  ** without including the source code for TQt in the source distribution.
32  **
33  **********************************************************************/
34 
35 #ifndef KDGANTTVIEWTASKLINK_H
36 #define KDGANTTVIEWTASKLINK_H
37 
38 #include <tqcolor.h>
39 #include <tqstring.h>
40 #include <tqptrlist.h>
41 #include <tqcanvas.h>
42 
43 #include "KDGanttViewItem.h"
45 class KDCanvasPolygon;
46 class KDCanvasLine;
47 
49 {
50 public:
51  enum LinkType { None, FinishStart, StartStart, FinishFinish, StartFinish };
52 
53  KDGanttViewTaskLink( TQPtrList<KDGanttViewItem> from,
54  TQPtrList<KDGanttViewItem> to,
55  LinkType type=None );
57  TQPtrList<KDGanttViewItem> from,
58  TQPtrList<KDGanttViewItem> to,
59  LinkType type=None );
63  LinkType type=None );
66  LinkType type=None );
68  TQPtrList<KDGanttViewItem> from() const;
69  TQPtrList<KDGanttViewItem> to() const;
71 
72  void setVisible( bool );
73  bool isVisible() const;
74 
77 
78  void setHighlight( bool highlight );
79  bool highlight() const;
80 
81  void setColor( const TQColor& color );
82  TQColor color() const;
83  void setHighlightColor( const TQColor& color );
84  TQColor highlightColor() const;
85 
86  void setTooltipText( const TQString& text );
87  TQString tooltipText() const;
88  void setWhatsThisText( const TQString& text );
89  TQString whatsThisText() const;
90 
91  void createNode( TQDomDocument& doc,
92  TQDomElement& parentElement );
93  static KDGanttViewTaskLink* createFromDomElement( TQDomElement& );
94 
95  int linkType();
96  void setLinkType(int type);
97 
98 private:
99  friend class KDGanttViewTaskLinkGroup;
100  friend class KDTimeTableWidget;
101  TQPtrList<KDGanttViewItem> fromList,toList;
102  TQPtrList<KDCanvasLine>* horLineList;
103  TQPtrList<KDCanvasLine>* verLineList;
104  TQPtrList<KDCanvasPolygon>* topList;
105 
106  // also used when linkType != None
107  TQPtrList<KDCanvasLine>* horLineList2;
108  TQPtrList<KDCanvasLine>* verLineList2;
109  TQPtrList<KDCanvasLine>* horLineList3;
110  TQPtrList<KDCanvasPolygon>* topLeftList;
111  TQPtrList<KDCanvasPolygon>* topRightList;
112 
113  KDGanttViewTaskLinkGroup* myGroup;
114  bool isvisible,ishighlighted;
115  TQColor myColor, myColorHL;
116  TQString myToolTipText,myWhatsThisText;
117  KDTimeTableWidget* myTimeTable;
118  void initTaskLink();
119  void showMe( bool );
120  void showMeType( bool );
121  void hide();
122  int xOffset(KDGanttViewItem *item);
123 
124  LinkType myLinkType;
125  static TQString linkTypeToString( LinkType type );
126  static LinkType stringToLinkType( const TQString type );
127 };
128 
129 #endif