author | zecke <zecke> | 2005-02-22 23:25:19 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-22 23:25:19 (UTC) |
commit | 30857db6ca3f355aa3d50b59f03a13c82f265af2 (patch) (unidiff) | |
tree | 53431b5d7108c674fe99ea214d06a60a5e494588 | |
parent | ff2fdaf1a8e8a17ce756c0413102b37705e0c646 (diff) | |
download | opie-30857db6ca3f355aa3d50b59f03a13c82f265af2.zip opie-30857db6ca3f355aa3d50b59f03a13c82f265af2.tar.gz opie-30857db6ca3f355aa3d50b59f03a13c82f265af2.tar.bz2 |
Instead of having the same method four time with different name and image to load
we now have a define.
This makes it more easy to change the handling of builtin decoration image
-rw-r--r-- | library/qpedecoration_qws.cpp | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index fb47c14..1afae88 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp | |||
@@ -300,56 +300,31 @@ void QPEManager::whatsThisTimeout() | |||
300 | wtTimer->start( 250 ); | 300 | wtTimer->start( 250 ); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | inWhatsThis = !inWhatsThis; | 303 | inWhatsThis = !inWhatsThis; |
304 | } | 304 | } |
305 | } | 305 | } |
306 | 306 | ||
307 | //=========================================================================== | 307 | //=========================================================================== |
308 | 308 | #define IMAGE_METHOD( methodName, imageName ) \ | |
309 | static QImage *okImage( int th ) | 309 | static QImage* methodName( int th ) { \ |
310 | { | 310 | static QImage *i = 0; \ |
311 | static QImage *i = 0; | 311 | if ( !i || ::abs( i->height()-th ) > 4 ) { \ |
312 | if ( !i || ::abs( i->height()-th ) > 4 ) { | 312 | delete i; \ |
313 | delete i; | 313 | i = new QImage(scaleButton(Resource::loadImage(#imageName),th)); \ |
314 | i = new QImage(scaleButton(Resource::loadImage("OKButton"),th)); | 314 | } \ |
315 | } | 315 | \ |
316 | return i; | 316 | return i; \ |
317 | } | 317 | } |
318 | 318 | ||
319 | static QImage *closeImage( int th ) | 319 | IMAGE_METHOD(okImage, OKButton ); |
320 | { | 320 | IMAGE_METHOD(closeImage, CloseButton ); |
321 | static QImage *i = 0; | 321 | IMAGE_METHOD(helpImage, HelpButton ); |
322 | if ( !i || ::abs( i->height()-th ) > 4 ) { | 322 | IMAGE_METHOD(maximizeImage,MaximizeButton ); |
323 | delete i; | ||
324 | i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th)); | ||
325 | } | ||
326 | return i; | ||
327 | } | ||
328 | |||
329 | static QImage *helpImage( int th ) | ||
330 | { | ||
331 | static QImage *i = 0; | ||
332 | if ( !i || ::abs( i->height()-th ) > 4 ) { | ||
333 | delete i; | ||
334 | i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th)); | ||
335 | } | ||
336 | return i; | ||
337 | } | ||
338 | |||
339 | static QImage *maximizeImage( int th ) | ||
340 | { | ||
341 | static QImage *i = 0; | ||
342 | if ( !i || ::abs( i->height()-th ) > 4 ) { | ||
343 | delete i; | ||
344 | i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th)); | ||
345 | } | ||
346 | return i; | ||
347 | } | ||
348 | 323 | ||
349 | int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const | 324 | int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const |
350 | { | 325 | { |
351 | switch ( m ) { | 326 | switch ( m ) { |
352 | case TitleHeight: | 327 | case TitleHeight: |
353 | if ( QApplication::desktop()->height() > 320 ) | 328 | if ( QApplication::desktop()->height() > 320 ) |
354 | return 19; | 329 | return 19; |
355 | else | 330 | else |