Diffstat (limited to 'microkde/KDGanttMinimizeSplitter.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h index 3042e0a..338d965 100644 --- a/microkde/KDGanttMinimizeSplitter.h +++ b/microkde/KDGanttMinimizeSplitter.h | |||
@@ -1,192 +1,199 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3PointArray> | ||
3 | #include <QPaintEvent> | ||
4 | #include <QResizeEvent> | ||
5 | #include <QChildEvent> | ||
6 | #include <QMouseEvent> | ||
7 | #include <QEvent> | ||
1 | /* -*- Mode: C++ -*- | 8 | /* -*- Mode: C++ -*- |
2 | $Id$ | 9 | $Id$ |
3 | */ | 10 | */ |
4 | 11 | ||
5 | /**************************************************************************** | 12 | /**************************************************************************** |
6 | ** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved. | 13 | ** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved. |
7 | ** | 14 | ** |
8 | ** This file is part of the KDGantt library. | 15 | ** This file is part of the KDGantt library. |
9 | ** | 16 | ** |
10 | ** This file may be distributed and/or modified under the terms of the | 17 | ** This file may be distributed and/or modified under the terms of the |
11 | ** GNU General Public License version 2 as published by the Free Software | 18 | ** GNU General Public License version 2 as published by the Free Software |
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | 19 | ** Foundation and appearing in the file LICENSE.GPL included in the |
13 | ** packaging of this file. | 20 | ** packaging of this file. |
14 | ** | 21 | ** |
15 | ** Licensees holding valid commercial KDGantt licenses may use this file in | 22 | ** Licensees holding valid commercial KDGantt licenses may use this file in |
16 | ** accordance with the KDGantt Commercial License Agreement provided with | 23 | ** accordance with the KDGantt Commercial License Agreement provided with |
17 | ** the Software. | 24 | ** the Software. |
18 | ** | 25 | ** |
19 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 26 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
20 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 27 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
21 | ** | 28 | ** |
22 | ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for | 29 | ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for |
23 | ** information about KDGantt Commercial License Agreements. | 30 | ** information about KDGantt Commercial License Agreements. |
24 | ** | 31 | ** |
25 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this | 32 | ** Contact info@klaralvdalens-datakonsult.se if any conditions of this |
26 | ** licensing are not clear to you. | 33 | ** licensing are not clear to you. |
27 | ** | 34 | ** |
28 | ** As a special exception, permission is given to link this program | 35 | ** As a special exception, permission is given to link this program |
29 | ** with any edition of Qt, and distribute the resulting executable, | 36 | ** with any edition of Qt, and distribute the resulting executable, |
30 | ** without including the source code for Qt in the source distribution. | 37 | ** without including the source code for Qt in the source distribution. |
31 | ** | 38 | ** |
32 | **********************************************************************/ | 39 | **********************************************************************/ |
33 | 40 | ||
34 | #ifndef KDGANTTMINIMIZESPLITTER_H | 41 | #ifndef KDGANTTMINIMIZESPLITTER_H |
35 | #define KDGANTTMINIMIZESPLITTER_H | 42 | #define KDGANTTMINIMIZESPLITTER_H |
36 | 43 | ||
37 | #ifndef QT_H | 44 | #ifndef QT_H |
38 | #include "qframe.h" | 45 | #include "q3frame.h" |
39 | #include "qvaluelist.h" | 46 | #include "q3valuelist.h" |
40 | #endif // QT_H | 47 | #endif // QT_H |
41 | 48 | ||
42 | #ifndef QT_NO_SPLITTER___ | 49 | #ifndef QT_NO_SPLITTER___ |
43 | class QSplitterData; | 50 | class QSplitterData; |
44 | class QSplitterLayoutStruct; | 51 | class QSplitterLayoutStruct; |
45 | class KDGanttSplitterHandle; | 52 | class KDGanttSplitterHandle; |
46 | class KDRubberBand; | 53 | class KDRubberBand; |
47 | class KDGanttMinimizeSplitter : public QFrame | 54 | class KDGanttMinimizeSplitter : public Q3Frame |
48 | { | 55 | { |
49 | Q_OBJECT | 56 | Q_OBJECT |
50 | // Q_ENUMS( Direction ) | 57 | // Q_ENUMS( Direction ) |
51 | // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) | 58 | // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) |
52 | // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) | 59 | // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) |
53 | 60 | ||
54 | public: | 61 | public: |
55 | enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; | 62 | enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; |
56 | enum Direction { Left, Right, Up, Down }; | 63 | enum Direction { Left, Right, Up, Down }; |
57 | 64 | ||
58 | KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); | 65 | KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); |
59 | KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 ); | 66 | KDGanttMinimizeSplitter( Qt::Orientation, QWidget* parent=0, const char* name=0 ); |
60 | ~KDGanttMinimizeSplitter(); | 67 | ~KDGanttMinimizeSplitter(); |
61 | 68 | ||
62 | virtual void setOrientation( Orientation ); | 69 | virtual void setOrientation( Qt::Orientation ); |
63 | Orientation orientation() const { return orient; } | 70 | Qt::Orientation orientation() const { return orient; } |
64 | 71 | ||
65 | void setMinimizeDirection( Direction ); | 72 | void setMinimizeDirection( Direction ); |
66 | Direction minimizeDirection() const; | 73 | Direction minimizeDirection() const; |
67 | 74 | ||
68 | #if QT_VERSION >= 232 | 75 | #if QT_VERSION >= 232 |
69 | virtual void setResizeMode( QWidget *w, ResizeMode ); | 76 | virtual void setResizeMode( QWidget *w, ResizeMode ); |
70 | virtual void setOpaqueResize( bool = TRUE ); | 77 | virtual void setOpaqueResize( bool = TRUE ); |
71 | bool opaqueResize() const; | 78 | bool opaqueResize() const; |
72 | 79 | ||
73 | void moveToFirst( QWidget * ); | 80 | void moveToFirst( QWidget * ); |
74 | void moveToLast( QWidget * ); | 81 | void moveToLast( QWidget * ); |
75 | 82 | ||
76 | void refresh() { recalc( TRUE ); } | 83 | void refresh() { recalc( TRUE ); } |
77 | QSize sizeHint() const; | 84 | QSize sizeHint() const; |
78 | QSize minimumSizeHint() const; | 85 | QSize minimumSizeHint() const; |
79 | 86 | ||
80 | QValueList<int> sizes() const; | 87 | Q3ValueList<int> sizes() const; |
81 | void setSizes( QValueList<int> ); | 88 | void setSizes( Q3ValueList<int> ); |
82 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} | 89 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} |
83 | void expandPos( int id, int* min, int* max ); | 90 | void expandPos( int id, int* min, int* max ); |
84 | KDRubberBand* rubberBand() { return mRubberBand ;} | 91 | KDRubberBand* rubberBand() { return mRubberBand ;} |
85 | public slots: | 92 | public slots: |
86 | void toggle(); | 93 | void toggle(); |
87 | protected: | 94 | protected: |
88 | void childEvent( QChildEvent * ); | 95 | void childEvent( QChildEvent * ); |
89 | 96 | ||
90 | bool event( QEvent * ); | 97 | bool event( QEvent * ); |
91 | void resizeEvent( QResizeEvent * ); | 98 | void resizeEvent( QResizeEvent * ); |
92 | 99 | ||
93 | int idAfter( QWidget* ) const; | 100 | int idAfter( QWidget* ) const; |
94 | 101 | ||
95 | void moveSplitter( QCOORD pos, int id ); | 102 | void moveSplitter( QCOORD pos, int id ); |
96 | virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, | 103 | virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, |
97 | QCOORD w, QCOORD h ); | 104 | QCOORD w, QCOORD h ); |
98 | void styleChange( QStyle& ); | 105 | void styleChange( QStyle& ); |
99 | int adjustPos( int , int ); | 106 | int adjustPos( int , int ); |
100 | virtual void setRubberband( int ); | 107 | virtual void setRubberband( int ); |
101 | void getRange( int id, int*, int* ); | 108 | void getRange( int id, int*, int* ); |
102 | 109 | ||
103 | private: | 110 | private: |
104 | KDRubberBand* mRubberBand; | 111 | KDRubberBand* mRubberBand; |
105 | void init(); | 112 | void init(); |
106 | void recalc( bool update = FALSE ); | 113 | void recalc( bool update = FALSE ); |
107 | void doResize(); | 114 | void doResize(); |
108 | void storeSizes(); | 115 | void storeSizes(); |
109 | void processChildEvents(); | 116 | void processChildEvents(); |
110 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); | 117 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); |
111 | void recalcId(); | 118 | void recalcId(); |
112 | void moveBefore( int pos, int id, bool upLeft ); | 119 | void moveBefore( int pos, int id, bool upLeft ); |
113 | void moveAfter( int pos, int id, bool upLeft ); | 120 | void moveAfter( int pos, int id, bool upLeft ); |
114 | void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); | 121 | void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); |
115 | 122 | ||
116 | QCOORD pick( const QPoint &p ) const | 123 | QCOORD pick( const QPoint &p ) const |
117 | { return orient == Horizontal ? p.x() : p.y(); } | 124 | { return orient == Qt::Horizontal ? p.x() : p.y(); } |
118 | QCOORD pick( const QSize &s ) const | 125 | QCOORD pick( const QSize &s ) const |
119 | { return orient == Horizontal ? s.width() : s.height(); } | 126 | { return orient == Qt::Horizontal ? s.width() : s.height(); } |
120 | 127 | ||
121 | QCOORD trans( const QPoint &p ) const | 128 | QCOORD trans( const QPoint &p ) const |
122 | { return orient == Vertical ? p.x() : p.y(); } | 129 | { return orient == Qt::Vertical ? p.x() : p.y(); } |
123 | QCOORD trans( const QSize &s ) const | 130 | QCOORD trans( const QSize &s ) const |
124 | { return orient == Vertical ? s.width() : s.height(); } | 131 | { return orient == Qt::Vertical ? s.width() : s.height(); } |
125 | KDGanttSplitterHandle* mFirstHandle; | 132 | KDGanttSplitterHandle* mFirstHandle; |
126 | QSplitterData *data; | 133 | QSplitterData *data; |
127 | #endif | 134 | #endif |
128 | 135 | ||
129 | private: | 136 | private: |
130 | Orientation orient; | 137 | Qt::Orientation orient; |
131 | Direction _direction; | 138 | Direction _direction; |
132 | #ifndef DOXYGEN_SKIP_INTERNAL | 139 | #ifndef DOXYGEN_SKIP_INTERNAL |
133 | friend class KDGanttSplitterHandle; | 140 | friend class KDGanttSplitterHandle; |
134 | #endif | 141 | #endif |
135 | private:// Disabled copy constructor and operator= | 142 | private:// Disabled copy constructor and operator= |
136 | #if defined(Q_DISABLE_COPY) | 143 | #if defined(Q_DISABLE_COPY) |
137 | KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & ); | 144 | KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & ); |
138 | KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & ); | 145 | KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & ); |
139 | #endif | 146 | #endif |
140 | }; | 147 | }; |
141 | 148 | ||
142 | #ifndef DOXYGEN_SKIP_INTERNAL | 149 | #ifndef DOXYGEN_SKIP_INTERNAL |
143 | // This class was continued from a verbatim copy of the | 150 | // This class was continued from a verbatim copy of the |
144 | // QSplitterHandle pertaining to the Qt Enterprise License and the | 151 | // QSplitterHandle pertaining to the Qt Enterprise License and the |
145 | // GPL. It has only been renamed to KDGanttSplitterHandler in order to | 152 | // GPL. It has only been renamed to KDGanttSplitterHandler in order to |
146 | // avoid a symbol clash on some platforms. | 153 | // avoid a symbol clash on some platforms. |
147 | class KDGanttSplitterHandle : public QWidget | 154 | class KDGanttSplitterHandle : public QWidget |
148 | { | 155 | { |
149 | Q_OBJECT | 156 | Q_OBJECT |
150 | #if QT_VERSION >= 232 | 157 | #if QT_VERSION >= 232 |
151 | public: | 158 | public: |
152 | KDGanttSplitterHandle( Qt::Orientation o, | 159 | KDGanttSplitterHandle( Qt::Orientation o, |
153 | KDGanttMinimizeSplitter *parent, const char* name=0 ); | 160 | KDGanttMinimizeSplitter *parent, const char* name=0 ); |
154 | void setOrientation( Qt::Orientation o ); | 161 | void setOrientation( Qt::Orientation o ); |
155 | Qt::Orientation orientation() const { return orient; } | 162 | Qt::Orientation orientation() const { return orient; } |
156 | 163 | ||
157 | bool opaque() const { return s->opaqueResize(); } | 164 | bool opaque() const { return s->opaqueResize(); } |
158 | 165 | ||
159 | QSize sizeHint() const; | 166 | QSize sizeHint() const; |
160 | void toggle(); | 167 | void toggle(); |
161 | 168 | ||
162 | int id() const { return myId; } // data->list.at(id())->wid == this | 169 | int id() const { return myId; } // data->list.at(id())->wid == this |
163 | void setId( int i ) { myId = i; } | 170 | void setId( int i ) { myId = i; } |
164 | 171 | ||
165 | protected: | 172 | protected: |
166 | QValueList<QPointArray> buttonRegions(); | 173 | Q3ValueList<Q3PointArray> buttonRegions(); |
167 | void paintEvent( QPaintEvent * ); | 174 | void paintEvent( QPaintEvent * ); |
168 | void mouseMoveEvent( QMouseEvent * ); | 175 | void mouseMoveEvent( QMouseEvent * ); |
169 | void mousePressEvent( QMouseEvent * ); | 176 | void mousePressEvent( QMouseEvent * ); |
170 | void mouseReleaseEvent( QMouseEvent * ); | 177 | void mouseReleaseEvent( QMouseEvent * ); |
171 | int onButton( const QPoint& p ); | 178 | int onButton( const QPoint& p ); |
172 | void updateCursor( const QPoint& p ); | 179 | void updateCursor( const QPoint& p ); |
173 | 180 | ||
174 | private: | 181 | private: |
175 | bool mMouseDown; | 182 | bool mMouseDown; |
176 | QSize mSizeHint; | 183 | QSize mSizeHint; |
177 | bool mUseOffset; | 184 | bool mUseOffset; |
178 | Qt::Orientation orient; | 185 | Qt::Orientation orient; |
179 | bool opaq; | 186 | bool opaq; |
180 | int myId; | 187 | int myId; |
181 | 188 | ||
182 | KDGanttMinimizeSplitter *s; | 189 | KDGanttMinimizeSplitter *s; |
183 | int _activeButton; | 190 | int _activeButton; |
184 | bool _collapsed; | 191 | bool _collapsed; |
185 | int _origPos; | 192 | int _origPos; |
186 | #endif | 193 | #endif |
187 | }; | 194 | }; |
188 | #endif | 195 | #endif |
189 | 196 | ||
190 | #endif // QT_NO_SPLITTER | 197 | #endif // QT_NO_SPLITTER |
191 | 198 | ||
192 | #endif // KDGANTTMINIMIZESPLITTER_H | 199 | #endif // KDGANTTMINIMIZESPLITTER_H |