• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kdgantt1

KDGanttViewItem.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002    $Id: KDGanttViewItem.h 836291 2008-07-22 04:34:42Z pradeepto $
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 used under the terms of the GNU General Public
00012  ** License versions 2.0 or 3.0 as published by the Free Software
00013  ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
00014  ** included in the packaging of this file.  Alternatively you may (at
00015  ** your option) use any later version of the GNU General Public
00016  ** License if such license has been publicly approved by
00017  ** Klarälvdalens Datakonsult AB (or its successors, if any).
00018  ** 
00019  ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
00020  ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
00021  ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
00022  ** not expressly granted herein.
00023  ** 
00024  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00025  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00026  **
00027  ** As a special exception, permission is given to link this program
00028  ** with any edition of Qt, and distribute the resulting executable,
00029  ** without including the source code for Qt in the source distribution.
00030  **
00031  **********************************************************************/
00032 
00033 
00034 #ifndef KDGANTTVIEWITEM_H
00035 #define KDGANTTVIEWITEM_H
00036 
00037 
00038 #include <QDateTime>
00039 #include <QString>
00040 #include <QColor>
00041 #include <QPixmap>
00042 #include <QFont>
00043 
00044 
00045 #include "kdgantt_qt3_compat.h"
00046 
00047 
00048 class KDGanttView;
00049 class KDTimeTableWidget;
00050 class KDTimeHeaderWidget;
00051 class KDGanttViewTaskLink;
00052 class KDCanvasLine;
00053 class KDCanvasText;
00054 class KDCanvasPolygonItem;
00055 class KDGanttViewTaskLinkGroup;
00056 
00057 class KDGanttViewItem : public QListViewItem
00058 {
00059 public:
00060     enum Type { Event = 0, Task, Summary, UnknownType };
00061     enum Shape { TriangleDown, TriangleUp, Diamond, Square, Circle };
00062     enum Connector { NoConnector = 0, Start, Middle, End, Move, ActualEnd, Lead, TaskLinkStart, TaskLinkEnd };
00063 
00064 protected:
00065     KDGanttViewItem( Type type, KDGanttView* view,
00066                      const QString& lvtext = QString(),
00067                      const QString& name = QString() );
00068     KDGanttViewItem( Type type, KDGanttViewItem* parent,
00069                      const QString& lvtext = QString(),
00070                      const QString& name = QString() );
00071     KDGanttViewItem( Type type, KDGanttView* view, KDGanttViewItem* after,
00072                      const QString& lvtext = QString(),
00073                      const QString& name = QString() );
00074     KDGanttViewItem( Type type, KDGanttViewItem* parent,
00075                      KDGanttViewItem* after,
00076                      const QString& lvtext = QString(),
00077                      const QString& name = QString() );
00078 
00079     void checkCoord( int * );
00080     bool isVisibleInGanttView;
00081     void updateCanvasItems();
00082     int getCoordY();
00083     KDCanvasLine * startLine, *endLine,
00084       * startLineBack, *endLineBack, *actualEnd ;
00085     KDCanvasPolygonItem* startShape,* midShape, *endShape,
00086       * startShapeBack,* midShapeBack, *endShapeBack,
00087       * progressShape, * floatStartShape, * floatEndShape;
00088     
00089     KDGanttView* myGanttView;
00090     KDCanvasText* mTextCanvas;
00091     QString textCanvasText;
00092     QDateTime myStartTime, myEndTime;
00093     bool isHighlighted, isEditable;
00094     int myItemSize;
00095     bool blockUpdating;
00096     QCanvasText* textcanvas();
00097     void generateAndInsertName( const QString& name );
00098     QString mUid;
00099     
00100     void moveTextCanvas(int x, int y);
00101 
00102     int myProgress;
00103     QDateTime myFloatStartTime;
00104     QDateTime myFloatEndTime;
00105     
00106 public:
00107     virtual ~KDGanttViewItem();
00108 
00109     Type type() const;
00110     void setEnabled( bool on );
00111     bool enabled () const;
00112     virtual void setOpen( bool o );
00113     void setItemVisible( bool on );
00114     bool itemVisible () const;
00115     void setEditable( bool editable );
00116     bool editable() const;
00117     void setShowNoInformation( bool show );
00118     void setShowNoInformationBeforeAndAfter( bool show );
00119     bool showNoInformation();
00120     bool showNoInformationBeforeAndAfter();
00121     void setDisplaySubitemsAsGroup( bool show );
00122     bool displaySubitemsAsGroup() const;
00123     void setPriority( int prio );
00124     int priority();
00125     virtual void setStartTime( const QDateTime& start );
00126     QDateTime startTime() const;
00127     virtual void setEndTime( const QDateTime& end );
00128     QDateTime endTime() const;
00129 
00130     void setText( const QString& text );
00131     QString text() const;
00132     void setListViewText( const QString& text, int column = 0 );
00133     void setListViewText( int column, const QString& text );
00134     QString listViewText( int column = 0 ) const;
00135     void setFont( const QFont& font );
00136     QFont font() const;
00137     void setTooltipText( const QString& text );
00138     QString tooltipText() const;
00139     void setWhatsThisText( const QString& text );
00140     QString whatsThisText() const;
00141     void setPixmap( int column, const QPixmap& pixmap );
00142     void setPixmap( const QPixmap& pixmap );
00143     const QPixmap* pixmap( int column = 0 ) const;
00144 
00145     void setHighlight( bool );
00146     bool highlight() const;
00147 
00148     bool subitemIsCalendar() const;
00149 
00150     void setShapes( Shape start, Shape middle, Shape end );
00151     void shapes( Shape& start, Shape& middle, Shape& end ) const;
00152     void setDefaultColor( const QColor& );
00153     QColor defaultColor() const;
00154     void setColors( const QColor& start, const QColor& middle,
00155                     const QColor& end );
00156     void colors( QColor& start, QColor& middle, QColor& end ) const;
00157     void setDefaultHighlightColor( const QColor& );
00158     QColor defaultHighlightColor() const;
00159     void setHighlightColors( const QColor& start, const QColor& middle,
00160                              const QColor& end );
00161     void highlightColors( QColor& start, QColor& middle, QColor& end ) const;
00162     void setTextColor( const QColor& color );
00163     QColor textColor() const;
00164 
00165     void setProgress(int percent);
00166     void setFloatStartTime(const QDateTime &start);
00167     void setFloatEndTime(const QDateTime &end);
00168     
00169     KDGanttViewItem* firstChild() const;
00170     KDGanttViewItem* nextSibling() const;
00171     KDGanttViewItem* parent() const;
00172     KDGanttViewItem* itemAbove();
00173     KDGanttViewItem* itemBelow( bool includeDisabled = true );
00174     KDGanttViewItem* getChildByName( const QString& name );
00175     KDGanttViewItem* getChildByUid( const QString& name );
00176 
00177     void createNode( QDomDocument& doc,
00178                      QDomElement& parentElement );
00179     static KDGanttViewItem* createFromDomElement( KDGanttView* view,
00180                                                   QDomElement& element );
00181     static KDGanttViewItem* createFromDomElement( KDGanttView* view,
00182                                                   KDGanttViewItem* previous,
00183                                                   QDomElement& element );
00184     static KDGanttViewItem* createFromDomElement( KDGanttViewItem* parent,
00185                                                   QDomElement& element );
00186     static KDGanttViewItem* createFromDomElement( KDGanttViewItem* parent,
00187                                                   KDGanttViewItem* previous,
00188                                                   QDomElement& element );
00189     QString name() const;
00190     static KDGanttViewItem* find( const QString& name );
00191     virtual QString uid() const;
00192     virtual void setUid( const QString& text );
00193     unsigned int getChildTimeForTimespan( const QDateTime& start, const QDateTime& end );
00194     unsigned int getAllSubChildTimeForTimespan( const QDateTime& start, const QDateTime& end );
00195     virtual unsigned int getTimeForTimespan( const QDateTime& start, const QDateTime& end );
00196     QPtrList <KDGanttViewItem> getChildListForTimespan( const QDateTime& start, const QDateTime& end );
00197     QDateTime myChildStartTime();
00198     QDateTime myChildEndTime();
00199     virtual QString typeString() const;
00200     virtual Connector getConnector( QPoint p );
00201     virtual bool moveConnector( Connector, QPoint p );
00202     void updateItemsOnCanvas( bool forceUpdate = false );
00203 
00204 protected:
00205     int mCurrentCoord_Y;
00206     int mCurrentConnectorCoordX;
00207     int mCurrentConnectorDiffX;
00208     virtual void userReadFromElement( QDomElement& element );
00209     virtual void userWriteToElement( QDomDocument& doc,
00210                                      QDomElement& parentElement );
00211 
00212     void setMoveable( bool m );
00213     bool isMoveable() const;
00214     void setResizeable( bool r );
00215     bool isResizeable() const;
00216 
00217 private:
00218     friend class KDGanttView;
00219     friend class KDTimeTableWidget;
00220     friend class KDTimeHeaderWidget;
00221     friend class KDListView;
00222     friend class KDGanttViewTaskLink;
00223     friend class KDGanttViewTaskLinkGroup;
00224     friend class KDGanttCanvasView;
00225     friend class KDGanttViewItemDrag;
00226     friend class itemAttributeDialog;
00227 
00228     virtual KDGanttViewItem::Connector getConnector( QPoint p, bool linkMode );
00229 
00230     static QString shapeToString( Shape shape );
00231     static Shape stringToShape( const QString& string );
00232     static QString typeToString( Type type );
00233     static Type stringToType(  const QString& type );
00234 
00235     Type myType;
00236     void setAllSubitemsExpanded ( bool );
00237     void initColorAndShapes(Type t);
00238     void resetSubitemVisibility();
00239     virtual void showItem( bool show = true, int coordY = 0 );
00240     virtual void initItem();
00241     int computeHeight();
00242     void showSubItems();
00243     void showSubitemTree( int );
00244     void hideSubtree();
00245     void setCallListViewOnSetOpen( bool call );
00246     bool showNoCross();
00247     void createShape(KDCanvasPolygonItem* &,KDCanvasPolygonItem* &, Shape);
00248     void loadFromDomElement( QDomElement& element );
00249 
00250     //QFont myFont;
00251     QString myToolTipText,myWhatsThisText;
00252     void paintBranches ( QPainter * p, const QColorGroup & cg, int w, int y, int h );
00253     bool _displaySubitemsAsGroup;
00254     bool _showNoInformation;
00255     bool _showNoInformationBeforeAndAfter;
00256     bool _enabled;
00257     bool _callListViewOnSetOpen;
00258     Shape myStartShape,myMiddleShape,myEndShape;
00259     QColor myStartColor,myMiddleColor,myEndColor;
00260     QColor myStartColorHL,myMiddleColorHL,myEndColorHL;
00261     QColor myDefaultColor,myDefaultColorHL;
00262     QColor myTextColor;
00263     bool colorDefined,colorHLDefined;
00264     QPoint getTaskLinkStartCoord(QPoint);
00265     QPoint getTaskLinkEndCoord();
00266     QPoint middleLeft();
00267     QPoint middleRight();
00268     void moveTextCanvas();
00269     void setTextOffset(QPoint p);
00270     bool isMyTextCanvas(QCanvasItem *tc);
00271     QPoint myTextOffset;
00272     QString _name;
00273     bool shapeDefined;
00274     int _priority;
00275     static QDict<KDGanttViewItem> sItemDict;
00276 
00277     bool _isMoveable;
00278     bool _isResizeable;
00279 };
00280 
00281 
00282 #endif

kdgantt1

Skip menu "kdgantt1"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal