-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 32 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.h | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 029f14b..ea3a329 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp @@ -189,6 +189,8 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) s->moveSplitter( pos, id() ); } } + if ( s->rubberBand() ) + s->rubberBand()->hide(); repaint(); } @@ -434,7 +436,6 @@ static QSize minSizeHint( const QWidget* w ) } - /*! Constructs a horizontal splitter with the \a parent and \a name arguments being passed on to the QFrame constructor. @@ -442,6 +443,7 @@ static QSize minSizeHint( const QWidget* w ) KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) :QFrame(parent,name,WPaintUnclipped) { + mRubberBand = 0; mFirstHandle = 0; #if QT_VERSION >= 232 orient = Horizontal; @@ -456,6 +458,8 @@ KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *n KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name ) :QFrame(parent,name,WPaintUnclipped) { + + mRubberBand = 0; mFirstHandle = 0; #if QT_VERSION >= 232 orient = o; @@ -472,6 +476,8 @@ KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter() data->list.setAutoDelete( TRUE ); delete data; #endif + if ( mRubberBand ) + delete mRubberBand; } @@ -642,6 +648,7 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) */ void KDGanttMinimizeSplitter::setRubberband( int p ) { +#ifdef DESKTOP_VERSION QPainter paint( this ); paint.setPen( gray ); paint.setBrush( gray ); @@ -667,6 +674,29 @@ void KDGanttMinimizeSplitter::setRubberband( int p ) paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); } opaqueOldPos = p; +#else + if ( !mRubberBand ) { + mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); + mRubberBand->setFrameStyle( Box | Raised ); + mRubberBand->setPalette( QPalette ( Qt::green.light(),Qt::green.dark() ) ); + } + QRect r = contentsRect(); + const int rBord = 5; //Themable???? + int sw = style().splitterWidth(); + if ( orient == Horizontal ) { + if ( p >= 0 ) { + QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); + mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); + } + } else { + if ( p >= 0 ) { + QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); + mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); + } + } + opaqueOldPos = p; + mRubberBand->show(); +#endif } diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h index 84d3d8e..585298d 100644 --- a/microkde/KDGanttMinimizeSplitter.h +++ b/microkde/KDGanttMinimizeSplitter.h @@ -80,6 +80,7 @@ public: void setSizes( QValueList<int> ); KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} void expandPos( int id, int* min, int* max ); + QFrame* rubberBand() { return mRubberBand ;} public slots: void toggle(); protected: @@ -99,6 +100,7 @@ protected: void getRange( int id, int*, int* ); private: + QFrame* mRubberBand; void init(); void recalc( bool update = FALSE ); void doResize(); |