From 30857db6ca3f355aa3d50b59f03a13c82f265af2 Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 22 Feb 2005 23:25:19 +0000 Subject: 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 --- (limited to 'library') 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 @@ -305,46 +305,21 @@ void QPEManager::whatsThisTimeout() } //=========================================================================== - -static QImage *okImage( int th ) -{ - static QImage *i = 0; - if ( !i || ::abs( i->height()-th ) > 4 ) { - delete i; - i = new QImage(scaleButton(Resource::loadImage("OKButton"),th)); - } - return i; -} - -static QImage *closeImage( int th ) -{ - static QImage *i = 0; - if ( !i || ::abs( i->height()-th ) > 4 ) { - delete i; - i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th)); - } - return i; -} - -static QImage *helpImage( int th ) -{ - static QImage *i = 0; - if ( !i || ::abs( i->height()-th ) > 4 ) { - delete i; - i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th)); - } - return i; -} - -static QImage *maximizeImage( int th ) -{ - static QImage *i = 0; - if ( !i || ::abs( i->height()-th ) > 4 ) { - delete i; - i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th)); - } - return i; -} +#define IMAGE_METHOD( methodName, imageName ) \ +static QImage* methodName( int th ) { \ + static QImage *i = 0; \ + if ( !i || ::abs( i->height()-th ) > 4 ) { \ + delete i; \ + i = new QImage(scaleButton(Resource::loadImage(#imageName),th)); \ + } \ + \ + return i; \ +} + +IMAGE_METHOD(okImage, OKButton ); +IMAGE_METHOD(closeImage, CloseButton ); +IMAGE_METHOD(helpImage, HelpButton ); +IMAGE_METHOD(maximizeImage,MaximizeButton ); int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const { -- cgit v0.9.0.2