Waste less space in nested layouts.
[kdepim.git] / kdgantt1 / KDGanttView.h
blob72ba740662389c388bda7c95514053769b4a2aac
1 /* -*- Mode: C++ -*-
2 $Id$
3 KDChart - a multi-platform charting engine
4 */
6 /****************************************************************************
7 ** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved.
8 **
9 ** This file is part of the KDGantt library.
11 ** This file may be used under the terms of the GNU General Public
12 ** License versions 2.0 or 3.0 as published by the Free Software
13 ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
14 ** included in the packaging of this file. Alternatively you may (at
15 ** your option) use any later version of the GNU General Public
16 ** License if such license has been publicly approved by
17 ** Klarälvdalens Datakonsult AB (or its successors, if any).
18 **
19 ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
20 ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
21 ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
22 ** not expressly granted herein.
23 **
24 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27 ** As a special exception, permission is given to link this program
28 ** with any edition of Qt, and distribute the resulting executable,
29 ** without including the source code for Qt in the source distribution.
31 **********************************************************************/
33 #ifndef KDGANTTVIEW_H
34 #define KDGANTTVIEW_H
38 #include <QWidget>
39 #include <QSplitter>
40 #include <QLayout>
41 #include <QFont>
43 #include "kdgantt_qt3_compat.h"
45 #include "KDGanttViewItem.h"
46 #include "KDGanttViewTaskLinkGroup.h"
47 #include "KDGanttMinimizeSplitter.h"
48 #include "KDGanttViewItemDrag.h"
50 class KDIntervalColorRectangle;
51 class KDGanttViewTaskLink;
52 class QPrinter;
53 class QIODevice;
54 class itemAttributeDialog;
55 class KDListView;
56 class KDGanttViewItem;
57 class KDGanttViewEventItem;
58 class KDGanttViewTaskItem;
59 class KDGanttViewSummaryItem;
60 class KDTimeTableWidget;
61 class KDTimeHeaderWidget;
62 class KDLegendWidget;
63 class KDGanttCanvasView;
64 class KDGanttViewTaskLink;
65 class KDGanttMinimizeSplitter;
67 class KDGanttView : public KDGanttMinimizeSplitter
69 Q_OBJECT
71 Q_PROPERTY( bool showLegend READ showLegend WRITE setShowLegend )
72 Q_PROPERTY( bool showListView READ showListView WRITE setShowListView )
73 Q_PROPERTY( bool showTaskLinks READ showTaskLinks WRITE setShowTaskLinks )
74 Q_PROPERTY( bool editorEnabled READ editorEnabled WRITE setEditorEnabled )
75 Q_PROPERTY( QDateTime horizonStart READ horizonStart WRITE setHorizonStart )
76 Q_PROPERTY( QDateTime horizonEnd READ horizonEnd WRITE setHorizonEnd )
77 Q_PROPERTY( Scale scale READ scale WRITE setScale )
78 Q_PROPERTY( YearFormat yearFormat READ yearFormat WRITE setYearFormat )
79 Q_PROPERTY( HourFormat hourFormat READ hourFormat WRITE setHourFormat )
80 Q_PROPERTY( ShowTicksType showTicks READ showTicks WRITE setShowTicks )
81 Q_PROPERTY( bool editable READ editable WRITE setEditable )
82 Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
83 Q_PROPERTY( int majorScaleCount READ majorScaleCount WRITE setMajorScaleCount )
84 Q_PROPERTY( int minorScaleCount READ minorScaleCount WRITE setMinorScaleCount )
85 Q_PROPERTY( int autoScaleMinorTickCount READ autoScaleMinorTickCount WRITE setAutoScaleMinorTickCount )
86 Q_PROPERTY( Scale maximumScale READ maximumScale WRITE setMaximumScale )
87 Q_PROPERTY( Scale minimumScale READ minimumScale WRITE setMinimumScale )
88 Q_PROPERTY( int minimumColumnWidth READ minimumColumnWidth WRITE setMinimumColumnWidth )
89 Q_PROPERTY( int ganttMaximumWidth READ ganttMaximumWidth WRITE setGanttMaximumWidth )
90 Q_PROPERTY( QColor weekendBackgroundColor READ weekendBackgroundColor WRITE setWeekendBackgroundColor )
91 Q_PROPERTY( QColor ganttViewBackgroundColor READ gvBackgroundColor WRITE setGvBackgroundColor )
92 Q_PROPERTY( QColor listViewBackgroundColor READ lvBackgroundColor WRITE setLvBackgroundColor )
93 Q_PROPERTY( QColor timeHeaderBackgroundColor READ timeHeaderBackgroundColor WRITE setTimeHeaderBackgroundColor )
94 Q_PROPERTY( QColor legendHeaderBackgroundColor READ legendHeaderBackgroundColor WRITE setLegendHeaderBackgroundColor )
95 Q_PROPERTY( double zoomFactor READ zoomFactor )
96 Q_PROPERTY( bool showHeaderPopupMenu READ showHeaderPopupMenu WRITE setShowHeaderPopupMenu )
97 Q_PROPERTY( bool showTimeTablePopupMenu READ showTimeTablePopupMenu WRITE setShowTimeTablePopupMenu )
98 Q_PROPERTY( bool headerVisible READ headerVisible WRITE setHeaderVisible )
99 Q_PROPERTY( bool showLegendButton READ showLegendButton WRITE setShowLegendButton )
100 Q_PROPERTY( bool legendIsDockwindow READ legendIsDockwindow WRITE setLegendIsDockwindow )
101 Q_PROPERTY( bool displayEmptyTasksAsLine READ displayEmptyTasksAsLine WRITE setDisplayEmptyTasksAsLine )
102 Q_PROPERTY( QBrush noInformationBrush READ noInformationBrush WRITE setNoInformationBrush )
103 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
104 Q_PROPERTY( bool dropEnabled READ dropEnabled WRITE setDropEnabled )
105 Q_PROPERTY( bool calendarMode READ calendarMode WRITE setCalendarMode )
107 Q_ENUMS( Scale )
108 Q_ENUMS( YearFormat )
109 Q_ENUMS( HourFormat )
110 Q_ENUMS(ShowTicksType)
112 public:
113 enum Scale { Second = 0, Minute, Hour, Day, Week, Month, Auto };
114 enum YearFormat { FourDigit, TwoDigit, TwoDigitApostrophe, NoDate };
115 enum HourFormat { Hour_24, Hour_12, Hour_24_FourDigit };
116 enum RepaintMode { No, Medium, Always };
117 enum ShowTicksType { ShowMajorTicks = 0, ShowMinorTicks, ShowNoTicks };
119 KDGanttView( QWidget* parent = 0, const char* name = 0 );
120 ~KDGanttView();
122 // Pass-through methods from QListView
123 virtual int addColumn( const QString& label, int width = -1 );
124 virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 );
125 virtual void removeColumn( int index );
127 virtual bool lvDropEvent ( QDropEvent *e, KDGanttViewItem*, KDGanttViewItem*);
128 virtual void lvStartDrag (KDGanttViewItem*);
129 virtual bool lvDragMoveEvent (QDragMoveEvent * e,KDGanttViewItem*, KDGanttViewItem*);
130 virtual void lvDragEnterEvent (QDragEnterEvent * e );
132 void setRepaintMode( RepaintMode mode );
133 void setUpdateEnabled( bool enable);
134 bool getUpdateEnabled( )const;
136 void setGanttMaximumWidth( int w );
137 int ganttMaximumWidth() const;
138 bool showLegend() const;
139 void setLegendIsDockwindow( bool dock );
140 bool legendIsDockwindow( ) const;
141 QDockWindow* legendDockwindow( ) const;
142 bool showListView() const;
143 void setEditorEnabled( bool enable );
144 bool editorEnabled() const;
145 int listViewWidth();
146 bool editable() const;
147 void setCalendarMode( bool mode );
148 bool calendarMode() const;
149 void setDisplaySubitemsAsGroup( bool show );
150 bool displaySubitemsAsGroup() const;
151 void setDisplayEmptyTasksAsLine( bool show );
152 bool displayEmptyTasksAsLine() const;
154 void setHorBackgroundLines( int count = 2,
155 QBrush brush =
156 QBrush( QColor ( 200,200,200 ),
157 Qt::Dense6Pattern ));
158 int horBackgroundLines( QBrush& brush ) const;
159 bool saveProject( QIODevice* );
160 bool loadProject( QIODevice* );
161 void print( QPrinter* printer,
162 bool printListView = true, bool printTimeLine = true,
163 bool printLegend = false );
164 QSize drawContents( QPainter* p = 0,
165 bool drawListView = true, bool drawTimeLine = true,
166 bool drawLegend = false );
167 void setZoomFactor( double factor, bool absolute );
168 double zoomFactor() const;
169 void ensureVisible( KDGanttViewItem* );
170 void centerTimelineAfterShow( const QDateTime& center );
171 void addTicksLeft( int num = 1 );
172 void addTicksRight( int num = 1 );
173 bool showTaskLinks() const;
175 void setFont(const QFont& f);
176 void setShowHeaderPopupMenu( bool show = true,
177 bool showZoom = true,
178 bool showScale = true,
179 bool showTime = true,
180 bool showYear = true,
181 bool showGrid = true,
182 bool showPrint = false);
183 bool showHeaderPopupMenu() const;
184 void setShowTimeTablePopupMenu( bool );
185 bool showTimeTablePopupMenu() const;
186 void setShapes( KDGanttViewItem::Type type,
187 KDGanttViewItem::Shape start,
188 KDGanttViewItem::Shape middle,
189 KDGanttViewItem::Shape end,
190 bool overwriteExisting = true );
191 bool shapes( KDGanttViewItem::Type type,
192 KDGanttViewItem::Shape& start,
193 KDGanttViewItem::Shape& middle,
194 KDGanttViewItem::Shape& end ) const;
195 void setColors( KDGanttViewItem::Type type,
196 const QColor& start, const QColor& middle,
197 const QColor& end,
198 bool overwriteExisting = true );
199 bool colors( KDGanttViewItem::Type type,
200 QColor& start, QColor& middle, QColor& end ) const;
201 void setDefaultColor( KDGanttViewItem::Type type,
202 const QColor&,
203 bool overwriteExisting = true );
204 QColor defaultColor( KDGanttViewItem::Type type ) const;
205 void setHighlightColors( KDGanttViewItem::Type type,
206 const QColor& start, const QColor& middle,
207 const QColor& end,
208 bool overwriteExisting = true );
209 bool highlightColors( KDGanttViewItem::Type type,
210 QColor& start, QColor& middle, QColor& end ) const;
211 void setDefaultHighlightColor( KDGanttViewItem::Type type,
212 const QColor&,
213 bool overwriteExisting = true );
214 QColor defaultHighlightColor( KDGanttViewItem::Type type ) const;
215 void setTextColor( const QColor& color );
216 QColor textColor() const;
218 void setNoInformationBrush( const QBrush& brush );
219 QBrush noInformationBrush() const;
221 // Link-related stuff
222 QPtrList<KDGanttViewTaskLink> taskLinks() const;
223 QPtrList<KDGanttViewTaskLinkGroup> taskLinkGroups() const;
225 // Legend-related stuff
226 void addLegendItem( KDGanttViewItem::Shape shape, const QColor& shapeColor, const QString& text );
227 void addLegendItem( KDGanttViewItem::Shape shape, const QColor& shapeColor, const QString& text, KDGanttViewItem::Shape shape2, const QColor& shapeColor2,const QString& text2 );
228 void clearLegend();
229 // Header-related stuff
230 void setHorizonStart( const QDateTime& start );
231 QDateTime horizonStart() const;
232 void setHorizonEnd( const QDateTime& start );
233 QDateTime horizonEnd() const;
234 Scale scale() const;
235 void setMaximumScale( Scale );
236 Scale maximumScale() const;
237 void setMinimumScale( Scale );
238 Scale minimumScale() const;
239 void setAutoScaleMinorTickCount( int count );
240 int autoScaleMinorTickCount() const;
241 void setMajorScaleCount( int count );
242 int majorScaleCount() const;
243 void setMinorScaleCount( int count );
244 int minorScaleCount() const;
245 void setMinimumColumnWidth( int width );
246 int minimumColumnWidth() const;
247 void setYearFormat( YearFormat format );
248 YearFormat yearFormat() const;
249 void setHourFormat( HourFormat format );
250 HourFormat hourFormat() const;
251 void setShowTicks( ShowTicksType );
252 ShowTicksType showTicks() const;
253 void setColumnBackgroundColor( const QDateTime& column,
254 const QColor& color,
255 Scale mini = KDGanttView::Second ,
256 Scale maxi = KDGanttView::Month);
257 #if 0
258 // This API has been replaced with KDIntervalColorRectangle and addIntervalBackgroundColor
259 void setIntervalBackgroundColor( const QDateTime& start,
260 const QDateTime& end,
261 const QColor& color,
262 int priority = 0,
263 Scale mini = KDGanttView::Second ,
264 Scale maxi = KDGanttView::Month);
265 bool changeBackgroundInterval( const QDateTime& oldstart,
266 const QDateTime& oldend,
267 const QDateTime& newstart,
268 const QDateTime& newend );
269 bool deleteBackgroundInterval( const QDateTime& start,
270 const QDateTime& end );
271 #endif
272 void addIntervalBackgroundColor( KDIntervalColorRectangle* newItem );
273 void clearBackgroundColor();
274 QColor columnBackgroundColor( const QDateTime& column ) const;
275 void setWeekendBackgroundColor( const QColor& color );
276 QColor weekendBackgroundColor() const;
277 void setWeekdayBackgroundColor( const QColor& color, int weekday );
278 QColor weekdayBackgroundColor(int weekday) const;
281 void setPaletteBackgroundColor(const QColor& col);
282 void setGvBackgroundColor ( const QColor & );
283 void setLvBackgroundColor ( const QColor & );
284 void setTimeHeaderBackgroundColor ( const QColor & );
285 void setLegendHeaderBackgroundColor ( const QColor & );
286 QColor gvBackgroundColor () const ;
287 QColor lvBackgroundColor () const ;
288 QColor timeHeaderBackgroundColor () const ;
289 QColor legendHeaderBackgroundColor () const ;
290 void addUserdefinedLegendHeaderWidget( QWidget * w );
292 void setWeekendDays( int start, int end );
293 void weekendDays( int& start, int& end ) const;
295 static QPixmap getPixmap( KDGanttViewItem::Shape shape, const QColor& shapeColor,const QColor& backgroundColor, int itemSize);
297 void setHeaderVisible( bool );
298 bool headerVisible() const;
300 void setShowLegendButton( bool show );
301 bool showLegendButton() const;
304 KDGanttViewItem* selectedItem() const;
305 void setSelected( KDGanttViewItem*, bool );
306 KDGanttViewItem* firstChild() const;
307 KDGanttViewItem* lastItem() const;
308 int childCount() const;
309 void clear();
310 void clearAll();
312 void setDragEnabled( bool b );
313 void setDropEnabled( bool b );
314 void setDragDropEnabled( bool b );
315 bool dragEnabled() const;
316 bool dropEnabled() const;
317 bool isDragEnabled() const;
318 bool isDropEnabled() const;
320 void setUserHorizonChangeEnabled( bool b );
321 bool userHorizonChangeEnabled() const;
323 virtual QSize sizeHint() const;
324 KDGanttViewItem* getItemByName( const QString& name ) const;
325 KDGanttViewItem* getItemByUid( const QString& name, KDGanttViewItem* parentItem = 0 ) const;
326 QDateTime getDateTimeForCoordX(int coordX, bool global = true ) const;
327 KDGanttViewItem* getItemByListViewPos( const QPoint& pos ) const;
328 KDGanttViewItem* getItemByGanttViewPos( const QPoint& pos ) const;
329 KDGanttViewItem* getItemAt( const QPoint& pos , bool global = true ) const;
331 // setting the vertical scrollbars of the listview and the timetable
332 // default values: always off for the listview, always on for the timetable
333 void setLvVScrollBarMode( QScrollView::ScrollBarMode );
334 void setGvVScrollBarMode( QScrollView::ScrollBarMode );
337 void setGermanDateTimeFormat();
338 void setTimeHeaderTooltipDateTimeFormat( const QString& fmt );
339 QString timeHeaderTooltipDateTimeFormat() const;
341 void setTimeHeaderDateFormatMonth( const QString& fmt );
342 QString timeHeaderDateFormatMonth() const;
343 void setTimeHeaderDateFormatWeek( const QString& fmt );
344 QString timeHeaderDateFormatWeek() const;
345 void setTimeHeaderDateFormatDay( const QString& fmt );
346 QString timeHeaderDateFormatDay() const;
347 void setTimeHeaderDatetimeFormatHour( const QString& fmt );
348 QString timeHeaderDatetimeFormatHour() const;
349 void setTimeHeaderDatetimeFormatMinute( const QString& fmt );
350 QString timeHeaderDatetimeFormatMinute() const;
351 void setTimeHeaderDatetimeFormatSecond( const QString& fmt );
352 QString timeHeaderDatetimeFormatSecond() const;
353 void setWeekStartsMonday( bool b );
354 bool weekStartsMonday() const;
355 void setWeekScaleShowNumber( bool b );
356 bool weekScaleShowNumber() const;
357 QHeader * listViewHeader () const;
358 int getWeekOfYear( const QDate& date );
359 void setListViewColumnWidth ( int column, int w );
360 void setAddTickcountForTimeline( int );
361 int addTickcountForTimeline() const;
363 QDate yesterday() const;
364 QDate today() const;
365 QDate tomorrow() const;
366 QDate currentWeek() const;
367 QDate lastWeek() const;
368 QDate currentMonth() const;
369 QDate lastMonth() const;
370 QDate currentYear() const;
371 QDate lastYear() const;
373 virtual KDGanttViewItem* createNewItem( QString KDGanttViewItemTypeAsString,
374 KDGanttViewItem* parent = 0,
375 KDGanttViewItem* after = 0,
376 const QString& lvtext = QString(),
377 const QString& name = QString() );
378 virtual KDGanttViewItem* createUserDefinedItem( QString KDGanttViewItemTypeAsString,
379 KDGanttViewItem* parent = 0,
380 KDGanttViewItem* after = 0,
381 const QString& lvtext = QString(),
382 const QString& name = QString() );
384 void setConnectorEnabled( int connector, bool state );
385 bool isConnectorEnabled( int connector ) const;
386 void setAllConnectorsEnabled( bool state );
387 void setAutoScrollEnabled( bool state );
389 KDTimeTableWidget * timeTableWidget() { return myTimeTable; }
390 KDTimeHeaderWidget * timeHeaderWidget() { return myTimeHeader; }
392 void setFixedHorizon( bool f ) { mFixedHorizon = f; }
394 public slots:
395 void editItem( KDGanttViewItem* );
396 void zoomToSelection( const QDateTime& start, const QDateTime& end);
397 void zoomToSelectionAndSetStartEnd( const QDateTime& start, const QDateTime& end);
398 void zoomToFit();
399 void setShowLegend( bool show );
400 void setShowListView( bool show );
401 void setListViewWidth( int );
402 void setEditable( bool editable );
403 void center( KDGanttViewItem* );
404 void centerTimeline( const QDateTime& center );
405 void setTimelineToStart();
406 void setTimelineToEnd();
407 void setShowTaskLinks( bool show );
408 void setScale( Scale );
409 void setScaleSilent( Scale );
410 void setAllOpen();
411 void setAllClose();
413 void gotoToday();
414 void gotoYesterday();
415 void gotoCurrentWeek();
416 void gotoLastWeek();
417 void gotoCurrentMonth();
418 void gotoLastMonth();
419 void gotoCurrentYear();
420 void gotoLastYear();
422 void selectToday();
423 void selectYesterday();
424 void selectCurrentWeek();
425 void selectLastWeek();
426 void selectCurrentMonth();
427 void selectLastMonth();
428 void selectCurrentYear();
429 void selectLastYear();
431 void print();
433 signals:
434 void itemDeleted( KDGanttViewItem* );
435 void timeIntervallSelected( const QDateTime& start, const QDateTime& end);
436 void timeIntervalSelected( const QDateTime& start, const QDateTime& end);
437 void rescaling( KDGanttView::Scale );
438 void intervalColorRectangleMoved( const QDateTime& start, const QDateTime& end );
440 // the following signals are emitted if an item is clicked in the
441 // listview (inclusive) or in the ganttview
442 void itemLeftClicked( KDGanttViewItem* );
443 void itemMidClicked( KDGanttViewItem* );
444 void itemRightClicked( KDGanttViewItem* );
445 void itemDoubleClicked( KDGanttViewItem* );
447 // the following signals are emitted if an item is clicked in the
448 // listview (exlusive) or in the ganttview
449 // gv... means item in ganttview clicked
451 void gvCurrentChanged( KDGanttViewItem* );
452 void gvItemLeftClicked( KDGanttViewItem* );
453 void gvItemMidClicked( KDGanttViewItem* );
454 void gvItemRightClicked( KDGanttViewItem* );
455 // the point is the global position!!
456 void gvMouseButtonClicked ( int button, KDGanttViewItem* item, const QPoint & pos);
457 void gvMouseButtonPressed ( int button, KDGanttViewItem* item, const QPoint & pos);
458 void gvMouseButtonReleased ( int button, KDGanttViewItem* item, const QPoint & pos);
459 void gvMouseMove ( int button, KDGanttViewItem* item, const QPoint & pos);
460 void gvItemDoubleClicked( KDGanttViewItem* );
461 // the point is the global position!!
462 void gvContextMenuRequested ( KDGanttViewItem * item, const QPoint & pos );
463 void gvItemMoved( KDGanttViewItem* );
465 void gvCreateTaskLink( KDGanttViewItem*, int, KDGanttViewItem*, int );
467 // lv... means item in listview clicked
468 void lvCurrentChanged( KDGanttViewItem* );
469 void lvItemRenamed( KDGanttViewItem* , int col, const QString & text );
470 void lvMouseButtonPressed( int button, KDGanttViewItem * item, const QPoint & pos, int c );
471 void lvItemLeftClicked( KDGanttViewItem* );
472 void lvItemMidClicked( KDGanttViewItem* );
473 void lvItemRightClicked( KDGanttViewItem* );
474 void lvContextMenuRequested ( KDGanttViewItem * item, const QPoint & pos, int col );
475 void lvMouseButtonClicked ( int button, KDGanttViewItem* item, const QPoint & pos, int c );
476 void lvItemDoubleClicked( KDGanttViewItem* );
477 void lvSelectionChanged( KDGanttViewItem* );
479 void itemConfigured( KDGanttViewItem* );
480 void itemChanged( KDGanttViewItem* );
481 void itemExpanded ( KDGanttViewItem * item );
482 void itemCollapsed ( KDGanttViewItem * item );
484 void taskLinkLeftClicked( KDGanttViewTaskLink* );
485 void taskLinkMidClicked( KDGanttViewTaskLink* );
486 void taskLinkRightClicked( KDGanttViewTaskLink* );
487 void taskLinkDoubleClicked( KDGanttViewTaskLink* );
489 void dropped ( QDropEvent * e, KDGanttViewItem* droppedItem, KDGanttViewItem* itemBelowMouse);
490 void dateTimeDoubleClicked ( const QDateTime& );
491 void addOneTickRight();
492 void addOneTickLeft();
494 protected:
495 // virtual protected methods
496 virtual QDragObject * dragObject ();
497 virtual void startDrag ();
498 virtual void userReadFromElement( QDomElement& element );
499 virtual void userWriteToElement( QDomDocument& doc,
500 QDomElement& parentElement ) const ;
501 virtual void showEvent ( QShowEvent * event );
502 virtual void closeEvent ( QCloseEvent * event );
504 private slots:
505 void updateGanttContent();
506 void forceRepaint( int val = 0 );
507 void vScrollBarAction( int action );
508 void hScrollBarAction( int action );
510 #if QT_VERSION < 0x040000
511 void slotSelectionChanged( QListViewItem* item );
512 void slotCurrentChanged ( QListViewItem * item );
513 void slotItemRenamed ( QListViewItem * item, int col, const QString & text );
514 void slotMouseButtonPressed ( int button, QListViewItem * item, const QPoint & pos, int c );
515 void slotmouseButtonClicked ( int button, QListViewItem * item, const QPoint & pos, int c );
516 void slotcontextMenuRequested ( QListViewItem * item, const QPoint & pos, int col );
517 void slotItemExpanded ( QListViewItem * item );
518 void slotItemCollapsed ( QListViewItem * item );
519 #else
520 void slotSelectionChanged( Q3ListViewItem* item );
521 void slotCurrentChanged ( Q3ListViewItem * item );
522 void slotItemRenamed ( Q3ListViewItem * item, int col, const QString & text );
523 void slotMouseButtonPressed ( int button, Q3ListViewItem * item, const QPoint & pos, int c );
524 void slotmouseButtonClicked ( int button, Q3ListViewItem * item, const QPoint & pos, int c );
525 void slotcontextMenuRequested ( Q3ListViewItem * item, const QPoint & pos, int col );
526 void slotItemExpanded ( Q3ListViewItem * item );
527 void slotItemCollapsed ( Q3ListViewItem * item );
528 #endif
529 void slotHeaderSizeChanged();
530 void addTickRight();
531 void addTickLeft();
532 void enableAdding( int );
533 void slot_lvDropped(QDropEvent* e, KDGanttViewItem* droppedItem, KDGanttViewItem* itemBelowMouse );
534 private:
535 struct legendItem {
536 KDGanttViewItem::Shape shape;
537 QColor color;
538 QString text;
539 KDGanttViewItem::Shape shape2;
540 QColor color2;
541 QString text2;
542 bool has2;
544 bool loadXML( const QDomDocument& doc );
545 QDomDocument saveXML( bool withPI = true ) const;
547 void emptySpaceDoubleClicked( QMouseEvent* e );
549 static QString scaleToString( Scale scale );
550 static QString yearFormatToString( YearFormat format );
551 static QString hourFormatToString( HourFormat format );
552 static Scale stringToScale( const QString& string );
553 static YearFormat stringToYearFormat( const QString& string );
554 static HourFormat stringToHourFormat( const QString& string );
556 friend class KDGanttCanvasView;
557 friend class KDGanttViewEventItem;
558 friend class KDGanttViewItem;
559 friend class KDGanttViewTaskItem;
560 friend class KDGanttViewSummaryItem;
561 friend class KDGanttViewTaskLink;
562 friend class KDGanttViewCalendarItem;
563 friend class KDTimeTableWidget;
564 friend class KDTimeHeaderWidget;
565 friend class KDListView;
566 friend class KDGanttViewTaskLinkGroup;
567 friend class KDLegendWidget;
569 KDListView * myListView;
570 KDGanttCanvasView *myCanvasView;
571 KDTimeHeaderWidget * myTimeHeader;
572 KDTimeTableWidget * myTimeTable;
573 KDLegendWidget * myLegend;
574 #if QT_VERSION < 0x040000
575 itemAttributeDialog* myItemAttributeDialog;
576 #endif
577 QVBox * leftWidget, * rightWidget;
578 QWidget * spacerLeft;
579 QHBoxLayout * spacerLeftLayout;
580 QScrollView* myTimeHeaderScroll;
581 QHBox* myTimeHeaderContainer ;
582 QWidget* timeHeaderSpacerWidget;
583 QWidget *spacerRight;
585 bool listViewIsVisible;
586 bool chartIsEditable;
587 bool editorIsEnabled;
588 bool _displaySubitemsAsGroup;
589 bool _displayEmptyTasksAsLine;
590 bool _showLegendButton;
591 bool _showHeader;
592 bool _enableAdding;
593 bool fCenterTimeLineAfterShow;
594 bool fDragEnabled;
595 bool fDropEnabled;
596 bool closingBlocked;
597 bool mUserHorizonChangeEnabled;
598 QDateTime dtCenterTimeLineAfterShow;
599 KDGanttViewItem::Shape myDefaultShape [9];
600 QColor myColor[9],myColorHL[9];
601 bool undefinedShape[3],undefinedColor[3],undefinedColorHL[3];
602 QColor myTextColor;
603 QColor myDefaultColor[3],myDefaultColorHL[3];
604 QPtrList<KDGanttViewTaskLinkGroup> myTaskLinkGroupList;
605 QPtrList<legendItem> myLegendItems;
606 void addTaskLinkGroup(KDGanttViewTaskLinkGroup*);
607 void removeTaskLinkGroup(KDGanttViewTaskLinkGroup*);
608 int getIndex( KDGanttViewItem::Type ) const;
609 void itemAboutToBeDeleted( KDGanttViewItem * );
610 void initDefaults();
611 KDGanttViewItem* myCurrentItem;
612 KDGanttMinimizeSplitter *mySplitter;
613 int mAddTickcountForTimeline;
614 RepaintMode mRepaintMode;
615 bool mFixedHorizon;
620 #endif