author | ar <ar> | 2005-01-21 19:56:15 (UTC) |
---|---|---|
committer | ar <ar> | 2005-01-21 19:56:15 (UTC) |
commit | cd51d382be50bc021739395309e23760f1619759 (patch) (unidiff) | |
tree | e76155f772df7faea5fcf38667c6da8c916208db /library | |
parent | fdc37fbd908472e28735a8f0b01e3e66a43535e0 (diff) | |
download | opie-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
-rw-r--r-- | library/lightstyle.cpp | 10 | ||||
-rw-r--r-- | library/lightstyle.h | 2 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 4 | ||||
-rw-r--r-- | library/qpestyle.cpp | 4 | ||||
-rw-r--r-- | library/qpestyle.h | 2 |
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,626 +1,626 @@ | |||
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 | ||
39 | class LightStylePrivate | 39 | class LightStylePrivate |
40 | { | 40 | { |
41 | public: | 41 | public: |
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 | ||
55 | static LightStylePrivate *singleton = 0; | 55 | static LightStylePrivate *singleton = 0; |
56 | 56 | ||
57 | 57 | ||
58 | LightStyle::LightStyle() | 58 | LightStyle::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) |
71 | prelight = pal.color(QPalette::Active, | 71 | prelight = pal.color(QPalette::Active, |
72 | QColorGroup::Background).light(110); | 72 | QColorGroup::Background).light(110); |
73 | else | 73 | else |
74 | prelight = pal.color(QPalette::Active, | 74 | prelight = pal.color(QPalette::Active, |
75 | QColorGroup::Background).light(120); | 75 | QColorGroup::Background).light(120); |
76 | 76 | ||
77 | QColorGroup active2(pal.color(QPalette::Active, | 77 | QColorGroup active2(pal.color(QPalette::Active, |
78 | QColorGroup::Foreground), // foreground | 78 | QColorGroup::Foreground), // foreground |
79 | prelight, // button | 79 | prelight, // button |
80 | prelight.light(), // light | 80 | prelight.light(), // light |
81 | prelight.dark(), // dark | 81 | prelight.dark(), // dark |
82 | prelight.dark(120), // mid | 82 | prelight.dark(120), // mid |
83 | pal.color(QPalette::Active, | 83 | pal.color(QPalette::Active, |
84 | QColorGroup::Text), // text | 84 | QColorGroup::Text), // text |
85 | pal.color(QPalette::Active, | 85 | pal.color(QPalette::Active, |
86 | QColorGroup::BrightText), // bright text | 86 | QColorGroup::BrightText), // bright text |
87 | pal.color(QPalette::Active, | 87 | pal.color(QPalette::Active, |
88 | QColorGroup::Base), // base | 88 | QColorGroup::Base), // base |
89 | bg); // background | 89 | bg); // background |
90 | active2.setColor(QColorGroup::Highlight, | 90 | active2.setColor(QColorGroup::Highlight, |
91 | pal.color(QPalette::Active, QColorGroup::Highlight)); | 91 | pal.color(QPalette::Active, QColorGroup::Highlight)); |
92 | 92 | ||
93 | singleton->hoverPalette = pal; | 93 | singleton->hoverPalette = pal; |
94 | singleton->hoverPalette.setActive(active2); | 94 | singleton->hoverPalette.setActive(active2); |
95 | singleton->hoverPalette.setInactive(active2); | 95 | singleton->hoverPalette.setInactive(active2); |
96 | } else | 96 | } else |
97 | singleton->ref++; | 97 | singleton->ref++; |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | LightStyle::~LightStyle() | 101 | LightStyle::~LightStyle() |
102 | { | 102 | { |
103 | if (singleton && singleton->ref-- <= 0) { | 103 | if (singleton && singleton->ref-- <= 0) { |
104 | delete singleton; | 104 | delete singleton; |
105 | singleton = 0; | 105 | singleton = 0; |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | QSize LightStyle::scrollBarExtent() const | 110 | QSize LightStyle::scrollBarExtent() const |
111 | { | 111 | { |
112 | return QSize(12 + defaultFrameWidth(), 12 + defaultFrameWidth()); | 112 | return QSize(12 + defaultFrameWidth(), 12 + defaultFrameWidth()); |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | int LightStyle::buttonDefaultIndicatorWidth() const | 116 | int LightStyle::buttonDefaultIndicatorWidth() const |
117 | { | 117 | { |
118 | return 2; | 118 | return 2; |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | int LightStyle::sliderThickness() const | 122 | int LightStyle::sliderThickness() const |
123 | { | 123 | { |
124 | return 16; | 124 | return 16; |
125 | } | 125 | } |
126 | 126 | ||
127 | int LightStyle::sliderLength() const | 127 | int LightStyle::sliderLength() const |
128 | { | 128 | { |
129 | return 13; | 129 | return 13; |
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | int LightStyle::buttonMargin() const | 133 | int LightStyle::buttonMargin() const |
134 | { | 134 | { |
135 | return 4; | 135 | return 4; |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | QSize LightStyle::exclusiveIndicatorSize() const | 139 | QSize LightStyle::exclusiveIndicatorSize() const |
140 | { | 140 | { |
141 | return QSize(13, 13); | 141 | return QSize(13, 13); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | int LightStyle::defaultFrameWidth() const | 145 | int LightStyle::defaultFrameWidth() const |
146 | { | 146 | { |
147 | return 2; | 147 | return 2; |
148 | } | 148 | } |
149 | 149 | ||
150 | 150 | ||
151 | QSize LightStyle::indicatorSize() const | 151 | QSize LightStyle::indicatorSize() const |
152 | { | 152 | { |
153 | return QSize(13, 13); | 153 | return QSize(13, 13); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | void LightStyle::polish(QWidget *widget) | 157 | void 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 | ||
174 | void LightStyle::unPolish(QWidget *widget) | 174 | void 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 | ||
191 | void LightStyle::polish(QApplication *app) | 191 | void 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, |
228 | QColorGroup::BrightText), // bright text | 228 | QColorGroup::BrightText), // bright text |
229 | pal.color(QPalette::Disabled, | 229 | pal.color(QPalette::Disabled, |
230 | QColorGroup::Base), // base | 230 | QColorGroup::Base), // base |
231 | pal.color(QPalette::Disabled, | 231 | pal.color(QPalette::Disabled, |
232 | QColorGroup::Background)); // background | 232 | QColorGroup::Background)); // background |
233 | 233 | ||
234 | active.setColor(QColorGroup::Highlight, | 234 | active.setColor(QColorGroup::Highlight, |
235 | pal.color(QPalette::Active, QColorGroup::Highlight)); | 235 | pal.color(QPalette::Active, QColorGroup::Highlight)); |
236 | disabled.setColor(QColorGroup::Highlight, | 236 | disabled.setColor(QColorGroup::Highlight, |
237 | pal.color(QPalette::Disabled, QColorGroup::Highlight)); | 237 | pal.color(QPalette::Disabled, QColorGroup::Highlight)); |
238 | 238 | ||
239 | active.setColor(QColorGroup::HighlightedText, | 239 | active.setColor(QColorGroup::HighlightedText, |
240 | pal.color(QPalette::Active, QColorGroup::HighlightedText)); | 240 | pal.color(QPalette::Active, QColorGroup::HighlightedText)); |
241 | disabled.setColor(QColorGroup::HighlightedText, | 241 | disabled.setColor(QColorGroup::HighlightedText, |
242 | pal.color(QPalette::Disabled, QColorGroup::HighlightedText)); | 242 | pal.color(QPalette::Disabled, QColorGroup::HighlightedText)); |
243 | 243 | ||
244 | pal.setActive(active); | 244 | pal.setActive(active); |
245 | pal.setInactive(active); | 245 | pal.setInactive(active); |
246 | pal.setDisabled(disabled); | 246 | pal.setDisabled(disabled); |
247 | 247 | ||
248 | singleton->oldPalette = pal; | 248 | singleton->oldPalette = pal; |
249 | 249 | ||
250 | QColor bg = pal.color(QPalette::Active, QColorGroup::Background); | 250 | QColor bg = pal.color(QPalette::Active, QColorGroup::Background); |
251 | QColor prelight; | 251 | QColor prelight; |
252 | 252 | ||
253 | if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128) | 253 | if ( (bg.red() + bg.green() + bg.blue()) / 3 > 128) |
254 | prelight = pal.color(QPalette::Active, | 254 | prelight = pal.color(QPalette::Active, |
255 | QColorGroup::Background).light(110); | 255 | QColorGroup::Background).light(110); |
256 | else | 256 | else |
257 | prelight = pal.color(QPalette::Active, | 257 | prelight = pal.color(QPalette::Active, |
258 | QColorGroup::Background).light(120); | 258 | QColorGroup::Background).light(120); |
259 | 259 | ||
260 | QColorGroup active2(pal.color(QPalette::Active, | 260 | QColorGroup active2(pal.color(QPalette::Active, |
261 | QColorGroup::Foreground), // foreground | 261 | QColorGroup::Foreground), // foreground |
262 | prelight, // button | 262 | prelight, // button |
263 | prelight.light(), // light | 263 | prelight.light(), // light |
264 | prelight.dark(), // dark | 264 | prelight.dark(), // dark |
265 | prelight.dark(120), // mid | 265 | prelight.dark(120), // mid |
266 | pal.color(QPalette::Active, | 266 | pal.color(QPalette::Active, |
267 | QColorGroup::Text), // text | 267 | QColorGroup::Text), // text |
268 | pal.color(QPalette::Active, | 268 | pal.color(QPalette::Active, |
269 | QColorGroup::BrightText), // bright text | 269 | QColorGroup::BrightText), // bright text |
270 | pal.color(QPalette::Active, | 270 | pal.color(QPalette::Active, |
271 | QColorGroup::Base), // base | 271 | QColorGroup::Base), // base |
272 | bg); // background | 272 | bg); // background |
273 | active2.setColor(QColorGroup::Highlight, | 273 | active2.setColor(QColorGroup::Highlight, |
274 | pal.color(QPalette::Active, QColorGroup::Highlight)); | 274 | pal.color(QPalette::Active, QColorGroup::Highlight)); |
275 | 275 | ||
276 | singleton->hoverPalette = pal; | 276 | singleton->hoverPalette = pal; |
277 | singleton->hoverPalette.setActive(active2); | 277 | singleton->hoverPalette.setActive(active2); |
278 | singleton->hoverPalette.setInactive(active2); | 278 | singleton->hoverPalette.setInactive(active2); |
279 | 279 | ||
280 | app->setPalette(pal); | 280 | app->setPalette(pal); |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void LightStyle::unPolish(QApplication *app) | 284 | void LightStyle::unPolish(QApplication *app) |
285 | { | 285 | { |
286 | app->setPalette(singleton->oldPalette); | 286 | app->setPalette(singleton->oldPalette); |
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | void LightStyle::polishPopupMenu(QPopupMenu *menu) | 290 | void LightStyle::polishPopupMenu(QPopupMenu *menu) |
291 | { | 291 | { |
292 | menu->setMouseTracking(TRUE); | 292 | menu->setMouseTracking(TRUE); |
293 | } | 293 | } |
294 | 294 | ||
295 | 295 | ||
296 | void LightStyle::drawPushButton(QPushButton *button, QPainter *p) | 296 | void LightStyle::drawPushButton(QPushButton *button, QPainter *p) |
297 | { | 297 | { |
298 | int x1, y1, x2, y2; | 298 | int x1, y1, x2, y2; |
299 | button->rect().coords(&x1, &y1, &x2, &y2); | 299 | button->rect().coords(&x1, &y1, &x2, &y2); |
300 | 300 | ||
301 | if (button->isDefault()) { | 301 | if (button->isDefault()) { |
302 | p->save(); | 302 | p->save(); |
303 | p->setPen(button->palette().active().color(QColorGroup::Highlight)); | 303 | p->setPen(button->palette().active().color(QColorGroup::Highlight)); |
304 | p->setBrush(button->palette().active().brush(QColorGroup::Highlight)); | 304 | p->setBrush(button->palette().active().brush(QColorGroup::Highlight)); |
305 | p->drawRoundRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 15, 15); | 305 | p->drawRoundRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, 15, 15); |
306 | p->restore(); | 306 | p->restore(); |
307 | } | 307 | } |
308 | 308 | ||
309 | if (button->isDefault() || button->autoDefault()) { | 309 | if (button->isDefault() || button->autoDefault()) { |
310 | x1 += buttonDefaultIndicatorWidth(); | 310 | x1 += buttonDefaultIndicatorWidth(); |
311 | y1 += buttonDefaultIndicatorWidth(); | 311 | y1 += buttonDefaultIndicatorWidth(); |
312 | x2 -= buttonDefaultIndicatorWidth(); | 312 | x2 -= buttonDefaultIndicatorWidth(); |
313 | y2 -= buttonDefaultIndicatorWidth(); | 313 | y2 -= buttonDefaultIndicatorWidth(); |
314 | 314 | ||
315 | if (button->isDefault()) { | 315 | if (button->isDefault()) { |
316 | QPointArray pa(8); | 316 | QPointArray pa(8); |
317 | pa.setPoint(0, x1 + 2, y1 ); | 317 | pa.setPoint(0, x1 + 2, y1 ); |
318 | pa.setPoint(1, x2 - 1, y1 ); | 318 | pa.setPoint(1, x2 - 1, y1 ); |
319 | pa.setPoint(2, x2 + 1, y1 + 2); | 319 | pa.setPoint(2, x2 + 1, y1 + 2); |
320 | pa.setPoint(3, x2 + 1, y2 - 2); | 320 | pa.setPoint(3, x2 + 1, y2 - 2); |
321 | pa.setPoint(4, x2 - 2, y2 + 1); | 321 | pa.setPoint(4, x2 - 2, y2 + 1); |
322 | pa.setPoint(5, x1 + 2, y2 + 1); | 322 | pa.setPoint(5, x1 + 2, y2 + 1); |
323 | pa.setPoint(6, x1, y2 - 1); | 323 | pa.setPoint(6, x1, y2 - 1); |
324 | pa.setPoint(7, x1, y1 + 2); | 324 | pa.setPoint(7, x1, y1 + 2); |
325 | QRegion r(pa); | 325 | QRegion r(pa); |
326 | p->setClipRegion(r); | 326 | p->setClipRegion(r); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | QBrush fill; | 330 | QBrush fill; |
331 | if (button->isDown() || button->isOn()) | 331 | if (button->isDown() || button->isOn()) |
332 | fill = button->colorGroup().brush(QColorGroup::Mid); | 332 | fill = button->colorGroup().brush(QColorGroup::Mid); |
333 | else | 333 | else |
334 | fill = button->colorGroup().brush(QColorGroup::Button); | 334 | fill = button->colorGroup().brush(QColorGroup::Button); |
335 | 335 | ||
336 | if ( !button->isFlat() || button->isOn() || button->isDown() ) | 336 | if ( !button->isFlat() || button->isOn() || button->isDown() ) |
337 | drawButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1, | 337 | drawButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1, |
338 | button->colorGroup(), button->isOn() || button->isDown(), &fill); | 338 | button->colorGroup(), button->isOn() || button->isDown(), &fill); |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
342 | void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h, | 342 | void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h, |
343 | const QColorGroup &g, | 343 | const QColorGroup &g, |
344 | bool sunken, const QBrush *fill) | 344 | bool sunken, const QBrush *fill) |
345 | { | 345 | { |
346 | p->save(); | 346 | p->save(); |
347 | if ( fill ) | 347 | if ( fill ) |
348 | p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); | 348 | p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); |
349 | else | 349 | else |
350 | p->fillRect(x + 2, y + 2, w - 4, h - 4, | 350 | p->fillRect(x + 2, y + 2, w - 4, h - 4, |
351 | QBrush(sunken ? g.mid() : g.button())); | 351 | QBrush(sunken ? g.mid() : g.button())); |
352 | 352 | ||
353 | // frame | 353 | // frame |
354 | p->setPen(g.dark()); | 354 | p->setPen(g.dark()); |
355 | p->drawLine(x, y + 2, x, y + h - 3); // left | 355 | p->drawLine(x, y + 2, x, y + h - 3); // left |
356 | p->drawLine(x + 2, y, x + w - 3, y); // top | 356 | p->drawLine(x + 2, y, x + w - 3, y); // top |
357 | p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right | 357 | p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right |
358 | p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom | 358 | p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom |
359 | p->drawPoint(x + 1, y + 1); | 359 | p->drawPoint(x + 1, y + 1); |
360 | p->drawPoint(x + 1, y + h - 2); | 360 | p->drawPoint(x + 1, y + h - 2); |
361 | p->drawPoint(x + w - 2, y + 1); | 361 | p->drawPoint(x + w - 2, y + 1); |
362 | p->drawPoint(x + w - 2, y + h - 2); | 362 | p->drawPoint(x + w - 2, y + h - 2); |
363 | 363 | ||
364 | // bevel | 364 | // bevel |
365 | if (sunken) | 365 | if (sunken) |
366 | p->setPen(g.mid()); | 366 | p->setPen(g.mid()); |
367 | else | 367 | else |
368 | p->setPen(g.light()); | 368 | p->setPen(g.light()); |
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 | ||
385 | void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, | 385 | void 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 | ||
393 | void LightStyle::getButtonShift(int &x, int &y) const | 393 | void LightStyle::getButtonShift(int &x, int &y) const |
394 | { | 394 | { |
395 | x = y = 0; | 395 | x = y = 0; |
396 | } | 396 | } |
397 | 397 | ||
398 | 398 | ||
399 | void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h, | 399 | void 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 | ||
428 | QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const | 428 | QRect 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 | ||
443 | QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const | 443 | QRect 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 | ||
449 | void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h, | 449 | void 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()); |
483 | 483 | ||
484 | p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 | 484 | p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 |
485 | p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 | 485 | p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 |
486 | 486 | ||
487 | // corners | 487 | // corners |
488 | p->setPen(g.background()); | 488 | p->setPen(g.background()); |
489 | p->drawLine(x, y, x + 1, y); | 489 | p->drawLine(x, y, x + 1, y); |
490 | p->drawLine(x, y + h - 1, x + 1, y + h - 1); | 490 | p->drawLine(x, y + h - 1, x + 1, y + h - 1); |
491 | p->drawLine(x + w - 2, y, x + w - 1, y); | 491 | p->drawLine(x + w - 2, y, x + w - 1, y); |
492 | p->drawLine(x + w - 2, y + h - 1, x + w - 1, y + h - 1); | 492 | p->drawLine(x + w - 2, y + h - 1, x + w - 1, y + h - 1); |
493 | p->drawPoint(x, y + 1); | 493 | p->drawPoint(x, y + 1); |
494 | p->drawPoint(x, y + h - 2); | 494 | p->drawPoint(x, y + h - 2); |
495 | p->drawPoint(x + w - 1, y + 1); | 495 | p->drawPoint(x + w - 1, y + 1); |
496 | p->drawPoint(x + w - 1, y + h - 2); | 496 | p->drawPoint(x + w - 1, y + h - 2); |
497 | 497 | ||
498 | p->setPen(oldpen); | 498 | p->setPen(oldpen); |
499 | } else | 499 | } else |
500 | qDrawShadePanel(p, x, y, w, h, g, sunken, lw, fill); | 500 | qDrawShadePanel(p, x, y, w, h, g, sunken, lw, fill); |
501 | } | 501 | } |
502 | 502 | ||
503 | 503 | ||
504 | void LightStyle::drawIndicator(QPainter *p, int x, int y ,int w, int h, | 504 | void LightStyle::drawIndicator(QPainter *p, int x, int y ,int w, int h, |
505 | const QColorGroup &g, int state, | 505 | const QColorGroup &g, int state, |
506 | bool down, bool) | 506 | bool down, bool) |
507 | { | 507 | { |
508 | drawButton(p, x, y, w, h, g, TRUE, | 508 | drawButton(p, x, y, w, h, g, TRUE, |
509 | &g.brush(down ? QColorGroup::Mid : QColorGroup::Base)); | 509 | &g.brush(down ? QColorGroup::Mid : QColorGroup::Base)); |
510 | 510 | ||
511 | p->save(); | 511 | p->save(); |
512 | 512 | ||
513 | p->setPen(g.foreground()); | 513 | p->setPen(g.foreground()); |
514 | if (state == QButton::NoChange) { | 514 | if (state == QButton::NoChange) { |
515 | p->drawLine(x + 3, y + h / 2, x + w - 4, y + h / 2); | 515 | p->drawLine(x + 3, y + h / 2, x + w - 4, y + h / 2); |
516 | p->drawLine(x + 3, y + 1 + h / 2, x + w - 4, y + 1 + h / 2); | 516 | p->drawLine(x + 3, y + 1 + h / 2, x + w - 4, y + 1 + h / 2); |
517 | p->drawLine(x + 3, y - 1 + h / 2, x + w - 4, y - 1 + h / 2); | 517 | p->drawLine(x + 3, y - 1 + h / 2, x + w - 4, y - 1 + h / 2); |
518 | } else if (state == QButton::On) { | 518 | } else if (state == QButton::On) { |
519 | p->drawLine(x + 4, y + 3, x + w - 4, y + h - 5); | 519 | p->drawLine(x + 4, y + 3, x + w - 4, y + h - 5); |
520 | p->drawLine(x + 3, y + 3, x + w - 4, y + h - 4); | 520 | p->drawLine(x + 3, y + 3, x + w - 4, y + h - 4); |
521 | p->drawLine(x + 3, y + 4, x + w - 5, y + h - 4); | 521 | p->drawLine(x + 3, y + 4, x + w - 5, y + h - 4); |
522 | p->drawLine(x + 3, y + h - 5, x + w - 5, y + 3); | 522 | p->drawLine(x + 3, y + h - 5, x + w - 5, y + 3); |
523 | p->drawLine(x + 3, y + h - 4, x + w - 4, y + 3); | 523 | p->drawLine(x + 3, y + h - 4, x + w - 4, y + 3); |
524 | p->drawLine(x + 4, y + h - 4, x + w - 4, y + 4); | 524 | p->drawLine(x + 4, y + h - 4, x + w - 4, y + 4); |
525 | } | 525 | } |
526 | 526 | ||
527 | p->restore(); | 527 | p->restore(); |
528 | } | 528 | } |
529 | 529 | ||
530 | 530 | ||
531 | void LightStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, int h, | 531 | void LightStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, int h, |
532 | const QColorGroup &g, bool on, | 532 | const QColorGroup &g, bool on, |
533 | bool down, bool) | 533 | bool down, bool) |
534 | { | 534 | { |
535 | p->save(); | 535 | p->save(); |
536 | 536 | ||
537 | p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | 537 | p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); |
538 | 538 | ||
539 | p->setPen(g.dark()); | 539 | p->setPen(g.dark()); |
540 | p->drawArc(x, y, w, h, 0, 16*360); | 540 | p->drawArc(x, y, w, h, 0, 16*360); |
541 | p->setPen(g.mid()); | 541 | p->setPen(g.mid()); |
542 | p->drawArc(x + 1, y + 1, w - 2, h - 2, 45*16, 180*16); | 542 | p->drawArc(x + 1, y + 1, w - 2, h - 2, 45*16, 180*16); |
543 | p->setPen(g.light()); | 543 | p->setPen(g.light()); |
544 | p->drawArc(x + 1, y + 1, w - 2, h - 2, 235*16, 180*16); | 544 | p->drawArc(x + 1, y + 1, w - 2, h - 2, 235*16, 180*16); |
545 | 545 | ||
546 | p->setPen(down ? g.mid() : g.base()); | 546 | p->setPen(down ? g.mid() : g.base()); |
547 | p->setBrush(down ? g.mid() : g.base()); | 547 | p->setBrush(down ? g.mid() : g.base()); |
548 | p->drawEllipse(x + 2, y + 2, w - 4, h - 4); | 548 | p->drawEllipse(x + 2, y + 2, w - 4, h - 4); |
549 | 549 | ||
550 | if (on) { | 550 | if (on) { |
551 | p->setBrush(g.foreground()); | 551 | p->setBrush(g.foreground()); |
552 | p->drawEllipse(x + 3, y + 3, w - x - 6, h - y - 6); | 552 | p->drawEllipse(x + 3, y + 3, w - x - 6, h - y - 6); |
553 | } | 553 | } |
554 | 554 | ||
555 | p->restore(); | 555 | p->restore(); |
556 | } | 556 | } |
557 | 557 | ||
558 | 558 | ||
559 | 559 | ||
560 | #if 1 | 560 | #if 1 |
561 | //copied from QPE style | 561 | //copied from QPE style |
562 | void LightStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected ) | 562 | void LightStyle::drawTab( QPainter *p, const QTabBar *tb, QTab *t, bool selected ) |
563 | { | 563 | { |
564 | #if 0 | 564 | #if 0 |
565 | //We can't do this, because QTabBar::focusInEvent redraws the | 565 | //We can't do this, because QTabBar::focusInEvent redraws the |
566 | // tab label with the default font. | 566 | // tab label with the default font. |
567 | QFont f = tb->font(); | 567 | QFont f = tb->font(); |
568 | f.setBold( selected ); | 568 | f.setBold( selected ); |
569 | p->setFont( f ); | 569 | p->setFont( f ); |
570 | #endif | 570 | #endif |
571 | QRect r( t->rect() ); | 571 | QRect r( t->rect() ); |
572 | if ( tb->shape() == QTabBar::RoundedAbove ) { | 572 | if ( tb->shape() == QTabBar::RoundedAbove ) { |
573 | p->setPen( tb->colorGroup().light() ); | 573 | p->setPen( tb->colorGroup().light() ); |
574 | p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() ); | 574 | p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() ); |
575 | if ( r.left() == 0 ) | 575 | if ( r.left() == 0 ) |
576 | p->drawPoint( tb->rect().bottomLeft() ); | 576 | p->drawPoint( tb->rect().bottomLeft() ); |
577 | else { | 577 | else { |
578 | p->setPen( tb->colorGroup().light() ); | 578 | p->setPen( tb->colorGroup().light() ); |
579 | p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() ); | 579 | p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() ); |
580 | } | 580 | } |
581 | 581 | ||
582 | if ( selected ) { | 582 | if ( selected ) { |
583 | p->setPen( tb->colorGroup().background() ); | 583 | p->setPen( tb->colorGroup().background() ); |
584 | p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); | 584 | p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); |
585 | p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-2), | 585 | p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-2), |
586 | tb->colorGroup().brush( QColorGroup::Background )); | 586 | tb->colorGroup().brush( QColorGroup::Background )); |
587 | 587 | ||
588 | } else { | 588 | } else { |
589 | r.setRect( r.left() + 2, r.top() + 2, | 589 | r.setRect( r.left() + 2, r.top() + 2, |
590 | r.width() - 4, r.height() - 2 ); | 590 | r.width() - 4, r.height() - 2 ); |
591 | p->setPen( tb->colorGroup().button() ); | 591 | p->setPen( tb->colorGroup().button() ); |
592 | p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); | 592 | p->drawLine( r.left()+2, r.top()+1, r.right()-2, r.top()+1 ); |
593 | p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-3), | 593 | p->fillRect( QRect( r.left()+1, r.top()+2, r.width()-2, r.height()-3), |
594 | tb->colorGroup().brush( QColorGroup::Button )); | 594 | tb->colorGroup().brush( QColorGroup::Button )); |
595 | //do shading; will not work for pixmap brushes | 595 | //do shading; will not work for pixmap brushes |
596 | QColor bg = tb->colorGroup().button(); | 596 | QColor bg = tb->colorGroup().button(); |
597 | // int h,s,v; | 597 | // int h,s,v; |
598 | // bg.hsv( &h, &s, &v ); | 598 | // bg.hsv( &h, &s, &v ); |
599 | int n = r.height()/2; | 599 | int n = r.height()/2; |
600 | int dark = 100; | 600 | int dark = 100; |
601 | for ( int i = 1; i < n; i++ ) { | 601 | for ( int i = 1; i < n; i++ ) { |
602 | dark = (dark * (100+(i*15)/n) )/100; | 602 | dark = (dark * (100+(i*15)/n) )/100; |
603 | p->setPen( bg.dark( dark ) ); | 603 | p->setPen( bg.dark( dark ) ); |
604 | int y = r.bottom()-n+i; | 604 | int y = r.bottom()-n+i; |
605 | int x1 = r.left()+1; | 605 | int x1 = r.left()+1; |
606 | int x2 = r.right()-1; | 606 | int x2 = r.right()-1; |
607 | p->drawLine( x1, y, x2, y ); | 607 | p->drawLine( x1, y, x2, y ); |
608 | } | 608 | } |
609 | 609 | ||
610 | } | 610 | } |
611 | 611 | ||
612 | p->setPen( tb->colorGroup().light() ); | 612 | p->setPen( tb->colorGroup().light() ); |
613 | p->drawLine( r.left(), r.bottom()-1, r.left(), r.top() + 2 ); | 613 | p->drawLine( r.left(), r.bottom()-1, r.left(), r.top() + 2 ); |
614 | p->drawPoint( r.left()+1, r.top() + 1 ); | 614 | p->drawPoint( r.left()+1, r.top() + 1 ); |
615 | p->drawLine( r.left()+2, r.top(), | 615 | p->drawLine( r.left()+2, r.top(), |
616 | r.right() - 2, r.top() ); | 616 | r.right() - 2, r.top() ); |
617 | 617 | ||
618 | p->setPen( tb->colorGroup().dark() ); | 618 | p->setPen( tb->colorGroup().dark() ); |
619 | p->drawPoint( r.right() - 1, r.top() + 1 ); | 619 | p->drawPoint( r.right() - 1, r.top() + 1 ); |
620 | p->drawLine( r.right(), r.top() + 2, r.right(), r.bottom() - 1); | 620 | p->drawLine( r.right(), r.top() + 2, r.right(), r.bottom() - 1); |
621 | } else if ( tb->shape() == QTabBar::RoundedBelow ) { | 621 | } else if ( tb->shape() == QTabBar::RoundedBelow ) { |
622 | if ( selected ) { | 622 | if ( selected ) { |
623 | p->setPen( tb->colorGroup().background() ); | 623 | p->setPen( tb->colorGroup().background() ); |
624 | p->drawLine( r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 ); | 624 | p->drawLine( r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 ); |
625 | p->fillRect( QRect( r.left()+1, r.top(), r.width()-2, r.height()-2), | 625 | p->fillRect( QRect( r.left()+1, r.top(), r.width()-2, r.height()-2), |
626 | tb->palette().normal().brush( QColorGroup::Background )); | 626 | tb->palette().normal().brush( QColorGroup::Background )); |
diff --git a/library/lightstyle.h b/library/lightstyle.h index c377cc2..0392957 100644 --- a/library/lightstyle.h +++ b/library/lightstyle.h | |||
@@ -1,120 +1,120 @@ | |||
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 | ||
38 | class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle | 38 | class Q_EXPORT_STYLE_LIGHT LightStyle : public QWindowsStyle |
39 | { | 39 | { |
40 | public: | 40 | public: |
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 | ||
78 | void drawPanel(QPainter * p, int x, int y, int w, int h, | 78 | void drawPanel(QPainter * p, int x, int y, int w, int h, |
79 | const QColorGroup &g, bool sunken = FALSE, | 79 | const QColorGroup &g, bool sunken = FALSE, |
80 | int = 1, const QBrush * = 0); | 80 | int = 1, const QBrush * = 0); |
81 | 81 | ||
82 | void scrollBarMetrics( const QScrollBar *, | 82 | void scrollBarMetrics( const QScrollBar *, |
83 | int &, int &, int &, int & ) const; | 83 | int &, int &, int &, int & ) const; |
84 | void drawScrollBarControls(QPainter* p, const QScrollBar* sb, | 84 | void drawScrollBarControls(QPainter* p, const QScrollBar* sb, |
85 | int sliderStart, uint controls, | 85 | int sliderStart, uint controls, |
86 | uint activeControl); | 86 | uint activeControl); |
87 | QStyle::ScrollControl scrollBarPointOver(const QScrollBar *, int, const QPoint& p); | 87 | QStyle::ScrollControl scrollBarPointOver(const QScrollBar *, int, const QPoint& p); |
88 | 88 | ||
89 | void drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab, bool selected); | 89 | void drawTab(QPainter *p, const QTabBar *tabbar, QTab *tab, bool selected); |
90 | 90 | ||
91 | void drawSlider(QPainter *p, int x, int y, int w, int h, | 91 | void drawSlider(QPainter *p, int x, int y, int w, int h, |
92 | const QColorGroup &g, Qt::Orientation orientation, | 92 | const QColorGroup &g, Qt::Orientation orientation, |
93 | bool, bool); | 93 | bool, bool); |
94 | void drawSliderGroove(QPainter *p, int x, int y, int w, int h, | 94 | void drawSliderGroove(QPainter *p, int x, int y, int w, int h, |
95 | const QColorGroup& g, QCOORD, | 95 | const QColorGroup& g, QCOORD, |
96 | Qt::Orientation ); | 96 | Qt::Orientation ); |
97 | 97 | ||
98 | void drawToolBarHandle(QPainter *, const QRect &, Qt::Orientation, | 98 | void drawToolBarHandle(QPainter *, const QRect &, Qt::Orientation, |
99 | bool, const QColorGroup &, bool = FALSE ); | 99 | bool, const QColorGroup &, bool = FALSE ); |
100 | 100 | ||
101 | QSize scrollBarExtent() const; | 101 | QSize scrollBarExtent() const; |
102 | int buttonDefaultIndicatorWidth() const; | 102 | int buttonDefaultIndicatorWidth() const; |
103 | int buttonMargin() const; | 103 | int buttonMargin() const; |
104 | int sliderThickness() const; | 104 | int sliderThickness() const; |
105 | int sliderLength() const; | 105 | int sliderLength() const; |
106 | int defaultFrameWidth() const; | 106 | int defaultFrameWidth() const; |
107 | 107 | ||
108 | int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); | 108 | int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); |
109 | int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); | 109 | int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); |
110 | void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, | 110 | void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, |
111 | const QPalette& pal, | 111 | const QPalette& pal, |
112 | bool act, bool enabled, int x, int y, int w, int h); | 112 | bool act, bool enabled, int x, int y, int w, int h); |
113 | 113 | ||
114 | protected: | 114 | protected: |
115 | bool eventFilter(QObject *, QEvent *); | 115 | bool eventFilter(QObject *, QEvent *); |
116 | }; | 116 | }; |
117 | 117 | ||
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | #endif // LIGHTSTYLE_H | 120 | #endif // LIGHTSTYLE_H |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index af00f49..1c5ced3 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1,255 +1,255 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the 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 | #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 | ||
104 | static bool useBigPixmaps = 0; | 104 | static bool useBigPixmaps = 0; |
105 | 105 | ||
106 | class HackWidget : public QWidget | 106 | class HackWidget : public QWidget |
107 | { | 107 | { |
108 | public: | 108 | public: |
109 | bool needsOk() | 109 | bool needsOk() |
110 | { return (getWState() & WState_Reserved1 ); } | 110 | { return (getWState() & WState_Reserved1 ); } |
111 | 111 | ||
112 | QRect normalGeometry() | 112 | QRect normalGeometry() |
113 | { return topData()->normalGeometry; }; | 113 | { return topData()->normalGeometry; }; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | class QPEApplicationData | 116 | class QPEApplicationData |
117 | { | 117 | { |
118 | public: | 118 | public: |
119 | QPEApplicationData ( ) : | 119 | QPEApplicationData ( ) : |
120 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 120 | presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
121 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 121 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
122 | keep_running( true ), qcopQok( false ), | 122 | keep_running( true ), qcopQok( false ), |
123 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), | 123 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), |
124 | bigIconSize( 32 ), qpe_main_widget( 0 ) | 124 | bigIconSize( 32 ), qpe_main_widget( 0 ) |
125 | { | 125 | { |
126 | Config cfg( "qpe" ); | 126 | Config cfg( "qpe" ); |
127 | cfg.setGroup( "Appearance" ); | 127 | cfg.setGroup( "Appearance" ); |
128 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); | 128 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); |
129 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); | 129 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); |
130 | fontSize = cfg.readNumEntry( "FontSize", 10 ); | 130 | fontSize = cfg.readNumEntry( "FontSize", 10 ); |
131 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); | 131 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); |
132 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); | 132 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); |
133 | #ifdef OPIE_WITHROHFEEDBACK | 133 | #ifdef OPIE_WITHROHFEEDBACK |
134 | RoH = 0; | 134 | RoH = 0; |
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | 137 | ||
138 | int presstimer; | 138 | int presstimer; |
139 | QWidget* presswidget; | 139 | QWidget* presswidget; |
140 | QPoint presspos; | 140 | QPoint presspos; |
141 | #ifdef OPIE_WITHROHFEEDBACK | 141 | #ifdef OPIE_WITHROHFEEDBACK |
142 | Opie::Internal::RoHFeedback *RoH; | 142 | Opie::Internal::RoHFeedback *RoH; |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | bool rightpressed : 1; | 145 | bool rightpressed : 1; |
146 | bool kbgrabbed : 1; | 146 | bool kbgrabbed : 1; |
147 | bool notbusysent : 1; | 147 | bool notbusysent : 1; |
148 | bool preloaded : 1; | 148 | bool preloaded : 1; |
149 | bool forceshow : 1; | 149 | bool forceshow : 1; |
150 | bool nomaximize : 1; | 150 | bool nomaximize : 1; |
151 | bool keep_running : 1; | 151 | bool keep_running : 1; |
152 | bool qcopQok : 1; | 152 | bool qcopQok : 1; |
153 | 153 | ||
154 | QCString fontFamily; | 154 | QCString fontFamily; |
155 | int fontSize; | 155 | int fontSize; |
156 | int smallIconSize; | 156 | int smallIconSize; |
157 | int bigIconSize; | 157 | int bigIconSize; |
158 | 158 | ||
159 | QString appName; | 159 | QString appName; |
160 | struct QCopRec | 160 | struct QCopRec |
161 | { | 161 | { |
162 | QCopRec( const QCString &ch, const QCString &msg, | 162 | QCopRec( const QCString &ch, const QCString &msg, |
163 | const QByteArray &d ) : | 163 | const QByteArray &d ) : |
164 | channel( ch ), message( msg ), data( d ) | 164 | channel( ch ), message( msg ), data( d ) |
165 | { } | 165 | { } |
166 | 166 | ||
167 | QCString channel; | 167 | QCString channel; |
168 | QCString message; | 168 | QCString message; |
169 | QByteArray data; | 169 | QByteArray data; |
170 | }; | 170 | }; |
171 | QWidget* qpe_main_widget; | 171 | QWidget* qpe_main_widget; |
172 | QGuardedPtr<QWidget> lastraised; | 172 | QGuardedPtr<QWidget> lastraised; |
173 | QQueue<QCopRec> qcopq; | 173 | QQueue<QCopRec> qcopq; |
174 | QString styleName; | 174 | QString styleName; |
175 | QString decorationName; | 175 | QString decorationName; |
176 | 176 | ||
177 | void enqueueQCop( const QCString &ch, const QCString &msg, | 177 | void enqueueQCop( const QCString &ch, const QCString &msg, |
178 | const QByteArray &data ) | 178 | const QByteArray &data ) |
179 | { | 179 | { |
180 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); | 180 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); |
181 | } | 181 | } |
182 | void sendQCopQ() | 182 | void sendQCopQ() |
183 | { | 183 | { |
184 | if (!qcopQok ) | 184 | if (!qcopQok ) |
185 | return; | 185 | return; |
186 | 186 | ||
187 | QCopRec * r; | 187 | QCopRec * r; |
188 | 188 | ||
189 | while((r=qcopq.dequeue())) { | 189 | while((r=qcopq.dequeue())) { |
190 | // remove from queue before sending... | 190 | // remove from queue before sending... |
191 | // event loop can come around again before getting | 191 | // event loop can come around again before getting |
192 | // back from sendLocally | 192 | // back from sendLocally |
193 | #ifndef QT_NO_COP | 193 | #ifndef QT_NO_COP |
194 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 194 | QCopChannel::sendLocally( r->channel, r->message, r->data ); |
195 | #endif | 195 | #endif |
196 | 196 | ||
197 | delete r; | 197 | delete r; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | static void show_mx(QWidget* mw, bool nomaximize, QString &strName) { | 201 | static void show_mx(QWidget* mw, bool nomaximize, QString &strName) { |
202 | if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) | 202 | if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) |
203 | { | 203 | { |
204 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); | 204 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); |
205 | } | 205 | } |
206 | QPoint p; | 206 | QPoint p; |
207 | QSize s; | 207 | QSize s; |
208 | bool max; | 208 | bool max; |
209 | 209 | ||
210 | if ( mw->isVisible() ) { | 210 | if ( mw->isVisible() ) { |
211 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 211 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
212 | mw->resize(s); | 212 | mw->resize(s); |
213 | mw->move(p); | 213 | mw->move(p); |
214 | } | 214 | } |
215 | mw->raise(); | 215 | mw->raise(); |
216 | } else { | 216 | } else { |
217 | 217 | ||
218 | if ( mw->layout() && mw->inherits("QDialog") ) { | 218 | if ( mw->layout() && mw->inherits("QDialog") ) { |
219 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 219 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
220 | mw->resize(s); | 220 | mw->resize(s); |
221 | mw->move(p); | 221 | mw->move(p); |
222 | 222 | ||
223 | if ( max && !nomaximize ) { | 223 | if ( max && !nomaximize ) { |
224 | mw->showMaximized(); | 224 | mw->showMaximized(); |
225 | } else { | 225 | } else { |
226 | mw->show(); | 226 | mw->show(); |
227 | } | 227 | } |
228 | } else { | 228 | } else { |
229 | QPEApplication::showDialog((QDialog*)mw,nomaximize); | 229 | QPEApplication::showDialog((QDialog*)mw,nomaximize); |
230 | } | 230 | } |
231 | } else { | 231 | } else { |
232 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 232 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
233 | mw->resize(s); | 233 | mw->resize(s); |
234 | mw->move(p); | 234 | mw->move(p); |
235 | } else { //no stored rectangle, make an estimation | 235 | } else { //no stored rectangle, make an estimation |
236 | int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; | 236 | int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2; |
237 | int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; | 237 | int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2; |
238 | mw->move( QMAX(x,0), QMAX(y,0) ); | 238 | mw->move( QMAX(x,0), QMAX(y,0) ); |
239 | #ifdef Q_WS_QWS | 239 | #ifdef Q_WS_QWS |
240 | if ( !nomaximize ) | 240 | if ( !nomaximize ) |
241 | mw->showMaximized(); | 241 | mw->showMaximized(); |
242 | #endif | 242 | #endif |
243 | } | 243 | } |
244 | if ( max && !nomaximize ) | 244 | if ( max && !nomaximize ) |
245 | mw->showMaximized(); | 245 | mw->showMaximized(); |
246 | else | 246 | else |
247 | mw->show(); | 247 | mw->show(); |
248 | } | 248 | } |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) | 252 | static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s) |
253 | { | 253 | { |
254 | maximized = TRUE; | 254 | maximized = TRUE; |
255 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button | 255 | // 350 is the trigger in qwsdefaultdecoration for providing a resize button |
@@ -1654,385 +1654,385 @@ bool QPEApplication::raiseAppropriateWindow() | |||
1654 | if ( list ) { | 1654 | if ( list ) { |
1655 | bool foundlast = FALSE; | 1655 | bool foundlast = FALSE; |
1656 | QWidget* topsub = 0; | 1656 | QWidget* topsub = 0; |
1657 | if ( d->lastraised ) { | 1657 | if ( d->lastraised ) { |
1658 | for (QWidget* w = list->first(); w; w = list->next()) { | 1658 | for (QWidget* w = list->first(); w; w = list->next()) { |
1659 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { | 1659 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { |
1660 | if ( w == d->lastraised ) | 1660 | if ( w == d->lastraised ) |
1661 | foundlast = TRUE; | 1661 | foundlast = TRUE; |
1662 | if ( foundlast ) { | 1662 | if ( foundlast ) { |
1663 | w->raise(); | 1663 | w->raise(); |
1664 | topsub = w; | 1664 | topsub = w; |
1665 | } | 1665 | } |
1666 | } | 1666 | } |
1667 | } | 1667 | } |
1668 | } | 1668 | } |
1669 | for (QWidget* w = list->first(); w; w = list->next()) { | 1669 | for (QWidget* w = list->first(); w; w = list->next()) { |
1670 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { | 1670 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { |
1671 | if ( w == d->lastraised ) | 1671 | if ( w == d->lastraised ) |
1672 | break; | 1672 | break; |
1673 | w->raise(); | 1673 | w->raise(); |
1674 | topsub = w; | 1674 | topsub = w; |
1675 | } | 1675 | } |
1676 | } | 1676 | } |
1677 | d->lastraised = topsub; | 1677 | d->lastraised = topsub; |
1678 | delete list; | 1678 | delete list; |
1679 | } | 1679 | } |
1680 | 1680 | ||
1681 | // 3. Raise the active modal widget. | 1681 | // 3. Raise the active modal widget. |
1682 | if ( topm ) { | 1682 | if ( topm ) { |
1683 | topm->show(); | 1683 | topm->show(); |
1684 | topm->raise(); | 1684 | topm->raise(); |
1685 | // If we haven't already handled the fastAppShowing message | 1685 | // If we haven't already handled the fastAppShowing message |
1686 | if (!top && d->preloaded) { | 1686 | if (!top && d->preloaded) { |
1687 | #ifndef QT_NO_COP | 1687 | #ifndef QT_NO_COP |
1688 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1688 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1689 | e << d->appName; | 1689 | e << d->appName; |
1690 | #endif | 1690 | #endif |
1691 | } | 1691 | } |
1692 | r = FALSE; | 1692 | r = FALSE; |
1693 | } | 1693 | } |
1694 | 1694 | ||
1695 | return r; | 1695 | return r; |
1696 | } | 1696 | } |
1697 | 1697 | ||
1698 | 1698 | ||
1699 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | 1699 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) |
1700 | { | 1700 | { |
1701 | #ifdef Q_WS_QWS | 1701 | #ifdef Q_WS_QWS |
1702 | 1702 | ||
1703 | if ( msg == "quit()" ) { | 1703 | if ( msg == "quit()" ) { |
1704 | tryQuit(); | 1704 | tryQuit(); |
1705 | } | 1705 | } |
1706 | else if ( msg == "quitIfInvisible()" ) { | 1706 | else if ( msg == "quitIfInvisible()" ) { |
1707 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) | 1707 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) |
1708 | quit(); | 1708 | quit(); |
1709 | } | 1709 | } |
1710 | else if ( msg == "close()" ) { | 1710 | else if ( msg == "close()" ) { |
1711 | hideOrQuit(); | 1711 | hideOrQuit(); |
1712 | } | 1712 | } |
1713 | else if ( msg == "disablePreload()" ) { | 1713 | else if ( msg == "disablePreload()" ) { |
1714 | d->preloaded = FALSE; | 1714 | d->preloaded = FALSE; |
1715 | d->keep_running = TRUE; | 1715 | d->keep_running = TRUE; |
1716 | /* so that quit will quit */ | 1716 | /* so that quit will quit */ |
1717 | } | 1717 | } |
1718 | else if ( msg == "enablePreload()" ) { | 1718 | else if ( msg == "enablePreload()" ) { |
1719 | if (d->qpe_main_widget) | 1719 | if (d->qpe_main_widget) |
1720 | d->preloaded = TRUE; | 1720 | d->preloaded = TRUE; |
1721 | d->keep_running = TRUE; | 1721 | d->keep_running = TRUE; |
1722 | /* so next quit won't quit */ | 1722 | /* so next quit won't quit */ |
1723 | } | 1723 | } |
1724 | else if ( msg == "raise()" ) { | 1724 | else if ( msg == "raise()" ) { |
1725 | d->keep_running = TRUE; | 1725 | d->keep_running = TRUE; |
1726 | d->notbusysent = FALSE; | 1726 | d->notbusysent = FALSE; |
1727 | raiseAppropriateWindow(); | 1727 | raiseAppropriateWindow(); |
1728 | // Tell the system we're still chugging along... | 1728 | // Tell the system we're still chugging along... |
1729 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1729 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1730 | e << d->appName; | 1730 | e << d->appName; |
1731 | } | 1731 | } |
1732 | else if ( msg == "flush()" ) { | 1732 | else if ( msg == "flush()" ) { |
1733 | emit flush(); | 1733 | emit flush(); |
1734 | // we need to tell the desktop | 1734 | // we need to tell the desktop |
1735 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); | 1735 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); |
1736 | e << d->appName; | 1736 | e << d->appName; |
1737 | } | 1737 | } |
1738 | else if ( msg == "reload()" ) { | 1738 | else if ( msg == "reload()" ) { |
1739 | emit reload(); | 1739 | emit reload(); |
1740 | } | 1740 | } |
1741 | else if ( msg == "setDocument(QString)" ) { | 1741 | else if ( msg == "setDocument(QString)" ) { |
1742 | d->keep_running = TRUE; | 1742 | d->keep_running = TRUE; |
1743 | QDataStream stream( data, IO_ReadOnly ); | 1743 | QDataStream stream( data, IO_ReadOnly ); |
1744 | QString doc; | 1744 | QString doc; |
1745 | stream >> doc; | 1745 | stream >> doc; |
1746 | QWidget *mw = mainWidget(); | 1746 | QWidget *mw = mainWidget(); |
1747 | if ( !mw ) | 1747 | if ( !mw ) |
1748 | mw = d->qpe_main_widget; | 1748 | mw = d->qpe_main_widget; |
1749 | if ( mw ) | 1749 | if ( mw ) |
1750 | Global::setDocument( mw, doc ); | 1750 | Global::setDocument( mw, doc ); |
1751 | 1751 | ||
1752 | } else if ( msg == "QPEProcessQCop()" ) { | 1752 | } else if ( msg == "QPEProcessQCop()" ) { |
1753 | processQCopFile(); | 1753 | processQCopFile(); |
1754 | d->sendQCopQ(); | 1754 | d->sendQCopQ(); |
1755 | }else | 1755 | }else |
1756 | { | 1756 | { |
1757 | bool p = d->keep_running; | 1757 | bool p = d->keep_running; |
1758 | d->keep_running = FALSE; | 1758 | d->keep_running = FALSE; |
1759 | emit appMessage( msg, data); | 1759 | emit appMessage( msg, data); |
1760 | if ( d->keep_running ) { | 1760 | if ( d->keep_running ) { |
1761 | d->notbusysent = FALSE; | 1761 | d->notbusysent = FALSE; |
1762 | raiseAppropriateWindow(); | 1762 | raiseAppropriateWindow(); |
1763 | if ( !p ) { | 1763 | if ( !p ) { |
1764 | // Tell the system we're still chugging along... | 1764 | // Tell the system we're still chugging along... |
1765 | #ifndef QT_NO_COP | 1765 | #ifndef QT_NO_COP |
1766 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1766 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1767 | e << d->appName; | 1767 | e << d->appName; |
1768 | #endif | 1768 | #endif |
1769 | } | 1769 | } |
1770 | } | 1770 | } |
1771 | if ( p ) | 1771 | if ( p ) |
1772 | d->keep_running = p; | 1772 | d->keep_running = p; |
1773 | } | 1773 | } |
1774 | #endif | 1774 | #endif |
1775 | } | 1775 | } |
1776 | 1776 | ||
1777 | 1777 | ||
1778 | /*! | 1778 | /*! |
1779 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1779 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1780 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1780 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1781 | 1781 | ||
1782 | \sa showMainDocumentWidget() | 1782 | \sa showMainDocumentWidget() |
1783 | */ | 1783 | */ |
1784 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1784 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1785 | { | 1785 | { |
1786 | // setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit | 1786 | // setMainWidget(mw); this breaks FastLoading because lastWindowClose() would quit |
1787 | d->show(mw, nomaximize ); | 1787 | d->show(mw, nomaximize ); |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | /*! | 1790 | /*! |
1791 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1791 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1792 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1792 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1793 | 1793 | ||
1794 | This calls designates the application as | 1794 | This calls designates the application as |
1795 | a \link docwidget.html document-oriented\endlink application. | 1795 | a \link docwidget.html document-oriented\endlink application. |
1796 | 1796 | ||
1797 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1797 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1798 | 1798 | ||
1799 | \sa showMainWidget() | 1799 | \sa showMainWidget() |
1800 | */ | 1800 | */ |
1801 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1801 | void 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 | */ |
1822 | void QPEApplication::setKeepRunning() | 1822 | void 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 | */ |
1836 | bool QPEApplication::keepRunning() const | 1836 | bool 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 | */ |
1844 | void QPEApplication::internalSetStyle( const QString &style ) | 1844 | void 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 |
1895 | #endif | 1895 | #endif |
1896 | static QLibrary *lastlib = 0; | 1896 | static QLibrary *lastlib = 0; |
1897 | static StyleInterface *lastiface = 0; | 1897 | static StyleInterface *lastiface = 0; |
1898 | 1898 | ||
1899 | QLibrary *lib = new QLibrary ( path ); | 1899 | QLibrary *lib = new QLibrary ( path ); |
1900 | StyleInterface *iface = 0; | 1900 | StyleInterface *iface = 0; |
1901 | 1901 | ||
1902 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) | 1902 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1903 | sty = iface-> style ( ); | 1903 | sty = iface-> style ( ); |
1904 | 1904 | ||
1905 | if ( sty ) { | 1905 | if ( sty ) { |
1906 | setStyle ( sty ); | 1906 | setStyle ( sty ); |
1907 | 1907 | ||
1908 | if ( lastiface ) | 1908 | if ( lastiface ) |
1909 | lastiface-> release ( ); | 1909 | lastiface-> release ( ); |
1910 | lastiface = iface; | 1910 | lastiface = iface; |
1911 | 1911 | ||
1912 | if ( lastlib ) { | 1912 | if ( lastlib ) { |
1913 | lastlib-> unload ( ); | 1913 | lastlib-> unload ( ); |
1914 | delete lastlib; | 1914 | delete lastlib; |
1915 | } | 1915 | } |
1916 | lastlib = lib; | 1916 | lastlib = lib; |
1917 | } | 1917 | } |
1918 | else { | 1918 | else { |
1919 | if ( iface ) | 1919 | if ( iface ) |
1920 | iface-> release ( ); | 1920 | iface-> release ( ); |
1921 | delete lib; | 1921 | delete lib; |
1922 | 1922 | ||
1923 | setStyle ( new LightStyle ( )); | 1923 | setStyle ( new LightStyle ( )); |
1924 | } | 1924 | } |
1925 | } | 1925 | } |
1926 | #endif | 1926 | #endif |
1927 | } | 1927 | } |
1928 | 1928 | ||
1929 | /*! | 1929 | /*! |
1930 | \internal | 1930 | \internal |
1931 | */ | 1931 | */ |
1932 | void QPEApplication::prepareForTermination( bool willrestart ) | 1932 | void QPEApplication::prepareForTermination( bool willrestart ) |
1933 | { | 1933 | { |
1934 | if ( willrestart ) { | 1934 | if ( willrestart ) { |
1935 | QLabel *lblWait = new QLabel( tr( "Please wait..." ), 0, "wait hack", QWidget::WStyle_Customize | | 1935 | QLabel *lblWait = new QLabel( tr( "Please wait..." ), 0, "wait hack", QWidget::WStyle_Customize | |
1936 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1936 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1937 | lblWait->setAlignment( QWidget::AlignCenter ); | 1937 | lblWait->setAlignment( QWidget::AlignCenter ); |
1938 | lblWait->show(); | 1938 | lblWait->show(); |
1939 | lblWait->showMaximized(); | 1939 | lblWait->showMaximized(); |
1940 | } | 1940 | } |
1941 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 1941 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
1942 | } | 1942 | } |
1943 | processEvents(); // ensure the message goes out. | 1943 | processEvents(); // ensure the message goes out. |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | /*! | 1946 | /*! |
1947 | \internal | 1947 | \internal |
1948 | */ | 1948 | */ |
1949 | void QPEApplication::shutdown() | 1949 | void QPEApplication::shutdown() |
1950 | { | 1950 | { |
1951 | // Implement in server's QPEApplication subclass | 1951 | // Implement in server's QPEApplication subclass |
1952 | } | 1952 | } |
1953 | 1953 | ||
1954 | /*! | 1954 | /*! |
1955 | \internal | 1955 | \internal |
1956 | */ | 1956 | */ |
1957 | void QPEApplication::restart() | 1957 | void QPEApplication::restart() |
1958 | { | 1958 | { |
1959 | // Implement in server's QPEApplication subclass | 1959 | // Implement in server's QPEApplication subclass |
1960 | } | 1960 | } |
1961 | 1961 | ||
1962 | static QPtrDict<void>* stylusDict = 0; | 1962 | static QPtrDict<void>* stylusDict = 0; |
1963 | static void createDict() | 1963 | static void createDict() |
1964 | { | 1964 | { |
1965 | if ( !stylusDict ) | 1965 | if ( !stylusDict ) |
1966 | stylusDict = new QPtrDict<void>; | 1966 | stylusDict = new QPtrDict<void>; |
1967 | } | 1967 | } |
1968 | 1968 | ||
1969 | /*! | 1969 | /*! |
1970 | Returns the current StylusMode for widget \a w. | 1970 | Returns the current StylusMode for widget \a w. |
1971 | 1971 | ||
1972 | \sa setStylusOperation() StylusMode | 1972 | \sa setStylusOperation() StylusMode |
1973 | */ | 1973 | */ |
1974 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1974 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
1975 | { | 1975 | { |
1976 | if ( stylusDict ) | 1976 | if ( stylusDict ) |
1977 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 1977 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
1978 | return LeftOnly; | 1978 | return LeftOnly; |
1979 | } | 1979 | } |
1980 | 1980 | ||
1981 | /*! | 1981 | /*! |
1982 | \enum QPEApplication::StylusMode | 1982 | \enum QPEApplication::StylusMode |
1983 | 1983 | ||
1984 | \value LeftOnly the stylus only generates LeftButton | 1984 | \value LeftOnly the stylus only generates LeftButton |
1985 | events (the default). | 1985 | events (the default). |
1986 | \value RightOnHold the stylus generates RightButton events | 1986 | \value RightOnHold the stylus generates RightButton events |
1987 | if the user uses the press-and-hold gesture. | 1987 | if the user uses the press-and-hold gesture. |
1988 | 1988 | ||
1989 | \sa setStylusOperation() stylusOperation() | 1989 | \sa setStylusOperation() stylusOperation() |
1990 | */ | 1990 | */ |
1991 | 1991 | ||
1992 | /*! | 1992 | /*! |
1993 | Causes widget \a w to receive mouse events according to the stylus | 1993 | Causes widget \a w to receive mouse events according to the stylus |
1994 | \a mode. | 1994 | \a mode. |
1995 | 1995 | ||
1996 | \sa stylusOperation() StylusMode | 1996 | \sa stylusOperation() StylusMode |
1997 | */ | 1997 | */ |
1998 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) | 1998 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) |
1999 | { | 1999 | { |
2000 | createDict(); | 2000 | createDict(); |
2001 | if ( mode == LeftOnly ) { | 2001 | if ( mode == LeftOnly ) { |
2002 | stylusDict->remove | 2002 | stylusDict->remove |
2003 | ( w ); | 2003 | ( w ); |
2004 | w->removeEventFilter( qApp ); | 2004 | w->removeEventFilter( qApp ); |
2005 | } | 2005 | } |
2006 | else { | 2006 | else { |
2007 | stylusDict->insert( w, ( void* ) mode ); | 2007 | stylusDict->insert( w, ( void* ) mode ); |
2008 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 2008 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
2009 | w->installEventFilter( qApp ); | 2009 | w->installEventFilter( qApp ); |
2010 | } | 2010 | } |
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | 2013 | ||
2014 | /*! | 2014 | /*! |
2015 | \reimp | 2015 | \reimp |
2016 | */ | 2016 | */ |
2017 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | 2017 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) |
2018 | { | 2018 | { |
2019 | if ( !o->isWidgetType() ) | 2019 | if ( !o->isWidgetType() ) |
2020 | return FALSE; | 2020 | return FALSE; |
2021 | 2021 | ||
2022 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { | 2022 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { |
2023 | QMouseEvent * me = ( QMouseEvent* ) e; | 2023 | QMouseEvent * me = ( QMouseEvent* ) e; |
2024 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 2024 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
2025 | switch (mode) { | 2025 | switch (mode) { |
2026 | case RightOnHold: | 2026 | case RightOnHold: |
2027 | switch ( me->type() ) { | 2027 | switch ( me->type() ) { |
2028 | case QEvent::MouseButtonPress: | 2028 | case QEvent::MouseButtonPress: |
2029 | if ( me->button() == LeftButton ) { | 2029 | if ( me->button() == LeftButton ) { |
2030 | static long Pref = 500; // #### pref. | 2030 | static long Pref = 500; // #### pref. |
2031 | d->presswidget = (QWidget*)o; | 2031 | d->presswidget = (QWidget*)o; |
2032 | d->presspos = me->pos(); | 2032 | d->presspos = me->pos(); |
2033 | d->rightpressed = FALSE; | 2033 | d->rightpressed = FALSE; |
2034 | #ifdef OPIE_WITHROHFEEDBACK | 2034 | #ifdef OPIE_WITHROHFEEDBACK |
2035 | if( ! d->RoH ) | 2035 | if( ! d->RoH ) |
2036 | d->RoH = new Opie::Internal::RoHFeedback; | 2036 | d->RoH = new Opie::Internal::RoHFeedback; |
2037 | 2037 | ||
2038 | d->RoH->init( me->globalPos(), d->presswidget ); | 2038 | d->RoH->init( me->globalPos(), d->presswidget ); |
diff --git a/library/qpestyle.cpp b/library/qpestyle.cpp index b61ada4..0566f6b 100644 --- a/library/qpestyle.cpp +++ b/library/qpestyle.cpp | |||
@@ -1,218 +1,218 @@ | |||
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 | ||
32 | QPEStyle::QPEStyle() | 32 | QPEStyle::QPEStyle() |
33 | { | 33 | { |
34 | } | 34 | } |
35 | 35 | ||
36 | QPEStyle::~QPEStyle() | 36 | QPEStyle::~QPEStyle() |
37 | { | 37 | { |
38 | } | 38 | } |
39 | 39 | ||
40 | void QPEStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, | 40 | void 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 |
75 | p->setPen( cg.dark() ); | 75 | p->setPen( cg.dark() ); |
76 | p->drawLine( x2, r.y()+1, x2, y2-1 ); | 76 | p->drawLine( x2, r.y()+1, x2, y2-1 ); |
77 | p->drawLine( r.x()+1, y2, x2-1, y2 ); | 77 | p->drawLine( r.x()+1, y2, x2-1, y2 ); |
78 | p->setPen( oldPen ); | 78 | p->setPen( oldPen ); |
79 | break; | 79 | break; |
80 | } | 80 | } |
81 | case PE_FocusRect: | 81 | case PE_FocusRect: |
82 | break; | 82 | break; |
83 | case PE_Indicator: | 83 | case PE_Indicator: |
84 | { | 84 | { |
85 | QColorGroup mycg( cg ); | 85 | QColorGroup mycg( cg ); |
86 | QBrush fill; | 86 | QBrush fill; |
87 | if ( flags & Style_Down ) | 87 | if ( flags & Style_Down ) |
88 | fill = cg.brush( QColorGroup::Button ); | 88 | fill = cg.brush( QColorGroup::Button ); |
89 | else | 89 | else |
90 | fill = cg.brush( (flags&Style_Enabled) ? QColorGroup::Base : QColorGroup::Background ); | 90 | fill = cg.brush( (flags&Style_Enabled) ? QColorGroup::Base : QColorGroup::Background ); |
91 | mycg.setBrush( QColorGroup::Button, fill ); | 91 | mycg.setBrush( QColorGroup::Button, fill ); |
92 | if ( flags&Style_Enabled ) | 92 | if ( flags&Style_Enabled ) |
93 | flags |= Style_Sunken; | 93 | flags |= Style_Sunken; |
94 | drawPrimitive( PE_ButtonBevel, p, r, mycg, flags ); | 94 | drawPrimitive( PE_ButtonBevel, p, r, mycg, flags ); |
95 | if ( flags & Style_On ) { | 95 | if ( flags & Style_On ) { |
96 | QPointArray a( 7*2 ); | 96 | QPointArray a( 7*2 ); |
97 | int i, xx, yy; | 97 | int i, xx, yy; |
98 | xx = r.x()+3; | 98 | xx = r.x()+3; |
99 | yy = r.y()+5; | 99 | yy = r.y()+5; |
100 | for ( i=0; i<3; i++ ) { | 100 | for ( i=0; i<3; i++ ) { |
101 | a.setPoint( 2*i, xx, yy ); | 101 | a.setPoint( 2*i, xx, yy ); |
102 | a.setPoint( 2*i+1, xx, yy+2 ); | 102 | a.setPoint( 2*i+1, xx, yy+2 ); |
103 | xx++; yy++; | 103 | xx++; yy++; |
104 | } | 104 | } |
105 | yy -= 2; | 105 | yy -= 2; |
106 | for ( i=3; i<7; i++ ) { | 106 | for ( i=3; i<7; i++ ) { |
107 | a.setPoint( 2*i, xx, yy ); | 107 | a.setPoint( 2*i, xx, yy ); |
108 | a.setPoint( 2*i+1, xx, yy+2 ); | 108 | a.setPoint( 2*i+1, xx, yy+2 ); |
109 | xx++; yy--; | 109 | xx++; yy--; |
110 | } | 110 | } |
111 | if ( flags & Style_NoChange ) { | 111 | if ( flags & Style_NoChange ) { |
112 | p->setPen( mycg.dark() ); | 112 | p->setPen( mycg.dark() ); |
113 | } else { | 113 | } else { |
114 | p->setPen( mycg.text() ); | 114 | p->setPen( mycg.text() ); |
115 | } | 115 | } |
116 | p->drawLineSegments( a ); | 116 | p->drawLineSegments( a ); |
117 | } | 117 | } |
118 | break; | 118 | break; |
119 | } | 119 | } |
120 | case PE_ExclusiveIndicator: | 120 | case PE_ExclusiveIndicator: |
121 | { | 121 | { |
122 | static const QCOORD pts1[] = { // dark lines | 122 | static const QCOORD pts1[] = { // dark lines |
123 | 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; | 123 | 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; |
124 | static const QCOORD pts4[] = { // white lines | 124 | static const QCOORD pts4[] = { // white lines |
125 | 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, | 125 | 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, |
126 | 11,4, 10,3, 10,2 }; | 126 | 11,4, 10,3, 10,2 }; |
127 | static const QCOORD pts5[] = { // inner fill | 127 | static const QCOORD pts5[] = { // inner fill |
128 | 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; | 128 | 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; |
129 | 129 | ||
130 | int x, y, w, h; | 130 | int x, y, w, h; |
131 | r.rect( &x, &y, &w, &h ); | 131 | r.rect( &x, &y, &w, &h ); |
132 | p->eraseRect( x, y, w, h ); | 132 | p->eraseRect( x, y, w, h ); |
133 | QPointArray a( QCOORDARRLEN(pts1), pts1 ); | 133 | QPointArray a( QCOORDARRLEN(pts1), pts1 ); |
134 | a.translate( x, y ); | 134 | a.translate( x, y ); |
135 | p->setPen( cg.dark() ); | 135 | p->setPen( cg.dark() ); |
136 | p->drawPolyline( a ); | 136 | p->drawPolyline( a ); |
137 | a.setPoints( QCOORDARRLEN(pts4), pts4 ); | 137 | a.setPoints( QCOORDARRLEN(pts4), pts4 ); |
138 | a.translate( x, y ); | 138 | a.translate( x, y ); |
139 | p->setPen( cg.light() ); | 139 | p->setPen( cg.light() ); |
140 | p->drawPolyline( a ); | 140 | p->drawPolyline( a ); |
141 | a.setPoints( QCOORDARRLEN(pts5), pts5 ); | 141 | a.setPoints( QCOORDARRLEN(pts5), pts5 ); |
142 | a.translate( x, y ); | 142 | a.translate( x, y ); |
143 | QColor fillColor = ( flags&Style_Down || !(flags&Style_Enabled) ) ? cg.button() : cg.base(); | 143 | QColor fillColor = ( flags&Style_Down || !(flags&Style_Enabled) ) ? cg.button() : cg.base(); |
144 | p->setPen( fillColor ); | 144 | p->setPen( fillColor ); |
145 | p->setBrush( fillColor ) ; | 145 | p->setBrush( fillColor ) ; |
146 | p->drawPolygon( a ); | 146 | p->drawPolygon( a ); |
147 | if ( flags&Style_On ) { | 147 | if ( flags&Style_On ) { |
148 | p->setPen( NoPen ); | 148 | p->setPen( NoPen ); |
149 | p->setBrush( cg.text() ); | 149 | p->setBrush( cg.text() ); |
150 | p->drawRect( x+5, y+4, 2, 4 ); | 150 | p->drawRect( x+5, y+4, 2, 4 ); |
151 | p->drawRect( x+4, y+5, 4, 2 ); | 151 | p->drawRect( x+4, y+5, 4, 2 ); |
152 | } | 152 | } |
153 | break; | 153 | break; |
154 | } | 154 | } |
155 | default: | 155 | default: |
156 | QWindowsStyle::drawPrimitive( pe, p, r, cg, flags, data ); | 156 | QWindowsStyle::drawPrimitive( pe, p, r, cg, flags, data ); |
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | void QPEStyle::drawControl( ControlElement ce, QPainter *p, | 161 | void QPEStyle::drawControl( ControlElement ce, QPainter *p, |
162 | const QWidget *widget, const QRect &r, | 162 | const QWidget *widget, const QRect &r, |
163 | const QColorGroup &cg, SFlags how, const QStyleOption &data) const | 163 | const QColorGroup &cg, SFlags how, const QStyleOption &data) const |
164 | { | 164 | { |
165 | switch ( ce ) { | 165 | switch ( ce ) { |
166 | case CE_PushButton: | 166 | case CE_PushButton: |
167 | { | 167 | { |
168 | const QPushButton *btn = (QPushButton*)widget; | 168 | const QPushButton *btn = (QPushButton*)widget; |
169 | SFlags flags; | 169 | SFlags flags; |
170 | flags = Style_Default; | 170 | flags = Style_Default; |
171 | if ( btn->isDown() ) | 171 | if ( btn->isDown() ) |
172 | flags |= Style_Down; | 172 | flags |= Style_Down; |
173 | if ( btn->isOn() ) | 173 | if ( btn->isOn() ) |
174 | flags |= Style_On; | 174 | flags |= Style_On; |
175 | if ( btn->isEnabled() ) | 175 | if ( btn->isEnabled() ) |
176 | flags |= Style_Enabled; | 176 | flags |= Style_Enabled; |
177 | if ( btn->isDefault() ) | 177 | if ( btn->isDefault() ) |
178 | flags |= Style_Default; | 178 | flags |= Style_Default; |
179 | if (! btn->isFlat() && !(flags & Style_Down)) | 179 | if (! btn->isFlat() && !(flags & Style_Down)) |
180 | flags |= Style_Raised; | 180 | flags |= Style_Raised; |
181 | p->setPen( cg.foreground() ); | 181 | p->setPen( cg.foreground() ); |
182 | p->setBrush( QBrush(cg.button(), NoBrush) ); | 182 | p->setBrush( QBrush(cg.button(), NoBrush) ); |
183 | QColorGroup mycg( cg ); | 183 | QColorGroup mycg( cg ); |
184 | if ( flags & Style_On ) { | 184 | if ( flags & Style_On ) { |
185 | QBrush fill = QBrush( cg.mid(), Dense4Pattern ); | 185 | QBrush fill = QBrush( cg.mid(), Dense4Pattern ); |
186 | mycg.setBrush( QColorGroup::Button, fill ); | 186 | mycg.setBrush( QColorGroup::Button, fill ); |
187 | } | 187 | } |
188 | drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data ); | 188 | drawPrimitive( PE_ButtonBevel, p, r, mycg, flags, data ); |
189 | break; | 189 | break; |
190 | } | 190 | } |
191 | case CE_TabBarTab: | 191 | case CE_TabBarTab: |
192 | { | 192 | { |
193 | if ( !widget || !widget->parentWidget() ) | 193 | if ( !widget || !widget->parentWidget() ) |
194 | break; | 194 | break; |
195 | 195 | ||
196 | const QTabBar *tb = (const QTabBar *) widget; | 196 | const QTabBar *tb = (const QTabBar *) widget; |
197 | bool selected = how & Style_Selected; | 197 | bool selected = how & Style_Selected; |
198 | 198 | ||
199 | QRect r2(r); | 199 | QRect r2(r); |
200 | if ( tb->shape() == QTabBar::RoundedAbove ) { | 200 | if ( tb->shape() == QTabBar::RoundedAbove ) { |
201 | p->setPen( cg.light() ); | 201 | p->setPen( cg.light() ); |
202 | p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); | 202 | p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); |
203 | if ( r2.left() == 0 ) | 203 | if ( r2.left() == 0 ) |
204 | p->drawPoint( tb->rect().bottomLeft() ); | 204 | p->drawPoint( tb->rect().bottomLeft() ); |
205 | else { | 205 | else { |
206 | p->setPen( cg.light() ); | 206 | p->setPen( cg.light() ); |
207 | p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); | 207 | p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); |
208 | } | 208 | } |
209 | 209 | ||
210 | if ( selected ) { | 210 | if ( selected ) { |
211 | p->setPen( cg.background() ); | 211 | p->setPen( cg.background() ); |
212 | p->drawLine( r2.left()+2, r2.top()+1, r2.right()-2, r2.top()+1 ); | 212 | p->drawLine( r2.left()+2, r2.top()+1, r2.right()-2, r2.top()+1 ); |
213 | p->fillRect( QRect( r2.left()+1, r2.top()+2, r2.width()-2, r2.height()-2), | 213 | p->fillRect( QRect( r2.left()+1, r2.top()+2, r2.width()-2, r2.height()-2), |
214 | cg.brush( QColorGroup::Background )); | 214 | cg.brush( QColorGroup::Background )); |
215 | } else { | 215 | } else { |
216 | r2.setRect( r2.left() + 2, r2.top() + 2, | 216 | r2.setRect( r2.left() + 2, r2.top() + 2, |
217 | r2.width() - 4, r2.height() - 2 ); | 217 | r2.width() - 4, r2.height() - 2 ); |
218 | p->setPen( cg.button() ); | 218 | p->setPen( cg.button() ); |
@@ -240,385 +240,385 @@ void QPEStyle::drawControl( ControlElement ce, QPainter *p, | |||
240 | p->drawLine( r2.left(), r2.bottom()-1, r2.left(), r2.top() + 2 ); | 240 | p->drawLine( r2.left(), r2.bottom()-1, r2.left(), r2.top() + 2 ); |
241 | p->drawPoint( r2.left()+1, r2.top() + 1 ); | 241 | p->drawPoint( r2.left()+1, r2.top() + 1 ); |
242 | p->drawLine( r2.left()+2, r2.top(), | 242 | p->drawLine( r2.left()+2, r2.top(), |
243 | r2.right() - 2, r2.top() ); | 243 | r2.right() - 2, r2.top() ); |
244 | 244 | ||
245 | p->setPen( cg.dark() ); | 245 | p->setPen( cg.dark() ); |
246 | p->drawPoint( r2.right() - 1, r2.top() + 1 ); | 246 | p->drawPoint( r2.right() - 1, r2.top() + 1 ); |
247 | p->drawLine( r2.right(), r2.top() + 2, r2.right(), r2.bottom() - 1); | 247 | p->drawLine( r2.right(), r2.top() + 2, r2.right(), r2.bottom() - 1); |
248 | } else if ( tb->shape() == QTabBar::RoundedBelow ) { | 248 | } else if ( tb->shape() == QTabBar::RoundedBelow ) { |
249 | if ( selected ) { | 249 | if ( selected ) { |
250 | p->setPen( cg.background() ); | 250 | p->setPen( cg.background() ); |
251 | p->drawLine( r2.left()+2, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); | 251 | p->drawLine( r2.left()+2, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); |
252 | p->fillRect( QRect( r2.left()+1, r2.top(), r2.width()-2, r2.height()-2), | 252 | p->fillRect( QRect( r2.left()+1, r2.top(), r2.width()-2, r2.height()-2), |
253 | tb->palette().normal().brush( QColorGroup::Background )); | 253 | tb->palette().normal().brush( QColorGroup::Background )); |
254 | } else { | 254 | } else { |
255 | p->setPen( cg.dark() ); | 255 | p->setPen( cg.dark() ); |
256 | p->drawLine( r2.left(), r2.top(), | 256 | p->drawLine( r2.left(), r2.top(), |
257 | r2.right(), r2.top() ); | 257 | r2.right(), r2.top() ); |
258 | r2.setRect( r2.left() + 2, r2.top(), | 258 | r2.setRect( r2.left() + 2, r2.top(), |
259 | r2.width() - 4, r2.height() - 2 ); | 259 | r2.width() - 4, r2.height() - 2 ); |
260 | p->setPen( cg.button() ); | 260 | p->setPen( cg.button() ); |
261 | p->drawLine( r2.left()+2, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); | 261 | p->drawLine( r2.left()+2, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); |
262 | p->fillRect( QRect( r2.left()+1, r2.top()+1, r2.width()-2, r2.height()-3), | 262 | p->fillRect( QRect( r2.left()+1, r2.top()+1, r2.width()-2, r2.height()-3), |
263 | tb->palette().normal().brush( QColorGroup::Button )); | 263 | tb->palette().normal().brush( QColorGroup::Button )); |
264 | } | 264 | } |
265 | 265 | ||
266 | p->setPen( cg.dark() ); | 266 | p->setPen( cg.dark() ); |
267 | p->drawLine( r2.right(), r2.top(), | 267 | p->drawLine( r2.right(), r2.top(), |
268 | r2.right(), r2.bottom() - 2 ); | 268 | r2.right(), r2.bottom() - 2 ); |
269 | p->drawPoint( r2.right() - 1, r2.bottom() - 1 ); | 269 | p->drawPoint( r2.right() - 1, r2.bottom() - 1 ); |
270 | p->drawLine( r2.right() - 2, r2.bottom(), | 270 | p->drawLine( r2.right() - 2, r2.bottom(), |
271 | r2.left() + 2, r2.bottom() ); | 271 | r2.left() + 2, r2.bottom() ); |
272 | 272 | ||
273 | p->setPen( cg.light() ); | 273 | p->setPen( cg.light() ); |
274 | p->drawLine( r2.left(), r2.top()+1, | 274 | p->drawLine( r2.left(), r2.top()+1, |
275 | r2.left(), r2.bottom() - 2 ); | 275 | r2.left(), r2.bottom() - 2 ); |
276 | p->drawPoint( r2.left() + 1, r2.bottom() - 1 ); | 276 | p->drawPoint( r2.left() + 1, r2.bottom() - 1 ); |
277 | if ( r2.left() == 0 ) | 277 | if ( r2.left() == 0 ) |
278 | p->drawPoint( tb->rect().topLeft() ); | 278 | p->drawPoint( tb->rect().topLeft() ); |
279 | 279 | ||
280 | } else { | 280 | } else { |
281 | QCommonStyle::drawControl( ce, p, widget, r, cg, how, data ); | 281 | QCommonStyle::drawControl( ce, p, widget, r, cg, how, data ); |
282 | } | 282 | } |
283 | break; | 283 | break; |
284 | } | 284 | } |
285 | default: | 285 | default: |
286 | QWindowsStyle::drawControl( ce, p, widget, r, cg, how, data ); | 286 | QWindowsStyle::drawControl( ce, p, widget, r, cg, how, data ); |
287 | break; | 287 | break; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | void QPEStyle::drawComplexControl( ComplexControl control, QPainter *p, | 291 | void QPEStyle::drawComplexControl( ComplexControl control, QPainter *p, |
292 | const QWidget *widget, const QRect &r, | 292 | const QWidget *widget, const QRect &r, |
293 | const QColorGroup &cg, SFlags how, | 293 | const QColorGroup &cg, SFlags how, |
294 | SCFlags sub, SCFlags subActive, const QStyleOption &data) const | 294 | SCFlags sub, SCFlags subActive, const QStyleOption &data) const |
295 | { | 295 | { |
296 | switch ( control ) { | 296 | switch ( control ) { |
297 | case CC_ComboBox: | 297 | case CC_ComboBox: |
298 | if ( sub & SC_ComboBoxArrow ) { | 298 | if ( sub & SC_ComboBoxArrow ) { |
299 | SFlags flags = Style_Default; | 299 | SFlags flags = Style_Default; |
300 | 300 | ||
301 | drawPrimitive( PE_ButtonBevel, p, r, cg, flags, data ); | 301 | drawPrimitive( PE_ButtonBevel, p, r, cg, flags, data ); |
302 | 302 | ||
303 | QRect ar = | 303 | QRect ar = |
304 | QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, | 304 | QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, |
305 | SC_ComboBoxArrow ), widget ); | 305 | SC_ComboBoxArrow ), widget ); |
306 | 306 | ||
307 | if ( subActive == SC_ComboBoxArrow ) { | 307 | if ( subActive == SC_ComboBoxArrow ) { |
308 | p->setPen( cg.dark() ); | 308 | p->setPen( cg.dark() ); |
309 | p->setBrush( cg.brush( QColorGroup::Button ) ); | 309 | p->setBrush( cg.brush( QColorGroup::Button ) ); |
310 | p->drawRect( ar ); | 310 | p->drawRect( ar ); |
311 | } | 311 | } |
312 | 312 | ||
313 | ar.addCoords( 2, 2, -2, -2 ); | 313 | ar.addCoords( 2, 2, -2, -2 ); |
314 | if ( widget->isEnabled() ) | 314 | if ( widget->isEnabled() ) |
315 | flags |= Style_Enabled; | 315 | flags |= Style_Enabled; |
316 | 316 | ||
317 | if ( subActive & Style_Sunken ) { | 317 | if ( subActive & Style_Sunken ) { |
318 | flags |= Style_Sunken; | 318 | flags |= Style_Sunken; |
319 | } | 319 | } |
320 | drawPrimitive( PE_ArrowDown, p, ar, cg, flags ); | 320 | drawPrimitive( PE_ArrowDown, p, ar, cg, flags ); |
321 | } | 321 | } |
322 | 322 | ||
323 | if ( sub & SC_ComboBoxEditField ) { | 323 | if ( sub & SC_ComboBoxEditField ) { |
324 | const QComboBox * cb = (const QComboBox *) widget; | 324 | const QComboBox * cb = (const QComboBox *) widget; |
325 | QRect re = | 325 | QRect re = |
326 | QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, | 326 | QStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, |
327 | SC_ComboBoxEditField ), widget ); | 327 | SC_ComboBoxEditField ), widget ); |
328 | if ( cb->hasFocus() && !cb->editable() ) | 328 | if ( cb->hasFocus() && !cb->editable() ) |
329 | p->fillRect( re.x(), re.y(), re.width(), re.height(), | 329 | p->fillRect( re.x(), re.y(), re.width(), re.height(), |
330 | cg.brush( QColorGroup::Highlight ) ); | 330 | cg.brush( QColorGroup::Highlight ) ); |
331 | 331 | ||
332 | if ( cb->hasFocus() ) { | 332 | if ( cb->hasFocus() ) { |
333 | p->setPen( cg.highlightedText() ); | 333 | p->setPen( cg.highlightedText() ); |
334 | p->setBackgroundColor( cg.highlight() ); | 334 | p->setBackgroundColor( cg.highlight() ); |
335 | 335 | ||
336 | } else { | 336 | } else { |
337 | p->setPen( cg.text() ); | 337 | p->setPen( cg.text() ); |
338 | p->setBackgroundColor( cg.background() ); | 338 | p->setBackgroundColor( cg.background() ); |
339 | } | 339 | } |
340 | 340 | ||
341 | if ( cb->hasFocus() && !cb->editable() ) { | 341 | if ( cb->hasFocus() && !cb->editable() ) { |
342 | QRect re = | 342 | QRect re = |
343 | QStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), widget ); | 343 | QStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), widget ); |
344 | drawPrimitive( PE_FocusRect, p, re, cg, Style_FocusAtBorder, QStyleOption(cg.highlight())); | 344 | drawPrimitive( PE_FocusRect, p, re, cg, Style_FocusAtBorder, QStyleOption(cg.highlight())); |
345 | } | 345 | } |
346 | } | 346 | } |
347 | break; | 347 | break; |
348 | default: | 348 | default: |
349 | QWindowsStyle::drawComplexControl( control, p, widget, r, cg, how, | 349 | QWindowsStyle::drawComplexControl( control, p, widget, r, cg, how, |
350 | sub, subActive, data ); | 350 | sub, subActive, data ); |
351 | break; | 351 | break; |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
355 | int QPEStyle::pixelMetric( PixelMetric metric, const QWidget *widget ) const | 355 | int QPEStyle::pixelMetric( PixelMetric metric, const QWidget *widget ) const |
356 | { | 356 | { |
357 | int ret; | 357 | int ret; |
358 | switch( metric ) { | 358 | switch( metric ) { |
359 | case PM_ButtonMargin: | 359 | case PM_ButtonMargin: |
360 | ret = 2; | 360 | ret = 2; |
361 | break; | 361 | break; |
362 | case PM_DefaultFrameWidth: | 362 | case PM_DefaultFrameWidth: |
363 | ret = 1; | 363 | ret = 1; |
364 | break; | 364 | break; |
365 | case PM_ButtonDefaultIndicator: | 365 | case PM_ButtonDefaultIndicator: |
366 | ret = 2; | 366 | ret = 2; |
367 | break; | 367 | break; |
368 | case PM_ButtonShiftHorizontal: | 368 | case PM_ButtonShiftHorizontal: |
369 | case PM_ButtonShiftVertical: | 369 | case PM_ButtonShiftVertical: |
370 | ret = -1; | 370 | ret = -1; |
371 | break; | 371 | break; |
372 | case PM_IndicatorWidth: | 372 | case PM_IndicatorWidth: |
373 | ret = 15; | 373 | ret = 15; |
374 | break; | 374 | break; |
375 | case PM_IndicatorHeight: | 375 | case PM_IndicatorHeight: |
376 | ret = 13; | 376 | ret = 13; |
377 | break; | 377 | break; |
378 | case PM_ExclusiveIndicatorHeight: | 378 | case PM_ExclusiveIndicatorHeight: |
379 | case PM_ExclusiveIndicatorWidth: | 379 | case PM_ExclusiveIndicatorWidth: |
380 | ret = 15; | 380 | ret = 15; |
381 | break; | 381 | break; |
382 | case PM_ScrollBarExtent: | 382 | case PM_ScrollBarExtent: |
383 | ret = 13; | 383 | ret = 13; |
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 | ||
395 | QSize QPEStyle::sizeFromContents( ContentsType contents, const QWidget *widget, | 395 | QSize 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 | ||
430 | QPEStyle::QPEStyle() | 430 | QPEStyle::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 | ||
438 | QPEStyle::~QPEStyle() | 438 | QPEStyle::~QPEStyle() |
439 | { | 439 | { |
440 | } | 440 | } |
441 | 441 | ||
442 | int QPEStyle::buttonMargin() const | 442 | int QPEStyle::buttonMargin() const |
443 | { | 443 | { |
444 | return 2; | 444 | return 2; |
445 | } | 445 | } |
446 | 446 | ||
447 | QSize QPEStyle::scrollBarExtent() const | 447 | QSize QPEStyle::scrollBarExtent() const |
448 | { | 448 | { |
449 | return QSize(13,13); | 449 | return QSize(13,13); |
450 | } | 450 | } |
451 | 451 | ||
452 | void QPEStyle::polish ( QPalette & ) | 452 | void QPEStyle::polish ( QPalette & ) |
453 | { | 453 | { |
454 | } | 454 | } |
455 | 455 | ||
456 | void QPEStyle::polish( QWidget *w ) | 456 | void 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 | ||
468 | void QPEStyle::unPolish( QWidget *w ) | 468 | void 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 | ||
480 | int QPEStyle::defaultFrameWidth() const | 480 | int QPEStyle::defaultFrameWidth() const |
481 | { | 481 | { |
482 | return 1; | 482 | return 1; |
483 | } | 483 | } |
484 | 484 | ||
485 | void QPEStyle::drawPanel ( QPainter * p, int x, int y, int w, int h, | 485 | void QPEStyle::drawPanel ( QPainter * p, int x, int y, int w, int h, |
486 | const QColorGroup &g, bool sunken, int lineWidth, const QBrush * fill ) | 486 | const QColorGroup &g, bool sunken, int lineWidth, const QBrush * fill ) |
487 | { | 487 | { |
488 | qDrawShadePanel( p, QRect(x, y, w, h), g, sunken, lineWidth, fill ); | 488 | qDrawShadePanel( p, QRect(x, y, w, h), g, sunken, lineWidth, fill ); |
489 | } | 489 | } |
490 | 490 | ||
491 | void QPEStyle::drawButton( QPainter *p, int x, int y, int w, int h, | 491 | void QPEStyle::drawButton( QPainter *p, int x, int y, int w, int h, |
492 | const QColorGroup &g, bool sunken, const QBrush* fill ) | 492 | const QColorGroup &g, bool sunken, const QBrush* fill ) |
493 | { | 493 | { |
494 | QPen oldPen = p->pen(); | 494 | QPen oldPen = p->pen(); |
495 | if ( sunken ) | 495 | if ( sunken ) |
496 | p->setPen( g.dark() ); | 496 | p->setPen( g.dark() ); |
497 | else | 497 | else |
498 | p->setPen( g.light() ); | 498 | p->setPen( g.light() ); |
499 | 499 | ||
500 | int x2 = x+w-1; | 500 | int x2 = x+w-1; |
501 | int y2 = y+h-1; | 501 | int y2 = y+h-1; |
502 | 502 | ||
503 | p->drawLine( x, y, x, y2 ); | 503 | p->drawLine( x, y, x, y2 ); |
504 | p->drawLine( x, y, x2, y ); | 504 | p->drawLine( x, y, x2, y ); |
505 | 505 | ||
506 | if ( sunken ) | 506 | if ( sunken ) |
507 | p->setPen( g.light() ); | 507 | p->setPen( g.light() ); |
508 | else | 508 | else |
509 | p->setPen( g.dark() ); | 509 | p->setPen( g.dark() ); |
510 | 510 | ||
511 | p->drawLine( x2, y, x2, y2 ); | 511 | p->drawLine( x2, y, x2, y2 ); |
512 | p->drawLine( x, y2, x2, y2 ); | 512 | p->drawLine( x, y2, x2, y2 ); |
513 | p->setPen( oldPen ); | 513 | p->setPen( oldPen ); |
514 | 514 | ||
515 | p->fillRect( x+1, y+1, w-2, h-2, fill?(*fill):g.brush(QColorGroup::Button) ); | 515 | p->fillRect( x+1, y+1, w-2, h-2, fill?(*fill):g.brush(QColorGroup::Button) ); |
516 | } | 516 | } |
517 | 517 | ||
518 | void QPEStyle::drawButtonMask ( QPainter * p, int x, int y, int w, int h ) | 518 | void QPEStyle::drawButtonMask ( QPainter * p, int x, int y, int w, int h ) |
519 | { | 519 | { |
520 | p->fillRect( x, y, w, h, color1 ); | 520 | p->fillRect( x, y, w, h, color1 ); |
521 | } | 521 | } |
522 | 522 | ||
523 | void QPEStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h, | 523 | void QPEStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h, |
524 | const QColorGroup &g, bool sunken, const QBrush* fill ) | 524 | const QColorGroup &g, bool sunken, const QBrush* fill ) |
525 | { | 525 | { |
526 | drawButton( p, x, y, w, h, g, sunken, fill ); | 526 | drawButton( p, x, y, w, h, g, sunken, fill ); |
527 | } | 527 | } |
528 | 528 | ||
529 | QRect QPEStyle::comboButtonRect( int x, int y, int w, int h) | 529 | QRect QPEStyle::comboButtonRect( int x, int y, int w, int h) |
530 | { | 530 | { |
531 | return QRect(x+1, y+1, w-2-14, h-2); | 531 | return QRect(x+1, y+1, w-2-14, h-2); |
532 | } | 532 | } |
533 | 533 | ||
534 | 534 | ||
535 | QRect QPEStyle::comboButtonFocusRect( int x, int y, int w, int h) | 535 | QRect QPEStyle::comboButtonFocusRect( int x, int y, int w, int h) |
536 | { | 536 | { |
537 | return QRect(x+2, y+2, w-4-14, h-4); | 537 | return QRect(x+2, y+2, w-4-14, h-4); |
538 | } | 538 | } |
539 | 539 | ||
540 | void QPEStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, | 540 | void QPEStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, |
541 | const QColorGroup &g, bool sunken, | 541 | const QColorGroup &g, bool sunken, |
542 | bool /*editable*/, | 542 | bool /*editable*/, |
543 | bool enabled, | 543 | bool enabled, |
544 | const QBrush *fill ) | 544 | const QBrush *fill ) |
545 | { | 545 | { |
546 | drawBevelButton( p, x, y, w, h, g, FALSE, fill ); | 546 | drawBevelButton( p, x, y, w, h, g, FALSE, fill ); |
547 | drawBevelButton( p, x+w-14, y, 14, h, g, sunken, fill ); | 547 | drawBevelButton( p, x+w-14, y, 14, h, g, sunken, fill ); |
548 | drawArrow( p, QStyle::DownArrow, sunken, | 548 | drawArrow( p, QStyle::DownArrow, sunken, |
549 | x+w-14+ 2, y+ 2, 14- 4, h- 4, g, enabled, | 549 | x+w-14+ 2, y+ 2, 14- 4, h- 4, g, enabled, |
550 | &g.brush( QColorGroup::Button ) ); | 550 | &g.brush( QColorGroup::Button ) ); |
551 | 551 | ||
552 | } | 552 | } |
553 | 553 | ||
554 | 554 | ||
555 | void QPEStyle::drawExclusiveIndicator ( QPainter * p, int x, int y, int w, | 555 | void QPEStyle::drawExclusiveIndicator ( QPainter * p, int x, int y, int w, |
556 | int h, const QColorGroup & g, bool on, bool down, bool enabled ) | 556 | int h, const QColorGroup & g, bool on, bool down, bool enabled ) |
557 | { | 557 | { |
558 | static const QCOORD pts1[] = { // dark lines | 558 | static const QCOORD pts1[] = { // dark lines |
559 | 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; | 559 | 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 }; |
560 | static const QCOORD pts4[] = { // white lines | 560 | static const QCOORD pts4[] = { // white lines |
561 | 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, | 561 | 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7, |
562 | 11,4, 10,3, 10,2 }; | 562 | 11,4, 10,3, 10,2 }; |
563 | static const QCOORD pts5[] = { // inner fill | 563 | static const QCOORD pts5[] = { // inner fill |
564 | 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; | 564 | 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 }; |
565 | 565 | ||
566 | p->eraseRect( x, y, w, h ); | 566 | p->eraseRect( x, y, w, h ); |
567 | QPointArray a( QCOORDARRLEN(pts1), pts1 ); | 567 | QPointArray a( QCOORDARRLEN(pts1), pts1 ); |
568 | a.translate( x, y ); | 568 | a.translate( x, y ); |
569 | p->setPen( g.dark() ); | 569 | p->setPen( g.dark() ); |
570 | p->drawPolyline( a ); | 570 | p->drawPolyline( a ); |
571 | a.setPoints( QCOORDARRLEN(pts4), pts4 ); | 571 | a.setPoints( QCOORDARRLEN(pts4), pts4 ); |
572 | a.translate( x, y ); | 572 | a.translate( x, y ); |
573 | p->setPen( g.light() ); | 573 | p->setPen( g.light() ); |
574 | p->drawPolyline( a ); | 574 | p->drawPolyline( a ); |
575 | a.setPoints( QCOORDARRLEN(pts5), pts5 ); | 575 | a.setPoints( QCOORDARRLEN(pts5), pts5 ); |
576 | a.translate( x, y ); | 576 | a.translate( x, y ); |
577 | QColor fillColor = ( down || !enabled ) ? g.button() : g.base(); | 577 | QColor fillColor = ( down || !enabled ) ? g.button() : g.base(); |
578 | p->setPen( fillColor ); | 578 | p->setPen( fillColor ); |
579 | p->setBrush( fillColor ) ; | 579 | p->setBrush( fillColor ) ; |
580 | p->drawPolygon( a ); | 580 | p->drawPolygon( a ); |
581 | if ( on ) { | 581 | if ( on ) { |
582 | p->setPen( NoPen ); | 582 | p->setPen( NoPen ); |
583 | p->setBrush( g.text() ); | 583 | p->setBrush( g.text() ); |
584 | p->drawRect( x+5, y+4, 2, 4 ); | 584 | p->drawRect( x+5, y+4, 2, 4 ); |
585 | p->drawRect( x+4, y+5, 4, 2 ); | 585 | p->drawRect( x+4, y+5, 4, 2 ); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | 588 | ||
589 | void QPEStyle::drawIndicator ( QPainter * p, int x, int y, int w, int h, | 589 | void QPEStyle::drawIndicator ( QPainter * p, int x, int y, int w, int h, |
590 | const QColorGroup & g, int state, bool down, bool enabled ) | 590 | const QColorGroup & g, int state, bool down, bool enabled ) |
591 | { | 591 | { |
592 | 592 | ||
593 | QBrush fill; | 593 | QBrush fill; |
594 | if ( state == QButton::NoChange ) { | 594 | if ( state == QButton::NoChange ) { |
595 | QBrush b = p->brush(); | 595 | QBrush b = p->brush(); |
596 | QColor c = p->backgroundColor(); | 596 | QColor c = p->backgroundColor(); |
597 | p->setBackgroundMode( TransparentMode ); | 597 | p->setBackgroundMode( TransparentMode ); |
598 | p->setBackgroundColor( green ); | 598 | p->setBackgroundColor( green ); |
599 | fill = QBrush(g.base(), Dense4Pattern); | 599 | fill = QBrush(g.base(), Dense4Pattern); |
600 | p->setBackgroundColor( c ); | 600 | p->setBackgroundColor( c ); |
601 | p->setBrush( b ); | 601 | p->setBrush( b ); |
602 | } else if ( down ) | 602 | } else if ( down ) |
603 | fill = g.brush( QColorGroup::Button ); | 603 | fill = g.brush( QColorGroup::Button ); |
604 | else | 604 | else |
605 | fill = g.brush( enabled ? QColorGroup::Base : QColorGroup::Background ); | 605 | fill = g.brush( enabled ? QColorGroup::Base : QColorGroup::Background ); |
606 | drawPanel( p, x, y, w, h, g, TRUE, 1, &fill ); | 606 | drawPanel( p, x, y, w, h, g, TRUE, 1, &fill ); |
607 | if ( state != QButton::Off ) { | 607 | if ( state != QButton::Off ) { |
608 | QPointArray a( 7*2 ); | 608 | QPointArray a( 7*2 ); |
609 | int i, xx, yy; | 609 | int i, xx, yy; |
610 | xx = x+3; | 610 | xx = x+3; |
611 | yy = y+5; | 611 | yy = y+5; |
612 | for ( i=0; i<3; i++ ) { | 612 | for ( i=0; i<3; i++ ) { |
613 | a.setPoint( 2*i, xx, yy ); | 613 | a.setPoint( 2*i, xx, yy ); |
614 | a.setPoint( 2*i+1, xx, yy+2 ); | 614 | a.setPoint( 2*i+1, xx, yy+2 ); |
615 | xx++; yy++; | 615 | xx++; yy++; |
616 | } | 616 | } |
617 | yy -= 2; | 617 | yy -= 2; |
618 | for ( i=3; i<7; i++ ) { | 618 | for ( i=3; i<7; i++ ) { |
619 | a.setPoint( 2*i, xx, yy ); | 619 | a.setPoint( 2*i, xx, yy ); |
620 | a.setPoint( 2*i+1, xx, yy+2 ); | 620 | a.setPoint( 2*i+1, xx, yy+2 ); |
621 | xx++; yy--; | 621 | xx++; yy--; |
622 | } | 622 | } |
623 | if ( state == QButton::NoChange ) { | 623 | if ( state == QButton::NoChange ) { |
624 | p->setPen( g.dark() ); | 624 | p->setPen( g.dark() ); |
diff --git a/library/qpestyle.h b/library/qpestyle.h index 19ef346..1bde0ff 100644 --- a/library/qpestyle.h +++ b/library/qpestyle.h | |||
@@ -1,102 +1,102 @@ | |||
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 | ||
30 | class Q_EXPORT QPEStyle : public QWindowsStyle | 30 | class Q_EXPORT QPEStyle : public QWindowsStyle |
31 | { | 31 | { |
32 | public: | 32 | public: |
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 | ||
45 | class Q_EXPORT QPEStyle : public QWindowsStyle | 45 | class Q_EXPORT QPEStyle : public QWindowsStyle |
46 | { | 46 | { |
47 | public: | 47 | public: |
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; |
77 | void drawSlider( QPainter *p, int x, int y, int w, int h, | 77 | void drawSlider( QPainter *p, int x, int y, int w, int h, |
78 | const QColorGroup &g, Orientation, bool tickAbove, bool tickBelow ); | 78 | const QColorGroup &g, Orientation, bool tickAbove, bool tickBelow ); |
79 | void drawSliderMask( QPainter *p, int x, int y, int w, int h, | 79 | void drawSliderMask( QPainter *p, int x, int y, int w, int h, |
80 | Orientation, bool tickAbove, bool tickBelow ); | 80 | Orientation, bool tickAbove, bool tickBelow ); |
81 | void drawSliderGrooveMask( QPainter *p, int x, int y, int w, int h, | 81 | void drawSliderGrooveMask( QPainter *p, int x, int y, int w, int h, |
82 | const QColorGroup& , QCOORD c, Orientation orient ); | 82 | const QColorGroup& , QCOORD c, Orientation orient ); |
83 | void drawTab( QPainter *, const QTabBar *, QTab *, bool selected ); | 83 | void drawTab( QPainter *, const QTabBar *, QTab *, bool selected ); |
84 | int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); | 84 | int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& ); |
85 | int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); | 85 | int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& ); |
86 | void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, | 86 | void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, |
87 | const QPalette& pal, | 87 | const QPalette& pal, |
88 | bool act, bool enabled, int x, int y, int w, int h); | 88 | bool act, bool enabled, int x, int y, int w, int h); |
89 | 89 | ||
90 | int buttonMargin() const; | 90 | int buttonMargin() const; |
91 | QSize scrollBarExtent() const; | 91 | QSize scrollBarExtent() const; |
92 | 92 | ||
93 | private:// Disabled copy constructor and operator= | 93 | private:// Disabled copy constructor and operator= |
94 | #if defined(Q_DISABLE_COPY) | 94 | #if defined(Q_DISABLE_COPY) |
95 | QPEStyle( const QPEStyle & ); | 95 | QPEStyle( const QPEStyle & ); |
96 | QPEStyle& operator=( const QPEStyle & ); | 96 | QPEStyle& operator=( const QPEStyle & ); |
97 | #endif | 97 | #endif |
98 | }; | 98 | }; |
99 | 99 | ||
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | #endif // QPESTYLE_H | 102 | #endif // QPESTYLE_H |