kdgantt

KDGanttViewTaskLink.h

00001 /* -*- Mode: C++ -*-
00002    $Id: KDGanttViewTaskLink.h 360094 2004-11-03 13:56:18Z danders $
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 Qt, and distribute the resulting executable,
00031  ** without including the source code for Qt in the source distribution.
00032  **
00033  **********************************************************************/
00034 
00035 #ifndef KDGANTTVIEWTASKLINK_H
00036 #define KDGANTTVIEWTASKLINK_H
00037 
00038 #include <qcolor.h>
00039 #include <qstring.h>
00040 #include <qptrlist.h>
00041 #include <qcanvas.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( QPtrList<KDGanttViewItem> from,
00054                          QPtrList<KDGanttViewItem> to,
00055                          LinkType type=None );
00056     KDGanttViewTaskLink( KDGanttViewTaskLinkGroup* group,
00057                          QPtrList<KDGanttViewItem> from,
00058                          QPtrList<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     QPtrList<KDGanttViewItem> from() const;
00069     QPtrList<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 QColor& color );
00082     QColor color() const;
00083     void setHighlightColor( const QColor& color );
00084     QColor highlightColor() const;
00085 
00086     void setTooltipText( const QString& text );
00087     QString tooltipText() const;
00088     void setWhatsThisText( const QString& text );
00089     QString whatsThisText() const;
00090 
00091     void createNode( QDomDocument& doc,
00092                      QDomElement& parentElement );
00093     static KDGanttViewTaskLink* createFromDomElement( QDomElement& );
00094 
00095     int linkType();
00096     void setLinkType(int type);
00097     
00098 private:
00099     friend class KDGanttViewTaskLinkGroup;
00100     friend class KDTimeTableWidget;
00101     QPtrList<KDGanttViewItem> fromList,toList;
00102     QPtrList<KDCanvasLine>* horLineList;
00103     QPtrList<KDCanvasLine>* verLineList;
00104     QPtrList<KDCanvasPolygon>* topList;
00105 
00106     // also used when linkType != None    
00107     QPtrList<KDCanvasLine>* horLineList2;
00108     QPtrList<KDCanvasLine>* verLineList2;
00109     QPtrList<KDCanvasLine>* horLineList3;
00110     QPtrList<KDCanvasPolygon>* topLeftList;
00111     QPtrList<KDCanvasPolygon>* topRightList;
00112     
00113     KDGanttViewTaskLinkGroup* myGroup;
00114     bool isvisible,ishighlighted;
00115     QColor myColor, myColorHL;
00116     QString 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 QString linkTypeToString( LinkType type );
00126     static LinkType stringToLinkType( const QString type );
00127 };
00128 
00129 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys