kgantt

xQGanttListViewPort.h

00001 #ifndef _XTQGANTTLISTVIEWPORT_H_
00002 #define _XTQGANTTLISTVIEWPORT_H_
00003 
00004 /*
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 
00021     author  : jh, jochen@ifb.bv.tu-berlin.de
00022 
00023     file    : xQGanttListViewPort.h
00024     date    : 26 oct 2000
00025 
00026 
00027     changelog :
00028 
00029 */
00030 
00031 
00032 
00033 #include "xQGanttBarViewPort.h"
00034 #include "KGanttItem.h"
00035 
00036 
00037 #include <tqcursor.h>
00038 
00039 
00040 
00042 
00046 
00047 class xQGanttListViewPort : public TQFrame
00049 {
00050 
00051   Q_OBJECT
00052   TQ_OBJECT
00053 
00054   friend class xQGanttListView;
00055  
00056 
00057 public:
00058 
00059 
00061 
00064   xQGanttListViewPort(KGanttItem* toplevelitem, TQWidget* parent = 0,
00065              const char * name=0, WFlags f=0 );
00066 
00067 
00068 
00070 
00073   ~xQGanttListViewPort();
00074  
00075 
00076 
00077 public slots:
00078 
00079   void barViewResized();
00080 
00081 
00082 protected:
00083 
00085 
00088   void update(int x1, int y1, int x2, int y2);
00089 
00090 
00092 
00095   void setBarViewPort(xQGanttBarViewPort* v);
00096 
00097 
00098   void drawContents(TQPainter*, int x1, int y1, int x2, int y2);
00099   void drawItem(KGanttItem*, TQPainter* p, const TQRect&, int);
00100 
00101   xQGanttBarViewPort* _barviewport;
00102 
00103   int _width;
00104 
00105   KGanttItem* _toplevelitem;
00106 
00107   void paintEvent(TQPaintEvent * e) {    
00108     // printf("xQGanttListViewPort::paintEvent()\n");
00109     update(e->rect().left(), e->rect().top(),
00110        e->rect().right(), e->rect().bottom() );
00111   }
00112 
00113   TQPopupMenu* _menu;
00114 
00115   void mousePressEvent(TQMouseEvent* e) {
00116 
00117     if(e->button() == Qt::RightButton && e->state() == ControlButton ) {
00118       _menu->popup(e->globalPos());
00119       return;
00120     }
00121     
00122   }
00123 
00124 
00125   TQBrush brush1, brush2;
00126 
00127   static int _ListViewCounter;
00128 
00129 };
00130 
00131 
00132 #endif