kdgantt
KDGanttMinimizeSplitter.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef KDGANTTMINIMIZESPLITTER_H
00035 #define KDGANTTMINIMIZESPLITTER_H
00036
00037 #include "tqframe.h"
00038 #include "tqvaluelist.h"
00039
00040 class TQSplitterData;
00041 class TQSplitterLayoutStruct;
00042
00043 class KDGanttMinimizeSplitter : public TQFrame
00044 {
00045 Q_OBJECT
00046
00047 TQ_ENUMS( Direction )
00048 TQ_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
00049 TQ_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection )
00050
00051 public:
00052 enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
00053 enum Direction { Left, Right, Up, Down };
00054
00055 KDGanttMinimizeSplitter( TQWidget* parent=0, const char* name=0 );
00056 KDGanttMinimizeSplitter( Qt::Orientation, TQWidget* parent=0, const char* name=0 );
00057 ~KDGanttMinimizeSplitter();
00058
00059 virtual void setOrientation( Qt::Orientation );
00060 Qt::Orientation orientation() const { return orient; }
00061
00062 void setMinimizeDirection( Direction );
00063 Direction minimizeDirection() const;
00064
00065 virtual void setResizeMode( TQWidget *w, ResizeMode );
00066 virtual void setOpaqueResize( bool = TRUE );
00067 bool opaqueResize() const;
00068
00069 void moveToFirst( TQWidget * );
00070 void moveToLast( TQWidget * );
00071
00072 void refresh() { recalc( TRUE ); }
00073 virtual TQSize sizeHint() const;
00074 virtual TQSize minimumSizeHint() const;
00075
00076 TQValueList<int> sizes() const;
00077 void setSizes( TQValueList<int> );
00078
00079 void expandPos( int id, int* min, int* max );
00080 protected:
00081 void childEvent( TQChildEvent * );
00082
00083 bool event( TQEvent * );
00084 void resizeEvent( TQResizeEvent * );
00085
00086 int idAfter( TQWidget* ) const;
00087
00088 void moveSplitter( TQCOORD pos, int id );
00089 virtual void drawSplitter( TQPainter*, TQCOORD x, TQCOORD y,
00090 TQCOORD w, TQCOORD h );
00091 void styleChange( TQStyle& );
00092 int adjustPos( int , int );
00093 virtual void setRubberband( int );
00094 void getRange( int id, int*, int* );
00095
00096 private:
00097 void init();
00098 void recalc( bool update = FALSE );
00099 void doResize();
00100 void storeSizes();
00101 void processChildEvents();
00102 TQSplitterLayoutStruct *addWidget( TQWidget*, bool first = FALSE );
00103 void recalcId();
00104 void moveBefore( int pos, int id, bool upLeft );
00105 void moveAfter( int pos, int id, bool upLeft );
00106 void setG( TQWidget *w, int p, int s, bool isSplitter = FALSE );
00107
00108 TQCOORD pick( const TQPoint &p ) const
00109 { return orient == Qt::Horizontal ? p.x() : p.y(); }
00110 TQCOORD pick( const TQSize &s ) const
00111 { return orient == Qt::Horizontal ? s.width() : s.height(); }
00112
00113 TQCOORD trans( const TQPoint &p ) const
00114 { return orient == Qt::Vertical ? p.x() : p.y(); }
00115 TQCOORD trans( const TQSize &s ) const
00116 { return orient == Qt::Vertical ? s.width() : s.height(); }
00117
00118 TQSplitterData *data;
00119
00120 private:
00121 Qt::Orientation orient;
00122 Direction _direction;
00123 #ifndef DOXYGEN_SKIP_INTERNAL
00124 friend class KDGanttSplitterHandle;
00125 #endif
00126 private:
00127 #if defined(TQ_DISABLE_COPY)
00128 KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & );
00129 KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & );
00130 #endif
00131 };
00132
00133 #ifndef DOXYGEN_SKIP_INTERNAL
00134
00135
00136
00137
00138 class KDGanttSplitterHandle : public TQWidget
00139 {
00140 Q_OBJECT
00141
00142 public:
00143 KDGanttSplitterHandle( Qt::Orientation o,
00144 KDGanttMinimizeSplitter *parent, const char* name=0 );
00145 void setOrientation( Qt::Orientation o );
00146 Qt::Orientation orientation() const { return orient; }
00147
00148 bool opaque() const { return s->opaqueResize(); }
00149
00150 TQSize sizeHint() const;
00151
00152 int id() const { return myId; }
00153 void setId( int i ) { myId = i; }
00154
00155 protected:
00156 TQValueList<TQPointArray> buttonRegions();
00157 void paintEvent( TQPaintEvent * );
00158 void mouseMoveEvent( TQMouseEvent * );
00159 void mousePressEvent( TQMouseEvent * );
00160 void mouseReleaseEvent( TQMouseEvent * );
00161 int onButton( const TQPoint& p );
00162 void updateCursor( const TQPoint& p );
00163
00164 private:
00165 Qt::Orientation orient;
00166 bool opaq;
00167 int myId;
00168
00169 KDGanttMinimizeSplitter *s;
00170 int _activeButton;
00171 bool _collapsed;
00172 int _origPos;
00173 };
00174 #endif
00175
00176 #endif // KDGANTTMINIMIZESPLITTER_H
|