-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() wtTimer->start( 250 ); } } inWhatsThis = !inWhatsThis; } } //=========================================================================== - -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 { switch ( m ) { case TitleHeight: if ( QApplication::desktop()->height() > 320 ) return 19; else |