-rw-r--r-- | korganizer/kolistview.cpp | 2 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 32 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.h | 2 |
3 files changed, 34 insertions, 2 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 09d70f1..15e094d 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1186,57 +1186,57 @@ void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | |||
1186 | if ( ci ) | 1186 | if ( ci ) |
1187 | ci->setSelected( true ); | 1187 | ci->setSelected( true ); |
1188 | } | 1188 | } |
1189 | } | 1189 | } |
1190 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1190 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1191 | { | 1191 | { |
1192 | KListView::contentsMouseReleaseEvent(e); | 1192 | KListView::contentsMouseReleaseEvent(e); |
1193 | } | 1193 | } |
1194 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1194 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1195 | { | 1195 | { |
1196 | KListView::contentsMouseMoveEvent(e); | 1196 | KListView::contentsMouseMoveEvent(e); |
1197 | } | 1197 | } |
1198 | #endif | 1198 | #endif |
1199 | void KOListViewListView::popupMenu() | 1199 | void KOListViewListView::popupMenu() |
1200 | { | 1200 | { |
1201 | mPopupTimer->stop(); | 1201 | mPopupTimer->stop(); |
1202 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); | 1202 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); |
1203 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | 1203 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); |
1204 | QApplication::postEvent( this->viewport(), e ); | 1204 | QApplication::postEvent( this->viewport(), e ); |
1205 | } | 1205 | } |
1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1207 | { | 1207 | { |
1208 | //qDebug("contentsMousePressEvent++++ "); | 1208 | //qDebug("contentsMousePressEvent++++ "); |
1209 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1209 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1210 | if ( e->button() == LeftButton ) { | 1210 | if ( e->button() == LeftButton ) { |
1211 | mPopupTimer->start( 600 ); | 1211 | mPopupTimer->start( 600 ); |
1212 | mEventPos = e->pos(); | 1212 | mEventPos = e->pos(); |
1213 | mEventGlobalPos = e->globalPos(); | 1213 | mEventGlobalPos = e->globalPos(); |
1214 | } | 1214 | } |
1215 | KListView::contentsMousePressEvent( e ); | 1215 | KListView::contentsMousePressEvent( e ); |
1216 | if ( e->button() == RightButton ) { | 1216 | if ( e->button() == RightButton ) { |
1217 | QListViewItem* ci = currentItem(); | 1217 | QListViewItem* ci = currentItem(); |
1218 | clearSelection(); | 1218 | //clearSelection(); |
1219 | if ( ci ) | 1219 | if ( ci ) |
1220 | ci->setSelected( true ); | 1220 | ci->setSelected( true ); |
1221 | } | 1221 | } |
1222 | } | 1222 | } |
1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1224 | { | 1224 | { |
1225 | mPopupTimer->stop(); | 1225 | mPopupTimer->stop(); |
1226 | KListView::contentsMouseReleaseEvent(e); | 1226 | KListView::contentsMouseReleaseEvent(e); |
1227 | } | 1227 | } |
1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1229 | { | 1229 | { |
1230 | // qDebug("contentsMouseMoveEv....... "); | 1230 | // qDebug("contentsMouseMoveEv....... "); |
1231 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1231 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1232 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1232 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1233 | if ( diff < 0 ) diff = -diff; | 1233 | if ( diff < 0 ) diff = -diff; |
1234 | if ( diff > 15 ) | 1234 | if ( diff > 15 ) |
1235 | mPopupTimer->stop(); | 1235 | mPopupTimer->stop(); |
1236 | else { | 1236 | else { |
1237 | mEventPos = e->pos(); | 1237 | mEventPos = e->pos(); |
1238 | mEventGlobalPos = e->globalPos(); | 1238 | mEventGlobalPos = e->globalPos(); |
1239 | } | 1239 | } |
1240 | KListView::contentsMouseMoveEvent(e); | 1240 | KListView::contentsMouseMoveEvent(e); |
1241 | } | 1241 | } |
1242 | 1242 | ||
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 029f14b..ea3a329 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp | |||
@@ -160,64 +160,66 @@ void KDGanttSplitterHandle::toggle() | |||
160 | } | 160 | } |
161 | 161 | ||
162 | _origPos = s->pick(mapToParent( QPoint( 0,0 ) )); | 162 | _origPos = s->pick(mapToParent( QPoint( 0,0 ) )); |
163 | s->moveSplitter( pos, id() ); | 163 | s->moveSplitter( pos, id() ); |
164 | _collapsed = true; | 164 | _collapsed = true; |
165 | } | 165 | } |
166 | else { | 166 | else { |
167 | s->moveSplitter( _origPos, id() ); | 167 | s->moveSplitter( _origPos, id() ); |
168 | _collapsed = false; | 168 | _collapsed = false; |
169 | } | 169 | } |
170 | repaint(); | 170 | repaint(); |
171 | } | 171 | } |
172 | 172 | ||
173 | void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) | 173 | void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) |
174 | { | 174 | { |
175 | mMouseDown = false; | 175 | mMouseDown = false; |
176 | if ( _activeButton != 0 ) { | 176 | if ( _activeButton != 0 ) { |
177 | if ( onButton( e->pos() ) == _activeButton ) | 177 | if ( onButton( e->pos() ) == _activeButton ) |
178 | { | 178 | { |
179 | toggle(); | 179 | toggle(); |
180 | } | 180 | } |
181 | _activeButton = 0; | 181 | _activeButton = 0; |
182 | updateCursor( e->pos() ); | 182 | updateCursor( e->pos() ); |
183 | } | 183 | } |
184 | else { | 184 | else { |
185 | if ( !opaque() && e->button() == LeftButton ) { | 185 | if ( !opaque() && e->button() == LeftButton ) { |
186 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) | 186 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) |
187 | - mouseOffset; | 187 | - mouseOffset; |
188 | s->setRubberband( -1 ); | 188 | s->setRubberband( -1 ); |
189 | s->moveSplitter( pos, id() ); | 189 | s->moveSplitter( pos, id() ); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | if ( s->rubberBand() ) | ||
193 | s->rubberBand()->hide(); | ||
192 | repaint(); | 194 | repaint(); |
193 | } | 195 | } |
194 | 196 | ||
195 | int KDGanttSplitterHandle::onButton( const QPoint& p ) | 197 | int KDGanttSplitterHandle::onButton( const QPoint& p ) |
196 | { | 198 | { |
197 | QValueList<QPointArray> list = buttonRegions(); | 199 | QValueList<QPointArray> list = buttonRegions(); |
198 | int index = 1; | 200 | int index = 1; |
199 | int add = 12; | 201 | int add = 12; |
200 | for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { | 202 | for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { |
201 | QRect rect = (*it).boundingRect(); | 203 | QRect rect = (*it).boundingRect(); |
202 | rect.setLeft( rect.left()- add ); | 204 | rect.setLeft( rect.left()- add ); |
203 | rect.setRight( rect.right() + add); | 205 | rect.setRight( rect.right() + add); |
204 | rect.setTop( rect.top()- add ); | 206 | rect.setTop( rect.top()- add ); |
205 | rect.setBottom( rect.bottom() + add); | 207 | rect.setBottom( rect.bottom() + add); |
206 | if ( rect.contains( p ) ) { | 208 | if ( rect.contains( p ) ) { |
207 | return index; | 209 | return index; |
208 | } | 210 | } |
209 | index++; | 211 | index++; |
210 | } | 212 | } |
211 | return 0; | 213 | return 0; |
212 | } | 214 | } |
213 | 215 | ||
214 | 216 | ||
215 | QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() | 217 | QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions() |
216 | { | 218 | { |
217 | QValueList<QPointArray> list; | 219 | QValueList<QPointArray> list; |
218 | 220 | ||
219 | int sw = 8; | 221 | int sw = 8; |
220 | int yyy = 1; | 222 | int yyy = 1; |
221 | int xxx = 1; | 223 | int xxx = 1; |
222 | int voffset[] = { (int) -sw*3, (int) sw*3 }; | 224 | int voffset[] = { (int) -sw*3, (int) sw*3 }; |
223 | for ( int i = 0; i < 2; i++ ) { | 225 | for ( int i = 0; i < 2; i++ ) { |
@@ -405,102 +407,106 @@ void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int | |||
405 | by the initial size of each widget. You can also use setSizes() to | 407 | by the initial size of each widget. You can also use setSizes() to |
406 | set the sizes of all the widgets. The function sizes() returns the | 408 | set the sizes of all the widgets. The function sizes() returns the |
407 | sizes set by the user. | 409 | sizes set by the user. |
408 | 410 | ||
409 | If you hide() a child, its space will be distributed among the other | 411 | If you hide() a child, its space will be distributed among the other |
410 | children. It will be reinstated when you show() it again. It is also | 412 | children. It will be reinstated when you show() it again. It is also |
411 | possible to reorder the widgets within the splitter using | 413 | possible to reorder the widgets within the splitter using |
412 | moveToFirst() and moveToLast(). | 414 | moveToFirst() and moveToLast(). |
413 | */ | 415 | */ |
414 | 416 | ||
415 | 417 | ||
416 | 418 | ||
417 | static QSize minSize( const QWidget* /*w*/ ) | 419 | static QSize minSize( const QWidget* /*w*/ ) |
418 | { | 420 | { |
419 | return QSize(0,0); | 421 | return QSize(0,0); |
420 | } | 422 | } |
421 | 423 | ||
422 | // This is the original version of minSize | 424 | // This is the original version of minSize |
423 | static QSize minSizeHint( const QWidget* w ) | 425 | static QSize minSizeHint( const QWidget* w ) |
424 | { | 426 | { |
425 | QSize min = w->minimumSize(); | 427 | QSize min = w->minimumSize(); |
426 | QSize s; | 428 | QSize s; |
427 | if ( min.height() <= 0 || min.width() <= 0 ) | 429 | if ( min.height() <= 0 || min.width() <= 0 ) |
428 | s = w->minimumSizeHint(); | 430 | s = w->minimumSizeHint(); |
429 | if ( min.height() > 0 ) | 431 | if ( min.height() > 0 ) |
430 | s.setHeight( min.height() ); | 432 | s.setHeight( min.height() ); |
431 | if ( min.width() > 0 ) | 433 | if ( min.width() > 0 ) |
432 | s.setWidth( min.width() ); | 434 | s.setWidth( min.width() ); |
433 | return s.expandedTo(QSize(0,0)); | 435 | return s.expandedTo(QSize(0,0)); |
434 | } | 436 | } |
435 | 437 | ||
436 | 438 | ||
437 | |||
438 | /*! | 439 | /*! |
439 | Constructs a horizontal splitter with the \a parent and \a | 440 | Constructs a horizontal splitter with the \a parent and \a |
440 | name arguments being passed on to the QFrame constructor. | 441 | name arguments being passed on to the QFrame constructor. |
441 | */ | 442 | */ |
442 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) | 443 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) |
443 | :QFrame(parent,name,WPaintUnclipped) | 444 | :QFrame(parent,name,WPaintUnclipped) |
444 | { | 445 | { |
446 | mRubberBand = 0; | ||
445 | mFirstHandle = 0; | 447 | mFirstHandle = 0; |
446 | #if QT_VERSION >= 232 | 448 | #if QT_VERSION >= 232 |
447 | orient = Horizontal; | 449 | orient = Horizontal; |
448 | init(); | 450 | init(); |
449 | #endif | 451 | #endif |
450 | } | 452 | } |
451 | 453 | ||
452 | /*! | 454 | /*! |
453 | Constructs a splitter with orientation \a o with the \a parent | 455 | Constructs a splitter with orientation \a o with the \a parent |
454 | and \a name arguments being passed on to the QFrame constructor. | 456 | and \a name arguments being passed on to the QFrame constructor. |
455 | */ | 457 | */ |
456 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name ) | 458 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name ) |
457 | :QFrame(parent,name,WPaintUnclipped) | 459 | :QFrame(parent,name,WPaintUnclipped) |
458 | { | 460 | { |
461 | |||
462 | mRubberBand = 0; | ||
459 | mFirstHandle = 0; | 463 | mFirstHandle = 0; |
460 | #if QT_VERSION >= 232 | 464 | #if QT_VERSION >= 232 |
461 | orient = o; | 465 | orient = o; |
462 | init(); | 466 | init(); |
463 | #endif | 467 | #endif |
464 | } | 468 | } |
465 | 469 | ||
466 | /*! | 470 | /*! |
467 | Destroys the splitter and any children. | 471 | Destroys the splitter and any children. |
468 | */ | 472 | */ |
469 | KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter() | 473 | KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter() |
470 | { | 474 | { |
471 | #if QT_VERSION >= 232 | 475 | #if QT_VERSION >= 232 |
472 | data->list.setAutoDelete( TRUE ); | 476 | data->list.setAutoDelete( TRUE ); |
473 | delete data; | 477 | delete data; |
474 | #endif | 478 | #endif |
479 | if ( mRubberBand ) | ||
480 | delete mRubberBand; | ||
475 | } | 481 | } |
476 | 482 | ||
477 | 483 | ||
478 | #if QT_VERSION >= 232 | 484 | #if QT_VERSION >= 232 |
479 | void KDGanttMinimizeSplitter::init() | 485 | void KDGanttMinimizeSplitter::init() |
480 | { | 486 | { |
481 | data = new QSplitterData; | 487 | data = new QSplitterData; |
482 | if ( orient == Horizontal ) | 488 | if ( orient == Horizontal ) |
483 | setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) ); | 489 | setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) ); |
484 | else | 490 | else |
485 | setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) ); | 491 | setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) ); |
486 | #ifndef DESKTOP_VERSION | 492 | #ifndef DESKTOP_VERSION |
487 | setOpaqueResize( false ); | 493 | setOpaqueResize( false ); |
488 | #else | 494 | #else |
489 | setOpaqueResize( true ); | 495 | setOpaqueResize( true ); |
490 | #endif | 496 | #endif |
491 | } | 497 | } |
492 | #endif | 498 | #endif |
493 | 499 | ||
494 | 500 | ||
495 | void KDGanttMinimizeSplitter::toggle() | 501 | void KDGanttMinimizeSplitter::toggle() |
496 | { | 502 | { |
497 | if ( mFirstHandle ) | 503 | if ( mFirstHandle ) |
498 | mFirstHandle->toggle(); | 504 | mFirstHandle->toggle(); |
499 | else | 505 | else |
500 | qDebug("KDGanttMinimizeSplitter::toggle::sorry, handle not available "); | 506 | qDebug("KDGanttMinimizeSplitter::toggle::sorry, handle not available "); |
501 | 507 | ||
502 | } | 508 | } |
503 | 509 | ||
504 | 510 | ||
505 | /*! | 511 | /*! |
506 | \brief the orientation of the splitter | 512 | \brief the orientation of the splitter |
@@ -613,89 +619,113 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | |||
613 | 619 | ||
614 | } else if ( c->type() == QEvent::ChildRemoved ) { | 620 | } else if ( c->type() == QEvent::ChildRemoved ) { |
615 | QSplitterLayoutStruct *p = 0; | 621 | QSplitterLayoutStruct *p = 0; |
616 | if ( data->list.count() > 1 ) | 622 | if ( data->list.count() > 1 ) |
617 | p = data->list.at(1); //remove handle _after_ first widget. | 623 | p = data->list.at(1); //remove handle _after_ first widget. |
618 | QSplitterLayoutStruct *s = data->list.first(); | 624 | QSplitterLayoutStruct *s = data->list.first(); |
619 | while ( s ) { | 625 | while ( s ) { |
620 | if ( s->wid == c->child() ) { | 626 | if ( s->wid == c->child() ) { |
621 | data->list.removeRef( s ); | 627 | data->list.removeRef( s ); |
622 | delete s; | 628 | delete s; |
623 | if ( p && p->isSplitter ) { | 629 | if ( p && p->isSplitter ) { |
624 | data->list.removeRef( p ); | 630 | data->list.removeRef( p ); |
625 | delete p->wid; //will call childEvent | 631 | delete p->wid; //will call childEvent |
626 | delete p; | 632 | delete p; |
627 | } | 633 | } |
628 | recalcId(); | 634 | recalcId(); |
629 | doResize(); | 635 | doResize(); |
630 | return; | 636 | return; |
631 | } | 637 | } |
632 | p = s; | 638 | p = s; |
633 | s = data->list.next(); | 639 | s = data->list.next(); |
634 | } | 640 | } |
635 | } | 641 | } |
636 | } | 642 | } |
637 | 643 | ||
638 | 644 | ||
639 | /*! | 645 | /*! |
640 | Shows a rubber band at position \a p. If \a p is negative, the | 646 | Shows a rubber band at position \a p. If \a p is negative, the |
641 | rubber band is removed. | 647 | rubber band is removed. |
642 | */ | 648 | */ |
643 | void KDGanttMinimizeSplitter::setRubberband( int p ) | 649 | void KDGanttMinimizeSplitter::setRubberband( int p ) |
644 | { | 650 | { |
651 | #ifdef DESKTOP_VERSION | ||
645 | QPainter paint( this ); | 652 | QPainter paint( this ); |
646 | paint.setPen( gray ); | 653 | paint.setPen( gray ); |
647 | paint.setBrush( gray ); | 654 | paint.setBrush( gray ); |
648 | paint.setRasterOp( XorROP ); | 655 | paint.setRasterOp( XorROP ); |
649 | QRect r = contentsRect(); | 656 | QRect r = contentsRect(); |
650 | const int rBord = 3; //Themable???? | 657 | const int rBord = 3; //Themable???? |
651 | #if QT_VERSION >= 0x030000 | 658 | #if QT_VERSION >= 0x030000 |
652 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 659 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); |
653 | #else | 660 | #else |
654 | int sw = style().splitterWidth(); | 661 | int sw = style().splitterWidth(); |
655 | #endif | 662 | #endif |
656 | if ( orient == Horizontal ) { | 663 | if ( orient == Horizontal ) { |
657 | if ( opaqueOldPos >= 0 ) | 664 | if ( opaqueOldPos >= 0 ) |
658 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), | 665 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), |
659 | 2*rBord, r.height() ); | 666 | 2*rBord, r.height() ); |
660 | if ( p >= 0 ) | 667 | if ( p >= 0 ) |
661 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); | 668 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); |
662 | } else { | 669 | } else { |
663 | if ( opaqueOldPos >= 0 ) | 670 | if ( opaqueOldPos >= 0 ) |
664 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, | 671 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, |
665 | r.width(), 2*rBord ); | 672 | r.width(), 2*rBord ); |
666 | if ( p >= 0 ) | 673 | if ( p >= 0 ) |
667 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); | 674 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); |
668 | } | 675 | } |
669 | opaqueOldPos = p; | 676 | opaqueOldPos = p; |
677 | #else | ||
678 | if ( !mRubberBand ) { | ||
679 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); | ||
680 | mRubberBand->setFrameStyle( Box | Raised ); | ||
681 | mRubberBand->setPalette( QPalette ( Qt::green.light(),Qt::green.dark() ) ); | ||
682 | } | ||
683 | QRect r = contentsRect(); | ||
684 | const int rBord = 5; //Themable???? | ||
685 | int sw = style().splitterWidth(); | ||
686 | if ( orient == Horizontal ) { | ||
687 | if ( p >= 0 ) { | ||
688 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); | ||
689 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); | ||
690 | } | ||
691 | } else { | ||
692 | if ( p >= 0 ) { | ||
693 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); | ||
694 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); | ||
695 | } | ||
696 | } | ||
697 | opaqueOldPos = p; | ||
698 | mRubberBand->show(); | ||
699 | #endif | ||
670 | } | 700 | } |
671 | 701 | ||
672 | 702 | ||
673 | /*! \reimp */ | 703 | /*! \reimp */ |
674 | bool KDGanttMinimizeSplitter::event( QEvent *e ) | 704 | bool KDGanttMinimizeSplitter::event( QEvent *e ) |
675 | { | 705 | { |
676 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { | 706 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { |
677 | recalc( isVisible() ); | 707 | recalc( isVisible() ); |
678 | if ( e->type() == QEvent::Show ) | 708 | if ( e->type() == QEvent::Show ) |
679 | data->firstShow = FALSE; | 709 | data->firstShow = FALSE; |
680 | } | 710 | } |
681 | return QWidget::event( e ); | 711 | return QWidget::event( e ); |
682 | } | 712 | } |
683 | 713 | ||
684 | 714 | ||
685 | /*! | 715 | /*! |
686 | \obsolete | 716 | \obsolete |
687 | 717 | ||
688 | Draws the splitter handle in the rectangle described by \a x, \a y, | 718 | Draws the splitter handle in the rectangle described by \a x, \a y, |
689 | \a w, \a h using painter \a p. | 719 | \a w, \a h using painter \a p. |
690 | \sa QStyle::drawPrimitive() | 720 | \sa QStyle::drawPrimitive() |
691 | */ | 721 | */ |
692 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, | 722 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, |
693 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) | 723 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) |
694 | { | 724 | { |
695 | #if 0 | 725 | #if 0 |
696 | // LR | 726 | // LR |
697 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), | 727 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), |
698 | (orientation() == Qt::Horizontal ? | 728 | (orientation() == Qt::Horizontal ? |
699 | QStyle::Style_Horizontal : 0)); | 729 | QStyle::Style_Horizontal : 0)); |
700 | #endif | 730 | #endif |
701 | } | 731 | } |
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h index 84d3d8e..585298d 100644 --- a/microkde/KDGanttMinimizeSplitter.h +++ b/microkde/KDGanttMinimizeSplitter.h | |||
@@ -51,83 +51,85 @@ class KDGanttMinimizeSplitter : public QFrame | |||
51 | // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) | 51 | // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) |
52 | 52 | ||
53 | public: | 53 | public: |
54 | enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; | 54 | enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; |
55 | enum Direction { Left, Right, Up, Down }; | 55 | enum Direction { Left, Right, Up, Down }; |
56 | 56 | ||
57 | KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); | 57 | KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); |
58 | KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 ); | 58 | KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 ); |
59 | ~KDGanttMinimizeSplitter(); | 59 | ~KDGanttMinimizeSplitter(); |
60 | 60 | ||
61 | virtual void setOrientation( Orientation ); | 61 | virtual void setOrientation( Orientation ); |
62 | Orientation orientation() const { return orient; } | 62 | Orientation orientation() const { return orient; } |
63 | 63 | ||
64 | void setMinimizeDirection( Direction ); | 64 | void setMinimizeDirection( Direction ); |
65 | Direction minimizeDirection() const; | 65 | Direction minimizeDirection() const; |
66 | 66 | ||
67 | #if QT_VERSION >= 232 | 67 | #if QT_VERSION >= 232 |
68 | virtual void setResizeMode( QWidget *w, ResizeMode ); | 68 | virtual void setResizeMode( QWidget *w, ResizeMode ); |
69 | virtual void setOpaqueResize( bool = TRUE ); | 69 | virtual void setOpaqueResize( bool = TRUE ); |
70 | bool opaqueResize() const; | 70 | bool opaqueResize() const; |
71 | 71 | ||
72 | void moveToFirst( QWidget * ); | 72 | void moveToFirst( QWidget * ); |
73 | void moveToLast( QWidget * ); | 73 | void moveToLast( QWidget * ); |
74 | 74 | ||
75 | void refresh() { recalc( TRUE ); } | 75 | void refresh() { recalc( TRUE ); } |
76 | QSize sizeHint() const; | 76 | QSize sizeHint() const; |
77 | QSize minimumSizeHint() const; | 77 | QSize minimumSizeHint() const; |
78 | 78 | ||
79 | QValueList<int> sizes() const; | 79 | QValueList<int> sizes() const; |
80 | void setSizes( QValueList<int> ); | 80 | void setSizes( QValueList<int> ); |
81 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} | 81 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} |
82 | void expandPos( int id, int* min, int* max ); | 82 | void expandPos( int id, int* min, int* max ); |
83 | QFrame* rubberBand() { return mRubberBand ;} | ||
83 | public slots: | 84 | public slots: |
84 | void toggle(); | 85 | void toggle(); |
85 | protected: | 86 | protected: |
86 | void childEvent( QChildEvent * ); | 87 | void childEvent( QChildEvent * ); |
87 | 88 | ||
88 | bool event( QEvent * ); | 89 | bool event( QEvent * ); |
89 | void resizeEvent( QResizeEvent * ); | 90 | void resizeEvent( QResizeEvent * ); |
90 | 91 | ||
91 | int idAfter( QWidget* ) const; | 92 | int idAfter( QWidget* ) const; |
92 | 93 | ||
93 | void moveSplitter( QCOORD pos, int id ); | 94 | void moveSplitter( QCOORD pos, int id ); |
94 | virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, | 95 | virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, |
95 | QCOORD w, QCOORD h ); | 96 | QCOORD w, QCOORD h ); |
96 | void styleChange( QStyle& ); | 97 | void styleChange( QStyle& ); |
97 | int adjustPos( int , int ); | 98 | int adjustPos( int , int ); |
98 | virtual void setRubberband( int ); | 99 | virtual void setRubberband( int ); |
99 | void getRange( int id, int*, int* ); | 100 | void getRange( int id, int*, int* ); |
100 | 101 | ||
101 | private: | 102 | private: |
103 | QFrame* mRubberBand; | ||
102 | void init(); | 104 | void init(); |
103 | void recalc( bool update = FALSE ); | 105 | void recalc( bool update = FALSE ); |
104 | void doResize(); | 106 | void doResize(); |
105 | void storeSizes(); | 107 | void storeSizes(); |
106 | void processChildEvents(); | 108 | void processChildEvents(); |
107 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); | 109 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); |
108 | void recalcId(); | 110 | void recalcId(); |
109 | void moveBefore( int pos, int id, bool upLeft ); | 111 | void moveBefore( int pos, int id, bool upLeft ); |
110 | void moveAfter( int pos, int id, bool upLeft ); | 112 | void moveAfter( int pos, int id, bool upLeft ); |
111 | void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); | 113 | void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); |
112 | 114 | ||
113 | QCOORD pick( const QPoint &p ) const | 115 | QCOORD pick( const QPoint &p ) const |
114 | { return orient == Horizontal ? p.x() : p.y(); } | 116 | { return orient == Horizontal ? p.x() : p.y(); } |
115 | QCOORD pick( const QSize &s ) const | 117 | QCOORD pick( const QSize &s ) const |
116 | { return orient == Horizontal ? s.width() : s.height(); } | 118 | { return orient == Horizontal ? s.width() : s.height(); } |
117 | 119 | ||
118 | QCOORD trans( const QPoint &p ) const | 120 | QCOORD trans( const QPoint &p ) const |
119 | { return orient == Vertical ? p.x() : p.y(); } | 121 | { return orient == Vertical ? p.x() : p.y(); } |
120 | QCOORD trans( const QSize &s ) const | 122 | QCOORD trans( const QSize &s ) const |
121 | { return orient == Vertical ? s.width() : s.height(); } | 123 | { return orient == Vertical ? s.width() : s.height(); } |
122 | KDGanttSplitterHandle* mFirstHandle; | 124 | KDGanttSplitterHandle* mFirstHandle; |
123 | QSplitterData *data; | 125 | QSplitterData *data; |
124 | #endif | 126 | #endif |
125 | 127 | ||
126 | private: | 128 | private: |
127 | Orientation orient; | 129 | Orientation orient; |
128 | Direction _direction; | 130 | Direction _direction; |
129 | #ifndef DOXYGEN_SKIP_INTERNAL | 131 | #ifndef DOXYGEN_SKIP_INTERNAL |
130 | friend class KDGanttSplitterHandle; | 132 | friend class KDGanttSplitterHandle; |
131 | #endif | 133 | #endif |
132 | private:// Disabled copy constructor and operator= | 134 | private:// Disabled copy constructor and operator= |
133 | #if defined(Q_DISABLE_COPY) | 135 | #if defined(Q_DISABLE_COPY) |