summaryrefslogtreecommitdiff
path: root/noncore/decorations/flat/flat.cpp
Unidiff
Diffstat (limited to 'noncore/decorations/flat/flat.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/decorations/flat/flat.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/decorations/flat/flat.cpp b/noncore/decorations/flat/flat.cpp
index b6a81a3..a2f12be 100644
--- a/noncore/decorations/flat/flat.cpp
+++ b/noncore/decorations/flat/flat.cpp
@@ -179,49 +179,49 @@ static const char * maximize_xpm[] = {
179" +++++ +++++ ", 179" +++++ +++++ ",
180" ++++++++++++ ", 180" ++++++++++++ ",
181" ++++++++ ", 181" ++++++++ ",
182" ", 182" ",
183" "}; 183" "};
184 184
185static QImage scaleButton( const QImage &img, int height ) 185static QImage scaleButton( const QImage &img, int height )
186{ 186{
187 if ( img.height() != height ) { 187 if ( img.height() != height ) {
188 return img.smoothScale( img.width()*height/img.height(), height ); 188 return img.smoothScale( img.width()*height/img.height(), height );
189 } else { 189 } else {
190 return img; 190 return img;
191 } 191 }
192} 192}
193 193
194static void colorize( QImage &img, const QColor &c, bool rev ) 194static void colorize( QImage &img, const QColor &c, bool rev )
195{ 195{
196 for ( int i = 0; i < img.numColors(); i++ ) { 196 for ( int i = 0; i < img.numColors(); i++ ) {
197 bool sc = (img.color(i) & 0xff000000); 197 bool sc = (img.color(i) & 0xff000000);
198 if ( rev ) sc = !sc; 198 if ( rev ) sc = !sc;
199 img.setColor(i, sc ? c.rgb() : 0x00000000 ); 199 img.setColor(i, sc ? c.rgb() : 0x00000000 );
200 } 200 }
201} 201}
202 202
203FlatDecoration::FlatDecoration() : ref(0), buttonCache(16) 203FlatDecoration::FlatDecoration() : buttonCache(16)
204{ 204{
205 buttonCache.setAutoDelete(TRUE); 205 buttonCache.setAutoDelete(TRUE);
206} 206}
207 207
208FlatDecoration::~FlatDecoration() 208FlatDecoration::~FlatDecoration()
209{ 209{
210} 210}
211 211
212int FlatDecoration::metric( Metric m, const WindowData *wd ) const 212int FlatDecoration::metric( Metric m, const WindowData *wd ) const
213{ 213{
214 switch ( m ) { 214 switch ( m ) {
215 case TopBorder: 215 case TopBorder:
216 return 1; 216 return 1;
217 break; 217 break;
218 case LeftBorder: 218 case LeftBorder:
219 case RightBorder: 219 case RightBorder:
220 return 2; 220 return 2;
221 case BottomBorder: 221 case BottomBorder:
222 return 4; 222 return 4;
223 case TitleHeight: 223 case TitleHeight:
224 if ( QApplication::desktop()->height() > 320 ) 224 if ( QApplication::desktop()->height() > 320 )
225 return 20; 225 return 20;
226 else 226 else
227 return 18; 227 return 18;
@@ -326,35 +326,37 @@ void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, in
326} 326}
327 327
328QRegion FlatDecoration::mask( const WindowData *wd ) const 328QRegion FlatDecoration::mask( const WindowData *wd ) const
329{ 329{
330 return WindowDecorationInterface::mask( wd ); 330 return WindowDecorationInterface::mask( wd );
331} 331}
332 332
333QString FlatDecoration::name() const 333QString FlatDecoration::name() const
334{ 334{
335 return qApp->translate( "Decoration", "Flat" ); 335 return qApp->translate( "Decoration", "Flat" );
336} 336}
337 337
338QPixmap FlatDecoration::icon() const 338QPixmap FlatDecoration::icon() const
339{ 339{
340 return QPixmap(); 340 return QPixmap();
341} 341}
342 342
343QRESULT FlatDecoration::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 343QRESULT FlatDecoration::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
344{ 344{
345 *iface = 0; 345 *iface = 0;
346 if ( uuid == IID_QUnknown ) 346 if ( uuid == IID_QUnknown )
347 *iface = this; 347 *iface = this;
348 else if ( uuid == IID_WindowDecoration ) 348 else if ( uuid == IID_WindowDecoration )
349 *iface = this; 349 *iface = this;
350 else
351 return QS_FALSE;
350 352
351 if ( *iface ) 353 if ( *iface )
352 (*iface)->addRef(); 354 (*iface)->addRef();
353 return QS_OK; 355 return QS_OK;
354} 356}
355 357
356Q_EXPORT_INTERFACE() 358Q_EXPORT_INTERFACE()
357{ 359{
358 Q_CREATE_INSTANCE( FlatDecoration ) 360 Q_CREATE_INSTANCE( FlatDecoration )
359} 361}
360 362