summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-10-29 16:53:56 (UTC)
committer mickeyl <mickeyl>2003-10-29 16:53:56 (UTC)
commit80fc44ae81d88c4cee5ea160818881acb2422a62 (patch) (unidiff)
treec7a9b698aa1bc3f12fc757e924ed424916ce1a06
parentf254437deda45d7cccf2ba3c27c5fe934af1fca7 (diff)
downloadopie-80fc44ae81d88c4cee5ea160818881acb2422a62.zip
opie-80fc44ae81d88c4cee5ea160818881acb2422a62.tar.gz
opie-80fc44ae81d88c4cee5ea160818881acb2422a62.tar.bz2
merge noncore/styles/*
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/metal/metal.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/styles/metal/metal.cpp b/noncore/styles/metal/metal.cpp
index 5cb2d22..e13a249 100644
--- a/noncore/styles/metal/metal.cpp
+++ b/noncore/styles/metal/metal.cpp
@@ -1,386 +1,385 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$
3** 2**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 3** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5** 4**
6** This file is part of an example program for Qt. This example 5** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation. 6** program may be used, distributed and modified without limitation.
8** 7**
9*****************************************************************************/ 8*****************************************************************************/
10 9
11#include "metal.h" 10#include "metal.h"
12#include <qapplication.h> 11#include <qapplication.h>
13#include <qpushbutton.h> 12#include <qpushbutton.h>
14#include <qscrollbar.h> 13#include <qscrollbar.h>
15#include <limits.h> 14#include <limits.h>
16 15
17 16
18///////////////////////////////////////////////////////// 17/////////////////////////////////////////////////////////
19#include "stonedark.xpm" 18#include "stonedark.xpm"
20#include "stone1.xpm" 19#include "stone1.xpm"
21#include "marble.xpm" 20#include "marble.xpm"
22/////////////////////////////////////////////////////// 21///////////////////////////////////////////////////////
23 22
24 23
25 24
26MetalStyle::MetalStyle() : QWindowsStyle() { } 25MetalStyle::MetalStyle() : QWindowsStyle() { }
27 26
28/*! 27/*!
29 Reimplementation from QStyle 28 Reimplementation from QStyle
30 */ 29 */
31void MetalStyle::polish( QApplication *app) 30void MetalStyle::polish( QApplication *app)
32{ 31{
33 oldPalette = app->palette(); 32 oldPalette = app->palette();
34 33
35 // we simply create a nice QColorGroup with a couple of fancy 34 // we simply create a nice QColorGroup with a couple of fancy
36 // pixmaps here and apply to it all widgets 35 // pixmaps here and apply to it all widgets
37 36
38 QFont f("times", app->font().pointSize() ); 37 QFont f("times", app->font().pointSize() );
39 f.setBold( TRUE ); 38 f.setBold( TRUE );
40 f.setItalic( TRUE ); 39 f.setItalic( TRUE );
41 app->setFont( f, TRUE, "QMenuBar"); 40 app->setFont( f, TRUE, "QMenuBar");
42 app->setFont( f, TRUE, "QPopupMenu"); 41 app->setFont( f, TRUE, "QPopupMenu");
43 42
44 43
45 //QPixmap button( stone1_xpm ); 44 //QPixmap button( stone1_xpm );
46 QPixmap button( stonedark_xpm ); 45 QPixmap button( stonedark_xpm );
47 QPixmap background(marble_xpm); 46 QPixmap background(marble_xpm);
48#if 0 47#if 0
49 48
50 int i; 49 int i;
51 for (i=0; i<img.numColors(); i++) { 50 for (i=0; i<img.numColors(); i++) {
52 QRgb rgb = img.color(i); 51 QRgb rgb = img.color(i);
53 QColor c(rgb); 52 QColor c(rgb);
54 rgb = c.dark().rgb(); 53 rgb = c.dark().rgb();
55 img.setColor(i,rgb); 54 img.setColor(i,rgb);
56 } 55 }
57 QPixmap mid; 56 QPixmap mid;
58 mid.convertFromImage(img); 57 mid.convertFromImage(img);
59 58
60 img = orig; 59 img = orig;
61 for (i=0; i<img.numColors(); i++) { 60 for (i=0; i<img.numColors(); i++) {
62 QRgb rgb = img.color(i); 61 QRgb rgb = img.color(i);
63 QColor c(rgb); 62 QColor c(rgb);
64 rgb = c.light().rgb(); 63 rgb = c.light().rgb();
65 img.setColor(i,rgb); 64 img.setColor(i,rgb);
66 } 65 }
67 QPixmap light; 66 QPixmap light;
68 light.convertFromImage(img); 67 light.convertFromImage(img);
69 68
70 img = orig; 69 img = orig;
71 for (i=0; i<img.numColors(); i++) { 70 for (i=0; i<img.numColors(); i++) {
72 QRgb rgb = img.color(i); 71 QRgb rgb = img.color(i);
73 QColor c(rgb); 72 QColor c(rgb);
74 rgb = c.dark().rgb(); 73 rgb = c.dark().rgb();
75 img.setColor(i,rgb); 74 img.setColor(i,rgb);
76 } 75 }
77 QPixmap dark; 76 QPixmap dark;
78 dark.convertFromImage(img); 77 dark.convertFromImage(img);
79#else 78#else
80 QPixmap dark( 1, 1 ); dark.fill( red.dark() ); 79 QPixmap dark( 1, 1 ); dark.fill( red.dark() );
81 QPixmap mid( stone1_xpm ); 80 QPixmap mid( stone1_xpm );
82 QPixmap light( stone1_xpm );//1, 1 ); light.fill( green ); 81 QPixmap light( stone1_xpm );//1, 1 ); light.fill( green );
83#endif 82#endif
84 QPalette op = app->palette(); 83 QPalette op = app->palette();
85 84
86 QColor backCol( 227,227,227 ); 85 QColor backCol( 227,227,227 );
87 86
88 // QPalette op(white); 87 // QPalette op(white);
89 QColorGroup active (op.normal().foreground(), 88 QColorGroup active (op.normal().foreground(),
90 QBrush(op.normal().button(),button), 89 QBrush(op.normal().button(),button),
91 QBrush(op.normal().light(), light), 90 QBrush(op.normal().light(), light),
92 QBrush(op.normal().dark(), dark), 91 QBrush(op.normal().dark(), dark),
93 QBrush(op.normal().mid(), mid), 92 QBrush(op.normal().mid(), mid),
94 op.normal().text(), 93 op.normal().text(),
95 Qt::white, 94 Qt::white,
96 op.normal().base(),// QColor(236,182,120), 95 op.normal().base(),// QColor(236,182,120),
97 QBrush(backCol, background) 96 QBrush(backCol, background)
98 ); 97 );
99 active.setColor( QColorGroup::ButtonText, Qt::white ); 98 active.setColor( QColorGroup::ButtonText, Qt::white );
100 active.setColor( QColorGroup::Shadow, Qt::black ); 99 active.setColor( QColorGroup::Shadow, Qt::black );
101 QColorGroup disabled (op.disabled().foreground(), 100 QColorGroup disabled (op.disabled().foreground(),
102 QBrush(op.disabled().button(),button), 101 QBrush(op.disabled().button(),button),
103 QBrush(op.disabled().light(), light), 102 QBrush(op.disabled().light(), light),
104 op.disabled().dark(), 103 op.disabled().dark(),
105 QBrush(op.disabled().mid(), mid), 104 QBrush(op.disabled().mid(), mid),
106 op.disabled().text(), 105 op.disabled().text(),
107 Qt::white, 106 Qt::white,
108 op.disabled().base(),// QColor(236,182,120), 107 op.disabled().base(),// QColor(236,182,120),
109 QBrush(backCol, background) 108 QBrush(backCol, background)
110 ); 109 );
111 110
112 QPalette newPalette( active, disabled, active ); 111 QPalette newPalette( active, disabled, active );
113 app->setPalette( newPalette, TRUE ); 112 app->setPalette( newPalette, TRUE );
114} 113}
115 114
116/*! 115/*!
117 Reimplementation from QStyle 116 Reimplementation from QStyle
118 */ 117 */
119void MetalStyle::unPolish( QApplication *app) 118void MetalStyle::unPolish( QApplication *app)
120{ 119{
121 app->setPalette(oldPalette, TRUE); 120 app->setPalette(oldPalette, TRUE);
122 app->setFont( app->font(), TRUE ); 121 app->setFont( app->font(), TRUE );
123} 122}
124 123
125/*! 124/*!
126 Reimplementation from QStyle 125 Reimplementation from QStyle
127 */ 126 */
128void MetalStyle::polish( QWidget* w) 127void MetalStyle::polish( QWidget* w)
129{ 128{
130 129
131 // the polish function sets some widgets to transparent mode and 130 // the polish function sets some widgets to transparent mode and
132 // some to translate background mode in order to get the full 131 // some to translate background mode in order to get the full
133 // benefit from the nice pixmaps in the color group. 132 // benefit from the nice pixmaps in the color group.
134 133
135 if (w->inherits("QPushButton")){ 134 if (w->inherits("QPushButton")){
136 w->setBackgroundMode( QWidget::NoBackground ); 135 w->setBackgroundMode( QWidget::NoBackground );
137 return; 136 return;
138 } 137 }
139 138
140 if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){ 139 if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){
141 return; 140 return;
142 } 141 }
143 142
144 if ( !w->isTopLevel() ) { 143 if ( !w->isTopLevel() ) {
145 if ( w->inherits("QGroupBox") 144 if ( w->inherits("QGroupBox")
146 || w->inherits("QTabWidget") ) { 145 || w->inherits("QTabWidget") ) {
147 w->setAutoMask( TRUE ); 146 w->setAutoMask( TRUE );
148 return; 147 return;
149 } 148 }
150 if (w->inherits("QLabel") 149 if (w->inherits("QLabel")
151 || w->inherits("QSlider") 150 || w->inherits("QSlider")
152 || w->inherits("QButton") 151 || w->inherits("QButton")
153 || w->inherits("QProgressBar") 152 || w->inherits("QProgressBar")
154 ){ 153 ){
155 w->setBackgroundOrigin( QWidget::ParentOrigin ); 154 w->setBackgroundOrigin( QWidget::ParentOrigin );
156 } 155 }
157 } 156 }
158} 157}
159 158
160void MetalStyle::unPolish( QWidget* w) 159void MetalStyle::unPolish( QWidget* w)
161{ 160{
162 161
163 // the polish function sets some widgets to transparent mode and 162 // the polish function sets some widgets to transparent mode and
164 // some to translate background mode in order to get the full 163 // some to translate background mode in order to get the full
165 // benefit from the nice pixmaps in the color group. 164 // benefit from the nice pixmaps in the color group.
166 165
167 if (w->inherits("QPushButton")){ 166 if (w->inherits("QPushButton")){
168 w->setBackgroundMode( QWidget::PaletteButton ); 167 w->setBackgroundMode( QWidget::PaletteButton );
169 return; 168 return;
170 } 169 }
171 170
172 if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){ 171 if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){
173 return; 172 return;
174 } 173 }
175 174
176 if ( !w->isTopLevel() ) { 175 if ( !w->isTopLevel() ) {
177 if ( w->inherits("QGroupBox") 176 if ( w->inherits("QGroupBox")
178 || w->inherits("QTabWidget") ) { 177 || w->inherits("QTabWidget") ) {
179 w->setAutoMask( FALSE ); 178 w->setAutoMask( FALSE );
180 return; 179 return;
181 } 180 }
182 if (w->inherits("QLabel") 181 if (w->inherits("QLabel")
183 || w->inherits("QSlider") 182 || w->inherits("QSlider")
184 || w->inherits("QButton") 183 || w->inherits("QButton")
185 || w->inherits("QProgressBar") 184 || w->inherits("QProgressBar")
186 ){ 185 ){
187 w->setBackgroundOrigin( QWidget::WidgetOrigin ); 186 w->setBackgroundOrigin( QWidget::WidgetOrigin );
188 } 187 }
189 } 188 }
190 189
191} 190}
192 191
193/*! 192/*!
194 Draw a metallic button, sunken if \a sunken is TRUE, horizontal if 193 Draw a metallic button, sunken if \a sunken is TRUE, horizontal if
195 /a horz is TRUE. 194 /a horz is TRUE.
196*/ 195*/
197 196
198void MetalStyle::drawMetalButton( QPainter *p, int x, int y, int w, int h, 197void MetalStyle::drawMetalButton( QPainter *p, int x, int y, int w, int h,
199 bool sunken, bool horz ) 198 bool sunken, bool horz )
200{ 199{
201 QColor top1("#878769691515"); 200 QColor top1("#878769691515");
202 QColor top2("#C6C6B4B44949"); 201 QColor top2("#C6C6B4B44949");
203 202
204 QColor bot2("#70705B5B1414"); 203 QColor bot2("#70705B5B1414");
205 QColor bot1("56564A4A0E0E"); //first from the bottom 204 QColor bot1("56564A4A0E0E"); //first from the bottom
206 205
207 QColor highlight("#E8E8DDDD6565"); 206 QColor highlight("#E8E8DDDD6565");
208 QColor subh1("#CECEBDBD5151"); 207 QColor subh1("#CECEBDBD5151");
209 QColor subh2("#BFBFACAC4545"); 208 QColor subh2("#BFBFACAC4545");
210 209
211 QColor topgrad("#B9B9A5A54040"); 210 QColor topgrad("#B9B9A5A54040");
212 QColor botgrad("#89896C6C1A1A"); 211 QColor botgrad("#89896C6C1A1A");
213 212
214 213
215 int x2 = x + w - 1; 214 int x2 = x + w - 1;
216 int y2 = y + h - 1; 215 int y2 = y + h - 1;
217 216
218 //frame: 217 //frame:
219 218
220 p->setPen( top1 ); 219 p->setPen( top1 );
221 p->drawLine( x, y2, x, y ); 220 p->drawLine( x, y2, x, y );
222 p->drawLine( x, y, x2-1, y ); 221 p->drawLine( x, y, x2-1, y );
223 p->setPen( top2 ); 222 p->setPen( top2 );
224 p->drawLine( x+1, y2 -1, x+1, y+1 ); 223 p->drawLine( x+1, y2 -1, x+1, y+1 );
225 p->drawLine( x+1, y+1 , x2-2, y+1 ); 224 p->drawLine( x+1, y+1 , x2-2, y+1 );
226 225
227 p->setPen( bot1 ); 226 p->setPen( bot1 );
228 p->drawLine( x+1, y2, x2, y2 ); 227 p->drawLine( x+1, y2, x2, y2 );
229 p->drawLine( x2, y2, x2, y ); 228 p->drawLine( x2, y2, x2, y );
230 p->setPen( bot2 ); 229 p->setPen( bot2 );
231 p->drawLine( x+1, y2-1, x2-1, y2-1 ); 230 p->drawLine( x+1, y2-1, x2-1, y2-1 );
232 p->drawLine( x2-1, y2-1, x2-1, y+1 ); 231 p->drawLine( x2-1, y2-1, x2-1, y+1 );
233 232
234 // highlight: 233 // highlight:
235 int i = 0; 234 int i = 0;
236 int x1 = x + 2; 235 int x1 = x + 2;
237 int y1 = y + 2; 236 int y1 = y + 2;
238 if ( horz ) 237 if ( horz )
239 x2 = x2 - 2; 238 x2 = x2 - 2;
240 else 239 else
241 y2 = y2 - 2; 240 y2 = y2 - 2;
242 // Note that x2/y2 mean something else from this point down... 241 // Note that x2/y2 mean something else from this point down...
243 242
244#define DRAWLINE if (horz) \ 243#define DRAWLINE if (horz) \
245 p->drawLine( x1, y1+i, x2, y1+i ); \ 244 p->drawLine( x1, y1+i, x2, y1+i ); \
246 else \ 245 else \
247 p->drawLine( x1+i, y1, x1+i, y2 ); \ 246 p->drawLine( x1+i, y1, x1+i, y2 ); \
248 i++; 247 i++;
249 248
250 if ( !sunken ) { 249 if ( !sunken ) {
251 p->setPen( highlight ); 250 p->setPen( highlight );
252 DRAWLINE; 251 DRAWLINE;
253 DRAWLINE; 252 DRAWLINE;
254 p->setPen( subh1 ); 253 p->setPen( subh1 );
255 DRAWLINE; 254 DRAWLINE;
256 p->setPen( subh2 ); 255 p->setPen( subh2 );
257 DRAWLINE; 256 DRAWLINE;
258 } 257 }
259 // gradient: 258 // gradient:
260 int ng = (horz ? h : w) - 8; // how many lines for the gradient? 259 int ng = (horz ? h : w) - 8; // how many lines for the gradient?
261 260
262 int h1, h2, s1, s2, v1, v2; 261 int h1, h2, s1, s2, v1, v2;
263 if ( !sunken ) { 262 if ( !sunken ) {
264 topgrad.hsv( &h1, &s1, &v1 ); 263 topgrad.hsv( &h1, &s1, &v1 );
265 botgrad.hsv( &h2, &s2, &v2 ); 264 botgrad.hsv( &h2, &s2, &v2 );
266 } else { 265 } else {
267 botgrad.hsv( &h1, &s1, &v1 ); 266 botgrad.hsv( &h1, &s1, &v1 );
268 topgrad.hsv( &h2, &s2, &v2 ); 267 topgrad.hsv( &h2, &s2, &v2 );
269 } 268 }
270 269
271 if ( ng > 1 ) { 270 if ( ng > 1 ) {
272 271
273 for ( int j =0; j < ng; j++ ) { 272 for ( int j =0; j < ng; j++ ) {
274 p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), 273 p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1),
275 s1 + ((s2-s1)*j)/(ng-1), 274 s1 + ((s2-s1)*j)/(ng-1),
276 v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) ); 275 v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) );
277 DRAWLINE; 276 DRAWLINE;
278 } 277 }
279 } else if ( ng == 1 ) { 278 } else if ( ng == 1 ) {
280 p->setPen( QColor( (h1+h2)/2, (s1+s2)/2, (v1+v2)/2, QColor::Hsv ) ); 279 p->setPen( QColor( (h1+h2)/2, (s1+s2)/2, (v1+v2)/2, QColor::Hsv ) );
281 DRAWLINE; 280 DRAWLINE;
282 } 281 }
283 if ( sunken ) { 282 if ( sunken ) {
284 p->setPen( subh2 ); 283 p->setPen( subh2 );
285 DRAWLINE; 284 DRAWLINE;
286 285
287 p->setPen( subh1 ); 286 p->setPen( subh1 );
288 DRAWLINE; 287 DRAWLINE;
289 288
290 p->setPen( highlight ); 289 p->setPen( highlight );
291 DRAWLINE; 290 DRAWLINE;
292 DRAWLINE; 291 DRAWLINE;
293 } 292 }
294 293
295} 294}
296 295
297 296
298 297
299/*! 298/*!
300 Reimplementation from QStyle 299 Reimplementation from QStyle
301 */ 300 */
302void MetalStyle::drawButton( QPainter *p, int x, int y, int w, int h, 301void MetalStyle::drawButton( QPainter *p, int x, int y, int w, int h,
303 const QColorGroup &, bool sunken, const QBrush*) 302 const QColorGroup &, bool sunken, const QBrush*)
304{ 303{
305 304
306 drawMetalButton( p, x, y, w, h, sunken, TRUE ); 305 drawMetalButton( p, x, y, w, h, sunken, TRUE );
307} 306}
308 307
309/*! 308/*!
310 Reimplementation from QStyle 309 Reimplementation from QStyle
311 */ 310 */
312void MetalStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h, 311void MetalStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h,
313 const QColorGroup &, bool sunken, const QBrush*) 312 const QColorGroup &, bool sunken, const QBrush*)
314{ 313{
315 MetalStyle::drawMetalButton(p, x, y, w, h, sunken, TRUE ); 314 MetalStyle::drawMetalButton(p, x, y, w, h, sunken, TRUE );
316} 315}
317 316
318/*! 317/*!
319 Reimplementation from QStyle 318 Reimplementation from QStyle
320 */ 319 */
321void MetalStyle::drawPushButton( QPushButton* btn, QPainter *p) 320void MetalStyle::drawPushButton( QPushButton* btn, QPainter *p)
322{ 321{
323 QColorGroup g = btn->colorGroup(); 322 QColorGroup g = btn->colorGroup();
324 int x1, y1, x2, y2; 323 int x1, y1, x2, y2;
325 324
326 btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates 325 btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates
327 326
328 p->setPen( g.foreground() ); 327 p->setPen( g.foreground() );
329 p->setBrush( QBrush(g.button(),NoBrush) ); 328 p->setBrush( QBrush(g.button(),NoBrush) );
330 329
331 QBrush fill; 330 QBrush fill;
332 if ( btn->isDown() ) 331 if ( btn->isDown() )
333 fill = g.brush( QColorGroup::Mid ); 332 fill = g.brush( QColorGroup::Mid );
334 else if ( btn->isOn() ) 333 else if ( btn->isOn() )
335 fill = QBrush( g.mid(), Dense4Pattern ); 334 fill = QBrush( g.mid(), Dense4Pattern );
336 else 335 else
337 fill = g.brush( QColorGroup::Button ); 336 fill = g.brush( QColorGroup::Button );
338 337
339 if ( btn->isDefault() ) { 338 if ( btn->isDefault() ) {
340 QPointArray a; 339 QPointArray a;
341 a.setPoints( 9, 340 a.setPoints( 9,
342 x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, 341 x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1,
343 x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1 ); 342 x2-1, y1+1, x2-1, y2-1, x1+1, y2-1, x1+1, y1+1 );
344 p->setPen( Qt::black ); 343 p->setPen( Qt::black );
345 p->drawPolyline( a ); 344 p->drawPolyline( a );
346 x1 += 2; 345 x1 += 2;
347 y1 += 2; 346 y1 += 2;
348 x2 -= 2; 347 x2 -= 2;
349 y2 -= 2; 348 y2 -= 2;
350 } 349 }
351 350
352 drawMetalButton( p, x1, y1, x2-x1+1, y2-y1+1, btn->isOn() || btn->isDown(), 351 drawMetalButton( p, x1, y1, x2-x1+1, y2-y1+1, btn->isOn() || btn->isDown(),
353 TRUE ); // always horizontal 352 TRUE ); // always horizontal
354 353
355 354
356 if ( btn->isMenuButton() ) { 355 if ( btn->isMenuButton() ) {
357 int dx = (y1-y2-4)/3; 356 int dx = (y1-y2-4)/3;
358 drawArrow( p, DownArrow, FALSE, 357 drawArrow( p, DownArrow, FALSE,
359 x2 - dx, dx, y1, y2 - y1, 358 x2 - dx, dx, y1, y2 - y1,
360 g, btn->isEnabled() ); 359 g, btn->isEnabled() );
361 } 360 }
362 361
363 if ( p->brush().style() != NoBrush ) 362 if ( p->brush().style() != NoBrush )
364 p->setBrush( NoBrush ); 363 p->setBrush( NoBrush );
365 364
366} 365}
367 366
368 367
369/*! 368/*!
370 Reimplementation from QStyle 369 Reimplementation from QStyle
371 */ 370 */
372void MetalStyle::drawPushButtonLabel( QPushButton* btn, QPainter *p) 371void MetalStyle::drawPushButtonLabel( QPushButton* btn, QPainter *p)
373{ 372{
374 QRect r = btn->rect(); 373 QRect r = btn->rect();
375 int x, y, w, h; 374 int x, y, w, h;
376 r.rect( &x, &y, &w, &h ); 375 r.rect( &x, &y, &w, &h );
377 376
378 int x1, y1, x2, y2; 377 int x1, y1, x2, y2;
379 btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates 378 btn->rect().coords( &x1, &y1, &x2, &y2 ); // get coordinates
380 int dx = 0; 379 int dx = 0;
381 int dy = 0; 380 int dy = 0;
382 if ( btn->isMenuButton() ) 381 if ( btn->isMenuButton() )
383 dx = (y2-y1) / 3; 382 dx = (y2-y1) / 3;
384 if ( btn->isOn() || btn->isDown() ) { 383 if ( btn->isOn() || btn->isDown() ) {
385 dx--; 384 dx--;
386 dy--; 385 dy--;