summaryrefslogtreecommitdiff
path: root/libopie2/opieui
authorar <ar>2005-01-21 20:19:00 (UTC)
committer ar <ar>2005-01-21 20:19:00 (UTC)
commit55eccecc08f839878e5743d6e6be25af386b5a3f (patch) (unidiff)
treefd663ded2a2c097ce53bac6c021ca652ef5b5508 /libopie2/opieui
parentcd51d382be50bc021739395309e23760f1619759 (diff)
downloadopie-55eccecc08f839878e5743d6e6be25af386b5a3f.zip
opie-55eccecc08f839878e5743d6e6be25af386b5a3f.tar.gz
opie-55eccecc08f839878e5743d6e6be25af386b5a3f.tar.bz2
- make opie compilable against qte 2.3.10 snapshot
change QT_VERSION > 290 into QT_VERSION <= 0x030000
Diffstat (limited to 'libopie2/opieui') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/olistview.cpp8
-rw-r--r--libopie2/opieui/opopupmenu.cpp4
-rw-r--r--libopie2/opieui/oselector.cpp2
-rw-r--r--libopie2/opieui/oselector.h4
4 files changed, 9 insertions, 9 deletions
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp
index 67b4b83..4386e0e 100644
--- a/libopie2/opieui/olistview.cpp
+++ b/libopie2/opieui/olistview.cpp
@@ -18,134 +18,134 @@
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details. 19++=   -.     .`     .: details.
20 :     =  ...= . :.=- 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation, 24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330, 25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30/* QT */ 30/* QT */
31 31
32#include <qpixmap.h> 32#include <qpixmap.h>
33 33
34/* OPIE */ 34/* OPIE */
35 35
36#include <opie2/odebug.h> 36#include <opie2/odebug.h>
37#include <opie2/olistview.h> 37#include <opie2/olistview.h>
38 38
39using namespace Opie::Core; 39using namespace Opie::Core;
40 40
41 41
42namespace Opie { 42namespace Opie {
43namespace Ui { 43namespace Ui {
44/*====================================================================================== 44/*======================================================================================
45 * OListView 45 * OListView
46 *======================================================================================*/ 46 *======================================================================================*/
47 47
48OListView::OListView( QWidget *parent, const char *name, WFlags fl ) 48OListView::OListView( QWidget *parent, const char *name, WFlags fl )
49 :QListView( parent, name, fl ) 49 :QListView( parent, name, fl )
50{ 50{
51 //FIXME: get from global settings and calculate ==> see oglobalsettings.* 51 //FIXME: get from global settings and calculate ==> see oglobalsettings.*
52 52
53 m_alternateBackground = QColor( 238, 246, 255 ); 53 m_alternateBackground = QColor( 238, 246, 255 );
54 m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine ); 54 m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine );
55 m_fullWidth = true; 55 m_fullWidth = true;
56 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); 56 connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
57} 57}
58 58
59OListView::~OListView() 59OListView::~OListView()
60{ 60{
61} 61}
62 62
63void OListView::setFullWidth( bool fullWidth ) 63void OListView::setFullWidth( bool fullWidth )
64{ 64{
65 m_fullWidth = fullWidth; 65 m_fullWidth = fullWidth;
66 #if QT_VERSION > 290 66 #if QT_VERSION >= 0x030000
67 header()->setStretchEnabled( fullWidth, columns()-1 ); 67 header()->setStretchEnabled( fullWidth, columns()-1 );
68 #endif 68 #endif
69} 69}
70 70
71bool OListView::fullWidth() const 71bool OListView::fullWidth() const
72{ 72{
73 return m_fullWidth; 73 return m_fullWidth;
74} 74}
75 75
76int OListView::addColumn( const QString& label, int width ) 76int OListView::addColumn( const QString& label, int width )
77{ 77{
78 int result = QListView::addColumn( label, width ); 78 int result = QListView::addColumn( label, width );
79 #if QT_VERSION > 290 79 #if QT_VERSION >= 0x030000
80 if (m_fullWidth) { 80 if (m_fullWidth) {
81 header()->setStretchEnabled( false, columns()-2 ); 81 header()->setStretchEnabled( false, columns()-2 );
82 header()->setStretchEnabled( true, columns()-1 ); 82 header()->setStretchEnabled( true, columns()-1 );
83 } 83 }
84 #endif 84 #endif
85 return result; 85 return result;
86} 86}
87 87
88int OListView::addColumn( const QIconSet& iconset, const QString& label, int width ) 88int OListView::addColumn( const QIconSet& iconset, const QString& label, int width )
89{ 89{
90 int result = QListView::addColumn( iconset, label, width ); 90 int result = QListView::addColumn( iconset, label, width );
91 #if QT_VERSION > 290 91 #if QT_VERSION >= 0x030000
92 if (m_fullWidth) { 92 if (m_fullWidth) {
93 header()->setStretchEnabled( false, columns()-2 ); 93 header()->setStretchEnabled( false, columns()-2 );
94 header()->setStretchEnabled( true, columns()-1 ); 94 header()->setStretchEnabled( true, columns()-1 );
95 } 95 }
96 #endif 96 #endif
97 return result; 97 return result;
98} 98}
99 99
100void OListView::removeColumn( int index ) 100void OListView::removeColumn( int index )
101{ 101{
102 QListView::removeColumn(index); 102 QListView::removeColumn(index);
103 #if QT_VERSION > 290 103 #if QT_VERSION >= 0x030000
104 if ( m_fullWidth && index == columns() ) 104 if ( m_fullWidth && index == columns() )
105 { 105 {
106 header()->setStretchEnabled( true, columns()-1 ); 106 header()->setStretchEnabled( true, columns()-1 );
107 } 107 }
108 #endif 108 #endif
109} 109}
110 110
111const QColor& OListView::alternateBackground() const 111const QColor& OListView::alternateBackground() const
112{ 112{
113 return m_alternateBackground; 113 return m_alternateBackground;
114} 114}
115 115
116void OListView::setAlternateBackground( const QColor &c ) 116void OListView::setAlternateBackground( const QColor &c )
117{ 117{
118 m_alternateBackground = c; 118 m_alternateBackground = c;
119 repaint(); 119 repaint();
120} 120}
121 121
122const QPen& OListView::columnSeparator() const 122const QPen& OListView::columnSeparator() const
123{ 123{
124 return m_columnSeparator; 124 return m_columnSeparator;
125} 125}
126 126
127void OListView::setColumnSeparator( const QPen& p ) 127void OListView::setColumnSeparator( const QPen& p )
128{ 128{
129 m_columnSeparator = p; 129 m_columnSeparator = p;
130 repaint(); 130 repaint();
131} 131}
132 132
133void OListView::expand(QListViewItem *item) 133void OListView::expand(QListViewItem *item)
134{ 134{
135 ((OListViewItem*)item)->expand(); 135 ((OListViewItem*)item)->expand();
136} 136}
137 137
138OListViewItem* OListView::childFactory() 138OListViewItem* OListView::childFactory()
139{ 139{
140 return new OListViewItem( this ); 140 return new OListViewItem( this );
141} 141}
142 142
143#ifndef QT_NO_DATASTREAM 143#ifndef QT_NO_DATASTREAM
144void OListView::serializeTo( QDataStream& s ) const 144void OListView::serializeTo( QDataStream& s ) const
145{ 145{
146 #warning Caution... the binary format is still under construction... 146 #warning Caution... the binary format is still under construction...
147 odebug << "storing OListView..." << oendl; 147 odebug << "storing OListView..." << oendl;
148 148
149 // store number of columns and the labels 149 // store number of columns and the labels
150 s << columns(); 150 s << columns();
151 for ( int i = 0; i < columns(); ++i ) 151 for ( int i = 0; i < columns(); ++i )
diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp
index 50c613f..5ce048e 100644
--- a/libopie2/opieui/opopupmenu.cpp
+++ b/libopie2/opieui/opopupmenu.cpp
@@ -40,97 +40,97 @@ OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */,
40 const QColor &/* color */, const QColor &/* textColor */, 40 const QColor &/* color */, const QColor &/* textColor */,
41 QWidget *parent, const char *name) 41 QWidget *parent, const char *name)
42 : QWidget(parent, name) 42 : QWidget(parent, name)
43{ 43{
44 setMinimumSize(16, fontMetrics().height()+8); 44 setMinimumSize(16, fontMetrics().height()+8);
45} 45}
46 46
47OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */, 47OPopupTitle::OPopupTitle(const OPixmap & /* background */, const QColor &/* color */,
48 const QColor &/* textColor */, QWidget *parent, 48 const QColor &/* textColor */, QWidget *parent,
49 const char *name) 49 const char *name)
50 : QWidget(parent, name) 50 : QWidget(parent, name)
51{ 51{
52 setMinimumSize(16, fontMetrics().height()+8); 52 setMinimumSize(16, fontMetrics().height()+8);
53} 53}
54 54
55void OPopupTitle::setTitle(const QString &text, const QPixmap *icon) 55void OPopupTitle::setTitle(const QString &text, const QPixmap *icon)
56{ 56{
57 titleStr = text; 57 titleStr = text;
58 if (icon) 58 if (icon)
59 miniicon = *icon; 59 miniicon = *icon;
60 else 60 else
61 miniicon.resize(0, 0); 61 miniicon.resize(0, 0);
62 62
63 int w = miniicon.width()+fontMetrics().width(titleStr); 63 int w = miniicon.width()+fontMetrics().width(titleStr);
64 int h = QMAX( fontMetrics().height(), miniicon.height() ); 64 int h = QMAX( fontMetrics().height(), miniicon.height() );
65 setMinimumSize( w+16, h+8 ); 65 setMinimumSize( w+16, h+8 );
66} 66}
67 67
68void OPopupTitle::setText( const QString &text ) 68void OPopupTitle::setText( const QString &text )
69{ 69{
70 titleStr = text; 70 titleStr = text;
71 int w = miniicon.width()+fontMetrics().width(titleStr); 71 int w = miniicon.width()+fontMetrics().width(titleStr);
72 int h = QMAX( fontMetrics().height(), miniicon.height() ); 72 int h = QMAX( fontMetrics().height(), miniicon.height() );
73 setMinimumSize( w+16, h+8 ); 73 setMinimumSize( w+16, h+8 );
74} 74}
75 75
76void OPopupTitle::setIcon( const QPixmap &pix ) 76void OPopupTitle::setIcon( const QPixmap &pix )
77{ 77{
78 miniicon = pix; 78 miniicon = pix;
79 int w = miniicon.width()+fontMetrics().width(titleStr); 79 int w = miniicon.width()+fontMetrics().width(titleStr);
80 int h = QMAX( fontMetrics().height(), miniicon.height() ); 80 int h = QMAX( fontMetrics().height(), miniicon.height() );
81 setMinimumSize( w+16, h+8 ); 81 setMinimumSize( w+16, h+8 );
82} 82}
83 83
84void OPopupTitle::paintEvent(QPaintEvent *) 84void OPopupTitle::paintEvent(QPaintEvent *)
85{ 85{
86 QRect r(rect()); 86 QRect r(rect());
87 QPainter p(this); 87 QPainter p(this);
88 #if QT_VERSION > 290 88 #if QT_VERSION >= 0x030000
89 qApp->style().drawPrimitive(QStyle::PE_HeaderSection, &p, r, palette().active()); 89 qApp->style().drawPrimitive(QStyle::PE_HeaderSection, &p, r, palette().active());
90 #else 90 #else
91 #warning OPopupMenu is not fully functional on Qt2 91 #warning OPopupMenu is not fully functional on Qt2
92 #endif 92 #endif
93 93
94 if (!miniicon.isNull()) 94 if (!miniicon.isNull())
95 p.drawPixmap(4, (r.height()-miniicon.height())/2, miniicon); 95 p.drawPixmap(4, (r.height()-miniicon.height())/2, miniicon);
96 96
97 if (!titleStr.isNull()) 97 if (!titleStr.isNull())
98 { 98 {
99 p.setPen(palette().active().text()); 99 p.setPen(palette().active().text());
100 QFont f = p.font(); 100 QFont f = p.font();
101 f.setBold(true); 101 f.setBold(true);
102 p.setFont(f); 102 p.setFont(f);
103 if(!miniicon.isNull()) 103 if(!miniicon.isNull())
104 { 104 {
105 p.drawText(miniicon.width()+8, 0, width()-(miniicon.width()+8), 105 p.drawText(miniicon.width()+8, 0, width()-(miniicon.width()+8),
106 height(), AlignLeft | AlignVCenter | SingleLine, 106 height(), AlignLeft | AlignVCenter | SingleLine,
107 titleStr); 107 titleStr);
108 } 108 }
109 else 109 else
110 { 110 {
111 p.drawText(0, 0, width(), height(), 111 p.drawText(0, 0, width(), height(),
112 AlignCenter | SingleLine, titleStr); 112 AlignCenter | SingleLine, titleStr);
113 } 113 }
114 } 114 }
115 115
116 p.setPen(palette().active().highlight()); 116 p.setPen(palette().active().highlight());
117 p.drawLine(0, 0, r.right(), 0); 117 p.drawLine(0, 0, r.right(), 0);
118} 118}
119 119
120QSize OPopupTitle::sizeHint() const 120QSize OPopupTitle::sizeHint() const
121{ 121{
122 return(minimumSize()); 122 return(minimumSize());
123} 123}
124 124
125class OPopupMenu::OPopupMenuPrivate 125class OPopupMenu::OPopupMenuPrivate
126{ 126{
127public: 127public:
128 OPopupMenuPrivate () 128 OPopupMenuPrivate ()
129 : noMatches(false) 129 : noMatches(false)
130 , shortcuts(false) 130 , shortcuts(false)
131 , autoExec(false) 131 , autoExec(false)
132 , lastHitIndex(-1) 132 , lastHitIndex(-1)
133 , m_ctxMenu(0) 133 , m_ctxMenu(0)
134 {} 134 {}
135 135
136 ~OPopupMenuPrivate () 136 ~OPopupMenuPrivate ()
@@ -504,97 +504,97 @@ void OPopupMenu::itemHighlighted(int /* whichItem */)
504 { 504 {
505 return; 505 return;
506 } 506 }
507 507
508 d->m_ctxMenu->hide(); 508 d->m_ctxMenu->hide();
509 showCtxMenu(mapFromGlobal(QCursor::pos())); 509 showCtxMenu(mapFromGlobal(QCursor::pos()));
510} 510}
511 511
512void OPopupMenu::showCtxMenu(QPoint pos) 512void OPopupMenu::showCtxMenu(QPoint pos)
513{ 513{
514 OPopupMenuPrivate::s_highlightedItem = idAt(pos); 514 OPopupMenuPrivate::s_highlightedItem = idAt(pos);
515 515
516 if (OPopupMenuPrivate::s_highlightedItem == -1) 516 if (OPopupMenuPrivate::s_highlightedItem == -1)
517 { 517 {
518 OPopupMenuPrivate::s_contextedMenu = 0; 518 OPopupMenuPrivate::s_contextedMenu = 0;
519 return; 519 return;
520 } 520 }
521 521
522 emit aboutToShowContextMenu(this, OPopupMenuPrivate::s_highlightedItem, d->m_ctxMenu); 522 emit aboutToShowContextMenu(this, OPopupMenuPrivate::s_highlightedItem, d->m_ctxMenu);
523 523
524 if (!OPopupMenuPrivate::s_continueCtxMenuShow) 524 if (!OPopupMenuPrivate::s_continueCtxMenuShow)
525 { 525 {
526 OPopupMenuPrivate::s_continueCtxMenuShow = true; 526 OPopupMenuPrivate::s_continueCtxMenuShow = true;
527 return; 527 return;
528 } 528 }
529 529
530 OPopupMenuPrivate::s_contextedMenu = this; 530 OPopupMenuPrivate::s_contextedMenu = this;
531 d->m_ctxMenu->popup(this->mapToGlobal(pos)); 531 d->m_ctxMenu->popup(this->mapToGlobal(pos));
532 connect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int))); 532 connect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int)));
533} 533}
534 534
535void OPopupMenu::ctxMenuHiding() 535void OPopupMenu::ctxMenuHiding()
536{ 536{
537 disconnect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int))); 537 disconnect(this, SIGNAL(highlighted(int)), this, SLOT(itemHighlighted(int)));
538 OPopupMenuPrivate::s_continueCtxMenuShow = true; 538 OPopupMenuPrivate::s_continueCtxMenuShow = true;
539} 539}
540 540
541bool OPopupMenu::eventFilter(QObject* obj, QEvent* event) 541bool OPopupMenu::eventFilter(QObject* obj, QEvent* event)
542{ 542{
543 if (d->m_ctxMenu && obj == this) 543 if (d->m_ctxMenu && obj == this)
544 { 544 {
545 if (event->type() == QEvent::MouseButtonRelease) 545 if (event->type() == QEvent::MouseButtonRelease)
546 { 546 {
547 if (d->m_ctxMenu->isVisible()) 547 if (d->m_ctxMenu->isVisible())
548 { 548 {
549 return true; 549 return true;
550 } 550 }
551 } 551 }
552 #if QT_VERSION > 290 552 #if QT_VERSION >= 0x030000
553 else if (event->type() == QEvent::ContextMenu) 553 else if (event->type() == QEvent::ContextMenu)
554 #else 554 #else
555 else if ( (event->type() == QEvent::MouseButtonPress) && 555 else if ( (event->type() == QEvent::MouseButtonPress) &&
556 ( (QMouseEvent*) event )->button() == QMouseEvent::RightButton ) 556 ( (QMouseEvent*) event )->button() == QMouseEvent::RightButton )
557 #endif 557 #endif
558 { 558 {
559 showCtxMenu(mapFromGlobal(QCursor::pos())); 559 showCtxMenu(mapFromGlobal(QCursor::pos()));
560 return true; 560 return true;
561 } 561 }
562 } 562 }
563 563
564 return QWidget::eventFilter(obj, event); 564 return QWidget::eventFilter(obj, event);
565} 565}
566 566
567void OPopupMenu::hideEvent(QHideEvent*) 567void OPopupMenu::hideEvent(QHideEvent*)
568{ 568{
569 if (d->m_ctxMenu) 569 if (d->m_ctxMenu)
570 { 570 {
571 d->m_ctxMenu->hide(); 571 d->m_ctxMenu->hide();
572 } 572 }
573} 573}
574/** 574/**
575 * end of RMB menus on menus support 575 * end of RMB menus on menus support
576 */ 576 */
577 577
578// Obsolete 578// Obsolete
579OPopupMenu::OPopupMenu(const QString& title, QWidget *parent, const char *name) 579OPopupMenu::OPopupMenu(const QString& title, QWidget *parent, const char *name)
580 : QPopupMenu(parent, name) 580 : QPopupMenu(parent, name)
581{ 581{
582 d = new OPopupMenuPrivate; 582 d = new OPopupMenuPrivate;
583 setTitle(title); 583 setTitle(title);
584} 584}
585 585
586// Obsolete 586// Obsolete
587void OPopupMenu::setTitle(const QString &title) 587void OPopupMenu::setTitle(const QString &title)
588{ 588{
589 OPopupTitle *titleItem = new OPopupTitle(); 589 OPopupTitle *titleItem = new OPopupTitle();
590 titleItem->setTitle(title); 590 titleItem->setTitle(title);
591 insertItem(titleItem); 591 insertItem(titleItem);
592 d->m_lastTitle = title; 592 d->m_lastTitle = title;
593} 593}
594 594
595void OPopupTitle::virtual_hook( int, void* ) 595void OPopupTitle::virtual_hook( int, void* )
596{ /*BASE::virtual_hook( id, data );*/ } 596{ /*BASE::virtual_hook( id, data );*/ }
597 597
598void OPopupMenu::virtual_hook( int, void* ) 598void OPopupMenu::virtual_hook( int, void* )
599{ /*BASE::virtual_hook( id, data );*/ } 599{ /*BASE::virtual_hook( id, data );*/ }
600 600
diff --git a/libopie2/opieui/oselector.cpp b/libopie2/opieui/oselector.cpp
index 05543c5..936dfe6 100644
--- a/libopie2/opieui/oselector.cpp
+++ b/libopie2/opieui/oselector.cpp
@@ -94,97 +94,97 @@ QRect OXYSelector::contentsRect() const
94 94
95void OXYSelector::paintEvent( QPaintEvent *ev ) 95void OXYSelector::paintEvent( QPaintEvent *ev )
96{ 96{
97 QRect cursorRect( px - STORE_W, py - STORE_W, STORE_W2, STORE_W2); 97 QRect cursorRect( px - STORE_W, py - STORE_W, STORE_W2, STORE_W2);
98 QRect paintRect = ev->rect(); 98 QRect paintRect = ev->rect();
99 99
100 QPainter painter; 100 QPainter painter;
101 painter.begin( this ); 101 painter.begin( this );
102 102
103 QBrush brush; 103 QBrush brush;
104 qDrawShadePanel( &painter, 0, 0, width(), height(), colorGroup(), 104 qDrawShadePanel( &painter, 0, 0, width(), height(), colorGroup(),
105 TRUE, 2, &brush ); 105 TRUE, 2, &brush );
106 106
107 drawContents( &painter ); 107 drawContents( &painter );
108 if (paintRect.contains(cursorRect)) 108 if (paintRect.contains(cursorRect))
109 { 109 {
110 bitBlt( &store, 0, 0, this, px - STORE_W, py - STORE_W, 110 bitBlt( &store, 0, 0, this, px - STORE_W, py - STORE_W,
111 STORE_W2, STORE_W2, CopyROP ); 111 STORE_W2, STORE_W2, CopyROP );
112 drawCursor( &painter, px, py ); 112 drawCursor( &painter, px, py );
113 } 113 }
114 else if (paintRect.intersects(cursorRect)) 114 else if (paintRect.intersects(cursorRect))
115 { 115 {
116 repaint( cursorRect, false); 116 repaint( cursorRect, false);
117 } 117 }
118 118
119 painter.end(); 119 painter.end();
120} 120}
121 121
122void OXYSelector::mousePressEvent( QMouseEvent *e ) 122void OXYSelector::mousePressEvent( QMouseEvent *e )
123{ 123{
124 int xVal, yVal; 124 int xVal, yVal;
125 valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); 125 valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal );
126 setValues( xVal, yVal ); 126 setValues( xVal, yVal );
127 127
128 emit valueChanged( xPos, yPos ); 128 emit valueChanged( xPos, yPos );
129} 129}
130 130
131void OXYSelector::mouseMoveEvent( QMouseEvent *e ) 131void OXYSelector::mouseMoveEvent( QMouseEvent *e )
132{ 132{
133 int xVal, yVal; 133 int xVal, yVal;
134 valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); 134 valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal );
135 setValues( xVal, yVal ); 135 setValues( xVal, yVal );
136 136
137 emit valueChanged( xPos, yPos ); 137 emit valueChanged( xPos, yPos );
138} 138}
139 139
140void OXYSelector::wheelEvent( QWheelEvent *e ) 140void OXYSelector::wheelEvent( QWheelEvent *e )
141{ 141{
142 #if QT_VERSION > 290 142 #if QT_VERSION >= 0x030000
143 if ( e->orientation() == Qt::Horizontal ) 143 if ( e->orientation() == Qt::Horizontal )
144 setValues( xValue() + e->delta()/120, yValue() ); 144 setValues( xValue() + e->delta()/120, yValue() );
145 else 145 else
146 setValues( xValue(), yValue() + e->delta()/120 ); 146 setValues( xValue(), yValue() + e->delta()/120 );
147 147
148 emit valueChanged( xPos, yPos ); 148 emit valueChanged( xPos, yPos );
149 #else 149 #else
150 Q_UNUSED( e ) 150 Q_UNUSED( e )
151 #endif 151 #endif
152} 152}
153 153
154void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const 154void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const
155{ 155{
156 xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 ); 156 xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 );
157 yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) ); 157 yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) );
158 158
159 if ( xVal > maxX ) 159 if ( xVal > maxX )
160 xVal = maxX; 160 xVal = maxX;
161 else if ( xVal < minX ) 161 else if ( xVal < minX )
162 xVal = minX; 162 xVal = minX;
163 163
164 if ( yVal > maxY ) 164 if ( yVal > maxY )
165 yVal = maxY; 165 yVal = maxY;
166 else if ( yVal < minY ) 166 else if ( yVal < minY )
167 yVal = minY; 167 yVal = minY;
168} 168}
169 169
170void OXYSelector::setPosition( int xp, int yp ) 170void OXYSelector::setPosition( int xp, int yp )
171{ 171{
172 if ( xp < 2 ) 172 if ( xp < 2 )
173 xp = 2; 173 xp = 2;
174 else if ( xp > width() - 2 ) 174 else if ( xp > width() - 2 )
175 xp = width() - 2; 175 xp = width() - 2;
176 176
177 if ( yp < 2 ) 177 if ( yp < 2 )
178 yp = 2; 178 yp = 2;
179 else if ( yp > height() - 2 ) 179 else if ( yp > height() - 2 )
180 yp = height() - 2; 180 yp = height() - 2;
181 181
182 QPainter painter; 182 QPainter painter;
183 painter.begin( this ); 183 painter.begin( this );
184 184
185 bitBlt( this, px - STORE_W, py - STORE_W, &store, 0, 0, 185 bitBlt( this, px - STORE_W, py - STORE_W, &store, 0, 0,
186 STORE_W2, STORE_W2, CopyROP ); 186 STORE_W2, STORE_W2, CopyROP );
187 bitBlt( &store, 0, 0, this, xp - STORE_W, yp - STORE_W, 187 bitBlt( &store, 0, 0, this, xp - STORE_W, yp - STORE_W,
188 STORE_W2, STORE_W2, CopyROP ); 188 STORE_W2, STORE_W2, CopyROP );
189 drawCursor( &painter, xp, yp ); 189 drawCursor( &painter, xp, yp );
190 px = xp; 190 px = xp;
diff --git a/libopie2/opieui/oselector.h b/libopie2/opieui/oselector.h
index fe75a46..3dbdb38 100644
--- a/libopie2/opieui/oselector.h
+++ b/libopie2/opieui/oselector.h
@@ -163,112 +163,112 @@ public:
163 /** 163 /**
164 * Constructs a one-dimensional selection widget with 164 * Constructs a one-dimensional selection widget with
165 * a given orientation. 165 * a given orientation.
166 */ 166 */
167 OSelector( Orientation o, QWidget *parent = 0L, const char *name = 0L ); 167 OSelector( Orientation o, QWidget *parent = 0L, const char *name = 0L );
168 /* 168 /*
169 * Destructs the widget. 169 * Destructs the widget.
170 */ 170 */
171 ~OSelector(); 171 ~OSelector();
172 172
173 /** 173 /**
174 * @return the orientation of the widget. 174 * @return the orientation of the widget.
175 */ 175 */
176 Orientation orientation() const 176 Orientation orientation() const
177 {return _orientation; } 177 {return _orientation; }
178 178
179 /** 179 /**
180 * @return the rectangle on which subclasses should draw. 180 * @return the rectangle on which subclasses should draw.
181 */ 181 */
182 QRect contentsRect() const; 182 QRect contentsRect() const;
183 183
184 /** 184 /**
185 * Sets the indent option of the widget to i. 185 * Sets the indent option of the widget to i.
186 * This determines whether a shaded frame is drawn. 186 * This determines whether a shaded frame is drawn.
187 */ 187 */
188 void setIndent( bool i ) 188 void setIndent( bool i )
189 {_indent = i; } 189 {_indent = i; }
190 /** 190 /**
191 * @return whether the indent option is set. 191 * @return whether the indent option is set.
192 */ 192 */
193 bool indent() const 193 bool indent() const
194 {return _indent; } 194 {return _indent; }
195 195
196 /** 196 /**
197 * Sets the value. 197 * Sets the value.
198 */ 198 */
199 void setValue(int value) 199 void setValue(int value)
200 { QRangeControl::setValue(value); } 200 { QRangeControl::setValue(value); }
201 201
202 /** 202 /**
203 * @returns the value. 203 * @returns the value.
204 */ 204 */
205 int value() const 205 int value() const
206 { return QRangeControl::value(); } 206 { return QRangeControl::value(); }
207 207
208 /** 208 /**
209 * Sets the min value. 209 * Sets the min value.
210 */ 210 */
211 #if ( QT_VERSION > 290 ) 211 #if ( QT_VERSION >= 0x030000 )
212 void setMinValue(int value) { QRangeControl::setMinValue(value); } 212 void setMinValue(int value) { QRangeControl::setMinValue(value); }
213 #else 213 #else
214 void setMinValue(int value) { QRangeControl::setRange(value,QRangeControl::maxValue()); } 214 void setMinValue(int value) { QRangeControl::setRange(value,QRangeControl::maxValue()); }
215 #endif 215 #endif
216 216
217 /** 217 /**
218 * @return the min value. 218 * @return the min value.
219 */ 219 */
220 int minValue() const 220 int minValue() const
221 { return QRangeControl::minValue(); } 221 { return QRangeControl::minValue(); }
222 222
223 /** 223 /**
224 * Sets the max value. 224 * Sets the max value.
225 */ 225 */
226 #if ( QT_VERSION > 290 ) 226 #if ( QT_VERSION >= 0x030000 )
227 void setMaxValue(int value) { QRangeControl::setMaxValue(value); } 227 void setMaxValue(int value) { QRangeControl::setMaxValue(value); }
228 #else 228 #else
229 void setMaxValue(int value) { QRangeControl::setRange(QRangeControl::minValue(),value); } 229 void setMaxValue(int value) { QRangeControl::setRange(QRangeControl::minValue(),value); }
230 #endif 230 #endif
231 231
232 /** 232 /**
233 * @return the max value. 233 * @return the max value.
234 */ 234 */
235 int maxValue() const 235 int maxValue() const
236 { return QRangeControl::maxValue(); } 236 { return QRangeControl::maxValue(); }
237 237
238signals: 238signals:
239 /** 239 /**
240 * This signal is emitted whenever the user chooses a value, 240 * This signal is emitted whenever the user chooses a value,
241 * e.g. by clicking with the mouse on the widget. 241 * e.g. by clicking with the mouse on the widget.
242 */ 242 */
243 void valueChanged( int value ); 243 void valueChanged( int value );
244 244
245protected: 245protected:
246 /** 246 /**
247 * Override this function to draw the contents of the control. 247 * Override this function to draw the contents of the control.
248 * The default implementation does nothing. 248 * The default implementation does nothing.
249 * 249 *
250 * Draw only within contentsRect(). 250 * Draw only within contentsRect().
251 */ 251 */
252 virtual void drawContents( QPainter * ); 252 virtual void drawContents( QPainter * );
253 /** 253 /**
254 * Override this function to draw the cursor which 254 * Override this function to draw the cursor which
255 * indicates the current value. This function is 255 * indicates the current value. This function is
256 * always called twice, once with argument show=false 256 * always called twice, once with argument show=false
257 * to clear the old cursor, once with argument show=true 257 * to clear the old cursor, once with argument show=true
258 * to draw the new one. 258 * to draw the new one.
259 */ 259 */
260 virtual void drawArrow( QPainter *painter, bool show, const QPoint &pos ); 260 virtual void drawArrow( QPainter *painter, bool show, const QPoint &pos );
261 261
262 /** 262 /**
263 * @reimplemented 263 * @reimplemented
264 */ 264 */
265 virtual void valueChange(); 265 virtual void valueChange();
266 /** 266 /**
267 * @reimplemented 267 * @reimplemented
268 */ 268 */
269 virtual void paintEvent( QPaintEvent * ); 269 virtual void paintEvent( QPaintEvent * );
270 /** 270 /**
271 * @reimplemented 271 * @reimplemented
272 */ 272 */
273 virtual void mousePressEvent( QMouseEvent *e ); 273 virtual void mousePressEvent( QMouseEvent *e );
274 /** 274 /**