summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-21 12:32:52 (UTC)
committer zautrix <zautrix>2005-04-21 12:32:52 (UTC)
commit0a13a3490ec3bf4735e3435f80f58fa7d50b4448 (patch) (unidiff)
treec7f28c49b52e479f47da0dce9f0bfe9189ecdca4
parent4d96d7b681ce99d76746a843c289b75f5e7dba64 (diff)
downloadkdepimpi-0a13a3490ec3bf4735e3435f80f58fa7d50b4448.zip
kdepimpi-0a13a3490ec3bf4735e3435f80f58fa7d50b4448.tar.gz
kdepimpi-0a13a3490ec3bf4735e3435f80f58fa7d50b4448.tar.bz2
rubberband fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp21
-rw-r--r--microkde/KDGanttMinimizeSplitter.h5
3 files changed, 22 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 7927307..8ee1363 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -761,25 +761,25 @@ int MonthViewCell::insertEvent(Event *event)
761 } else 761 } else
762 item->setReply(false); 762 item->setReply(false);
763#endif 763#endif
764 item->setMultiDay( multiday ); 764 item->setMultiDay( multiday );
765 if ( multiday ) { 765 if ( multiday ) {
766 insertItem( item ,mdayCount); 766 insertItem( item ,mdayCount);
767 ++mdayCount; 767 ++mdayCount;
768 } else { 768 } else {
769 uint i; 769 uint i;
770 int pos = mdayCount; 770 int pos = mdayCount;
771 for ( i = mdayCount; i < count();++i ) { 771 for ( i = mdayCount; i < count();++i ) {
772 QListBoxItem* it = this->item ( i ); 772 QListBoxItem* it = this->item ( i );
773 if ( text < it->text() ) { 773 if ( it && text < it->text() ) {
774 pos = i; 774 pos = i;
775 break; 775 break;
776 } 776 }
777 ++pos; 777 ++pos;
778 } 778 }
779 insertItem( item ,pos); 779 insertItem( item ,pos);
780 } 780 }
781 if ( useToolTips ) { 781 if ( useToolTips ) {
782 mToolTip.append( mToolTipText ); 782 mToolTip.append( mToolTipText );
783 } 783 }
784 return mdayCount; 784 return mdayCount;
785} 785}
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index fb5d4e3..72c4e60 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -43,36 +43,49 @@
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#include <qframe.h>
55#ifndef KDGANTT_MASTER_CVS 56#ifndef KDGANTT_MASTER_CVS
56//#include "KDGanttMinimizeSplitter.moc" 57//#include "KDGanttMinimizeSplitter.moc"
57#endif 58#endif
58 59
59 60
60 61
61#ifndef DOXYGEN_SKIP_INTERNAL 62#ifndef DOXYGEN_SKIP_INTERNAL
62 63
63#if QT_VERSION >= 232 64#if QT_VERSION >= 232
64static int mouseOffset; 65static int mouseOffset;
65static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky 66static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
66 67
68class KDRubberBand: public QFrame
69{
70public:
71 KDRubberBand( QWidget *parent, const char * name, WFlags f ) :QFrame ( parent, name, f ) {;}
72
73protected:
74 virtual void mousePressEvent ( QMouseEvent * )
75 {
76 close();
77 };
78
79};
67 80
68KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, 81KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
69 KDGanttMinimizeSplitter *parent, const char * name ) 82 KDGanttMinimizeSplitter *parent, const char * name )
70 : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false ) 83 : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false )
71{ 84{
72 85
73 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { 86 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) {
74 mSizeHint = QSize(7,7); 87 mSizeHint = QSize(7,7);
75 mUseOffset = true; 88 mUseOffset = true;
76 } else { 89 } else {
77 mSizeHint = QSize(6,6); 90 mSizeHint = QSize(6,6);
78 mUseOffset = false; 91 mUseOffset = false;
@@ -180,26 +193,28 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
180 } 193 }
181 _activeButton = 0; 194 _activeButton = 0;
182 updateCursor( e->pos() ); 195 updateCursor( e->pos() );
183 } 196 }
184 else { 197 else {
185 if ( !opaque() && e->button() == LeftButton ) { 198 if ( !opaque() && e->button() == LeftButton ) {
186 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) 199 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
187 - mouseOffset; 200 - mouseOffset;
188 s->setRubberband( -1 ); 201 s->setRubberband( -1 );
189 s->moveSplitter( pos, id() ); 202 s->moveSplitter( pos, id() );
190 } 203 }
191 } 204 }
192 if ( s->rubberBand() ) 205 if ( s->rubberBand() ) {
193 s->rubberBand()->hide(); 206 //qDebug("hide rubberband ");
207 s->rubberBand()->close();
208 }
194 repaint(); 209 repaint();
195} 210}
196 211
197int KDGanttSplitterHandle::onButton( const QPoint& p ) 212int KDGanttSplitterHandle::onButton( const QPoint& p )
198{ 213{
199 QValueList<QPointArray> list = buttonRegions(); 214 QValueList<QPointArray> list = buttonRegions();
200 int index = 1; 215 int index = 1;
201 int add = 12; 216 int add = 12;
202 for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { 217 for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
203 QRect rect = (*it).boundingRect(); 218 QRect rect = (*it).boundingRect();
204 rect.setLeft( rect.left()- add ); 219 rect.setLeft( rect.left()- add );
205 rect.setRight( rect.right() + add); 220 rect.setRight( rect.right() + add);
@@ -672,25 +687,25 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
672 if ( p >= 0 ) 687 if ( p >= 0 )
673 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); 688 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
674 } else { 689 } else {
675 if ( opaqueOldPos >= 0 ) 690 if ( opaqueOldPos >= 0 )
676 paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, 691 paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord,
677 r.width(), 2*rBord ); 692 r.width(), 2*rBord );
678 if ( p >= 0 ) 693 if ( p >= 0 )
679 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); 694 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
680 } 695 }
681 opaqueOldPos = p; 696 opaqueOldPos = p;
682#else 697#else
683 if ( !mRubberBand ) { 698 if ( !mRubberBand ) {
684 mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); 699 mRubberBand = new KDRubberBand( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop);
685 mRubberBand->setFrameStyle( Box | Raised ); 700 mRubberBand->setFrameStyle( Box | Raised );
686 //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); 701 //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) );
687 mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() )); 702 mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() ));
688 } 703 }
689 QRect r = contentsRect(); 704 QRect r = contentsRect();
690 static int rBord = 0; //Themable???? 705 static int rBord = 0; //Themable????
691 if ( !rBord ) { 706 if ( !rBord ) {
692 if (QApplication::desktop()->width() <= 320 ) 707 if (QApplication::desktop()->width() <= 320 )
693 rBord = 3; 708 rBord = 3;
694 else 709 else
695 rBord = 4; 710 rBord = 4;
696 } 711 }
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h
index 585298d..3042e0a 100644
--- a/microkde/KDGanttMinimizeSplitter.h
+++ b/microkde/KDGanttMinimizeSplitter.h
@@ -34,24 +34,25 @@
34#ifndef KDGANTTMINIMIZESPLITTER_H 34#ifndef KDGANTTMINIMIZESPLITTER_H
35#define KDGANTTMINIMIZESPLITTER_H 35#define KDGANTTMINIMIZESPLITTER_H
36 36
37#ifndef QT_H 37#ifndef QT_H
38#include "qframe.h" 38#include "qframe.h"
39#include "qvaluelist.h" 39#include "qvaluelist.h"
40#endif // QT_H 40#endif // QT_H
41 41
42#ifndef QT_NO_SPLITTER___ 42#ifndef QT_NO_SPLITTER___
43class QSplitterData; 43class QSplitterData;
44class QSplitterLayoutStruct; 44class QSplitterLayoutStruct;
45class KDGanttSplitterHandle; 45class KDGanttSplitterHandle;
46class KDRubberBand;
46class KDGanttMinimizeSplitter : public QFrame 47class KDGanttMinimizeSplitter : public QFrame
47{ 48{
48 Q_OBJECT 49 Q_OBJECT
49 // Q_ENUMS( Direction ) 50 // Q_ENUMS( Direction )
50 // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) 51 // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
51 // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) 52 // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection )
52 53
53public: 54public:
54 enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; 55 enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
55 enum Direction { Left, Right, Up, Down }; 56 enum Direction { Left, Right, Up, Down };
56 57
57 KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); 58 KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 );
@@ -71,45 +72,45 @@ public:
71 72
72 void moveToFirst( QWidget * ); 73 void moveToFirst( QWidget * );
73 void moveToLast( QWidget * ); 74 void moveToLast( QWidget * );
74 75
75 void refresh() { recalc( TRUE ); } 76 void refresh() { recalc( TRUE ); }
76 QSize sizeHint() const; 77 QSize sizeHint() const;
77 QSize minimumSizeHint() const; 78 QSize minimumSizeHint() const;
78 79
79 QValueList<int> sizes() const; 80 QValueList<int> sizes() const;
80 void setSizes( QValueList<int> ); 81 void setSizes( QValueList<int> );
81 KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} 82 KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;}
82 void expandPos( int id, int* min, int* max ); 83 void expandPos( int id, int* min, int* max );
83 QFrame* rubberBand() { return mRubberBand ;} 84 KDRubberBand* rubberBand() { return mRubberBand ;}
84public slots: 85public slots:
85 void toggle(); 86 void toggle();
86protected: 87protected:
87 void childEvent( QChildEvent * ); 88 void childEvent( QChildEvent * );
88 89
89 bool event( QEvent * ); 90 bool event( QEvent * );
90 void resizeEvent( QResizeEvent * ); 91 void resizeEvent( QResizeEvent * );
91 92
92 int idAfter( QWidget* ) const; 93 int idAfter( QWidget* ) const;
93 94
94 void moveSplitter( QCOORD pos, int id ); 95 void moveSplitter( QCOORD pos, int id );
95 virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, 96 virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
96 QCOORD w, QCOORD h ); 97 QCOORD w, QCOORD h );
97 void styleChange( QStyle& ); 98 void styleChange( QStyle& );
98 int adjustPos( int , int ); 99 int adjustPos( int , int );
99 virtual void setRubberband( int ); 100 virtual void setRubberband( int );
100 void getRange( int id, int*, int* ); 101 void getRange( int id, int*, int* );
101 102
102private: 103private:
103 QFrame* mRubberBand; 104 KDRubberBand* mRubberBand;
104 void init(); 105 void init();
105 void recalc( bool update = FALSE ); 106 void recalc( bool update = FALSE );
106 void doResize(); 107 void doResize();
107 void storeSizes(); 108 void storeSizes();
108 void processChildEvents(); 109 void processChildEvents();
109 QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); 110 QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
110 void recalcId(); 111 void recalcId();
111 void moveBefore( int pos, int id, bool upLeft ); 112 void moveBefore( int pos, int id, bool upLeft );
112 void moveAfter( int pos, int id, bool upLeft ); 113 void moveAfter( int pos, int id, bool upLeft );
113 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); 114 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
114 115
115 QCOORD pick( const QPoint &p ) const 116 QCOORD pick( const QPoint &p ) const