KDGanttViewSubwidgets.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 00036 #ifndef KDGANTTVIEWSUBWIDGETS_H 00037 #define KDGANTTVIEWSUBWIDGETS_H 00038 00039 00040 #include <tqwidget.h> 00041 #include <tqlistview.h> 00042 #include <tqsplitter.h> 00043 #include <tqevent.h> 00044 #include <tqvaluelist.h> 00045 #include <tqcanvas.h> 00046 #include <tqwhatsthis.h> 00047 #include <tqpopupmenu.h> 00048 #include <tqtooltip.h> 00049 #include <tqtimer.h> 00050 #include <tqgroupbox.h> 00051 #include <tqvgroupbox.h> 00052 #include <tqlayout.h> 00053 #include <tqlabel.h> 00054 #include <tqbrush.h> 00055 #include <tqvbox.h> 00056 #include <tqdockwindow.h> 00057 #include <tqtimer.h> 00058 00059 #include "KDGanttView.h" 00060 #include "KDGanttViewTaskLink.h" 00061 #include "KDGanttViewTaskLinkGroup.h" 00062 #include "KDGanttViewSummaryItem.h" 00063 #include "KDGanttSemiSizingControl.h" 00064 #include "KDGanttViewItemDrag.h" 00065 00066 #define Type_is_KDGanttGridItem 1 00067 #define Type_is_KDGanttViewItem 2 00068 #define Type_is_KDGanttTaskLink 3 00069 00070 class KDIntervalColorRectangle; 00071 class KDCanvasWhatsThis; 00072 class KDToolTip; 00073 class KDCanvasRectangle; 00074 class KDTimeHeaderToolTip; 00075 00076 class KDTimeHeaderWidget : public TQWidget 00077 { 00078 Q_OBJECT 00079 TQ_OBJECT 00080 00081 public: 00082 typedef KDGanttView::Scale Scale; 00083 typedef KDGanttView::YearFormat YearFormat; 00084 typedef KDGanttView::HourFormat HourFormat; 00085 struct DateTimeColor { 00086 TQDateTime datetime; 00087 TQDateTime end; 00088 TQColor color; 00089 Scale minScaleView; 00090 Scale maxScaleView; 00091 //KDCanvasLine* canvasLine; 00092 KDCanvasRectangle* canvasRect; 00093 }; 00094 typedef TQValueList<DateTimeColor> ColumnColorList; 00095 typedef TQValueList<KDIntervalColorRectangle *> IntervalColorList; 00096 /* 00097 enum Scale { Minute, Hour, Day, Week, Month, Auto }; 00098 enum YearFormat { FourDigit, TwoDigit, TwoDigitApostrophe }; 00099 enum HourFormat { Hour_24, Hour_12 }; 00100 */ 00101 00102 KDTimeHeaderWidget (TQWidget* parent,KDGanttView* gant); 00103 ~KDTimeHeaderWidget(); 00104 00105 TQString getToolTipText(TQPoint p); 00106 void zoomToFit(); 00107 void zoom(double, bool absolute = true); 00108 void zoomToSelection( TQDateTime startTime, TQDateTime endTime); 00109 double zoomFactor(); 00110 void setAutoScaleMinorTickCount( int count ); 00111 int autoScaleMinorTickCount(); 00112 void setHorizonStart( const TQDateTime& start ); 00113 TQDateTime horizonStart() const; 00114 void setHorizonEnd( const TQDateTime& start ); 00115 TQDateTime horizonEnd() const; 00116 00117 void setMaximumScale( Scale ); 00118 KDTimeHeaderWidget::Scale maximumScale() const; 00119 void setMinimumScale( Scale ); 00120 KDTimeHeaderWidget::Scale minimumScale() const; 00121 KDTimeHeaderWidget::Scale scale() const; 00122 void setMajorScaleCount( int count ); 00123 int majorScaleCount() const; 00124 void setMinorScaleCount( int count ); 00125 int minorScaleCount() const; 00126 void setMinimumColumnWidth( int width ); 00127 int minimumColumnWidth() const; 00128 void setYearFormat( YearFormat format ); 00129 KDTimeHeaderWidget::YearFormat yearFormat() const; 00130 void setHourFormat( HourFormat format ); 00131 KDTimeHeaderWidget::HourFormat hourFormat() const; 00132 void setShowMajorTicks( bool ); 00133 bool showMajorTicks() const; 00134 void setShowMinorTicks( bool ); 00135 void setScale( Scale unit); 00136 bool showMinorTicks() const; 00137 void setColumnBackgroundColor( const TQDateTime& column, 00138 const TQColor& color, 00139 Scale mini = KDGanttView::Minute , 00140 Scale maxi = KDGanttView::Month); 00141 #if 0 00142 // This API has been replaced with KDIntervalColorRectangle and addIntervalBackgroundColor 00143 void setIntervalBackgroundColor( const TQDateTime& start, 00144 const TQDateTime& end, 00145 const TQColor& color, 00146 Scale mini = KDGanttView::Minute , 00147 Scale maxi = KDGanttView::Month); 00148 bool changeBackgroundInterval( const TQDateTime& oldstart, 00149 const TQDateTime& oldend, 00150 const TQDateTime& newstart, 00151 const TQDateTime& newend ); 00152 bool deleteBackgroundInterval( const TQDateTime& start, 00153 const TQDateTime& end ); 00154 #endif 00155 void addIntervalBackgroundColor( KDIntervalColorRectangle* newItem ); 00156 void clearBackgroundColor(); 00157 TQColor columnBackgroundColor( const TQDateTime& column ) const; 00158 void setWeekendBackgroundColor( const TQColor& color ); 00159 TQColor weekendBackgroundColor() const; 00160 void setWeekdayBackgroundColor( const TQColor& color, int weekday ); 00161 TQColor weekdayBackgroundColor(int weekday) const; 00162 void setWeekendDays( int start, int end ); 00163 void weekendDays( int& start, int& end ) const; 00164 void computeTicks(bool doNotComputeRealScale = false); 00165 void paintEvent(TQPaintEvent *); 00166 int getCoordX(TQDate); 00167 int getCoordX(TQDateTime); 00168 TQDateTime getDateTimeForIndex(int coordX, bool local = true ); 00169 void setShowPopupMenu( bool show, bool showZoom, bool showScale,bool showTime, 00170 bool showYear,bool showGrid, bool showPrint); 00171 bool registerStartTime(); 00172 bool registerEndTime(); 00173 bool showPopupMenu() const; 00174 ColumnColorList columnBackgroundColorList() const { 00175 return ccList; 00176 } 00177 TQColor weekdayColor[8]; 00178 void repaintMe(int left, int wid, TQPainter *p = 0); 00179 00180 void centerDateTime( const TQDateTime& center ); 00181 00182 public slots: 00183 void setSettings(int); 00184 void checkWidth( int ); 00185 void addTickRight( int num = 1 ); 00186 void addTickLeft( int num = 1 ); 00187 void preparePopupMenu(); 00188 signals: 00189 void sizeChanged( int ); 00190 00191 private: 00192 friend class KDTimeTableWidget; 00193 friend class KDGanttViewItem; 00194 friend class KDGanttView; 00195 friend class KDGanttCanvasView; // calls computeIntervals 00196 virtual void mousePressEvent ( TQMouseEvent * e ); 00197 virtual void mouseReleaseEvent ( TQMouseEvent * e ); 00198 virtual void mouseDoubleClickEvent ( TQMouseEvent * e ); 00199 virtual void mouseMoveEvent ( TQMouseEvent * e ); 00200 double secsFromTo( TQDateTime begin, TQDateTime end ); 00201 void updateTimeTable(); 00202 void computeIntervals( int height ); 00203 bool getColumnColor(TQColor& col,int coordLow, int coordHigh); 00204 void moveTimeLineTo(int x); 00205 //void mousePressEvent ( TQMouseEvent * ) ; 00206 void resizeEvent ( TQResizeEvent * ) ; 00207 TQValueList<int> majorTicks; 00208 TQValueList<TQString> minorText; 00209 TQValueList<TQString> majorText; 00210 TQDateTime myHorizonStart, myHorizonEnd, myRealEnd,myRealStart; 00211 TQDateTime myCenterDateTime; 00212 void saveCenterDateTime(); 00213 Scale myScale,myRealScale,myMaxScale,myMinScale; 00214 YearFormat myYearFormat; 00215 HourFormat myHourFormat; 00216 int myMinimumColumWidth; 00217 bool flagShowMajorTicks, flagShowMinorTicks, flagShowPopupMenu; 00218 bool flagShowZoom, flagShowScale ,flagShowTime ,flagShowYear; 00219 bool flagShowGrid ,flagShowPrint; 00220 bool flagStartTimeSet,flagEndTimeSet; 00221 TQColor myWeekendBackgroundColor; 00222 int myWeekendDaysStart, myWeekendDaysEnd; 00223 ColumnColorList ccList; 00224 IntervalColorList icList; 00225 int myMinorScaleCount,myMajorScaleCount; 00226 int myRealMinorScaleCount,myRealMajorScaleCount; 00227 bool flagDoNotRecomputeAfterChange,flagDoNotRepaintAfterChange; 00228 TQString getYear(TQDate); 00229 TQString getHour(TQTime); 00230 TQDateTime getEvenTimeDate(TQDateTime ,Scale); 00231 void computeRealScale(TQDateTime start); 00232 int myGridMinorWidth; 00233 int myMajorGridHeight; 00234 TQPopupMenu * myPopupMenu, *scalePopupMenu, *timePopupMenu; 00235 TQPopupMenu * yearPopupMenu, *gridPopupMenu; 00236 KDGanttView* myGanttView; 00237 double myZoomFactor; 00238 int myAutoScaleMinorTickcount; 00239 bool flagZoomToFit; 00240 int mySizeHint; 00241 int myMinimumWidth; 00242 int getTickTime(); 00243 KDTimeHeaderToolTip* myToolTip; 00244 bool mouseDown; 00245 int beginMouseDown; 00246 int endMouseDown; 00247 bool autoComputeTimeLine; 00248 TQPixmap paintPix; 00249 }; 00250 00251 /* KDTimeTableWidget */ 00252 class KDListView ; 00253 00254 class KDTimeTableWidget : public TQCanvas 00255 { 00256 Q_OBJECT 00257 TQ_OBJECT 00258 00259 public: 00260 KDTimeTableWidget (TQWidget* parent,KDGanttView* my); 00261 00262 void setBlockUpdating( bool block = true ); 00263 bool blockUpdating(); 00264 void inc_blockUpdating(); 00265 void dec_blockUpdating(); 00266 void setShowTaskLinks( bool show ); 00267 bool showTaskLinks(); 00268 TQPtrList<KDGanttViewTaskLink>taskLinks(); 00269 void clearTaskLinks(); 00270 void updateMyContent(); 00271 void removeItemFromTasklinks( KDGanttViewItem * ); 00272 void setHorBackgroundLines( int count, TQBrush brush ); 00273 int horBackgroundLines( TQBrush& brush ); 00274 00275 void setNoInformationBrush( const TQBrush& brush ); 00276 TQBrush noInformationBrush() const; 00277 00278 int getCoordX( TQDateTime dt ); 00279 00280 signals: 00281 void heightComputed( int ); 00282 00283 public slots: 00284 void expandItem(TQListViewItem * ); 00285 void collapseItem(TQListViewItem * ); 00286 void highlightItem(TQListViewItem * ); 00287 void resetWidth( int ); 00288 void checkHeight( int ); 00289 private: 00290 friend class KDGanttViewTaskLink; 00291 friend class KDTimeHeaderWidget; 00292 friend class KDGanttView; 00293 friend class KDGanttViewTaskItem; 00294 KDGanttView* myGanttView; 00295 00296 bool taskLinksVisible; 00297 00298 TQPtrList<KDGanttViewTaskLink> myTaskLinkList; 00299 00300 TQPtrList<KDCanvasLine> verGridList; 00301 TQPtrList<KDCanvasLine> horGridList; 00302 TQPtrList<KDCanvasRectangle> horDenseList; 00303 TQPtrList<KDCanvasRectangle> showNoInfoList; 00304 int denseLineCount; 00305 TQBrush denseLineBrush, noInfoLineBrush; 00306 TQPtrList<KDCanvasRectangle> columnColorList; 00307 00308 int computeHeight(); 00309 void computeVerticalGrid(); 00310 void computeHorizontalGrid(); 00311 void computeDenseLines(); 00312 void computeShowNoInformation(); 00313 void computeTaskLinks(); 00314 void computeMinorGrid(); 00315 void computeMajorGrid(); 00316 00317 void showMajorGrid(); 00318 void showMinorGrid(); 00319 void hideGrid(); 00320 00321 TQPen gridPen; 00322 int maximumComputedGridHeight; 00323 int minimumHeight; 00324 int int_blockUpdating; 00325 bool flag_blockUpdating; 00326 int pendingHeight; 00327 int pendingWidth; 00328 00329 }; 00330 00331 class KDLegendWidget : public KDGanttSemiSizingControl 00332 { 00333 Q_OBJECT 00334 TQ_OBJECT 00335 00336 public: 00337 KDLegendWidget ( TQWidget* parent, KDGanttMinimizeSplitter* legendParent ); 00338 void showMe(bool); 00339 bool isShown(); 00340 void addLegendItem( KDGanttViewItem::Shape shape, const TQColor& shapeColor, const TQString& text ); 00341 void clearLegend(); 00342 void setFont( TQFont ); 00343 void drawToPainter( TQPainter *p ); 00344 void setAsDockwindow( bool dockwin ); 00345 bool asDockwindow(); 00346 TQDockWindow* dockwindow(); 00347 TQSize legendSize(); 00348 TQSize legendSizeHint(); 00349 private: 00350 TQGroupBox * myLegend; 00351 TQLabel* myLabel; 00352 TQScrollView * scroll; 00353 TQDockWindow* dock; 00354 KDGanttMinimizeSplitter* myLegendParent; 00355 }; 00356 00357 class KDGanttView; 00358 class KDListView : public TQListView 00359 { 00360 Q_OBJECT 00361 TQ_OBJECT 00362 00363 public: 00364 KDListView (TQWidget* parent,KDGanttView* gv ); 00365 KDGanttView* myGanttView; 00366 void drawToPainter( TQPainter *p, bool drawHeader=false ); 00367 void setCalendarMode( bool mode ); 00368 bool calendarMode() { return _calendarMode; }; 00369 TQString getWhatsThisText(TQPoint p); 00370 void setOpen ( TQListViewItem * item, bool open ); 00371 void dragEnterEvent ( TQDragEnterEvent * ); 00372 void dragMoveEvent ( TQDragMoveEvent * ); 00373 void dragLeaveEvent ( TQDragLeaveEvent * ); 00374 void dropEvent ( TQDropEvent * ); 00375 TQDragObject * dragObject (); 00376 void startDrag (); 00377 void paintemptyarea ( TQPainter * p, const TQRect & rect ){ TQListView::paintEmptyArea( p, rect );}; 00378 00379 public: 00380 class DrawableItem { 00381 public: 00382 DrawableItem(int level, int ypos, TQListViewItem *item ) { y = ypos; l = level; i = item; }; 00383 int y; 00384 int l; 00385 TQListViewItem * i; 00386 }; 00387 protected: 00388 void drawAllContents(TQPainter * p, int cx, int cy, int cw, int ch); 00389 int buildDrawables(TQPtrList<KDListView::DrawableItem> &lst, int level, int ypos, TQListViewItem *item, int ymin, int ymax) const; 00390 00391 private slots: 00392 void dragItem( TQListViewItem * ); 00393 private: 00394 void resizeEvent ( TQResizeEvent * ) ; 00395 void contentsMouseDoubleClickEvent ( TQMouseEvent * e ); 00396 bool _calendarMode; 00397 00398 00399 00400 }; 00401 00402 00403 class KDCanvasText : public TQCanvasText 00404 { 00405 public: 00406 KDCanvasText( KDTimeTableWidget* canvas, void* parentItem, int type ); 00407 int myParentType; 00408 void* myParentItem; 00409 }; 00410 00411 00412 class KDCanvasLine : public TQCanvasLine 00413 { 00414 public: 00415 KDCanvasLine( KDTimeTableWidget* canvas, void* parentItem, int type ); 00416 int myParentType; 00417 void* myParentItem; 00418 }; 00419 00420 00421 class KDCanvasPolygonItem: public TQCanvasPolygonalItem 00422 { 00423 public: 00424 KDCanvasPolygonItem( KDTimeTableWidget* canvas, void* parentItem, 00425 int type ); 00426 int myParentType; 00427 void* myParentItem; 00428 }; 00429 00430 00431 class KDCanvasPolygon: public TQCanvasPolygon 00432 { 00433 public: 00434 KDCanvasPolygon( KDTimeTableWidget* canvas, void* parentItem, int type ); 00435 int myParentType; 00436 void* myParentItem; 00437 }; 00438 00439 00440 class KDCanvasEllipse: public TQCanvasEllipse 00441 { 00442 public: 00443 KDCanvasEllipse( KDTimeTableWidget* canvas, void* parentItem, int type ); 00444 int myParentType; 00445 void* myParentItem; 00446 }; 00447 00448 00449 class KDCanvasRectangle: public TQCanvasRectangle 00450 { 00451 public: 00452 KDCanvasRectangle( KDTimeTableWidget* canvas, void* parentItem, int type ); 00453 int myParentType; 00454 void* myParentItem; 00455 }; 00456 00457 00458 // Interval-color-rectangle, such as the one used in the freebusy view for the current event 00459 class KDIntervalColorRectangle: public KDCanvasRectangle 00460 { 00461 public: 00462 KDIntervalColorRectangle( KDGanttView* view ); 00463 00464 void setDateTimes( const TQDateTime& start, 00465 const TQDateTime& end ); 00466 TQDateTime start() const { return mStart; } 00467 TQDateTime end() const { return mEnd; } 00468 00469 void setColor( const TQColor& color ); 00470 00471 enum HitTest { Start, Middle, End }; 00472 HitTest hitTest( KDTimeHeaderWidget* timeHeader, const TQPoint& pos ) const; 00473 00474 void layout( KDTimeHeaderWidget* timeHeader, int height ); 00475 00476 static const int RTTI = 0x0c58; 00477 /*reimp*/ int rtti() const { return RTTI; } 00478 00479 private: 00480 TQColor mColor; 00481 TQDateTime mStart; 00482 TQDateTime mEnd; 00483 }; 00484 00485 class KDCanvasToolTip; 00486 00487 class KDGanttCanvasView : public TQCanvasView 00488 { 00489 Q_OBJECT 00490 TQ_OBJECT 00491 00492 public: 00493 KDGanttCanvasView(KDGanttView* sender, TQCanvas* canvas = 0, TQWidget* parent = 0, const char* name = 0 ); 00494 ~KDGanttCanvasView(); 00495 TQString getToolTipText(TQPoint p); 00496 TQString getWhatsThisText(TQPoint p); 00497 void drawToPainter ( TQPainter * p ); 00498 void resetCutPaste( KDGanttViewItem* ); 00499 void setShowPopupMenu( bool show ); 00500 bool showPopupMenu(); 00501 void cutItem ( KDGanttViewItem* ); 00502 void insertItemAsRoot( KDGanttViewItem* ); 00503 void insertItemAsChild( KDGanttViewItem* , KDGanttViewItem* ); 00504 void insertItemAfter( KDGanttViewItem* , KDGanttViewItem* ); 00505 protected: 00506 friend class KDGanttView; 00507 friend class KDListView; 00508 virtual void contentsMousePressEvent ( TQMouseEvent * ) ; 00509 virtual void contentsMouseReleaseEvent ( TQMouseEvent * ); 00510 virtual void contentsMouseDoubleClickEvent ( TQMouseEvent * ); 00511 virtual void contentsMouseMoveEvent ( TQMouseEvent * ) ; 00512 virtual void viewportPaintEvent ( TQPaintEvent * pe ); 00513 void resizeEvent ( TQResizeEvent * ) ; 00514 void set_MouseTracking(bool on); 00515 int getType(TQCanvasItem*); 00516 KDGanttViewItem* getItem(TQCanvasItem*); 00517 KDGanttViewTaskLink* getLink(TQCanvasItem*); 00518 int getItemArea(KDGanttViewItem *item, int x); 00519 int getLinkType(int from, int to); 00520 00521 KDGanttView* mySignalSender; 00522 KDGanttViewItem* currentItem, *lastClickedItem, *cuttedItem; 00523 TQCanvasRectangle* movingItem; 00524 KDGanttViewTaskItem* movingGVItem; 00525 TQPoint movingStart; 00526 TQDateTime movingStartDate; 00527 enum MovingOperation { Moving, ResizingLeft, ResizingRight }; 00528 MovingOperation movingOperation; 00529 KDGanttViewTaskLink* currentLink; 00530 KDCanvasWhatsThis* myWhatsThis; 00531 TQPopupMenu* onItem; 00532 bool _showItemAddPopupMenu; 00533 int myMyContentsHeight; 00534 KDGanttViewItem *fromItem; 00535 bool linkItemsEnabled; 00536 TQCanvasLine *linkLine; 00537 int fromArea; 00538 bool autoScrollEnabled; 00539 bool mouseDown; 00540 00541 signals: 00542 void heightResized( int ); 00543 void widthResized( int ); 00544 00545 public slots: 00546 void set_Mouse_Tracking(bool on); 00547 void moveMyContent( int, int ); 00548 void setMyContentsHeight( int ); 00549 void updateHorScrollBar(); 00550 private slots: 00551 void cutItem(); 00552 void pasteItem( int ); 00553 void newRootItem( int ); 00554 void newChildItem( int ); 00555 void slotScrollTimer(); 00556 void myUpdateScrollBars(); 00557 00558 private: 00559 MovingOperation gvItemHitTest( KDGanttViewItem *item, KDTimeHeaderWidget* timeHeader, const TQPoint &pos ); 00560 private: 00561 KDCanvasToolTip* myToolTip; 00562 TQTimer *myScrollTimer; 00563 TQPoint mousePos; 00564 TQTimer scrollBarTimer; 00565 }; 00566 00567 class KDTimeHeaderToolTip :public TQToolTip 00568 { 00569 00570 public: 00571 KDTimeHeaderToolTip( TQWidget *wid, KDTimeHeaderWidget* header ) : TQToolTip( wid ), _wid(wid),_header (header) { 00572 00573 }; 00574 00575 protected: 00576 virtual void maybeTip( const TQPoint& p) 00577 { 00578 static bool ishidden = true; 00579 if (TQToolTip::isGloballyEnabled () ) { 00580 if (ishidden) { 00581 tip( TQRect( p.x(),p.y(),5,5), _header->getToolTipText(p)); 00582 } 00583 else 00584 hide(); 00585 ishidden = !ishidden; 00586 } 00587 } 00588 private: 00589 TQWidget* _wid; 00590 KDTimeHeaderWidget * _header; 00591 }; 00592 00593 class KDCanvasToolTip :public TQToolTip 00594 { 00595 00596 public: 00597 KDCanvasToolTip( TQWidget *wid, KDGanttCanvasView* canview ) : TQToolTip( wid ), _wid(wid),_canview (canview) { 00598 00599 }; 00600 00601 protected: 00602 virtual void maybeTip( const TQPoint& p) 00603 { 00604 static bool ishidden = true; 00605 if (TQToolTip::isGloballyEnabled () ) { 00606 if (ishidden) { 00607 tip( TQRect( p.x()-2,p.y()-2,5,5), _canview->getToolTipText(p)); 00608 } 00609 else 00610 hide(); 00611 ishidden = !ishidden; 00612 } 00613 } 00614 private: 00615 TQWidget* _wid; 00616 KDGanttCanvasView * _canview; 00617 }; 00618 00619 class KDCanvasWhatsThis :public TQWhatsThis 00620 { 00621 public: 00622 KDCanvasWhatsThis( TQWidget *wid, KDGanttCanvasView* canview ) : TQWhatsThis( wid ), _wid(wid),_canview (canview) { }; 00623 00624 protected: 00625 virtual TQString text( const TQPoint& p) 00626 { 00627 return _canview->getWhatsThisText(p) ; 00628 } 00629 private: 00630 TQWidget* _wid; 00631 KDGanttCanvasView * _canview; 00632 }; 00633 00634 class KDListViewWhatsThis :public TQWhatsThis 00635 { 00636 public: 00637 KDListViewWhatsThis( TQWidget *wid, KDListView* view ) : TQWhatsThis( wid ), _wid(wid),_view (view) { }; 00638 00639 protected: 00640 virtual TQString text( const TQPoint& p) 00641 { 00642 return _view->getWhatsThisText(p) ; 00643 } 00644 private: 00645 TQWidget* _wid; 00646 KDListView * _view; 00647 }; 00648 00649 00650 00651 #endif