-rw-r--r-- | noncore/styles/theme/ogfxeffect.cpp | 22 | ||||
-rw-r--r-- | noncore/styles/theme/othemestyle.cpp | 6 |
2 files changed, 17 insertions, 11 deletions
diff --git a/noncore/styles/theme/ogfxeffect.cpp b/noncore/styles/theme/ogfxeffect.cpp index 2071a67..90b45fe 100644 --- a/noncore/styles/theme/ogfxeffect.cpp +++ b/noncore/styles/theme/ogfxeffect.cpp | |||
@@ -1,80 +1,81 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> | 2 | Copyright (C) 1998, 1999 Christian Tibirna <ctibirna@total.net> |
3 | (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> | 3 | (C) 1998, 1999 Daniel M. Duley <mosfet@kde.org> |
4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> | 4 | (C) 1998, 1999 Dirk A. Mueller <mueller@kde.org> |
5 | 5 | ||
6 | */ | 6 | */ |
7 | 7 | ||
8 | // $Id$ | 8 | // $Id$ |
9 | 9 | ||
10 | #include <qimage.h> | 10 | #include <qimage.h> |
11 | #include <qpainter.h> | 11 | #include <qpainter.h> |
12 | 12 | ||
13 | #include <qpe/qmath.h> | 13 | #include <qpe/qmath.h> |
14 | 14 | ||
15 | #include "ogfxeffect.h" | 15 | #include "ogfxeffect.h" |
16 | 16 | ||
17 | #include <cstdlib> | 17 | #include <cstdlib> |
18 | #include <cmath> | 18 | #include <cmath> |
19 | 19 | ||
20 | //====================================================================== | 20 | //====================================================================== |
21 | // | 21 | // |
22 | // Gradient effects | 22 | // Gradient effects |
23 | // | 23 | // |
24 | //====================================================================== | 24 | //====================================================================== |
25 | 25 | ||
26 | 26 | ||
27 | QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca, | 27 | QPixmap& OGfxEffect::gradient(QPixmap &pixmap, const QColor &ca, |
28 | const QColor &cb, GradientType eff, int ncols) | 28 | const QColor &cb, GradientType eff, int ncols) |
29 | { | 29 | { |
30 | QImage image = gradient(pixmap.size(), ca, cb, eff, ncols); | 30 | if ( !pixmap. isNull ( )) { |
31 | pixmap.convertFromImage(image); | 31 | QImage image = gradient(pixmap.size(), ca, cb, eff, ncols); |
32 | 32 | pixmap.convertFromImage(image); | |
33 | } | ||
33 | return pixmap; | 34 | return pixmap; |
34 | } | 35 | } |
35 | 36 | ||
36 | QImage OGfxEffect::gradient(const QSize &size, const QColor &ca, | 37 | QImage OGfxEffect::gradient(const QSize &size, const QColor &ca, |
37 | const QColor &cb, GradientType eff, int /*ncols*/) | 38 | const QColor &cb, GradientType eff, int /*ncols*/) |
38 | { | 39 | { |
39 | int rDiff, gDiff, bDiff; | 40 | int rDiff, gDiff, bDiff; |
40 | int rca, gca, bca, rcb, gcb, bcb; | 41 | int rca, gca, bca, rcb, gcb, bcb; |
41 | 42 | ||
42 | QImage image(size, 32); | 43 | QImage image(size, 32); |
43 | 44 | ||
44 | if (size.width() == 0 || size.height() == 0) { | 45 | if (size.width() == 0 || size.height() == 0) { |
45 | qDebug ( "WARNING: OGfxEffect::gradient: invalid image" ); | 46 | qDebug ( "WARNING: OGfxEffect::gradient: invalid image" ); |
46 | return image; | 47 | return image; |
47 | } | 48 | } |
48 | 49 | ||
49 | register int x, y; | 50 | register int x, y; |
50 | 51 | ||
51 | rDiff = (rcb = cb.red()) - (rca = ca.red()); | 52 | rDiff = (rcb = cb.red()) - (rca = ca.red()); |
52 | gDiff = (gcb = cb.green()) - (gca = ca.green()); | 53 | gDiff = (gcb = cb.green()) - (gca = ca.green()); |
53 | bDiff = (bcb = cb.blue()) - (bca = ca.blue()); | 54 | bDiff = (bcb = cb.blue()) - (bca = ca.blue()); |
54 | 55 | ||
55 | if( eff == VerticalGradient || eff == HorizontalGradient ){ | 56 | if( eff == VerticalGradient || eff == HorizontalGradient ){ |
56 | 57 | ||
57 | uint *p; | 58 | uint *p; |
58 | uint rgb; | 59 | uint rgb; |
59 | 60 | ||
60 | register int rl = rca << 16; | 61 | register int rl = rca << 16; |
61 | register int gl = gca << 16; | 62 | register int gl = gca << 16; |
62 | register int bl = bca << 16; | 63 | register int bl = bca << 16; |
63 | 64 | ||
64 | if( eff == VerticalGradient ) { | 65 | if( eff == VerticalGradient ) { |
65 | 66 | ||
66 | int rcdelta = ((1<<16) / size.height()) * rDiff; | 67 | int rcdelta = ((1<<16) / size.height()) * rDiff; |
67 | int gcdelta = ((1<<16) / size.height()) * gDiff; | 68 | int gcdelta = ((1<<16) / size.height()) * gDiff; |
68 | int bcdelta = ((1<<16) / size.height()) * bDiff; | 69 | int bcdelta = ((1<<16) / size.height()) * bDiff; |
69 | 70 | ||
70 | for ( y = 0; y < size.height(); y++ ) { | 71 | for ( y = 0; y < size.height(); y++ ) { |
71 | p = (uint *) image.scanLine(y); | 72 | p = (uint *) image.scanLine(y); |
72 | 73 | ||
73 | rl += rcdelta; | 74 | rl += rcdelta; |
74 | gl += gcdelta; | 75 | gl += gcdelta; |
75 | bl += bcdelta; | 76 | bl += bcdelta; |
76 | 77 | ||
77 | rgb = qRgb( (rl>>16), (gl>>16), (bl>>16) ); | 78 | rgb = qRgb( (rl>>16), (gl>>16), (bl>>16) ); |
78 | 79 | ||
79 | for( x = 0; x < size.width(); x++ ) { | 80 | for( x = 0; x < size.width(); x++ ) { |
80 | *p = rgb; | 81 | *p = rgb; |
@@ -235,105 +236,106 @@ QImage OGfxEffect::gradient(const QSize &size, const QColor &ca, | |||
235 | if (eff == PipeCrossGradient) { | 236 | if (eff == PipeCrossGradient) { |
236 | rgb = qRgb(rcb - rSign * | 237 | rgb = qRgb(rcb - rSign * |
237 | QMIN(xtable[0][x], ytable[0][y]) * 2, | 238 | QMIN(xtable[0][x], ytable[0][y]) * 2, |
238 | gcb - gSign * | 239 | gcb - gSign * |
239 | QMIN(xtable[1][x], ytable[1][y]) * 2, | 240 | QMIN(xtable[1][x], ytable[1][y]) * 2, |
240 | bcb - bSign * | 241 | bcb - bSign * |
241 | QMIN(xtable[2][x], ytable[2][y]) * 2); | 242 | QMIN(xtable[2][x], ytable[2][y]) * 2); |
242 | } | 243 | } |
243 | if (eff == EllipticGradient) { | 244 | if (eff == EllipticGradient) { |
244 | rgb = qRgb(rcb - rSign * | 245 | rgb = qRgb(rcb - rSign * |
245 | (int)sqrt((xtable[0][x]*xtable[0][x] + | 246 | (int)sqrt((xtable[0][x]*xtable[0][x] + |
246 | ytable[0][y]*ytable[0][y])*2.0), | 247 | ytable[0][y]*ytable[0][y])*2.0), |
247 | gcb - gSign * | 248 | gcb - gSign * |
248 | (int)sqrt((xtable[1][x]*xtable[1][x] + | 249 | (int)sqrt((xtable[1][x]*xtable[1][x] + |
249 | ytable[1][y]*ytable[1][y])*2.0), | 250 | ytable[1][y]*ytable[1][y])*2.0), |
250 | bcb - bSign * | 251 | bcb - bSign * |
251 | (int)sqrt((xtable[2][x]*xtable[2][x] + | 252 | (int)sqrt((xtable[2][x]*xtable[2][x] + |
252 | ytable[2][y]*ytable[2][y])*2.0)); | 253 | ytable[2][y]*ytable[2][y])*2.0)); |
253 | } | 254 | } |
254 | 255 | ||
255 | sl1[x] = sl2[x] = rgb; | 256 | sl1[x] = sl2[x] = rgb; |
256 | sl1[x2] = sl2[x2] = rgb; | 257 | sl1[x2] = sl2[x2] = rgb; |
257 | } | 258 | } |
258 | } | 259 | } |
259 | } | 260 | } |
260 | 261 | ||
261 | delete [] xtable[0]; | 262 | delete [] xtable[0]; |
262 | delete [] xtable[1]; | 263 | delete [] xtable[1]; |
263 | delete [] xtable[2]; | 264 | delete [] xtable[2]; |
264 | delete [] ytable[0]; | 265 | delete [] ytable[0]; |
265 | delete [] ytable[1]; | 266 | delete [] ytable[1]; |
266 | delete [] ytable[2]; | 267 | delete [] ytable[2]; |
267 | } | 268 | } |
268 | return image; | 269 | return image; |
269 | } | 270 | } |
270 | 271 | ||
271 | 272 | ||
272 | //====================================================================== | 273 | //====================================================================== |
273 | // | 274 | // |
274 | // Blend effects | 275 | // Blend effects |
275 | // | 276 | // |
276 | //====================================================================== | 277 | //====================================================================== |
277 | 278 | ||
278 | 279 | ||
279 | QPixmap& OGfxEffect::blend(QPixmap &pixmap, float initial_intensity, | 280 | QPixmap& OGfxEffect::blend(QPixmap &pixmap, float initial_intensity, |
280 | const QColor &bgnd, GradientType eff, | 281 | const QColor &bgnd, GradientType eff, |
281 | bool anti_dir, int /*ncols*/) | 282 | bool anti_dir, int /*ncols*/) |
282 | { | 283 | { |
283 | QImage image = pixmap.convertToImage(); | 284 | if ( !pixmap. isNull ( )) { |
284 | OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir); | 285 | QImage image = pixmap.convertToImage(); |
285 | 286 | OGfxEffect::blend(image, initial_intensity, bgnd, eff, anti_dir); | |
286 | if ( pixmap. depth ( ) <= 8 ) | ||
287 | image. convertDepth ( pixmap. depth ( )); | ||
288 | 287 | ||
289 | pixmap.convertFromImage(image); | 288 | if ( pixmap. depth ( ) <= 8 ) |
289 | image. convertDepth ( pixmap. depth ( )); | ||
290 | 290 | ||
291 | return pixmap; | 291 | pixmap.convertFromImage(image); |
292 | } | ||
293 | return pixmap; | ||
292 | } | 294 | } |
293 | 295 | ||
294 | 296 | ||
295 | QImage& OGfxEffect::blend(QImage &image, float initial_intensity, | 297 | QImage& OGfxEffect::blend(QImage &image, float initial_intensity, |
296 | const QColor &bgnd, GradientType eff, | 298 | const QColor &bgnd, GradientType eff, |
297 | bool anti_dir) | 299 | bool anti_dir) |
298 | { | 300 | { |
299 | if (image.width() == 0 || image.height() == 0) { | 301 | if (image.width() == 0 || image.height() == 0) { |
300 | qDebug ( "Invalid image\n" ); | 302 | qDebug ( "Invalid image\n" ); |
301 | return image; | 303 | return image; |
302 | } | 304 | } |
303 | 305 | ||
304 | int r_bgnd = bgnd.red(), g_bgnd = bgnd.green(), b_bgnd = bgnd.blue(); | 306 | int r_bgnd = bgnd.red(), g_bgnd = bgnd.green(), b_bgnd = bgnd.blue(); |
305 | int r, g, b; | 307 | int r, g, b; |
306 | int ind; | 308 | int ind; |
307 | 309 | ||
308 | unsigned int xi, xf, yi, yf; | 310 | unsigned int xi, xf, yi, yf; |
309 | unsigned int a; | 311 | unsigned int a; |
310 | 312 | ||
311 | // check the boundaries of the initial intesity param | 313 | // check the boundaries of the initial intesity param |
312 | float unaffected = 1; | 314 | float unaffected = 1; |
313 | if (initial_intensity > 1) initial_intensity = 1; | 315 | if (initial_intensity > 1) initial_intensity = 1; |
314 | if (initial_intensity < -1) initial_intensity = -1; | 316 | if (initial_intensity < -1) initial_intensity = -1; |
315 | if (initial_intensity < 0) { | 317 | if (initial_intensity < 0) { |
316 | unaffected = 1. + initial_intensity; | 318 | unaffected = 1. + initial_intensity; |
317 | initial_intensity = 0; | 319 | initial_intensity = 0; |
318 | } | 320 | } |
319 | 321 | ||
320 | 322 | ||
321 | float intensity = initial_intensity; | 323 | float intensity = initial_intensity; |
322 | float var = 1. - initial_intensity; | 324 | float var = 1. - initial_intensity; |
323 | 325 | ||
324 | if (anti_dir) { | 326 | if (anti_dir) { |
325 | initial_intensity = intensity = 1.; | 327 | initial_intensity = intensity = 1.; |
326 | var = -var; | 328 | var = -var; |
327 | } | 329 | } |
328 | 330 | ||
329 | register int x, y; | 331 | register int x, y; |
330 | 332 | ||
331 | unsigned int *data = (unsigned int *)image.bits(); | 333 | unsigned int *data = (unsigned int *)image.bits(); |
332 | 334 | ||
333 | if( eff == VerticalGradient || eff == HorizontalGradient ) { | 335 | if( eff == VerticalGradient || eff == HorizontalGradient ) { |
334 | 336 | ||
335 | // set the image domain to apply the effect to | 337 | // set the image domain to apply the effect to |
336 | xi = 0, xf = image.width(); | 338 | xi = 0, xf = image.width(); |
337 | yi = 0, yf = image.height(); | 339 | yi = 0, yf = image.height(); |
338 | if (eff == VerticalGradient) { | 340 | if (eff == VerticalGradient) { |
339 | if (anti_dir) yf = (int)(image.height() * unaffected); | 341 | if (anti_dir) yf = (int)(image.height() * unaffected); |
diff --git a/noncore/styles/theme/othemestyle.cpp b/noncore/styles/theme/othemestyle.cpp index a820efb..98e7253 100644 --- a/noncore/styles/theme/othemestyle.cpp +++ b/noncore/styles/theme/othemestyle.cpp | |||
@@ -204,137 +204,141 @@ void OThemeStyle::polish( QWidget *w ) | |||
204 | } | 204 | } |
205 | else if ( w-> inherits ( "QProgressBar" ) ) { | 205 | else if ( w-> inherits ( "QProgressBar" ) ) { |
206 | w-> installEventFilter ( this ); | 206 | w-> installEventFilter ( this ); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | void OThemeStyle::unPolish( QWidget* w ) | 210 | void OThemeStyle::unPolish( QWidget* w ) |
211 | { | 211 | { |
212 | if ( !w->isTopLevel() ) { | 212 | if ( !w->isTopLevel() ) { |
213 | if ( w->inherits( "QGroupBox" ) | 213 | if ( w->inherits( "QGroupBox" ) |
214 | || w->inherits( "QTabWidget" ) ) { | 214 | || w->inherits( "QTabWidget" ) ) { |
215 | w->setAutoMask( FALSE ); | 215 | w->setAutoMask( FALSE ); |
216 | return ; | 216 | return ; |
217 | } | 217 | } |
218 | if ( w->inherits( "QLabel" ) | 218 | if ( w->inherits( "QLabel" ) |
219 | || w->inherits( "QSlider" ) | 219 | || w->inherits( "QSlider" ) |
220 | || w->inherits( "QButton" ) | 220 | || w->inherits( "QButton" ) |
221 | || w->inherits( "QProgressBar" ) | 221 | || w->inherits( "QProgressBar" ) |
222 | ) { | 222 | ) { |
223 | w->setBackgroundOrigin( QWidget::WidgetOrigin ); | 223 | w->setBackgroundOrigin( QWidget::WidgetOrigin ); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | if ( w->inherits( "QPopupMenu" ) ) | 226 | if ( w->inherits( "QPopupMenu" ) ) |
227 | w->unsetPalette(); | 227 | w->unsetPalette(); |
228 | else if ( w->inherits( "QCheckBox" ) ) | 228 | else if ( w->inherits( "QCheckBox" ) ) |
229 | w->unsetPalette(); | 229 | w->unsetPalette(); |
230 | else if ( w->inherits( "QRadioButton" ) ) | 230 | else if ( w->inherits( "QRadioButton" ) ) |
231 | w->unsetPalette(); | 231 | w->unsetPalette(); |
232 | else if ( w-> inherits ( "QProgressBar" ) ) | 232 | else if ( w-> inherits ( "QProgressBar" ) ) |
233 | w-> removeEventFilter ( this ); | 233 | w-> removeEventFilter ( this ); |
234 | } | 234 | } |
235 | 235 | ||
236 | bool OThemeStyle::eventFilter ( QObject *obj, QEvent *ev ) | 236 | bool OThemeStyle::eventFilter ( QObject *obj, QEvent *ev ) |
237 | { | 237 | { |
238 | // only QProgressBar so far | 238 | // only QProgressBar so far |
239 | 239 | ||
240 | if ( ev-> type ( ) == QEvent::Paint ) { | 240 | if ( ev-> type ( ) == QEvent::Paint ) { |
241 | HackProgressBar *pb = (HackProgressBar *) obj; | 241 | HackProgressBar *pb = (HackProgressBar *) obj; |
242 | pb-> paint ((QPaintEvent *) ev, this ); | 242 | pb-> paint ((QPaintEvent *) ev, this ); |
243 | return true; | 243 | return true; |
244 | } | 244 | } |
245 | return false; | 245 | return false; |
246 | } | 246 | } |
247 | 247 | ||
248 | void OThemeStyle::drawBaseButton( QPainter *p, int x, int y, int w, int h, | 248 | void OThemeStyle::drawBaseButton( QPainter *p, int x, int y, int w, int h, |
249 | const QColorGroup &g, bool sunken, bool | 249 | const QColorGroup &g, bool sunken, bool |
250 | rounded, WidgetType type, const QBrush * ) | 250 | rounded, WidgetType type, const QBrush * ) |
251 | { | 251 | { |
252 | if ( w <= 0 || h <= 0 ) | ||
253 | return; | ||
254 | |||
252 | int offset = borderPixmap( type ) ? 0 : decoWidth( type ); | 255 | int offset = borderPixmap( type ) ? 0 : decoWidth( type ); |
253 | QPen oldPen = p->pen(); | 256 | QPen oldPen = p->pen(); |
254 | 257 | ||
255 | // handle reverse bevel here since it uses decowidth differently | 258 | // handle reverse bevel here since it uses decowidth differently |
256 | if ( gradientHint( type ) == GrReverseBevel ) { | 259 | if ( gradientHint( type ) == GrReverseBevel ) { |
257 | int i; | 260 | int i; |
258 | bitBlt( p->device(), x, y, scalePixmap( w, h, type ), 0, 0, w, h, | 261 | bitBlt( p->device(), x, y, scalePixmap( w, h, type ), 0, 0, w, h, |
259 | Qt::CopyROP, true ); | 262 | Qt::CopyROP, true ); |
260 | p->setPen( g.text() ); | 263 | p->setPen( g.text() ); |
261 | for ( i = 0; i < borderWidth( type ); ++i, ++x, ++y, w -= 2, h -= 2 ) | 264 | for ( i = 0; i < borderWidth( type ); ++i, ++x, ++y, w -= 2, h -= 2 ) |
262 | p->drawRect( x, y, w, h ); | 265 | p->drawRect( x, y, w, h ); |
263 | } | 266 | } |
264 | // same with KDE style borders | 267 | // same with KDE style borders |
265 | else if ( !borderPixmap( type ) && shade() == KDE ) { | 268 | else if ( !borderPixmap( type ) && shade() == KDE ) { |
266 | qDrawWinButton( p, x, y, w, h, g, sunken ); | 269 | qDrawWinButton( p, x, y, w, h, g, sunken ); |
267 | if ( isPixmap( type ) ) | 270 | if ( isPixmap( type ) ) |
268 | p->drawTiledPixmap( x + 4, y + 4, w - 6, h - 6, | 271 | p->drawTiledPixmap( x + 4, y + 4, w - 6, h - 6, |
269 | *scalePixmap( w - 6, h - 6, | 272 | *scalePixmap( w - 6, h - 6, |
270 | type ) ); | 273 | type ) ); |
271 | else | 274 | else |
272 | p->fillRect( x + 4, y + 4, w - 6, h - offset * 6, | 275 | p->fillRect( x + 4, y + 4, w - 6, h - offset * 6, |
273 | g.brush( QColorGroup::Button ) ); | 276 | g.brush( QColorGroup::Button ) ); |
274 | 277 | ||
275 | } | 278 | } |
276 | else { | 279 | else { |
277 | if ( ( w - offset * 2 ) > 0 && ( h - offset * 2 ) > 0 ) { | 280 | if ( ( w - offset * 2 ) > 0 && ( h - offset * 2 ) > 0 ) { |
278 | if ( isPixmap( type ) ) | 281 | if ( isPixmap( type ) ) |
279 | if ( rounded ) | 282 | if ( rounded ) |
280 | p->drawTiledPixmap( x, y, w, h, *scalePixmap( w, h, type ) ); | 283 | p->drawTiledPixmap( x, y, w, h, *scalePixmap( w, h, type ) ); |
281 | else | 284 | else |
282 | p->drawTiledPixmap( x + offset, y + offset, w - offset * 2, | 285 | p->drawTiledPixmap( x + offset, y + offset, w - offset * 2, |
283 | h - offset * 2, | 286 | h - offset * 2, |
284 | *scalePixmap( w - offset * 2, h - offset * 2, | 287 | *scalePixmap( w - offset * 2, h - offset * 2, |
285 | type ) ); | 288 | type ) ); |
286 | else | 289 | else |
287 | p->fillRect( x + offset, y + offset, w - offset * 2, h - offset * 2, | 290 | p->fillRect( x + offset, y + offset, w - offset * 2, h - offset * 2, |
288 | g.brush( QColorGroup::Button ) ); | 291 | g.brush( QColorGroup::Button ) ); |
289 | } | 292 | } |
290 | if ( borderPixmap( type ) ) | 293 | if ( borderPixmap( type ) ) { |
291 | bitBlt( p->device(), x, y, scaleBorder( w, h, type ), 0, 0, w, h, | 294 | bitBlt( p->device(), x, y, scaleBorder( w, h, type ), 0, 0, w, h, |
292 | Qt::CopyROP, false ); | 295 | Qt::CopyROP, false ); |
296 | } | ||
293 | else | 297 | else |
294 | drawShade( p, x, y, w, h, g, sunken, rounded, | 298 | drawShade( p, x, y, w, h, g, sunken, rounded, |
295 | highlightWidth( type ), borderWidth( type ), shade() ); | 299 | highlightWidth( type ), borderWidth( type ), shade() ); |
296 | } | 300 | } |
297 | p->setPen( oldPen ); | 301 | p->setPen( oldPen ); |
298 | } | 302 | } |
299 | 303 | ||
300 | void OThemeStyle::drawButton( QPainter *p, int x, int y, int w, int h, | 304 | void OThemeStyle::drawButton( QPainter *p, int x, int y, int w, int h, |
301 | const QColorGroup &g, bool sunken, | 305 | const QColorGroup &g, bool sunken, |
302 | const QBrush *fill ) | 306 | const QBrush *fill ) |
303 | { | 307 | { |
304 | drawBaseButton( p, x, y, w, h, g, sunken, roundButton(), sunken ? | 308 | drawBaseButton( p, x, y, w, h, g, sunken, roundButton(), sunken ? |
305 | PushButtonDown : PushButton, fill ); | 309 | PushButtonDown : PushButton, fill ); |
306 | } | 310 | } |
307 | 311 | ||
308 | void OThemeStyle::drawPushButton( QPushButton* btn, QPainter *p ) | 312 | void OThemeStyle::drawPushButton( QPushButton* btn, QPainter *p ) |
309 | { | 313 | { |
310 | bool sunken = btn->isOn() || btn->isDown(); | 314 | bool sunken = btn->isOn() || btn->isDown(); |
311 | int diw = buttonDefaultIndicatorWidth(); | 315 | int diw = buttonDefaultIndicatorWidth(); |
312 | drawBaseButton( p, diw, diw, btn->width() - 2 * diw, btn->height() - 2 * diw, | 316 | drawBaseButton( p, diw, diw, btn->width() - 2 * diw, btn->height() - 2 * diw, |
313 | *colorGroup( btn->colorGroup(), sunken ? PushButtonDown : | 317 | *colorGroup( btn->colorGroup(), sunken ? PushButtonDown : |
314 | PushButton ), sunken, roundButton(), | 318 | PushButton ), sunken, roundButton(), |
315 | sunken ? PushButtonDown : PushButton, NULL ); | 319 | sunken ? PushButtonDown : PushButton, NULL ); |
316 | // TODO if diw, draw fancy default button indicator | 320 | // TODO if diw, draw fancy default button indicator |
317 | } | 321 | } |
318 | 322 | ||
319 | void OThemeStyle::drawBaseMask( QPainter *p, int x, int y, int w, int h, | 323 | void OThemeStyle::drawBaseMask( QPainter *p, int x, int y, int w, int h, |
320 | bool round ) | 324 | bool round ) |
321 | { | 325 | { |
322 | // round edge fills | 326 | // round edge fills |
323 | static const QCOORD btm_left_fill[] = { | 327 | static const QCOORD btm_left_fill[] = { |
324 | 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, | 328 | 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, |
325 | 1, 2, 2, 2, 3, 2, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4 | 329 | 1, 2, 2, 2, 3, 2, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4 |
326 | }; | 330 | }; |
327 | 331 | ||
328 | static const QCOORD btm_right_fill[] = { | 332 | static const QCOORD btm_right_fill[] = { |
329 | 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, | 333 | 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, |
330 | 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4 | 334 | 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4 |
331 | }; | 335 | }; |
332 | 336 | ||
333 | static const QCOORD top_left_fill[] = { | 337 | static const QCOORD top_left_fill[] = { |
334 | 3, 0, 4, 0, 2, 1, 3, 1, 4, 1, 1, 2, 2, 2, 3, 2, 4, 2, 0, 3, | 338 | 3, 0, 4, 0, 2, 1, 3, 1, 4, 1, 1, 2, 2, 2, 3, 2, 4, 2, 0, 3, |
335 | 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4 | 339 | 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4 |
336 | }; | 340 | }; |
337 | 341 | ||
338 | static const QCOORD top_right_fill[] = { | 342 | static const QCOORD top_right_fill[] = { |
339 | 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, | 343 | 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, |
340 | 3, 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4 | 344 | 3, 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4 |