summaryrefslogtreecommitdiff
path: root/noncore/decorations/liquid/liquid.cpp
Unidiff
Diffstat (limited to 'noncore/decorations/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/decorations/liquid/liquid.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/decorations/liquid/liquid.cpp b/noncore/decorations/liquid/liquid.cpp
index 75b1fc9..ef2ac3c 100644
--- a/noncore/decorations/liquid/liquid.cpp
+++ b/noncore/decorations/liquid/liquid.cpp
@@ -1,57 +1,57 @@
1#include "liquid.h" 1#include "liquid.h"
2 2
3#include <qapplication.h> 3#include <qapplication.h>
4#include <qpainter.h> 4#include <qpainter.h>
5#include <qpalette.h> 5#include <qpalette.h>
6#include <qdrawutil.h> 6#include <qdrawutil.h>
7 7
8 8
9LiquidDecoInterface::LiquidDecoInterface ( ) : ref ( 0 ) 9LiquidDecoInterface::LiquidDecoInterface ( )
10{ 10{
11} 11}
12 12
13LiquidDecoInterface::~LiquidDecoInterface ( ) 13LiquidDecoInterface::~LiquidDecoInterface ( )
14{ 14{
15} 15}
16 16
17 17
18 18
19QString LiquidDecoInterface::name ( ) const 19QString LiquidDecoInterface::name ( ) const
20{ 20{
21 return qApp-> translate ( "Decoration", "Liquid" ); 21 return qApp-> translate ( "Decoration", "Liquid" );
22} 22}
23 23
24 24
25QPixmap LiquidDecoInterface::icon ( ) const 25QPixmap LiquidDecoInterface::icon ( ) const
26{ 26{
27 return QPixmap ( ); 27 return QPixmap ( );
28} 28}
29 29
30void LiquidDecoInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const 30void LiquidDecoInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const
31{ 31{
32 QRect r = wd-> rect; 32 QRect r = wd-> rect;
33 int th = metric ( TitleHeight, wd ); 33 int th = metric ( TitleHeight, wd );
34 34
35 switch ( a ) { 35 switch ( a ) {
36 case WindowDecorationInterface::Border: { 36 case WindowDecorationInterface::Border: {
37 const QColorGroup &cg = wd-> palette. active ( ); 37 const QColorGroup &cg = wd-> palette. active ( );
38 qDrawWinPanel ( p, r. x ( ) - metric ( LeftBorder, wd ), 38 qDrawWinPanel ( p, r. x ( ) - metric ( LeftBorder, wd ),
39 r. y ( ) - th - metric ( TopBorder, wd ), 39 r. y ( ) - th - metric ( TopBorder, wd ),
40 r. width ( ) + metric ( LeftBorder, wd ) + metric ( RightBorder, wd ), 40 r. width ( ) + metric ( LeftBorder, wd ) + metric ( RightBorder, wd ),
41 r. height ( ) + th + metric ( TopBorder,wd) + metric ( BottomBorder, wd ), 41 r. height ( ) + th + metric ( TopBorder,wd) + metric ( BottomBorder, wd ),
42 cg, false, &cg. brush ( QColorGroup::Background )); 42 cg, false, &cg. brush ( QColorGroup::Background ));
43 break; 43 break;
44 } 44 }
45 case WindowDecorationInterface::Title: { 45 case WindowDecorationInterface::Title: {
46 const QColorGroup &cg = wd-> palette. active ( ); 46 const QColorGroup &cg = wd-> palette. active ( );
47 47
48 QBrush titleBrush; 48 QBrush titleBrush;
49 QPen titleLines1, titleLines2; 49 QPen titleLines1, titleLines2;
50 50
51 titleBrush = cg. brush (( wd-> flags & WindowData::Active ) ? QColorGroup::Highlight : QColorGroup::Background ); 51 titleBrush = cg. brush (( wd-> flags & WindowData::Active ) ? QColorGroup::Highlight : QColorGroup::Background );
52 titleLines1 = titleBrush. color ( ). dark ( 105 ); 52 titleLines1 = titleBrush. color ( ). dark ( 105 );
53 titleLines2 = titleBrush. color ( ). dark ( 103 ); 53 titleLines2 = titleBrush. color ( ). dark ( 103 );
54 54
55 p-> fillRect ( r. x ( ), r. y ( ) - th, r. width ( ), th, titleBrush ); 55 p-> fillRect ( r. x ( ), r. y ( ) - th, r. width ( ), th, titleBrush );
56 for ( int i = r.y()-th; i < r.y(); i += 4 ) { 56 for ( int i = r.y()-th; i < r.y(); i += 4 ) {
57 p-> setPen ( titleLines1 ); 57 p-> setPen ( titleLines1 );
@@ -77,60 +77,62 @@ void LiquidDecoInterface::drawArea( Area a, QPainter *p, const WindowData *wd )
77 QRect tr ( r.x ( ) + 3 + metric ( HelpWidth, wd ), r. top ( ) - th, 77 QRect tr ( r.x ( ) + 3 + metric ( HelpWidth, wd ), r. top ( ) - th,
78 r. width ( ) - metric ( OKWidth, wd ) - metric ( CloseWidth, wd ), th ); 78 r. width ( ) - metric ( OKWidth, wd ) - metric ( CloseWidth, wd ), th );
79 79
80 QFont f = p-> font ( ); 80 QFont f = p-> font ( );
81 f. setWeight ( QFont::Bold ); 81 f. setWeight ( QFont::Bold );
82 p-> setFont ( f ); 82 p-> setFont ( f );
83 83
84 QRect br = p-> boundingRect ( tr, QPainter::AlignCenter, wd-> caption ); 84 QRect br = p-> boundingRect ( tr, QPainter::AlignCenter, wd-> caption );
85 int trh2 = tr. height ( ) / 2; 85 int trh2 = tr. height ( ) / 2;
86 86
87 int align = QPainter::AlignCenter; 87 int align = QPainter::AlignCenter;
88 88
89 if ( br. width ( ) + 2 * trh2 > tr. width ( ) ) { 89 if ( br. width ( ) + 2 * trh2 > tr. width ( ) ) {
90 br. setLeft ( tr. left ( ) + trh2 ); 90 br. setLeft ( tr. left ( ) + trh2 );
91 br. setWidth ( tr. width ( ) - 2 * trh2 ); 91 br. setWidth ( tr. width ( ) - 2 * trh2 );
92 92
93 align = QPainter::AlignLeft | QPainter::AlignVCenter; 93 align = QPainter::AlignLeft | QPainter::AlignVCenter;
94 } 94 }
95 95
96 p-> setBrush ( fillcol ); 96 p-> setBrush ( fillcol );
97 p-> setPen ( bordercol /*Qt::NoPen*/ ); 97 p-> setPen ( bordercol /*Qt::NoPen*/ );
98 p->drawChord ( br. left ( ) - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, 180*16 ); 98 p->drawChord ( br. left ( ) - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, 180*16 );
99 p->drawChord ( br. right ( ) + 1 - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, -180*16 ); 99 p->drawChord ( br. right ( ) + 1 - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, -180*16 );
100 100
101 p-> fillRect ( br.left() - 1, tr. top ( ), br. width ( ) + 2, tr. height ( ), fillcol); 101 p-> fillRect ( br.left() - 1, tr. top ( ), br. width ( ) + 2, tr. height ( ), fillcol);
102 102
103 p-> setPen ( shadecol ); 103 p-> setPen ( shadecol );
104 p-> drawText ( br, align, wd-> caption ); 104 p-> drawText ( br, align, wd-> caption );
105 p-> setPen ( textcol ); 105 p-> setPen ( textcol );
106 br. moveBy ( -1, -1 ); 106 br. moveBy ( -1, -1 );
107 p-> drawText ( br, align, wd-> caption ); 107 p-> drawText ( br, align, wd-> caption );
108 break; 108 break;
109 } 109 }
110 default: { 110 default: {
111 WindowDecorationInterface::drawArea ( a, p, wd ); 111 WindowDecorationInterface::drawArea ( a, p, wd );
112 break; 112 break;
113 } 113 }
114 } 114 }
115} 115}
116 116
117QRESULT LiquidDecoInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 117QRESULT LiquidDecoInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
118{ 118{
119 *iface = 0; 119 *iface = 0;
120 120
121 if ( uuid == IID_QUnknown ) 121 if ( uuid == IID_QUnknown )
122 *iface = this; 122 *iface = this;
123 else if ( uuid == IID_WindowDecoration ) 123 else if ( uuid == IID_WindowDecoration )
124 *iface = this; 124 *iface = this;
125 else
126 return QS_FALSE;
125 127
126 if ( *iface ) 128 if ( *iface )
127 (*iface)-> addRef ( ); 129 (*iface)-> addRef ( );
128 130
129 return QS_OK; 131 return QS_OK;
130} 132}
131 133
132Q_EXPORT_INTERFACE() 134Q_EXPORT_INTERFACE()
133{ 135{
134 Q_CREATE_INSTANCE( LiquidDecoInterface ) 136 Q_CREATE_INSTANCE( LiquidDecoInterface )
135} 137}
136 138