summaryrefslogtreecommitdiff
path: root/library
authorar <ar>2005-01-21 19:56:15 (UTC)
committer ar <ar>2005-01-21 19:56:15 (UTC)
commitcd51d382be50bc021739395309e23760f1619759 (patch) (unidiff)
treee76155f772df7faea5fcf38667c6da8c916208db /library
parentfdc37fbd908472e28735a8f0b01e3e66a43535e0 (diff)
downloadopie-cd51d382be50bc021739395309e23760f1619759.zip
opie-cd51d382be50bc021739395309e23760f1619759.tar.gz
opie-cd51d382be50bc021739395309e23760f1619759.tar.bz2
- make opie compilable against qte 2.3.10 snapshot
check QT_VERSION against 0x030000 instead of 300
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/lightstyle.cpp10
-rw-r--r--library/lightstyle.h2
-rw-r--r--library/qpeapplication.cpp4
-rw-r--r--library/qpestyle.cpp4
-rw-r--r--library/qpestyle.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/library/lightstyle.cpp b/library/lightstyle.cpp
index f18bdca..3bd1623 100644
--- a/library/lightstyle.cpp
+++ b/library/lightstyle.cpp
@@ -1,70 +1,70 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "lightstyle.h" 20#include "lightstyle.h"
21 21
22#if QT_VERSION < 300 22#if QT_VERSION < 0x030000
23 23
24#define INCLUDE_MENUITEM_DEF 24#define INCLUDE_MENUITEM_DEF
25#include "qmenubar.h" 25#include "qmenubar.h"
26#include "qapplication.h" 26#include "qapplication.h"
27#include "qpainter.h" 27#include "qpainter.h"
28#include "qpalette.h" 28#include "qpalette.h"
29#include "qframe.h" 29#include "qframe.h"
30#include "qpushbutton.h" 30#include "qpushbutton.h"
31#include "qdrawutil.h" 31#include "qdrawutil.h"
32#include "qscrollbar.h" 32#include "qscrollbar.h"
33#include "qtabbar.h" 33#include "qtabbar.h"
34#include "qguardedptr.h" 34#include "qguardedptr.h"
35#include "qlayout.h" 35#include "qlayout.h"
36#include "qlineedit.h" 36#include "qlineedit.h"
37 37
38 38
39class LightStylePrivate 39class LightStylePrivate
40{ 40{
41public: 41public:
42 LightStylePrivate() 42 LightStylePrivate()
43 : hoverWidget(0), ref(1), savePalette(0) 43 : hoverWidget(0), ref(1), savePalette(0)
44 { 44 {
45 } 45 }
46 46
47 QGuardedPtr<QWidget> hoverWidget; 47 QGuardedPtr<QWidget> hoverWidget;
48 QPalette oldPalette, hoverPalette; 48 QPalette oldPalette, hoverPalette;
49 int ref; 49 int ref;
50 QPoint mousePos; 50 QPoint mousePos;
51 QPalette *savePalette; 51 QPalette *savePalette;
52}; 52};
53 53
54 54
55static LightStylePrivate *singleton = 0; 55static LightStylePrivate *singleton = 0;
56 56
57 57
58LightStyle::LightStyle() 58LightStyle::LightStyle()
59 : QWindowsStyle() 59 : QWindowsStyle()
60{ 60{
61 if (! singleton) { 61 if (! singleton) {
62 singleton = new LightStylePrivate; 62 singleton = new LightStylePrivate;
63 63
64 QPalette pal = QApplication::palette(); 64 QPalette pal = QApplication::palette();
65 singleton->oldPalette = pal; 65 singleton->oldPalette = pal;
66 66
67 QColor bg = pal.color(QPalette::Active, QColorGroup::Background); 67 QColor bg = pal.color(QPalette::Active, QColorGroup::Background);
68 QColor prelight; 68 QColor prelight;
69 69
70 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128) 70 if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128)
@@ -114,114 +114,114 @@ QSize LightStyle::scrollBarExtent() const
114 114
115 115
116int LightStyle::buttonDefaultIndicatorWidth() const 116int LightStyle::buttonDefaultIndicatorWidth() const
117{ 117{
118 return 2; 118 return 2;
119} 119}
120 120
121 121
122int LightStyle::sliderThickness() const 122int LightStyle::sliderThickness() const
123{ 123{
124 return 16; 124 return 16;
125} 125}
126 126
127int LightStyle::sliderLength() const 127int LightStyle::sliderLength() const
128{ 128{
129 return 13; 129 return 13;
130} 130}
131 131
132 132
133int LightStyle::buttonMargin() const 133int LightStyle::buttonMargin() const
134{ 134{
135 return 4; 135 return 4;
136} 136}
137 137
138 138
139QSize LightStyle::exclusiveIndicatorSize() const 139QSize LightStyle::exclusiveIndicatorSize() const
140{ 140{
141 return QSize(13, 13); 141 return QSize(13, 13);
142} 142}
143 143
144 144
145int LightStyle::defaultFrameWidth() const 145int LightStyle::defaultFrameWidth() const
146{ 146{
147 return 2; 147 return 2;
148} 148}
149 149
150 150
151QSize LightStyle::indicatorSize() const 151QSize LightStyle::indicatorSize() const
152{ 152{
153 return QSize(13, 13); 153 return QSize(13, 13);
154} 154}
155 155
156 156
157void LightStyle::polish(QWidget *widget) 157void LightStyle::polish(QWidget *widget)
158{ 158{
159 if (widget->inherits("QPushButton")) 159 if (widget->inherits("QPushButton"))
160 widget->installEventFilter(this); 160 widget->installEventFilter(this);
161 161
162#if QT_VERSION >= 300 162#if QT_VERSION >= 0x030000
163 if (widget->inherits("QLineEdit")) { 163 if (widget->inherits("QLineEdit")) {
164 QLineEdit *lineedit = (QLineEdit *) widget; 164 QLineEdit *lineedit = (QLineEdit *) widget;
165 lineedit->setFrameShape(QFrame::StyledPanel); 165 lineedit->setFrameShape(QFrame::StyledPanel);
166 lineedit->setLineWidth(2); 166 lineedit->setLineWidth(2);
167 } 167 }
168#endif 168#endif
169 169
170 QWindowsStyle::polish(widget); 170 QWindowsStyle::polish(widget);
171} 171}
172 172
173 173
174void LightStyle::unPolish(QWidget *widget) 174void LightStyle::unPolish(QWidget *widget)
175{ 175{
176 if (widget->inherits("QPushButton")) 176 if (widget->inherits("QPushButton"))
177 widget->removeEventFilter(this); 177 widget->removeEventFilter(this);
178 178
179#if QT_VERSION >= 300 179#if QT_VERSION >= 0x030000
180 if (widget->inherits("QLineEdit")) { 180 if (widget->inherits("QLineEdit")) {
181 QLineEdit *lineedit = (QLineEdit *) widget; 181 QLineEdit *lineedit = (QLineEdit *) widget;
182 lineedit->setLineWidth(1); 182 lineedit->setLineWidth(1);
183 lineedit->setFrameShape(QFrame::WinPanel); 183 lineedit->setFrameShape(QFrame::WinPanel);
184 } 184 }
185#endif 185#endif
186 186
187 QWindowsStyle::unPolish(widget); 187 QWindowsStyle::unPolish(widget);
188} 188}
189 189
190 190
191void LightStyle::polish(QApplication *app) 191void LightStyle::polish(QApplication *app)
192{ 192{
193 QPalette pal = app->palette(); 193 QPalette pal = app->palette();
194 194
195 QColorGroup active(pal.color(QPalette::Active, 195 QColorGroup active(pal.color(QPalette::Active,
196 QColorGroup::Foreground), // foreground 196 QColorGroup::Foreground), // foreground
197 pal.color(QPalette::Active, 197 pal.color(QPalette::Active,
198 QColorGroup::Button), // button 198 QColorGroup::Button), // button
199 pal.color(QPalette::Active, 199 pal.color(QPalette::Active,
200 QColorGroup::Background).light(), // light 200 QColorGroup::Background).light(), // light
201 pal.color(QPalette::Active, 201 pal.color(QPalette::Active,
202 QColorGroup::Background).dark(175), // dark 202 QColorGroup::Background).dark(175), // dark
203 pal.color(QPalette::Active, 203 pal.color(QPalette::Active,
204 QColorGroup::Background).dark(110), // mid 204 QColorGroup::Background).dark(110), // mid
205 pal.color(QPalette::Active, 205 pal.color(QPalette::Active,
206 QColorGroup::Text), // text 206 QColorGroup::Text), // text
207 pal.color(QPalette::Active, 207 pal.color(QPalette::Active,
208 QColorGroup::BrightText), // bright text 208 QColorGroup::BrightText), // bright text
209 pal.color(QPalette::Active, 209 pal.color(QPalette::Active,
210 QColorGroup::Base), // base 210 QColorGroup::Base), // base
211 pal.color(QPalette::Active, 211 pal.color(QPalette::Active,
212 QColorGroup::Background)), // background 212 QColorGroup::Background)), // background
213 213
214 214
215 disabled(pal.color(QPalette::Disabled, 215 disabled(pal.color(QPalette::Disabled,
216 QColorGroup::Foreground), // foreground 216 QColorGroup::Foreground), // foreground
217 pal.color(QPalette::Disabled, 217 pal.color(QPalette::Disabled,
218 QColorGroup::Button), // button 218 QColorGroup::Button), // button
219 pal.color(QPalette::Disabled, 219 pal.color(QPalette::Disabled,
220 QColorGroup::Background).light(), // light 220 QColorGroup::Background).light(), // light
221 pal.color(QPalette::Disabled, 221 pal.color(QPalette::Disabled,
222 QColorGroup::Background).dark(), // dark 222 QColorGroup::Background).dark(), // dark
223 pal.color(QPalette::Disabled, 223 pal.color(QPalette::Disabled,
224 QColorGroup::Background).dark(110), // mid 224 QColorGroup::Background).dark(110), // mid
225 pal.color(QPalette::Disabled, 225 pal.color(QPalette::Disabled,
226 QColorGroup::Text), // text 226 QColorGroup::Text), // text
227 pal.color(QPalette::Disabled, 227 pal.color(QPalette::Disabled,
@@ -369,114 +369,114 @@ void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h,
369 369
370 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left 370 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left
371 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top 371 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top
372 372
373 if (sunken) 373 if (sunken)
374 p->setPen(g.light()); 374 p->setPen(g.light());
375 else 375 else
376 p->setPen(g.mid()); 376 p->setPen(g.mid());
377 377
378 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 378 p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1
379 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 379 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1
380 380
381 p->restore(); 381 p->restore();
382} 382}
383 383
384 384
385void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, 385void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
386 const QColorGroup &g, 386 const QColorGroup &g,
387 bool sunken, const QBrush *fill) 387 bool sunken, const QBrush *fill)
388{ 388{
389 drawButton(p, x, y, w, h, g, sunken, fill); 389 drawButton(p, x, y, w, h, g, sunken, fill);
390} 390}
391 391
392 392
393void LightStyle::getButtonShift(int &x, int &y) const 393void LightStyle::getButtonShift(int &x, int &y) const
394{ 394{
395 x = y = 0; 395 x = y = 0;
396} 396}
397 397
398 398
399void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h, 399void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h,
400 const QColorGroup &g, bool, 400 const QColorGroup &g, bool,
401 bool editable, bool, 401 bool editable, bool,
402 const QBrush *fill) 402 const QBrush *fill)
403{ 403{
404 drawButton(p, x, y, w, h, g, FALSE, fill); 404 drawButton(p, x, y, w, h, g, FALSE, fill);
405 405
406 if (editable) { 406 if (editable) {
407 QRect r = comboButtonRect(x, y, w, h); 407 QRect r = comboButtonRect(x, y, w, h);
408 qDrawShadePanel(p, r.x() - 1, r.y() - 1, 408 qDrawShadePanel(p, r.x() - 1, r.y() - 1,
409 r.width() + defaultFrameWidth(), 409 r.width() + defaultFrameWidth(),
410 r.height() + defaultFrameWidth(), 410 r.height() + defaultFrameWidth(),
411 g, TRUE); 411 g, TRUE);
412 } 412 }
413 413
414 int indent = ((y + h) / 2) - 3; 414 int indent = ((y + h) / 2) - 3;
415 int xpos = x; 415 int xpos = x;
416 416
417#if QT_VERSION >= 300 417#if QT_VERSION >= 0x030000
418 if( QApplication::reverseLayout() ) 418 if( QApplication::reverseLayout() )
419 xpos += indent; 419 xpos += indent;
420 else 420 else
421#endif 421#endif
422 xpos += w - indent - 5; 422 xpos += w - indent - 5;
423 423
424 drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill); 424 drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill);
425} 425}
426 426
427 427
428QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const 428QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const
429{ 429{
430 QRect r(x + 3, y + 3, w - 6, h - 6); 430 QRect r(x + 3, y + 3, w - 6, h - 6);
431 int indent = ((y + h) / 2) - 3; 431 int indent = ((y + h) / 2) - 3;
432 r.setRight(r.right() - indent - 10); 432 r.setRight(r.right() - indent - 10);
433 433
434#if QT_VERSION >= 300 434#if QT_VERSION >= 0x030000
435 if( QApplication::reverseLayout() ) 435 if( QApplication::reverseLayout() )
436 r.moveBy( indent + 10, 0 ); 436 r.moveBy( indent + 10, 0 );
437#endif 437#endif
438 438
439 return r; 439 return r;
440} 440}
441 441
442 442
443QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const 443QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const
444{ 444{
445 return comboButtonRect(x, y, w, h); 445 return comboButtonRect(x, y, w, h);
446} 446}
447 447
448 448
449void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h, 449void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h,
450 const QColorGroup &g, bool sunken, 450 const QColorGroup &g, bool sunken,
451 int lw, const QBrush *fill) 451 int lw, const QBrush *fill)
452{ 452{
453 if (lw >= 2) { 453 if (lw >= 2) {
454 if ( fill ) 454 if ( fill )
455 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); 455 p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill);
456 456
457 QPen oldpen = p->pen(); 457 QPen oldpen = p->pen();
458 458
459 // frame 459 // frame
460 p->setPen(g.dark()); 460 p->setPen(g.dark());
461 p->drawLine(x, y + 2, x, y + h - 3); // left 461 p->drawLine(x, y + 2, x, y + h - 3); // left
462 p->drawLine(x + 2, y, x + w - 3, y); // top 462 p->drawLine(x + 2, y, x + w - 3, y); // top
463 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right 463 p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right
464 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom 464 p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom
465 p->drawPoint(x + 1, y + 1); 465 p->drawPoint(x + 1, y + 1);
466 p->drawPoint(x + 1, y + h - 2); 466 p->drawPoint(x + 1, y + h - 2);
467 p->drawPoint(x + w - 2, y + 1); 467 p->drawPoint(x + w - 2, y + 1);
468 p->drawPoint(x + w - 2, y + h - 2); 468 p->drawPoint(x + w - 2, y + h - 2);
469 469
470 // bevel 470 // bevel
471 if (sunken) 471 if (sunken)
472 p->setPen(g.mid()); 472 p->setPen(g.mid());
473 else 473 else
474 p->setPen(g.light()); 474 p->setPen(g.light());
475 475
476 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left 476 p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left
477 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top 477 p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top
478 478
479 if (sunken) 479 if (sunken)
480 p->setPen(g.light()); 480 p->setPen(g.light());
481 else 481 else
482 p->setPen(g.mid()); 482 p->setPen(g.mid());
diff --git a/library/lightstyle.h b/library/lightstyle.h
index c377cc2..0392957 100644
--- a/library/lightstyle.h
+++ b/library/lightstyle.h
@@ -1,77 +1,77 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef LIGHTSTYLE_H 20#ifndef LIGHTSTYLE_H
21#define LIGHTSTYLE_H 21#define LIGHTSTYLE_H
22 22
23 23
24#ifndef QT_H 24#ifndef QT_H
25#include <qstyle.h> 25#include <qstyle.h>
26#include <qwindowsstyle.h> 26#include <qwindowsstyle.h>
27#endif // QT_H 27#endif // QT_H
28 28
29#if QT_VERSION < 300 29#if QT_VERSION < 0x030000
30 30
31#ifdef QT_PLUGIN_STYLE_LIGHT 31#ifdef QT_PLUGIN_STYLE_LIGHT
32# define Q_EXPORT_STYLE_LIGHT 32# define Q_EXPORT_STYLE_LIGHT
33#else 33#else
34# define Q_EXPORT_STYLE_LIGHT Q_EXPORT 34# define Q_EXPORT_STYLE_LIGHT Q_EXPORT
35#endif // QT_PLUGIN_STYLE_LIGHT 35#endif // QT_PLUGIN_STYLE_LIGHT
36 36
37 37
38class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle 38class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle
39{ 39{
40public: 40public:
41 LightStyle(); 41 LightStyle();
42 virtual ~LightStyle(); 42 virtual ~LightStyle();
43 43
44 void polish(QWidget *widget); 44 void polish(QWidget *widget);
45 void unPolish(QWidget*widget); 45 void unPolish(QWidget*widget);
46 46
47 void polish(QApplication *app); 47 void polish(QApplication *app);
48 void unPolish(QApplication *app); 48 void unPolish(QApplication *app);
49 49
50 void polishPopupMenu(QPopupMenu *menu); 50 void polishPopupMenu(QPopupMenu *menu);
51 51
52 void drawPushButton(QPushButton *button, QPainter *p); 52 void drawPushButton(QPushButton *button, QPainter *p);
53 void drawButton(QPainter *p, int x, int y, int w, int h, 53 void drawButton(QPainter *p, int x, int y, int w, int h,
54 const QColorGroup &g, bool sunken = FALSE, 54 const QColorGroup &g, bool sunken = FALSE,
55 const QBrush *fill = 0); 55 const QBrush *fill = 0);
56 void drawBevelButton(QPainter *p, int x, int y, int w, int h, 56 void drawBevelButton(QPainter *p, int x, int y, int w, int h,
57 const QColorGroup &g, bool sunken = FALSE, 57 const QColorGroup &g, bool sunken = FALSE,
58 const QBrush *fill = 0); 58 const QBrush *fill = 0);
59 void getButtonShift(int &x, int &y) const; 59 void getButtonShift(int &x, int &y) const;
60 60
61 void drawComboButton(QPainter *p, int x, int y, int w, int h, 61 void drawComboButton(QPainter *p, int x, int y, int w, int h,
62 const QColorGroup &g, bool sunken = FALSE, 62 const QColorGroup &g, bool sunken = FALSE,
63 bool editable = FALSE, bool = TRUE, 63 bool editable = FALSE, bool = TRUE,
64 const QBrush *fill = 0); 64 const QBrush *fill = 0);
65 QRect comboButtonRect(int x, int y, int w, int h) const; 65 QRect comboButtonRect(int x, int y, int w, int h) const;
66 QRect comboButtonFocusRect(int x, int y, int w, int h) const; 66 QRect comboButtonFocusRect(int x, int y, int w, int h) const;
67 67
68 void drawIndicator(QPainter *p, int x, int y ,int w, int h, 68 void drawIndicator(QPainter *p, int x, int y ,int w, int h,
69 const QColorGroup &g, int state, 69 const QColorGroup &g, int state,
70 bool = FALSE, bool = TRUE); 70 bool = FALSE, bool = TRUE);
71 QSize indicatorSize() const; 71 QSize indicatorSize() const;
72 72
73 void drawExclusiveIndicator(QPainter *p, int x, int y ,int w, int h, 73 void drawExclusiveIndicator(QPainter *p, int x, int y ,int w, int h,
74 const QColorGroup &g, bool on, 74 const QColorGroup &g, bool on,
75 bool = FALSE, bool = TRUE); 75 bool = FALSE, bool = TRUE);
76 QSize exclusiveIndicatorSize() const; 76 QSize exclusiveIndicatorSize() const;
77 77
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index af00f49..1c5ced3 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -15,97 +15,97 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19*/ 19*/
20#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
21#include <stdlib.h> 21#include <stdlib.h>
22#include <unistd.h> 22#include <unistd.h>
23#ifndef Q_OS_MACX 23#ifndef Q_OS_MACX
24#include <linux/limits.h> // needed for some toolchains (PATH_MAX) 24#include <linux/limits.h> // needed for some toolchains (PATH_MAX)
25#endif 25#endif
26#include <qfile.h> 26#include <qfile.h>
27#include <qqueue.h> 27#include <qqueue.h>
28#ifdef Q_WS_QWS 28#ifdef Q_WS_QWS
29#ifndef QT_NO_COP 29#ifndef QT_NO_COP
30#if QT_VERSION <= 231 30#if QT_VERSION <= 231
31#define private public 31#define private public
32#define sendLocally processEvent 32#define sendLocally processEvent
33#include "qcopenvelope_qws.h" 33#include "qcopenvelope_qws.h"
34#undef private 34#undef private
35#else 35#else
36#include "qcopenvelope_qws.h" 36#include "qcopenvelope_qws.h"
37#endif 37#endif
38#endif 38#endif
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40#endif 40#endif
41#include <qtextstream.h> 41#include <qtextstream.h>
42#include <qpalette.h> 42#include <qpalette.h>
43#include <qbuffer.h> 43#include <qbuffer.h>
44#include <qptrdict.h> 44#include <qptrdict.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qdir.h> 46#include <qdir.h>
47#include <qlabel.h> 47#include <qlabel.h>
48#include <qdialog.h> 48#include <qdialog.h>
49#include <qdragobject.h> 49#include <qdragobject.h>
50#include <qtextcodec.h> 50#include <qtextcodec.h>
51#include <qevent.h> 51#include <qevent.h>
52#include <qtooltip.h> 52#include <qtooltip.h>
53#include <qsignal.h> 53#include <qsignal.h>
54#include <qmainwindow.h> 54#include <qmainwindow.h>
55#include <qwidgetlist.h> 55#include <qwidgetlist.h>
56#include <qpixmapcache.h> 56#include <qpixmapcache.h>
57 57
58#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 58#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
59#define QTOPIA_INTERNAL_INITAPP 59#define QTOPIA_INTERNAL_INITAPP
60#include "qpeapplication.h" 60#include "qpeapplication.h"
61#include "qpestyle.h" 61#include "qpestyle.h"
62#include "styleinterface.h" 62#include "styleinterface.h"
63#if QT_VERSION >= 300 63#if QT_VERSION >= 0x030000
64#include <qstylefactory.h> 64#include <qstylefactory.h>
65#else 65#else
66#include <qplatinumstyle.h> 66#include <qplatinumstyle.h>
67#include <qwindowsstyle.h> 67#include <qwindowsstyle.h>
68#include <qmotifstyle.h> 68#include <qmotifstyle.h>
69#include <qmotifplusstyle.h> 69#include <qmotifplusstyle.h>
70#include "lightstyle.h" 70#include "lightstyle.h"
71 71
72#include <qpe/qlibrary.h> 72#include <qpe/qlibrary.h>
73#endif 73#endif
74#include "global.h" 74#include "global.h"
75#include "resource.h" 75#include "resource.h"
76#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 76#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
77#include "qutfcodec.h" 77#include "qutfcodec.h"
78#endif 78#endif
79#include "config.h" 79#include "config.h"
80#include "network.h" 80#include "network.h"
81#ifdef QWS 81#ifdef QWS
82#include "fontmanager.h" 82#include "fontmanager.h"
83#include "fontdatabase.h" 83#include "fontdatabase.h"
84#endif 84#endif
85 85
86#include "alarmserver.h" 86#include "alarmserver.h"
87#include "applnk.h" 87#include "applnk.h"
88#include "qpemenubar.h" 88#include "qpemenubar.h"
89#include "textcodecinterface.h" 89#include "textcodecinterface.h"
90#include "imagecodecinterface.h" 90#include "imagecodecinterface.h"
91#include <qtopia/qpeglobal.h> 91#include <qtopia/qpeglobal.h>
92 92
93#include <unistd.h> 93#include <unistd.h>
94#include <sys/file.h> 94#include <sys/file.h>
95#include <sys/ioctl.h> 95#include <sys/ioctl.h>
96#ifndef QT_NO_SOUND 96#ifndef QT_NO_SOUND
97#include <sys/soundcard.h> 97#include <sys/soundcard.h>
98#endif 98#endif
99#include "qt_override_p.h" 99#include "qt_override_p.h"
100 100
101#include <backend/rohfeedback.h> 101#include <backend/rohfeedback.h>
102 102
103 103
104static bool useBigPixmaps = 0; 104static bool useBigPixmaps = 0;
105 105
106class HackWidget : public QWidget 106class HackWidget : public QWidget
107{ 107{
108public: 108public:
109 bool needsOk() 109 bool needsOk()
110 { return (getWState() & WState_Reserved1 ); } 110 { return (getWState() & WState_Reserved1 ); }
111 111
@@ -1798,97 +1798,97 @@ void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize )
1798 1798
1799 \sa showMainWidget() 1799 \sa showMainWidget()
1800*/ 1800*/
1801void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) 1801void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize )
1802{ 1802{
1803 if ( mw && argc() == 2 ) 1803 if ( mw && argc() == 2 )
1804 Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); 1804 Global::setDocument( mw, QString::fromUtf8(argv()[1]) );
1805 1805
1806 1806
1807// setMainWidget(mw); see above 1807// setMainWidget(mw); see above
1808 d->show(mw, nomaximize ); 1808 d->show(mw, nomaximize );
1809} 1809}
1810 1810
1811 1811
1812/*! 1812/*!
1813 If an application is started via a \link qcop.html QCop\endlink 1813 If an application is started via a \link qcop.html QCop\endlink
1814 message, the application will process the \link qcop.html 1814 message, the application will process the \link qcop.html
1815 QCop\endlink message and then quit. If the application calls this 1815 QCop\endlink message and then quit. If the application calls this
1816 function while processing a \link qcop.html QCop\endlink message, 1816 function while processing a \link qcop.html QCop\endlink message,
1817 after processing its outstanding \link qcop.html QCop\endlink 1817 after processing its outstanding \link qcop.html QCop\endlink
1818 messages the application will start 'properly' and show itself. 1818 messages the application will start 'properly' and show itself.
1819 1819
1820 \sa keepRunning() 1820 \sa keepRunning()
1821*/ 1821*/
1822void QPEApplication::setKeepRunning() 1822void QPEApplication::setKeepRunning()
1823{ 1823{
1824 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 1824 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
1825 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 1825 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
1826 qpeApp->d->keep_running = TRUE; 1826 qpeApp->d->keep_running = TRUE;
1827 } 1827 }
1828} 1828}
1829 1829
1830/*! 1830/*!
1831 Returns TRUE if the application will quit after processing the 1831 Returns TRUE if the application will quit after processing the
1832 current list of qcop messages; otherwise returns FALSE. 1832 current list of qcop messages; otherwise returns FALSE.
1833 1833
1834 \sa setKeepRunning() 1834 \sa setKeepRunning()
1835*/ 1835*/
1836bool QPEApplication::keepRunning() const 1836bool QPEApplication::keepRunning() const
1837{ 1837{
1838 return d->keep_running; 1838 return d->keep_running;
1839} 1839}
1840 1840
1841/*! 1841/*!
1842 \internal 1842 \internal
1843*/ 1843*/
1844void QPEApplication::internalSetStyle( const QString &style ) 1844void QPEApplication::internalSetStyle( const QString &style )
1845{ 1845{
1846#if QT_VERSION >= 300 1846#if QT_VERSION >= 0x030000
1847 if ( style == "QPE" ) { 1847 if ( style == "QPE" ) {
1848 setStyle( new QPEStyle ); 1848 setStyle( new QPEStyle );
1849 } 1849 }
1850 else { 1850 else {
1851 QStyle *s = QStyleFactory::create( style ); 1851 QStyle *s = QStyleFactory::create( style );
1852 if ( s ) 1852 if ( s )
1853 setStyle( s ); 1853 setStyle( s );
1854 } 1854 }
1855#else 1855#else
1856 if ( style == "Windows" ) { 1856 if ( style == "Windows" ) {
1857 setStyle( new QWindowsStyle ); 1857 setStyle( new QWindowsStyle );
1858 } 1858 }
1859 else if ( style == "QPE" ) { 1859 else if ( style == "QPE" ) {
1860 setStyle( new QPEStyle ); 1860 setStyle( new QPEStyle );
1861 } 1861 }
1862 else if ( style == "Light" ) { 1862 else if ( style == "Light" ) {
1863 setStyle( new LightStyle ); 1863 setStyle( new LightStyle );
1864 } 1864 }
1865#ifndef QT_NO_STYLE_PLATINUM 1865#ifndef QT_NO_STYLE_PLATINUM
1866 else if ( style == "Platinum" ) { 1866 else if ( style == "Platinum" ) {
1867 setStyle( new QPlatinumStyle ); 1867 setStyle( new QPlatinumStyle );
1868 } 1868 }
1869#endif 1869#endif
1870#ifndef QT_NO_STYLE_MOTIF 1870#ifndef QT_NO_STYLE_MOTIF
1871 else if ( style == "Motif" ) { 1871 else if ( style == "Motif" ) {
1872 setStyle( new QMotifStyle ); 1872 setStyle( new QMotifStyle );
1873 } 1873 }
1874#endif 1874#endif
1875#ifndef QT_NO_STYLE_MOTIFPLUS 1875#ifndef QT_NO_STYLE_MOTIFPLUS
1876 else if ( style == "MotifPlus" ) { 1876 else if ( style == "MotifPlus" ) {
1877 setStyle( new QMotifPlusStyle ); 1877 setStyle( new QMotifPlusStyle );
1878 } 1878 }
1879#endif 1879#endif
1880 1880
1881 else { 1881 else {
1882 QStyle *sty = 0; 1882 QStyle *sty = 0;
1883 QString path = QPEApplication::qpeDir ( ) + "plugins/styles/"; 1883 QString path = QPEApplication::qpeDir ( ) + "plugins/styles/";
1884 1884
1885#ifdef Q_OS_MACX 1885#ifdef Q_OS_MACX
1886 if ( style. find ( ".dylib" ) > 0 ) 1886 if ( style. find ( ".dylib" ) > 0 )
1887 path += style; 1887 path += style;
1888 else 1888 else
1889 path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility 1889 path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility
1890#else 1890#else
1891 if ( style. find ( ".so" ) > 0 ) 1891 if ( style. find ( ".so" ) > 0 )
1892 path += style; 1892 path += style;
1893 else 1893 else
1894 path = path + "lib" + style. lower ( ) + ".so"; // compatibility 1894 path = path + "lib" + style. lower ( ) + ".so"; // compatibility
diff --git a/library/qpestyle.cpp b/library/qpestyle.cpp
index b61ada4..0566f6b 100644
--- a/library/qpestyle.cpp
+++ b/library/qpestyle.cpp
@@ -1,74 +1,74 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qpestyle.h" 21#include "qpestyle.h"
22 22
23 23
24#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 24#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
25 25
26#if QT_VERSION >= 300 26#if QT_VERSION >= 0x030000
27 27
28#include <qdrawutil.h> 28#include <qdrawutil.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qtabbar.h> 30#include <qtabbar.h>
31 31
32QPEStyle::QPEStyle() 32QPEStyle::QPEStyle()
33{ 33{
34} 34}
35 35
36QPEStyle::~QPEStyle() 36QPEStyle::~QPEStyle()
37{ 37{
38} 38}
39 39
40void QPEStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, 40void QPEStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r,
41 const QColorGroup &cg, SFlags flags, const QStyleOption &data) const 41 const QColorGroup &cg, SFlags flags, const QStyleOption &data) const
42{ 42{
43 switch ( pe ) { 43 switch ( pe ) {
44 case PE_ButtonTool: 44 case PE_ButtonTool:
45 { 45 {
46 QColorGroup mycg = cg; 46 QColorGroup mycg = cg;
47 if ( flags & Style_On ) { 47 if ( flags & Style_On ) {
48 QBrush fill( cg.mid(), Dense4Pattern ); 48 QBrush fill( cg.mid(), Dense4Pattern );
49 mycg.setBrush( QColorGroup::Button, fill ); 49 mycg.setBrush( QColorGroup::Button, fill );
50 } 50 }
51 drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data ); 51 drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data );
52 break; 52 break;
53 } 53 }
54 case PE_ButtonCommand: 54 case PE_ButtonCommand:
55 case PE_ButtonDefault: 55 case PE_ButtonDefault:
56 case PE_ButtonBevel: 56 case PE_ButtonBevel:
57 case PE_HeaderSection: 57 case PE_HeaderSection:
58 { 58 {
59 QPen oldPen = p->pen(); 59 QPen oldPen = p->pen();
60 p->fillRect( r.x()+1, r.y()+1, r.width()-2, r.height()-2, cg.brush(QColorGroup::Button) ); 60 p->fillRect( r.x()+1, r.y()+1, r.width()-2, r.height()-2, cg.brush(QColorGroup::Button) );
61 61
62 int x2 = r.right(); 62 int x2 = r.right();
63 int y2 = r.bottom(); 63 int y2 = r.bottom();
64 64
65 if ( flags & (Style_Sunken | Style_Down | Style_On) ) 65 if ( flags & (Style_Sunken | Style_Down | Style_On) )
66 p->setPen( cg.dark() ); 66 p->setPen( cg.dark() );
67 else 67 else
68 p->setPen( cg.light() ); 68 p->setPen( cg.light() );
69 p->drawLine( r.x(), r.y()+1, r.x(), y2-1 ); 69 p->drawLine( r.x(), r.y()+1, r.x(), y2-1 );
70 p->drawLine( r.x()+1, r.y(), x2-1, r.y() ); 70 p->drawLine( r.x()+1, r.y(), x2-1, r.y() );
71 71
72 if ( flags & (Style_Sunken | Style_Down | Style_On) ) 72 if ( flags & (Style_Sunken | Style_Down | Style_On) )
73 p->setPen( cg.light() ); 73 p->setPen( cg.light() );
74 else 74 else
@@ -384,97 +384,97 @@ int QPEStyle::pixelMetric( PixelMetric metric, const QWidget *widget ) const
384 break; 384 break;
385 case PM_SliderLength: 385 case PM_SliderLength:
386 ret = 12; 386 ret = 12;
387 break; 387 break;
388 default: 388 default:
389 ret = QWindowsStyle::pixelMetric( metric, widget ); 389 ret = QWindowsStyle::pixelMetric( metric, widget );
390 break; 390 break;
391 } 391 }
392 return ret; 392 return ret;
393} 393}
394 394
395QSize QPEStyle::sizeFromContents( ContentsType contents, const QWidget *widget, 395QSize QPEStyle::sizeFromContents( ContentsType contents, const QWidget *widget,
396 const QSize &contentsSize, const QStyleOption &data) const 396 const QSize &contentsSize, const QStyleOption &data) const
397{ 397{
398 QSize sz(contentsSize); 398 QSize sz(contentsSize);
399 399
400 switch ( contents ) { 400 switch ( contents ) {
401 case CT_PopupMenuItem: 401 case CT_PopupMenuItem:
402 { 402 {
403 if ( !widget || data.isDefault() ) 403 if ( !widget || data.isDefault() )
404 break; 404 break;
405 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data ); 405 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data );
406 sz = QSize( sz.width(), sz.height()-2 ); 406 sz = QSize( sz.width(), sz.height()-2 );
407 break; 407 break;
408 } 408 }
409 default: 409 default:
410 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data ); 410 sz = QWindowsStyle::sizeFromContents( contents, widget, contentsSize, data );
411 break; 411 break;
412 } 412 }
413 413
414 return sz; 414 return sz;
415} 415}
416 416
417#else 417#else
418 418
419#include <qfontmetrics.h> 419#include <qfontmetrics.h>
420#include <qpalette.h> 420#include <qpalette.h>
421#include <qdrawutil.h> 421#include <qdrawutil.h>
422#include <qscrollbar.h> 422#include <qscrollbar.h>
423#include <qbutton.h> 423#include <qbutton.h>
424#include <qframe.h> 424#include <qframe.h>
425#include <qtabbar.h> 425#include <qtabbar.h>
426 426
427#define INCLUDE_MENUITEM_DEF 427#define INCLUDE_MENUITEM_DEF
428#include <qmenudata.h> 428#include <qmenudata.h>
429 429
430QPEStyle::QPEStyle() 430QPEStyle::QPEStyle()
431{ 431{
432#if QT_VERSION < 300 432#if QT_VERSION < 0x030000
433 setButtonMargin(buttonMargin()); 433 setButtonMargin(buttonMargin());
434 setScrollBarExtent(scrollBarExtent().width(),scrollBarExtent().height()); 434 setScrollBarExtent(scrollBarExtent().width(),scrollBarExtent().height());
435#endif 435#endif
436} 436}
437 437
438QPEStyle::~QPEStyle() 438QPEStyle::~QPEStyle()
439{ 439{
440} 440}
441 441
442int QPEStyle::buttonMargin() const 442int QPEStyle::buttonMargin() const
443{ 443{
444 return 2; 444 return 2;
445} 445}
446 446
447QSize QPEStyle::scrollBarExtent() const 447QSize QPEStyle::scrollBarExtent() const
448{ 448{
449 return QSize(13,13); 449 return QSize(13,13);
450} 450}
451 451
452void QPEStyle::polish ( QPalette & ) 452void QPEStyle::polish ( QPalette & )
453{ 453{
454} 454}
455 455
456void QPEStyle::polish( QWidget *w ) 456void QPEStyle::polish( QWidget *w )
457{ 457{
458 if ( w->inherits( "QListBox" ) || 458 if ( w->inherits( "QListBox" ) ||
459 w->inherits( "QListView" ) || 459 w->inherits( "QListView" ) ||
460 w->inherits( "QPopupMenu" ) || 460 w->inherits( "QPopupMenu" ) ||
461 w->inherits( "QSpinBox" ) ) { 461 w->inherits( "QSpinBox" ) ) {
462 QFrame *f = (QFrame *)w; 462 QFrame *f = (QFrame *)w;
463 f->setFrameShape( QFrame::StyledPanel ); 463 f->setFrameShape( QFrame::StyledPanel );
464 f->setLineWidth( 1 ); 464 f->setLineWidth( 1 );
465 } 465 }
466} 466}
467 467
468void QPEStyle::unPolish( QWidget *w ) 468void QPEStyle::unPolish( QWidget *w )
469{ 469{
470 if ( w->inherits( "QListBox" ) || 470 if ( w->inherits( "QListBox" ) ||
471 w->inherits( "QListView" ) || 471 w->inherits( "QListView" ) ||
472 w->inherits( "QPopupMenu" ) || 472 w->inherits( "QPopupMenu" ) ||
473 w->inherits( "QSpinBox" ) ) { 473 w->inherits( "QSpinBox" ) ) {
474 QFrame *f = (QFrame *)w; 474 QFrame *f = (QFrame *)w;
475 f->setFrameShape( QFrame::StyledPanel ); 475 f->setFrameShape( QFrame::StyledPanel );
476 f->setLineWidth( 2 ); 476 f->setLineWidth( 2 );
477 } 477 }
478} 478}
479 479
480int QPEStyle::defaultFrameWidth() const 480int QPEStyle::defaultFrameWidth() const
diff --git a/library/qpestyle.h b/library/qpestyle.h
index 19ef346..1bde0ff 100644
--- a/library/qpestyle.h
+++ b/library/qpestyle.h
@@ -1,76 +1,76 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef QPESTYLE_H 21#ifndef QPESTYLE_H
22#define QPESTYLE_H 22#define QPESTYLE_H
23 23
24#ifndef QT_H 24#ifndef QT_H
25#include "qwindowsstyle.h" 25#include "qwindowsstyle.h"
26#endif // QT_H 26#endif // QT_H
27 27
28#if QT_VERSION >= 300 28#if QT_VERSION >= 0x030000
29 29
30class Q_EXPORT QPEStyle : public QWindowsStyle 30class Q_EXPORT QPEStyle : public QWindowsStyle
31{ 31{
32public: 32public:
33 QPEStyle(); 33 QPEStyle();
34 virtual ~QPEStyle(); 34 virtual ~QPEStyle();
35 35
36 virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption & = QStyleOption::Default) const; 36 virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption & = QStyleOption::Default) const;
37 virtual void drawControl( ControlElement ce, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, const QStyleOption & = QStyleOption::Default) const; 37 virtual void drawControl( ControlElement ce, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, const QStyleOption & = QStyleOption::Default) const;
38 virtual void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, SCFlags sub=SC_All, SCFlags subActive=SC_None, const QStyleOption & = QStyleOption::Default) const; 38 virtual void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags how=Style_Default, SCFlags sub=SC_All, SCFlags subActive=SC_None, const QStyleOption & = QStyleOption::Default) const;
39 virtual int pixelMetric( PixelMetric metric, const QWidget *widget=0 ) const; 39 virtual int pixelMetric( PixelMetric metric, const QWidget *widget=0 ) const;
40 virtual QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize, const QStyleOption & = QStyleOption::Default) const; 40 virtual QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize, const QStyleOption & = QStyleOption::Default) const;
41}; 41};
42 42
43#else 43#else
44 44
45class Q_EXPORT QPEStyle : public QWindowsStyle 45class Q_EXPORT QPEStyle : public QWindowsStyle
46{ 46{
47public: 47public:
48 QPEStyle(); 48 QPEStyle();
49 virtual ~QPEStyle(); 49 virtual ~QPEStyle();
50 virtual void polish( QPalette &p ); 50 virtual void polish( QPalette &p );
51 virtual void polish( QWidget *w ); 51 virtual void polish( QWidget *w );
52 virtual void unPolish( QWidget *w ); 52 virtual void unPolish( QWidget *w );
53 53
54 int defaultFrameWidth () const; 54 int defaultFrameWidth () const;
55 void drawPanel ( QPainter * p, int x, int y, int w, int h, 55 void drawPanel ( QPainter * p, int x, int y, int w, int h,
56 const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 ); 56 const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 );
57 void drawButton( QPainter *p, int x, int y, int w, int h, 57 void drawButton( QPainter *p, int x, int y, int w, int h,
58 const QColorGroup &g, bool sunken, const QBrush* fill ); 58 const QColorGroup &g, bool sunken, const QBrush* fill );
59 void drawButtonMask ( QPainter * p, int x, int y, int w, int h ); 59 void drawButtonMask ( QPainter * p, int x, int y, int w, int h );
60 void drawBevelButton( QPainter *p, int x, int y, int w, int h, 60 void drawBevelButton( QPainter *p, int x, int y, int w, int h,
61 const QColorGroup &g, bool sunken=FALSE, const QBrush* fill=0 ); 61 const QColorGroup &g, bool sunken=FALSE, const QBrush* fill=0 );
62 QRect comboButtonRect( int x, int y, int w, int h); 62 QRect comboButtonRect( int x, int y, int w, int h);
63 QRect comboButtonFocusRect( int x, int y, int w, int h); 63 QRect comboButtonFocusRect( int x, int y, int w, int h);
64 void drawComboButton( QPainter *p, int x, int y, int w, int h, 64 void drawComboButton( QPainter *p, int x, int y, int w, int h,
65 const QColorGroup &g, bool sunken, bool, bool enabled, 65 const QColorGroup &g, bool sunken, bool, bool enabled,
66 const QBrush *fill ); 66 const QBrush *fill );
67 void drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h, 67 void drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h,
68 const QColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE ); 68 const QColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE );
69 void drawIndicator ( QPainter * p, int x, int y, int w, int h, 69 void drawIndicator ( QPainter * p, int x, int y, int w, int h,
70 const QColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE ); 70 const QColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE );
71 void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int&); 71 void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int&);
72 void drawScrollBarControls( QPainter*, const QScrollBar*, int sliderStart, uint controls, uint activeControl ); 72 void drawScrollBarControls( QPainter*, const QScrollBar*, int sliderStart, uint controls, uint activeControl );
73 ScrollControl scrollBarPointOver( const QScrollBar* sb, int sliderStart, const QPoint& p ); 73 ScrollControl scrollBarPointOver( const QScrollBar* sb, int sliderStart, const QPoint& p );
74 void drawRiffles( QPainter* p, int x, int y, int w, int h, 74 void drawRiffles( QPainter* p, int x, int y, int w, int h,
75 const QColorGroup &g, bool horizontal ); 75 const QColorGroup &g, bool horizontal );
76 int sliderLength() const; 76 int sliderLength() const;