summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp14
-rw-r--r--microkde/KDGanttMinimizeSplitter.h1
2 files changed, 11 insertions, 4 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 84edc0d..c60b566 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -19,327 +19,333 @@
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 19 ** 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. 20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 ** 21 **
22 ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for 22 ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
23 ** information about KDGantt Commercial License Agreements. 23 ** information about KDGantt Commercial License Agreements.
24 ** 24 **
25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this 25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
26 ** licensing are not clear to you. 26 ** licensing are not clear to you.
27 ** 27 **
28 ** As a special exception, permission is given to link this program 28 ** As a special exception, permission is given to link this program
29 ** with any edition of Qt, and distribute the resulting executable, 29 ** with any edition of Qt, and distribute the resulting executable,
30 ** without including the source code for Qt in the source distribution. 30 ** without including the source code for Qt in the source distribution.
31 ** 31 **
32 **********************************************************************/ 32 **********************************************************************/
33 33
34#include "KDGanttMinimizeSplitter.h" 34#include "KDGanttMinimizeSplitter.h"
35#ifndef QT_NO_SPLITTER___ 35#ifndef QT_NO_SPLITTER___
36 36
37#include "qpainter.h" 37#include "qpainter.h"
38#include "qdrawutil.h" 38#include "qdrawutil.h"
39#include "qbitmap.h" 39#include "qbitmap.h"
40#if QT_VERSION >= 0x030000 40#if QT_VERSION >= 0x030000
41#include "qptrlist.h" 41#include "qptrlist.h"
42#include "qmemarray.h" 42#include "qmemarray.h"
43#else 43#else
44#include <qlist.h> 44#include <qlist.h>
45#include <qarray.h> 45#include <qarray.h>
46#define QPtrList QList 46#define QPtrList QList
47#define QMemArray QArray 47#define QMemArray QArray
48#endif 48#endif
49#include "qlayoutengine_p.h" 49#include "qlayoutengine_p.h"
50#include "qobjectlist.h" 50#include "qobjectlist.h"
51#include "qstyle.h" 51#include "qstyle.h"
52#include "qapplication.h" //sendPostedEvents 52#include "qapplication.h" //sendPostedEvents
53#include <qvaluelist.h> 53#include <qvaluelist.h>
54#include <qcursor.h> 54#include <qcursor.h>
55#ifndef KDGANTT_MASTER_CVS 55#ifndef KDGANTT_MASTER_CVS
56//#include "KDGanttMinimizeSplitter.moc" 56//#include "KDGanttMinimizeSplitter.moc"
57#endif 57#endif
58 58
59 59
60 60
61#ifndef DOXYGEN_SKIP_INTERNAL 61#ifndef DOXYGEN_SKIP_INTERNAL
62 62
63#if QT_VERSION >= 232 63#if QT_VERSION >= 232
64static int mouseOffset; 64static int mouseOffset;
65static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky 65static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
66 66
67 67
68KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, 68KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
69 KDGanttMinimizeSplitter *parent, const char * name ) 69 KDGanttMinimizeSplitter *parent, const char * name )
70 : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false ) 70 : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false )
71{ 71{
72 72
73 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { 73 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) {
74 mSizeHint = QSize(7,7); 74 mSizeHint = QSize(7,7);
75 mUseOffset = true; 75 mUseOffset = true;
76 } else { 76 } else {
77 mSizeHint = QSize(6,6); 77 mSizeHint = QSize(6,6);
78 mUseOffset = false; 78 mUseOffset = false;
79 } 79 }
80 s = parent; 80 s = parent;
81 setOrientation(o); 81 setOrientation(o);
82 setMouseTracking( true ); 82 setMouseTracking( true );
83 mMouseDown = false;
83 //setMaximumHeight( 5 ); // test only 84 //setMaximumHeight( 5 ); // test only
84} 85}
85 86
86QSize KDGanttSplitterHandle::sizeHint() const 87QSize KDGanttSplitterHandle::sizeHint() const
87{ 88{
88 return mSizeHint; 89 return mSizeHint;
89} 90}
90 91
91void KDGanttSplitterHandle::setOrientation( Qt::Orientation o ) 92void KDGanttSplitterHandle::setOrientation( Qt::Orientation o )
92{ 93{
93 orient = o; 94 orient = o;
94#ifndef QT_NO_CURSOR 95#ifndef QT_NO_CURSOR
95 if ( o == KDGanttMinimizeSplitter::Horizontal ) 96 if ( o == KDGanttMinimizeSplitter::Horizontal )
96 setCursor( splitHCursor ); 97 setCursor( splitHCursor );
97 else 98 else
98 setCursor( splitVCursor ); 99 setCursor( splitVCursor );
99#endif 100#endif
100} 101}
101 102
102 103
103void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e ) 104void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e )
104{ 105{
105 updateCursor( e->pos() ); 106 updateCursor( e->pos() );
106 if ( !(e->state()&LeftButton) ) 107 if ( !(e->state()&LeftButton) )
107 return; 108 return;
108 109
109 if ( _activeButton != 0) 110 if ( _activeButton != 0)
110 return; 111 return;
111 112
112 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) 113 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
113 - mouseOffset; 114 - mouseOffset;
114 if ( true /*opaque()*/ ) { 115 if ( true /*opaque()*/ ) {
115 s->moveSplitter( pos, id() ); 116 s->moveSplitter( pos, id() );
116 } else { 117 } else {
117 int min = pos; int max = pos; 118 int min = pos; int max = pos;
118 s->getRange( id(), &min, &max ); 119 s->getRange( id(), &min, &max );
119 s->setRubberband( QMAX( min, QMIN(max, pos ))); 120 s->setRubberband( QMAX( min, QMIN(max, pos )));
120 } 121 }
121 _collapsed = false; 122 _collapsed = false;
122} 123}
123 124
124void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e ) 125void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e )
125{ 126{
126 if ( e->button() == LeftButton ) { 127 if ( e->button() == LeftButton ) {
127 _activeButton = onButton( e->pos() ); 128 _activeButton = onButton( e->pos() );
128 mouseOffset = s->pick(e->pos()); 129 mouseOffset = s->pick(e->pos());
129 if ( _activeButton != 0) 130 mMouseDown = true;
130 repaint(); 131 repaint();
131 updateCursor( e->pos() ); 132 updateCursor( e->pos() );
132 } 133 }
133} 134}
134 135
135void KDGanttSplitterHandle::updateCursor( const QPoint& p) 136void KDGanttSplitterHandle::updateCursor( const QPoint& p)
136{ 137{
137 if ( onButton( p ) != 0 ) { 138 if ( onButton( p ) != 0 ) {
138 setCursor( arrowCursor ); 139 setCursor( arrowCursor );
139 } 140 }
140 else { 141 else {
141 if ( orient == KDGanttMinimizeSplitter::Horizontal ) 142 if ( orient == KDGanttMinimizeSplitter::Horizontal )
142 setCursor( splitHCursor ); 143 setCursor( splitHCursor );
143 else 144 else
144 setCursor( splitVCursor ); 145 setCursor( splitVCursor );
145 } 146 }
146} 147}
147void KDGanttSplitterHandle::toggle() 148void KDGanttSplitterHandle::toggle()
148{ 149{
149 int pos; 150 int pos;
150 int min, max; 151 int min, max;
151 if ( !_collapsed ) { 152 if ( !_collapsed ) {
152 s->expandPos( id(), &min, &max ); 153 s->expandPos( id(), &min, &max );
153 if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left 154 if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left
154 || s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) { 155 || s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) {
155 pos = min; 156 pos = min;
156 } 157 }
157 else { 158 else {
158 pos = max; 159 pos = max;
159 } 160 }
160 161
161 _origPos = s->pick(mapToParent( QPoint( 0,0 ) )); 162 _origPos = s->pick(mapToParent( QPoint( 0,0 ) ));
162 s->moveSplitter( pos, id() ); 163 s->moveSplitter( pos, id() );
163 _collapsed = true; 164 _collapsed = true;
164 } 165 }
165 else { 166 else {
166 s->moveSplitter( _origPos, id() ); 167 s->moveSplitter( _origPos, id() );
167 _collapsed = false; 168 _collapsed = false;
168 } 169 }
169 repaint(); 170 repaint();
170} 171}
171 172
172void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) 173void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
173{ 174{
175 mMouseDown = false;
174 if ( _activeButton != 0 ) { 176 if ( _activeButton != 0 ) {
175 if ( onButton( e->pos() ) == _activeButton ) 177 if ( onButton( e->pos() ) == _activeButton )
176 { 178 {
177 toggle(); 179 toggle();
178 } 180 }
179 _activeButton = 0; 181 _activeButton = 0;
180 updateCursor( e->pos() ); 182 updateCursor( e->pos() );
181 } 183 }
182 else { 184 else {
183 if ( !opaque() && e->button() == LeftButton ) { 185 if ( !opaque() && e->button() == LeftButton ) {
184 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) 186 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
185 - mouseOffset; 187 - mouseOffset;
186 s->setRubberband( -1 ); 188 s->setRubberband( -1 );
187 s->moveSplitter( pos, id() ); 189 s->moveSplitter( pos, id() );
188 } 190 }
189 } 191 }
190 repaint(); 192 repaint();
191} 193}
192 194
193int KDGanttSplitterHandle::onButton( const QPoint& p ) 195int KDGanttSplitterHandle::onButton( const QPoint& p )
194{ 196{
195 QValueList<QPointArray> list = buttonRegions(); 197 QValueList<QPointArray> list = buttonRegions();
196 int index = 1; 198 int index = 1;
197 int add = 12; 199 int add = 12;
198 for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { 200 for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
199 QRect rect = (*it).boundingRect(); 201 QRect rect = (*it).boundingRect();
200 rect.setLeft( rect.left()- add ); 202 rect.setLeft( rect.left()- add );
201 rect.setRight( rect.right() + add); 203 rect.setRight( rect.right() + add);
202 rect.setTop( rect.top()- add ); 204 rect.setTop( rect.top()- add );
203 rect.setBottom( rect.bottom() + add); 205 rect.setBottom( rect.bottom() + add);
204 if ( rect.contains( p ) ) { 206 if ( rect.contains( p ) ) {
205 return index; 207 return index;
206 } 208 }
207 index++; 209 index++;
208 } 210 }
209 return 0; 211 return 0;
210} 212}
211 213
212 214
213QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() 215QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions()
214{ 216{
215 QValueList<QPointArray> list; 217 QValueList<QPointArray> list;
216 218
217 int sw = 8; 219 int sw = 8;
218 int yyy = 1; 220 int yyy = 1;
219 int xxx = 1; 221 int xxx = 1;
220 int voffset[] = { (int) -sw*3, (int) sw*3 }; 222 int voffset[] = { (int) -sw*3, (int) sw*3 };
221 for ( int i = 0; i < 2; i++ ) { 223 for ( int i = 0; i < 2; i++ ) {
222 QPointArray arr; 224 QPointArray arr;
223 if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right || 225 if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ||
224 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) { 226 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) {
225 int mid = height()/2 + voffset[i]; 227 int mid = height()/2 + voffset[i];
226 arr.setPoints( 3, 228 arr.setPoints( 3,
227 1-xxx, mid - sw + 4, 229 1-xxx, mid - sw + 4,
228 sw-3-xxx, mid, 230 sw-3-xxx, mid,
229 1-xxx, mid + sw -4); 231 1-xxx, mid + sw -4);
230 } 232 }
231 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left || 233 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left ||
232 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { 234 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) {
233 int mid = height()/2 + voffset[i]; 235 int mid = height()/2 + voffset[i];
234 arr.setPoints( 3, 236 arr.setPoints( 3,
235 sw-4, mid - sw + 4, 237 sw-4, mid - sw + 4,
236 0, mid, 238 0, mid,
237 sw-4, mid + sw - 4); 239 sw-4, mid + sw - 4);
238 } 240 }
239 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up || 241 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ||
240 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) { 242 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) {
241 int mid = width()/2 + voffset[i]; 243 int mid = width()/2 + voffset[i];
242 arr.setPoints( 3, 244 arr.setPoints( 3,
243 mid - sw + 4, sw-4, 245 mid - sw + 4, sw-4,
244 mid, 0, 246 mid, 0,
245 mid + sw - 4, sw-4 ); 247 mid + sw - 4, sw-4 );
246 } 248 }
247 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down || 249 else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down ||
248 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) { 250 _collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) {
249 int mid = width()/2 + voffset[i]; 251 int mid = width()/2 + voffset[i];
250 arr.setPoints( 3, 252 arr.setPoints( 3,
251 mid - sw + 4, 1-yyy, 253 mid - sw + 4, 1-yyy,
252 mid, sw-3-yyy, 254 mid, sw-3-yyy,
253 mid + sw -4, 1-yyy); 255 mid + sw -4, 1-yyy);
254 } 256 }
255 list.append( arr ); 257 list.append( arr );
256 } 258 }
257 return list; 259 return list;
258} 260}
259 261
260void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) 262void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
261{ 263{
262 QPixmap buffer( size() ); 264 QPixmap buffer( size() );
263 QPainter p( &buffer ); 265 QPainter p( &buffer );
264 266
265 //LR 267 //LR
266 // Draw the splitter rectangle 268 // Draw the splitter rectangle
267 p.setBrush( colorGroup().background() ); 269 p.setBrush( colorGroup().background() );
268 p.setPen( colorGroup().foreground() ); 270 p.setPen( colorGroup().foreground() );
269 //p.drawRect( rect() ); 271 //p.drawRect( rect() );
270 buffer.fill( colorGroup().background() ); 272 buffer.fill( colorGroup().background() );
271 //buffer.fill( backgroundColor() ); 273 //buffer.fill( backgroundColor() );
272 // parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup()); 274 // parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup());
273 275
274 int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size 276 int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size
275 277
276 // arrow color 278 // arrow color
277 QColor col; 279 QColor col;
278 if ( _activeButton ) 280 if ( _activeButton )
279 col = colorGroup().background().dark( 250 ); 281 col = colorGroup().background().dark( 250 );
280 else 282 else {
281 col = colorGroup().background().dark( 150 ); 283 if ( mMouseDown )
284 col = Qt::white;
285 else
286 col = colorGroup().background().dark( 150 );
287 }
282 //QColor col = backgroundColor().dark( 130 ); 288 //QColor col = backgroundColor().dark( 130 );
283 p.setBrush( col ); 289 p.setBrush( col );
284 p.setPen( col ); 290 p.setPen( col );
285 291
286 QValueList<QPointArray> list = buttonRegions(); 292 QValueList<QPointArray> list = buttonRegions();
287 int index = 1; 293 int index = 1;
288 if ( mUseOffset ) 294 if ( mUseOffset )
289 p.translate( 0, 1 ); 295 p.translate( 0, 1 );
290 for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { 296 for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
291 if ( index == _activeButton ) { 297 if ( index == _activeButton ) {
292 298
293 /* 299 /*
294 if ( ! _collapsed ) { 300 if ( ! _collapsed ) {
295 p.save(); 301 p.save();
296 // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), 302 // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ),
297 // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) ); 303 // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) );
298 p.translate( -1, 0 ); 304 p.translate( -1, 0 );
299 p.drawPolygon( *it, true ); 305 p.drawPolygon( *it, true );
300 p.restore(); } else 306 p.restore(); } else
301 */ 307 */
302 p.drawPolygon( *it, true ); 308 p.drawPolygon( *it, true );
303 309
304 } 310 }
305 else { 311 else {
306 /* 312 /*
307 if ( ! _collapsed ) { 313 if ( ! _collapsed ) {
308 p.save(); 314 p.save();
309 p.translate( -1, 0 ); 315 p.translate( -1, 0 );
310 p.drawPolygon( *it, true ); 316 p.drawPolygon( *it, true );
311 p.restore(); 317 p.restore();
312 } else 318 } else
313 */ 319 */
314 p.drawPolygon( *it, true ); 320 p.drawPolygon( *it, true );
315 321
316 } 322 }
317 index++; 323 index++;
318 } 324 }
319 325
320 // Draw the lines between the arrows 326 // Draw the lines between the arrows
321 if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left || 327 if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left ||
322 s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) { 328 s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) {
323 int mid = height()/2; 329 int mid = height()/2;
324 p.drawLine ( 1, mid - sw, 1, mid + sw ); 330 p.drawLine ( 1, mid - sw, 1, mid + sw );
325 p.drawLine ( 3, mid - sw, 3, mid + sw ); 331 p.drawLine ( 3, mid - sw, 3, mid + sw );
326 } 332 }
327 else if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Up || 333 else if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Up ||
328 s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) { 334 s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) {
329 int mid = width()/2; 335 int mid = width()/2;
330 p.drawLine( mid -sw, 1, mid +sw, 1 ); 336 p.drawLine( mid -sw, 1, mid +sw, 1 );
331 p.drawLine( mid -sw, 3, mid +sw, 3 ); 337 p.drawLine( mid -sw, 3, mid +sw, 3 );
332 } 338 }
333 bitBlt( this, 0, 0, &buffer ); 339 bitBlt( this, 0, 0, &buffer );
334 340
335} 341}
336#endif 342#endif
337 343
338class QSplitterLayoutStruct 344class QSplitterLayoutStruct
339{ 345{
340public: 346public:
341 KDGanttMinimizeSplitter::ResizeMode mode; 347 KDGanttMinimizeSplitter::ResizeMode mode;
342 QCOORD sizer; 348 QCOORD sizer;
343 bool isSplitter; 349 bool isSplitter;
344 QWidget *wid; 350 QWidget *wid;
345}; 351};
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h
index 8120d14..84d3d8e 100644
--- a/microkde/KDGanttMinimizeSplitter.h
+++ b/microkde/KDGanttMinimizeSplitter.h
@@ -108,81 +108,82 @@ private:
108 void recalcId(); 108 void recalcId();
109 void moveBefore( int pos, int id, bool upLeft ); 109 void moveBefore( int pos, int id, bool upLeft );
110 void moveAfter( int pos, int id, bool upLeft ); 110 void moveAfter( int pos, int id, bool upLeft );
111 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); 111 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
112 112
113 QCOORD pick( const QPoint &p ) const 113 QCOORD pick( const QPoint &p ) const
114 { return orient == Horizontal ? p.x() : p.y(); } 114 { return orient == Horizontal ? p.x() : p.y(); }
115 QCOORD pick( const QSize &s ) const 115 QCOORD pick( const QSize &s ) const
116 { return orient == Horizontal ? s.width() : s.height(); } 116 { return orient == Horizontal ? s.width() : s.height(); }
117 117
118 QCOORD trans( const QPoint &p ) const 118 QCOORD trans( const QPoint &p ) const
119 { return orient == Vertical ? p.x() : p.y(); } 119 { return orient == Vertical ? p.x() : p.y(); }
120 QCOORD trans( const QSize &s ) const 120 QCOORD trans( const QSize &s ) const
121 { return orient == Vertical ? s.width() : s.height(); } 121 { return orient == Vertical ? s.width() : s.height(); }
122 KDGanttSplitterHandle* mFirstHandle; 122 KDGanttSplitterHandle* mFirstHandle;
123 QSplitterData *data; 123 QSplitterData *data;
124#endif 124#endif
125 125
126private: 126private:
127 Orientation orient; 127 Orientation orient;
128 Direction _direction; 128 Direction _direction;
129#ifndef DOXYGEN_SKIP_INTERNAL 129#ifndef DOXYGEN_SKIP_INTERNAL
130 friend class KDGanttSplitterHandle; 130 friend class KDGanttSplitterHandle;
131#endif 131#endif
132 private:// Disabled copy constructor and operator= 132 private:// Disabled copy constructor and operator=
133#if defined(Q_DISABLE_COPY) 133#if defined(Q_DISABLE_COPY)
134 KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & ); 134 KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & );
135 KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & ); 135 KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & );
136#endif 136#endif
137}; 137};
138 138
139#ifndef DOXYGEN_SKIP_INTERNAL 139#ifndef DOXYGEN_SKIP_INTERNAL
140// This class was continued from a verbatim copy of the 140// This class was continued from a verbatim copy of the
141// QSplitterHandle pertaining to the Qt Enterprise License and the 141// QSplitterHandle pertaining to the Qt Enterprise License and the
142// GPL. It has only been renamed to KDGanttSplitterHandler in order to 142// GPL. It has only been renamed to KDGanttSplitterHandler in order to
143// avoid a symbol clash on some platforms. 143// avoid a symbol clash on some platforms.
144class KDGanttSplitterHandle : public QWidget 144class KDGanttSplitterHandle : public QWidget
145{ 145{
146 Q_OBJECT 146 Q_OBJECT
147#if QT_VERSION >= 232 147#if QT_VERSION >= 232
148public: 148public:
149 KDGanttSplitterHandle( Qt::Orientation o, 149 KDGanttSplitterHandle( Qt::Orientation o,
150 KDGanttMinimizeSplitter *parent, const char* name=0 ); 150 KDGanttMinimizeSplitter *parent, const char* name=0 );
151 void setOrientation( Qt::Orientation o ); 151 void setOrientation( Qt::Orientation o );
152 Qt::Orientation orientation() const { return orient; } 152 Qt::Orientation orientation() const { return orient; }
153 153
154 bool opaque() const { return s->opaqueResize(); } 154 bool opaque() const { return s->opaqueResize(); }
155 155
156 QSize sizeHint() const; 156 QSize sizeHint() const;
157 void toggle(); 157 void toggle();
158 158
159 int id() const { return myId; } // data->list.at(id())->wid == this 159 int id() const { return myId; } // data->list.at(id())->wid == this
160 void setId( int i ) { myId = i; } 160 void setId( int i ) { myId = i; }
161 161
162protected: 162protected:
163 QValueList<QPointArray> buttonRegions(); 163 QValueList<QPointArray> buttonRegions();
164 void paintEvent( QPaintEvent * ); 164 void paintEvent( QPaintEvent * );
165 void mouseMoveEvent( QMouseEvent * ); 165 void mouseMoveEvent( QMouseEvent * );
166 void mousePressEvent( QMouseEvent * ); 166 void mousePressEvent( QMouseEvent * );
167 void mouseReleaseEvent( QMouseEvent * ); 167 void mouseReleaseEvent( QMouseEvent * );
168 int onButton( const QPoint& p ); 168 int onButton( const QPoint& p );
169 void updateCursor( const QPoint& p ); 169 void updateCursor( const QPoint& p );
170 170
171private: 171private:
172 bool mMouseDown;
172 QSize mSizeHint; 173 QSize mSizeHint;
173 bool mUseOffset; 174 bool mUseOffset;
174 Qt::Orientation orient; 175 Qt::Orientation orient;
175 bool opaq; 176 bool opaq;
176 int myId; 177 int myId;
177 178
178 KDGanttMinimizeSplitter *s; 179 KDGanttMinimizeSplitter *s;
179 int _activeButton; 180 int _activeButton;
180 bool _collapsed; 181 bool _collapsed;
181 int _origPos; 182 int _origPos;
182#endif 183#endif
183}; 184};
184#endif 185#endif
185 186
186#endif // QT_NO_SPLITTER 187#endif // QT_NO_SPLITTER
187 188
188#endif // KDGANTTMINIMIZESPLITTER_H 189#endif // KDGANTTMINIMIZESPLITTER_H