KDGanttViewTaskLink.h
00001 /* -*- Mode: C++ -*- 00002 $Id$ 00003 KDGantt - a multi-platform charting engine 00004 */ 00005 00006 /**************************************************************************** 00007 ** Copyright (C) 2002-2004 Klarälvdalens Datakonsult AB. All rights reserved. 00008 ** 00009 ** This file is part of the KDGantt library. 00010 ** 00011 ** This file may be distributed and/or modified under the terms of the 00012 ** GNU General Public License version 2 as published by the Free Software 00013 ** Foundation and appearing in the file LICENSE.GPL included in the 00014 ** packaging of this file. 00015 ** 00016 ** Licensees holding valid commercial KDGantt licenses may use this file in 00017 ** accordance with the KDGantt Commercial License Agreement provided with 00018 ** the Software. 00019 ** 00020 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00021 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00022 ** 00023 ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for 00024 ** information about KDGantt Commercial License Agreements. 00025 ** 00026 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this 00027 ** licensing are not clear to you. 00028 ** 00029 ** As a special exception, permission is given to link this program 00030 ** with any edition of TQt, and distribute the resulting executable, 00031 ** without including the source code for TQt in the source distribution. 00032 ** 00033 **********************************************************************/ 00034 00035 #ifndef KDGANTTVIEWTASKLINK_H 00036 #define KDGANTTVIEWTASKLINK_H 00037 00038 #include <tqcolor.h> 00039 #include <tqstring.h> 00040 #include <tqptrlist.h> 00041 #include <tqcanvas.h> 00042 00043 #include "KDGanttViewItem.h" 00044 class KDGanttViewTaskLinkGroup; 00045 class KDCanvasPolygon; 00046 class KDCanvasLine; 00047 00048 class KDGanttViewTaskLink 00049 { 00050 public: 00051 enum LinkType { None, FinishStart, StartStart, FinishFinish, StartFinish }; 00052 00053 KDGanttViewTaskLink( TQPtrList<KDGanttViewItem> from, 00054 TQPtrList<KDGanttViewItem> to, 00055 LinkType type=None ); 00056 KDGanttViewTaskLink( KDGanttViewTaskLinkGroup* group, 00057 TQPtrList<KDGanttViewItem> from, 00058 TQPtrList<KDGanttViewItem> to, 00059 LinkType type=None ); 00060 KDGanttViewTaskLink( KDGanttViewTaskLinkGroup* group, 00061 KDGanttViewItem* from, 00062 KDGanttViewItem* to, 00063 LinkType type=None ); 00064 KDGanttViewTaskLink( KDGanttViewItem* from, 00065 KDGanttViewItem* to, 00066 LinkType type=None ); 00067 ~KDGanttViewTaskLink(); 00068 TQPtrList<KDGanttViewItem> from() const; 00069 TQPtrList<KDGanttViewItem> to() const; 00070 void removeItemFromList( KDGanttViewItem* ); 00071 00072 void setVisible( bool ); 00073 bool isVisible() const; 00074 00075 KDGanttViewTaskLinkGroup* group(); 00076 void setGroup( KDGanttViewTaskLinkGroup*) ; 00077 00078 void setHighlight( bool highlight ); 00079 bool highlight() const; 00080 00081 void setColor( const TQColor& color ); 00082 TQColor color() const; 00083 void setHighlightColor( const TQColor& color ); 00084 TQColor highlightColor() const; 00085 00086 void setTooltipText( const TQString& text ); 00087 TQString tooltipText() const; 00088 void setWhatsThisText( const TQString& text ); 00089 TQString whatsThisText() const; 00090 00091 void createNode( TQDomDocument& doc, 00092 TQDomElement& parentElement ); 00093 static KDGanttViewTaskLink* createFromDomElement( TQDomElement& ); 00094 00095 int linkType(); 00096 void setLinkType(int type); 00097 00098 private: 00099 friend class KDGanttViewTaskLinkGroup; 00100 friend class KDTimeTableWidget; 00101 TQPtrList<KDGanttViewItem> fromList,toList; 00102 TQPtrList<KDCanvasLine>* horLineList; 00103 TQPtrList<KDCanvasLine>* verLineList; 00104 TQPtrList<KDCanvasPolygon>* topList; 00105 00106 // also used when linkType != None 00107 TQPtrList<KDCanvasLine>* horLineList2; 00108 TQPtrList<KDCanvasLine>* verLineList2; 00109 TQPtrList<KDCanvasLine>* horLineList3; 00110 TQPtrList<KDCanvasPolygon>* topLeftList; 00111 TQPtrList<KDCanvasPolygon>* topRightList; 00112 00113 KDGanttViewTaskLinkGroup* myGroup; 00114 bool isvisible,ishighlighted; 00115 TQColor myColor, myColorHL; 00116 TQString myToolTipText,myWhatsThisText; 00117 KDTimeTableWidget* myTimeTable; 00118 void initTaskLink(); 00119 void showMe( bool ); 00120 void showMeType( bool ); 00121 void hide(); 00122 int xOffset(KDGanttViewItem *item); 00123 00124 LinkType myLinkType; 00125 static TQString linkTypeToString( LinkType type ); 00126 static LinkType stringToLinkType( const TQString type ); 00127 }; 00128 00129 #endif