summaryrefslogtreecommitdiff
authorsandman <sandman>2002-12-03 00:59:30 (UTC)
committer sandman <sandman>2002-12-03 00:59:30 (UTC)
commit26557b9370b3d1f28224374f8a035ae9051a1317 (patch) (unidiff)
treeb45c67bd4d71910f1faf020e23a01b648d2effbf
parentc3c95ff297355f7024c15134bbc1d15d340bf8fd (diff)
downloadopie-26557b9370b3d1f28224374f8a035ae9051a1317.zip
opie-26557b9370b3d1f28224374f8a035ae9051a1317.tar.gz
opie-26557b9370b3d1f28224374f8a035ae9051a1317.tar.bz2
small fix regarding focus handling on combo-boxes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index e6d8310..4a65952 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,2614 +1,2617 @@
1/*- 1/*-
2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
3 */ 3 */
4 4
5// 5//
6// (c) 2002 Robert 'sandman' Griebl 6// (c) 2002 Robert 'sandman' Griebl
7// 7//
8 8
9 9
10#ifndef INCLUDE_MENUITEM_DEF 10#ifndef INCLUDE_MENUITEM_DEF
11#define INCLUDE_MENUITEM_DEF 11#define INCLUDE_MENUITEM_DEF
12#endif 12#endif
13 13
14#include <qmenudata.h> 14#include <qmenudata.h>
15#include "liquid.h" 15#include "liquid.h"
16//#include "liquiddeco.h" 16//#include "liquiddeco.h"
17#include <qapplication.h> 17#include <qapplication.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include "effects.h" 19#include "effects.h"
20#include <qpalette.h> 20#include <qpalette.h>
21#include <qbitmap.h> 21#include <qbitmap.h>
22#include <qtabbar.h> 22#include <qtabbar.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qobjectlist.h> 24#include <qobjectlist.h>
25#include <qimage.h> 25#include <qimage.h>
26#include <qtimer.h> 26#include <qtimer.h>
27#include <qpixmapcache.h> 27#include <qpixmapcache.h>
28#include <qradiobutton.h> 28#include <qradiobutton.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qdrawutil.h> 30#include <qdrawutil.h>
31#include <qwidgetlist.h> 31#include <qwidgetlist.h>
32#include <qtoolbutton.h> 32#include <qtoolbutton.h>
33#include <qheader.h> 33#include <qheader.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <qmenubar.h> 35#include <qmenubar.h>
36#include <qprogressbar.h> 36#include <qprogressbar.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qlistbox.h>
38 39
39#include <stdio.h> 40#include <stdio.h>
40 41
41#include "htmlmasks.h" 42#include "htmlmasks.h"
42#include "embeddata.h" 43#include "embeddata.h"
43 44
45
44typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 46typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
45 QColorGroup &, bool, bool); 47 QColorGroup &, bool, bool);
46 48
47QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 49QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
48 50
49void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 51void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
50{ 52{
51 QImage img(pix.convertToImage()); 53 QImage img(pix.convertToImage());
52 QImageEffect::fade(img, 0.9, color); 54 QImageEffect::fade(img, 0.9, color);
53 int x, y; 55 int x, y;
54 int r, g, b; 56 int r, g, b;
55 for(y=0; y < img.height(); y+=3){ 57 for(y=0; y < img.height(); y+=3){
56 unsigned int *data = (unsigned int *) img.scanLine(y); 58 unsigned int *data = (unsigned int *) img.scanLine(y);
57 for(x=0; x < img.width(); ++x){ 59 for(x=0; x < img.width(); ++x){
58 r = qRed(data[x]); 60 r = qRed(data[x]);
59 g = qGreen(data[x]); 61 g = qGreen(data[x]);
60 b = qBlue(data[x]); 62 b = qBlue(data[x]);
61 if(r-10) 63 if(r-10)
62 r-=10; 64 r-=10;
63 if(g-10) 65 if(g-10)
64 g-=10; 66 g-=10;
65 if(b-10) 67 if(b-10)
66 b-=10; 68 b-=10;
67 data[x] = qRgb(r, g, b); 69 data[x] = qRgb(r, g, b);
68 } 70 }
69 } 71 }
70 pix.convertFromImage(img); 72 pix.convertFromImage(img);
71} 73}
72 74
73TransMenuHandler::TransMenuHandler(QObject *parent) 75TransMenuHandler::TransMenuHandler(QObject *parent)
74 : QObject(parent) 76 : QObject(parent)
75{ 77{
76 pixDict.setAutoDelete(true); 78 pixDict.setAutoDelete(true);
77 reloadSettings(); 79 reloadSettings();
78} 80}
79 81
80void TransMenuHandler::reloadSettings() 82void TransMenuHandler::reloadSettings()
81{ 83{
82 pixDict.clear(); 84 pixDict.clear();
83 85
84 Config config ( "qpe" ); 86 Config config ( "qpe" );
85 config. setGroup ( "Liquid-Style" ); 87 config. setGroup ( "Liquid-Style" );
86 88
87 type = config. readNumEntry("Type", TransStippleBg); 89 type = config. readNumEntry("Type", TransStippleBg);
88 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 90 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
89 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 91 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
90 opacity = config. readNumEntry("Opacity", 10); 92 opacity = config. readNumEntry("Opacity", 10);
91 if ( opacity < -20 ) 93 if ( opacity < -20 )
92 opacity = 20; 94 opacity = 20;
93 else if ( opacity > 20 ) 95 else if ( opacity > 20 )
94 opacity = 20; 96 opacity = 20;
95 97
96 shadowText = config. readBoolEntry("ShadowText", true); 98 shadowText = config. readBoolEntry("ShadowText", true);
97} 99}
98 100
99bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 101bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
100{ 102{
101 QWidget *p = (QWidget *)obj; 103 QWidget *p = (QWidget *)obj;
102 104
103 if(ev->type() == QEvent::Show){ 105 if(ev->type() == QEvent::Show){
104 if(type == TransStippleBg || type == TransStippleBtn || 106 if(type == TransStippleBg || type == TransStippleBtn ||
105 type == Custom){ 107 type == Custom){
106 QApplication::syncX(); 108 QApplication::syncX();
107 QPixmap *pix = new QPixmap; 109 QPixmap *pix = new QPixmap;
108 if(p->testWFlags(Qt::WType_Popup)){ 110 if(p->testWFlags(Qt::WType_Popup)){
109 QRect r(p->x(), p->y(), p->width(), p->height()); 111 QRect r(p->x(), p->y(), p->width(), p->height());
110 QRect deskR = QApplication::desktop()->rect(); 112 QRect deskR = QApplication::desktop()->rect();
111 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 113 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
112 r.setBottom(deskR.bottom()); 114 r.setBottom(deskR.bottom());
113 r.setRight(deskR.right()); 115 r.setRight(deskR.right());
114 } 116 }
115 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 117 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
116 r.width(), r.height()); 118 r.width(), r.height());
117 } 119 }
118 else{ // tear off menu 120 else{ // tear off menu
119 pix->resize(p->width(), p->height()); 121 pix->resize(p->width(), p->height());
120 pix->fill(Qt::black.rgb()); 122 pix->fill(Qt::black.rgb());
121 } 123 }
122 if(type == TransStippleBg){ 124 if(type == TransStippleBg){
123 stripePixmap(*pix, p->colorGroup().background()); 125 stripePixmap(*pix, p->colorGroup().background());
124 } 126 }
125 else if(type == TransStippleBtn){ 127 else if(type == TransStippleBtn){
126 stripePixmap(*pix, p->colorGroup().button()); 128 stripePixmap(*pix, p->colorGroup().button());
127 } 129 }
128 else{ 130 else{
129 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 131 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
130 } 132 }
131 133
132 pixDict.insert(p->winId(), pix); 134 pixDict.insert(p->winId(), pix);
133 135
134 if ( !p->inherits("QPopupMenu")) 136 if ( !p->inherits("QPopupMenu"))
135 p->setBackgroundPixmap(*pix); 137 p->setBackgroundPixmap(*pix);
136 138
137 QObjectList *ol = p-> queryList("QWidget"); 139 QObjectList *ol = p-> queryList("QWidget");
138 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 140 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
139 QWidget *wid = (QWidget *) it.current ( ); 141 QWidget *wid = (QWidget *) it.current ( );
140 142
141 wid-> setBackgroundPixmap(*pix); 143 wid-> setBackgroundPixmap(*pix);
142 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 144 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
143 } 145 }
144 delete ol; 146 delete ol;
145 } 147 }
146 } 148 }
147 else if(ev->type() == QEvent::Hide){ 149 else if(ev->type() == QEvent::Hide){
148 if(type == TransStippleBg || type == TransStippleBtn || 150 if(type == TransStippleBg || type == TransStippleBtn ||
149 type == Custom){ 151 type == Custom){
150// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 152// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
151 153
152 pixDict.remove(p->winId()); 154 pixDict.remove(p->winId());
153 if ( !p->inherits("QPopupMenu")) 155 if ( !p->inherits("QPopupMenu"))
154 p->setBackgroundMode(QWidget::PaletteBackground); 156 p->setBackgroundMode(QWidget::PaletteBackground);
155 157
156 QObjectList *ol = p-> queryList("QWidget"); 158 QObjectList *ol = p-> queryList("QWidget");
157 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 159 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
158 QWidget *wid = (QWidget *) it.current ( ); 160 QWidget *wid = (QWidget *) it.current ( );
159 161
160 wid-> setBackgroundMode( QWidget::PaletteBackground ); 162 wid-> setBackgroundMode( QWidget::PaletteBackground );
161 } 163 }
162 delete ol; 164 delete ol;
163 } 165 }
164 } 166 }
165 return(false); 167 return(false);
166} 168}
167 169
168 170
169static int qt_version ( ) 171static int qt_version ( )
170{ 172{
171 const char *qver = qVersion ( ); 173 const char *qver = qVersion ( );
172 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 174 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
173} 175}
174 176
175 177
176LiquidStyle::LiquidStyle() 178LiquidStyle::LiquidStyle()
177 :QWindowsStyle() 179 :QWindowsStyle()
178{ 180{
179 setName ( "LiquidStyle" ); 181 setName ( "LiquidStyle" );
180 182
181 oldqte = ( qt_version ( ) < 234 ); 183 oldqte = ( qt_version ( ) < 234 );
182 flatTBButtons = false; 184 flatTBButtons = false;
183 currentHeader = 0; 185 currentHeader = 0;
184 186
185 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 187 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
186 btnMaskBmp.setMask(btnMaskBmp); 188 btnMaskBmp.setMask(btnMaskBmp);
187 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 189 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
188 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 190 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
189 headerHoverID = -1; 191 headerHoverID = -1;
190 highlightWidget = NULL; 192 highlightWidget = NULL;
191 setButtonDefaultIndicatorWidth(0); 193 setButtonDefaultIndicatorWidth(0);
192 btnDict.setAutoDelete(true); 194 btnDict.setAutoDelete(true);
193 bevelFillDict.setAutoDelete(true); 195 bevelFillDict.setAutoDelete(true);
194 smallBevelFillDict.setAutoDelete(true); 196 smallBevelFillDict.setAutoDelete(true);
195 197
196 rMatrix.rotate(270.0); 198 rMatrix.rotate(270.0);
197 btnBorderPix = new QPixmap; 199 btnBorderPix = new QPixmap;
198 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 200 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
199 btnBlendPix = new QPixmap; 201 btnBlendPix = new QPixmap;
200 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 202 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
201 bevelFillPix = new QPixmap; 203 bevelFillPix = new QPixmap;
202 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 204 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
203 smallBevelFillPix = new QPixmap; 205 smallBevelFillPix = new QPixmap;
204 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 206 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
205 // new stuff 207 // new stuff
206 vsbSliderFillPix = menuPix = NULL; 208 vsbSliderFillPix = menuPix = NULL;
207 menuHandler = new TransMenuHandler(this); 209 menuHandler = new TransMenuHandler(this);
208 setScrollBarExtent(15, 15); 210 setScrollBarExtent(15, 15);
209 int i; 211 int i;
210 for(i=0; i < BITMAP_ITEMS; ++i){ 212 for(i=0; i < BITMAP_ITEMS; ++i){
211 pixmaps[i] = NULL; 213 pixmaps[i] = NULL;
212 } 214 }
213 oldSliderThickness = sliderThickness(); 215 oldSliderThickness = sliderThickness();
214 setSliderThickness(11); 216 setSliderThickness(11);
215} 217}
216 218
217LiquidStyle::~LiquidStyle() 219LiquidStyle::~LiquidStyle()
218{ 220{
219 if(btnBorderPix) 221 if(btnBorderPix)
220 delete btnBorderPix; 222 delete btnBorderPix;
221 if(btnBlendPix) 223 if(btnBlendPix)
222 delete btnBlendPix; 224 delete btnBlendPix;
223 if(bevelFillPix) 225 if(bevelFillPix)
224 delete bevelFillPix; 226 delete bevelFillPix;
225 if(smallBevelFillPix) 227 if(smallBevelFillPix)
226 delete smallBevelFillPix; 228 delete smallBevelFillPix;
227 if(vsbSliderFillPix) 229 if(vsbSliderFillPix)
228 delete vsbSliderFillPix; 230 delete vsbSliderFillPix;
229 if(menuPix) 231 if(menuPix)
230 delete menuPix; 232 delete menuPix;
231 233
232 setScrollBarExtent(16, 16); 234 setScrollBarExtent(16, 16);
233 setSliderThickness(oldSliderThickness); 235 setSliderThickness(oldSliderThickness);
234 int i; 236 int i;
235 for(i=0; i < BITMAP_ITEMS; ++i){ 237 for(i=0; i < BITMAP_ITEMS; ++i){
236 if(pixmaps[i]) 238 if(pixmaps[i])
237 delete pixmaps[i]; 239 delete pixmaps[i];
238 } 240 }
239} 241}
240 242
241void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 243void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
242 const QColor &c, const QColor &bg) 244 const QColor &c, const QColor &bg)
243{ 245{
244 246
245 QPen oldPen = p->pen(); // headers need this 247 QPen oldPen = p->pen(); // headers need this
246 int x2 = x+w-1; 248 int x2 = x+w-1;
247 int y2 = y+h-1; 249 int y2 = y+h-1;
248 // outer dark rect 250 // outer dark rect
249 p->setPen(c.dark(130)); 251 p->setPen(c.dark(130));
250 p->drawLine(x, y+2, x, y2-2); // l 252 p->drawLine(x, y+2, x, y2-2); // l
251 p->drawLine(x2, y+2, x2, y2-2); // r 253 p->drawLine(x2, y+2, x2, y2-2); // r
252 p->drawLine(x+2, y, x2-2, y); // t 254 p->drawLine(x+2, y, x2-2, y); // t
253 p->drawLine(x+2, y2, x2-2, y2); // b 255 p->drawLine(x+2, y2, x2-2, y2); // b
254 p->drawPoint(x+1, y+1); // tl 256 p->drawPoint(x+1, y+1); // tl
255 p->drawPoint(x2-1, y+1); // tr 257 p->drawPoint(x2-1, y+1); // tr
256 p->drawPoint(x+1, y2-1); // bl 258 p->drawPoint(x+1, y2-1); // bl
257 p->drawPoint(x2-1, y2-1); // br 259 p->drawPoint(x2-1, y2-1); // br
258 260
259 // inner top light lines 261 // inner top light lines
260 p->setPen(c.light(105)); 262 p->setPen(c.light(105));
261 p->drawLine(x+2, y+1, x2-2, y+1); 263 p->drawLine(x+2, y+1, x2-2, y+1);
262 p->drawLine(x+1, y+2, x2-1, y+2); 264 p->drawLine(x+1, y+2, x2-1, y+2);
263 p->drawLine(x+1, y+3, x+2, y+3); 265 p->drawLine(x+1, y+3, x+2, y+3);
264 p->drawLine(x2-2, y+3, x2-1, y+3); 266 p->drawLine(x2-2, y+3, x2-1, y+3);
265 p->drawPoint(x+1, y+4); 267 p->drawPoint(x+1, y+4);
266 p->drawPoint(x2-1, y+4); 268 p->drawPoint(x2-1, y+4);
267 269
268 // inner bottom light lines 270 // inner bottom light lines
269 p->setPen(c.light(110)); 271 p->setPen(c.light(110));
270 p->drawLine(x+2, y2-1, x2-2, y2-1); 272 p->drawLine(x+2, y2-1, x2-2, y2-1);
271 p->drawLine(x+1, y2-2, x2-1, y2-2); 273 p->drawLine(x+1, y2-2, x2-1, y2-2);
272 p->drawLine(x+1, y2-3, x+2, y2-3); 274 p->drawLine(x+1, y2-3, x+2, y2-3);
273 p->drawLine(x2-2, y2-3, x2-1, y2-3); 275 p->drawLine(x2-2, y2-3, x2-1, y2-3);
274 p->drawPoint(x+1, y2-4); 276 p->drawPoint(x+1, y2-4);
275 p->drawPoint(x2-1, y2-4); 277 p->drawPoint(x2-1, y2-4);
276 278
277 // inner left mid lines 279 // inner left mid lines
278 //p->setPen(c.light(105)); 280 //p->setPen(c.light(105));
279 p->setPen(c); 281 p->setPen(c);
280 p->drawLine(x+1, y+5, x+1, y2-5); 282 p->drawLine(x+1, y+5, x+1, y2-5);
281 p->drawLine(x+2, y+4, x+2, y2-4); 283 p->drawLine(x+2, y+4, x+2, y2-4);
282 284
283 // inner right mid lines 285 // inner right mid lines
284 p->drawLine(x2-1, y+5, x2-1, y2-5); 286 p->drawLine(x2-1, y+5, x2-1, y2-5);
285 p->drawLine(x2-2, y+4, x2-2, y2-4); 287 p->drawLine(x2-2, y+4, x2-2, y2-4);
286 288
287 // fill 289 // fill
288 QPixmap *pix; 290 QPixmap *pix;
289 if(h >= 32){ 291 if(h >= 32){
290 pix = bevelFillDict.find(c.rgb()); 292 pix = bevelFillDict.find(c.rgb());
291 if(!pix){ 293 if(!pix){
292 int h, s, v; 294 int h, s, v;
293 c.hsv(&h, &s, &v); 295 c.hsv(&h, &s, &v);
294 pix = new QPixmap(*bevelFillPix); 296 pix = new QPixmap(*bevelFillPix);
295 adjustHSV(*pix, h, s, v); 297 adjustHSV(*pix, h, s, v);
296 bevelFillDict.insert(c.rgb(), pix); 298 bevelFillDict.insert(c.rgb(), pix);
297 } 299 }
298 } 300 }
299 else{ 301 else{
300 pix = smallBevelFillDict.find(c.rgb()); 302 pix = smallBevelFillDict.find(c.rgb());
301 if(!pix){ 303 if(!pix){
302 int h, s, v; 304 int h, s, v;
303 c.hsv(&h, &s, &v); 305 c.hsv(&h, &s, &v);
304 pix = new QPixmap(*smallBevelFillPix); 306 pix = new QPixmap(*smallBevelFillPix);
305 adjustHSV(*pix, h, s, v); 307 adjustHSV(*pix, h, s, v);
306 smallBevelFillDict.insert(c.rgb(), pix); 308 smallBevelFillDict.insert(c.rgb(), pix);
307 } 309 }
308 } 310 }
309 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); 311 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix);
310 // blend 312 // blend
311 int red, green, blue; 313 int red, green, blue;
312 QColor btnColor(c.dark(130)); 314 QColor btnColor(c.dark(130));
313 red = (btnColor.red() >> 1) + (bg.red() >> 1); 315 red = (btnColor.red() >> 1) + (bg.red() >> 1);
314 green = (btnColor.green() >> 1) + (bg.green() >> 1); 316 green = (btnColor.green() >> 1) + (bg.green() >> 1);
315 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); 317 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1);
316 btnColor.setRgb(red, green, blue); 318 btnColor.setRgb(red, green, blue);
317 319
318 p->setPen(btnColor); 320 p->setPen(btnColor);
319 p->drawPoint(x+1, y); 321 p->drawPoint(x+1, y);
320 p->drawPoint(x, y+1); 322 p->drawPoint(x, y+1);
321 p->drawPoint(x+1, y2); 323 p->drawPoint(x+1, y2);
322 p->drawPoint(x, y2-1); 324 p->drawPoint(x, y2-1);
323 325
324 p->drawPoint(x2-1, y); 326 p->drawPoint(x2-1, y);
325 p->drawPoint(x2, y+1); 327 p->drawPoint(x2, y+1);
326 p->drawPoint(x2-1, y2); 328 p->drawPoint(x2-1, y2);
327 p->drawPoint(x2, y2-1); 329 p->drawPoint(x2, y2-1);
328 330
329 p->setPen(oldPen); 331 p->setPen(oldPen);
330 332
331} 333}
332 334
333void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, 335void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
334 const QColor &back, int x, int y, int w, int h, 336 const QColor &back, int x, int y, int w, int h,
335 bool supportPushDown, bool pushedDown, 337 bool supportPushDown, bool pushedDown,
336 bool autoDefault, bool isMasked) 338 bool autoDefault, bool isMasked)
337{ 339{
338 if(w < 21 || h < 21){ 340 if(w < 21 || h < 21){
339 drawClearBevel(painter, x, y, w, h, c, back); 341 drawClearBevel(painter, x, y, w, h, c, back);
340 return; 342 return;
341 } 343 }
342 if(supportPushDown){ 344 if(supportPushDown){
343 --w, --h; 345 --w, --h;
344 } 346 }
345 /* We don't make the round buttons smaller, since they don't look as good 347 /* We don't make the round buttons smaller, since they don't look as good
346 if(autoDefault){ 348 if(autoDefault){
347 w = w-buttonDefaultIndicatorWidth()*2; 349 w = w-buttonDefaultIndicatorWidth()*2;
348 h = h-buttonDefaultIndicatorWidth()*2; 350 h = h-buttonDefaultIndicatorWidth()*2;
349 }*/ 351 }*/
350 352
351 353
352 QPixmap *pix = btnDict.find(c.rgb()); 354 QPixmap *pix = btnDict.find(c.rgb());
353 if(!pix){ 355 if(!pix){
354 int h, s, v; 356 int h, s, v;
355 c.hsv(&h, &s, &v); 357 c.hsv(&h, &s, &v);
356 pix = new QPixmap(*btnBorderPix); 358 pix = new QPixmap(*btnBorderPix);
357 adjustHSV(*pix, h, s, v); 359 adjustHSV(*pix, h, s, v);
358 btnDict.insert(c.rgb(), pix); 360 btnDict.insert(c.rgb(), pix);
359 } 361 }
360 int x2 = x+w-1; 362 int x2 = x+w-1;
361 int y2 = y+h-1; 363 int y2 = y+h-1;
362 int bx2 = pix->width()-1; 364 int bx2 = pix->width()-1;
363 int by2 = pix->height()-1; 365 int by2 = pix->height()-1;
364 366
365 QPixmap tmpPix(w, h); 367 QPixmap tmpPix(w, h);
366 QPixmap tilePix; 368 QPixmap tilePix;
367 QPainter p; 369 QPainter p;
368 p.begin(&tmpPix); 370 p.begin(&tmpPix);
369 371
370 // do the fill 372 // do the fill
371 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 373 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
372 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 374 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr
373 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl 375 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl
374 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br 376 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
375 377
376 // edges 378 // edges
377 tilePix.resize(pix->width()-20, 10); 379 tilePix.resize(pix->width()-20, 10);
378 // top 380 // top
379 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 381 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
380 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 382 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
381 // bottom 383 // bottom
382 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 384 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
383 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 385 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
384 // left 386 // left
385 tilePix.resize(10, pix->height()-20); 387 tilePix.resize(10, pix->height()-20);
386 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 388 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
387 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 389 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
388 // right 390 // right
389 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 391 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
390 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 392 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
391 393
392 // middle 394 // middle
393 tilePix.resize(pix->width()-20, pix->height()-20); 395 tilePix.resize(pix->width()-20, pix->height()-20);
394 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); 396 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20);
395 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); 397 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix);
396 398
397 399
398 // do the blend 400 // do the blend
399 QBitmap blendMask; 401 QBitmap blendMask;
400 if(!isMasked){ 402 if(!isMasked){
401 //QRgb bgRgb = back.rgb(); 403 //QRgb bgRgb = back.rgb();
402 //QRgb fgRgb = c.rgb(); 404 //QRgb fgRgb = c.rgb();
403 //int r, g, b; 405 //int r, g, b;
404 406
405 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); 407 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25);
406 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); 408 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25);
407 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); 409 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25);
408 //QColor blendColor(r, g, b); 410 //QColor blendColor(r, g, b);
409 int hue, sat, v1, v2; 411 int hue, sat, v1, v2;
410 QColor blendColor(autoDefault ? c : back); 412 QColor blendColor(autoDefault ? c : back);
411 back.hsv(&hue, &sat, &v1); 413 back.hsv(&hue, &sat, &v1);
412 blendColor.hsv(&hue, &sat, &v2); 414 blendColor.hsv(&hue, &sat, &v2);
413 if(v2 > v1) 415 if(v2 > v1)
414 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); 416 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25));
415 417
416 pix = btnBorderDict.find(blendColor.rgb()); 418 pix = btnBorderDict.find(blendColor.rgb());
417 if(!pix){ 419 if(!pix){
418 int h, s, v; 420 int h, s, v;
419 blendColor.hsv(&h, &s, &v); 421 blendColor.hsv(&h, &s, &v);
420 pix = new QPixmap(*btnBlendPix); 422 pix = new QPixmap(*btnBlendPix);
421 adjustHSV(*pix, h, s, v); 423 adjustHSV(*pix, h, s, v);
422 btnBorderDict.insert(blendColor.rgb(), pix); 424 btnBorderDict.insert(blendColor.rgb(), pix);
423 } 425 }
424 } 426 }
425 else{ 427 else{
426 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : 428 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) :
427 getPixmap(HTMLBtnBorder); 429 getPixmap(HTMLBtnBorder);
428 } 430 }
429 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 431 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
430 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 432 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr
431 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl 433 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl
432 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br 434 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
433 435
434 // edges 436 // edges
435 tilePix.resize(pix->width()-20, 10); 437 tilePix.resize(pix->width()-20, 10);
436 blendMask.resize(pix->width()-20, 10); 438 blendMask.resize(pix->width()-20, 10);
437 // top 439 // top
438 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 440 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
439 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); 441 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10);
440 tilePix.setMask(blendMask); 442 tilePix.setMask(blendMask);
441 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 443 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
442 // bottom 444 // bottom
443 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 445 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
444 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20); 446 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20);
445 tilePix.setMask(blendMask); 447 tilePix.setMask(blendMask);
446 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 448 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
447 // left 449 // left
448 tilePix.resize(10, pix->height()-20); 450 tilePix.resize(10, pix->height()-20);
449 blendMask.resize(10, pix->height()-20); 451 blendMask.resize(10, pix->height()-20);
450 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 452 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
451 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); 453 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20);
452 tilePix.setMask(blendMask); 454 tilePix.setMask(blendMask);
453 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 455 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
454 // right 456 // right
455 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 457 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
456 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); 458 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20);
457 tilePix.setMask(blendMask); 459 tilePix.setMask(blendMask);
458 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 460 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
459 461
460 p.end(); 462 p.end();
461 463
462 // do the button mask - we don't automask buttons 464 // do the button mask - we don't automask buttons
463 QBitmap btnMask(w, h); 465 QBitmap btnMask(w, h);
464 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 466 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
465 p.begin(&btnMask); 467 p.begin(&btnMask);
466 p.fillRect(0, 0, w, h, Qt::color0); 468 p.fillRect(0, 0, w, h, Qt::color0);
467 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 469 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
468 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 470 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
469 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 471 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
470 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 472 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
471 // fills 473 // fills
472 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 474 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
473 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 475 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
474 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 476 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
475 p.end(); 477 p.end();
476 tmpPix.setMask(btnMask); 478 tmpPix.setMask(btnMask);
477 /*if(autoDefault){ 479 /*if(autoDefault){
478 if(supportPushDown && pushedDown){ 480 if(supportPushDown && pushedDown){
479 painter->drawPixmap(x+3, y+3, tmpPix); 481 painter->drawPixmap(x+3, y+3, tmpPix);
480 } 482 }
481 else{ 483 else{
482 painter->drawPixmap(x+2, y+2, tmpPix); 484 painter->drawPixmap(x+2, y+2, tmpPix);
483 } 485 }
484 } 486 }
485 else */if(supportPushDown && pushedDown) 487 else */if(supportPushDown && pushedDown)
486 painter->drawPixmap(x+1, y+1, tmpPix); 488 painter->drawPixmap(x+1, y+1, tmpPix);
487 else 489 else
488 painter->drawPixmap(x, y, tmpPix); 490 painter->drawPixmap(x, y, tmpPix);
489 491
490 492
491 493
492} 494}
493 495
494 496
495QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, 497QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
496 bool blend) 498 bool blend)
497{ 499{
498 QImage img(qembed_findImage(label)); 500 QImage img(qembed_findImage(label));
499 img.detach(); 501 img.detach();
500 if(img.isNull()){ // shouldn't happen, been tested 502 if(img.isNull()){ // shouldn't happen, been tested
501 qWarning("Invalid embedded label %s", label); 503 qWarning("Invalid embedded label %s", label);
502 return(NULL); 504 return(NULL);
503 } 505 }
504 if(img.depth() != 32) 506 if(img.depth() != 32)
505 img = img.convertDepth(32); 507 img = img.convertDepth(32);
506 unsigned int *data = (unsigned int *)img.bits(); 508 unsigned int *data = (unsigned int *)img.bits();
507 int total = img.width()*img.height(); 509 int total = img.width()*img.height();
508 int current; 510 int current;
509 QColor c; 511 QColor c;
510 int oldH, oldS, oldV; 512 int oldH, oldS, oldV;
511 int alpha; 513 int alpha;
512 if(v < 235) 514 if(v < 235)
513 v += 20; 515 v += 20;
514 else 516 else
515 v = 255; 517 v = 255;
516 float intensity = v/255.0; 518 float intensity = v/255.0;
517 519
518 for(current=0; current<total; ++current){ 520 for(current=0; current<total; ++current){
519 alpha = qAlpha(data[current]); 521 alpha = qAlpha(data[current]);
520 c.setRgb(data[current]); 522 c.setRgb(data[current]);
521 c.hsv(&oldH, &oldS, &oldV); 523 c.hsv(&oldH, &oldS, &oldV);
522 oldV = (int)(oldV*intensity); 524 oldV = (int)(oldV*intensity);
523 c.setHsv(h, s, oldV); 525 c.setHsv(h, s, oldV);
524 if(blend && alpha != 255 && alpha != 0){ 526 if(blend && alpha != 255 && alpha != 0){
525 float srcPercent = ((float)alpha)/255.0; 527 float srcPercent = ((float)alpha)/255.0;
526 float destPercent = 1.0-srcPercent; 528 float destPercent = 1.0-srcPercent;
527 oldH = (int)((srcPercent*h) + (destPercent*bH)); 529 oldH = (int)((srcPercent*h) + (destPercent*bH));
528 oldS = (int)((srcPercent*s) + (destPercent*bS)); 530 oldS = (int)((srcPercent*s) + (destPercent*bS));
529 oldV = (int)((srcPercent*oldV) + (destPercent*bV)); 531 oldV = (int)((srcPercent*oldV) + (destPercent*bV));
530 c.setHsv(oldH, oldS, oldV); 532 c.setHsv(oldH, oldS, oldV);
531 alpha = 255; 533 alpha = 255;
532 } 534 }
533 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); 535 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha);
534 } 536 }
535 QPixmap *pix = new QPixmap; 537 QPixmap *pix = new QPixmap;
536 pix->convertFromImage(img); 538 pix->convertFromImage(img);
537 return(pix); 539 return(pix);
538} 540}
539 541
540 542
541 543
542 544
543QPixmap* LiquidStyle::getPixmap(BitmapData item) 545QPixmap* LiquidStyle::getPixmap(BitmapData item)
544{ 546{
545 547
546 if(pixmaps[item]) 548 if(pixmaps[item])
547 return(pixmaps[item]); 549 return(pixmaps[item]);
548 550
549 switch(item){ 551 switch(item){
550 case HTMLBtnBorder: 552 case HTMLBtnBorder:
551 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); 553 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV);
552 break; 554 break;
553 case HTMLBtnBorderDown: 555 case HTMLBtnBorderDown:
554 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 556 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
555 break; 557 break;
556 558
557 case HTMLCB: 559 case HTMLCB:
558 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 560 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
559 break; 561 break;
560 case HTMLCBHover: 562 case HTMLCBHover:
561 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); 563 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV);
562 break; 564 break;
563 case HTMLCBDown: 565 case HTMLCBDown:
564 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 566 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
565 break; 567 break;
566 case HTMLCBDownHover: 568 case HTMLCBDownHover:
567 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); 569 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV);
568 break; 570 break;
569 571
570 case HTMLRadio: 572 case HTMLRadio:
571 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 573 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
572 break; 574 break;
573 case HTMLRadioHover: 575 case HTMLRadioHover:
574 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); 576 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV);
575 break; 577 break;
576 case HTMLRadioDown: 578 case HTMLRadioDown:
577 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 579 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
578 break; 580 break;
579 case HTMLRadioDownHover: 581 case HTMLRadioDownHover:
580 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); 582 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV);
581 break; 583 break;
582 584
583 case RadioOff: 585 case RadioOff:
584 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); 586 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/);
585 break; 587 break;
586 case RadioOffHover: 588 case RadioOffHover:
587 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); 589 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/);
588 break; 590 break;
589 case RadioOn: 591 case RadioOn:
590 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); 592 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/);
591 break; 593 break;
592 case RadioOnHover: 594 case RadioOnHover:
593 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); 595 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/);
594 break; 596 break;
595 597
596 case Tab: 598 case Tab:
597 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); 599 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/);
598 break; 600 break;
599 case TabDown: 601 case TabDown:
600 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); 602 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/);
601 break; 603 break;
602 case TabFocus: 604 case TabFocus:
603 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); 605 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/);
604 break; 606 break;
605 607
606 case CB: 608 case CB:
607 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); 609 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/);
608 break; 610 break;
609 case CBHover: 611 case CBHover:
610 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); 612 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/);
611 break; 613 break;
612 case CBDown: 614 case CBDown:
613 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); 615 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/);
614 break; 616 break;
615 case CBDownHover: 617 case CBDownHover:
616 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); 618 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/);
617 break; 619 break;
618 620
619 case VSlider: 621 case VSlider:
620 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); 622 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true );
621 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 623 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
622 break; 624 break;
623 case VSBSliderTop: 625 case VSBSliderTop:
624 case VSBSliderTopHover: 626 case VSBSliderTopHover:
625 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); 627 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/);
626 break; 628 break;
627 case VSBSliderBtm: 629 case VSBSliderBtm:
628 case VSBSliderBtmHover: 630 case VSBSliderBtmHover:
629 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); 631 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/);
630 break; 632 break;
631 case VSBSliderMid: 633 case VSBSliderMid:
632 case VSBSliderMidHover: 634 case VSBSliderMidHover:
633 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 635 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
634 break; 636 break;
635 case VSBSliderTopBg: 637 case VSBSliderTopBg:
636 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); 638 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/);
637 break; 639 break;
638 case VSBSliderBtmBg: 640 case VSBSliderBtmBg:
639 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); 641 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/);
640 break; 642 break;
641 case VSBSliderMidBg: 643 case VSBSliderMidBg:
642 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 644 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
643 break; 645 break;
644 646
645 case HSlider: 647 case HSlider:
646 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); 648 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/);
647 break; 649 break;
648 case HSBSliderTop: 650 case HSBSliderTop:
649 case HSBSliderTopHover: 651 case HSBSliderTopHover:
650 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); 652 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true );
651 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 653 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
652 break; 654 break;
653 case HSBSliderBtm: 655 case HSBSliderBtm:
654 case HSBSliderBtmHover: 656 case HSBSliderBtmHover:
655 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); 657 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true );
656 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 658 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
657 break; 659 break;
658 case HSBSliderMid: 660 case HSBSliderMid:
659 case HSBSliderMidHover: 661 case HSBSliderMidHover:
660 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 662 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
661 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 663 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
662 break; 664 break;
663 case HSBSliderTopBg: 665 case HSBSliderTopBg:
664 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); 666 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true );
665 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 667 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
666 break; 668 break;
667 case HSBSliderBtmBg: 669 case HSBSliderBtmBg:
668 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); 670 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true );
669 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 671 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
670 break; 672 break;
671 case HSBSliderMidBg: 673 case HSBSliderMidBg:
672 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 674 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
673 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 675 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
674 break; 676 break;
675 default: 677 default:
676 break; 678 break;
677 } 679 }
678 return(pixmaps[item]); 680 return(pixmaps[item]);
679} 681}
680 682
681void LiquidStyle::polish(QPalette &appPal) 683void LiquidStyle::polish(QPalette &appPal)
682{ 684{
683 int i; 685 int i;
684 for(i=0; i < BITMAP_ITEMS; ++i){ 686 for(i=0; i < BITMAP_ITEMS; ++i){
685 if(pixmaps[i]){ 687 if(pixmaps[i]){
686 delete pixmaps[i]; 688 delete pixmaps[i];
687 pixmaps[i] = NULL; 689 pixmaps[i] = NULL;
688 } 690 }
689 } 691 }
690 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 692 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
691 btnDict.clear(); 693 btnDict.clear();
692 btnBorderDict.clear(); 694 btnBorderDict.clear();
693 bevelFillDict.clear(); 695 bevelFillDict.clear();
694 smallBevelFillDict.clear(); 696 smallBevelFillDict.clear();
695 697
696 Config config ( "qpe" ); 698 Config config ( "qpe" );
697 config. setGroup ( "Liquid-Style" ); 699 config. setGroup ( "Liquid-Style" );
698 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 700 int contrast = config. readNumEntry ( "StippleContrast", 5 );
699 if ( contrast < 0 ) 701 if ( contrast < 0 )
700 contrast = 0; 702 contrast = 0;
701 else if ( contrast > 10 ) 703 else if ( contrast > 10 )
702 contrast = 10; 704 contrast = 10;
703 705
704// QPalette pal = QApplication::palette(); 706// QPalette pal = QApplication::palette();
705 707
706 // button color stuff 708 // button color stuff
707 config. setGroup ( "Appearance" ); 709 config. setGroup ( "Appearance" );
708 QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) 710 QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )))
709 : appPal. color ( QPalette::Active, QColorGroup::Button ); 711 : appPal. color ( QPalette::Active, QColorGroup::Button );
710 if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) 712 if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
711 : appPal. color ( QPalette::Active, QColorGroup::Background ))) { 713 : appPal. color ( QPalette::Active, QColorGroup::Background ))) {
712 // force button color to be different from background 714 // force button color to be different from background
713 QBrush btnBrush(QColor(200, 202, 228)); 715 QBrush btnBrush(QColor(200, 202, 228));
714 appPal.setBrush(QColorGroup::Button, btnBrush); 716 appPal.setBrush(QColorGroup::Button, btnBrush);
715 } 717 }
716 c.hsv(&btnH, &btnS, &btnV); 718 c.hsv(&btnH, &btnS, &btnV);
717 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 719 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
718 720
719 // menu pixmap 721 // menu pixmap
720 if(!menuPix){ 722 if(!menuPix){
721 menuPix = new QPixmap; 723 menuPix = new QPixmap;
722 menuPix->resize(64, 64); 724 menuPix->resize(64, 64);
723 } 725 }
724 QPainter painter; 726 QPainter painter;
725 menuPix->fill(c.rgb()); 727 menuPix->fill(c.rgb());
726 painter.begin(menuPix); 728 painter.begin(menuPix);
727 painter.setPen(c.dark(105)); 729 painter.setPen(c.dark(105));
728 for(i=0; i < 63; i+=4){ 730 for(i=0; i < 63; i+=4){
729 painter.drawLine(0, i, 63, i); 731 painter.drawLine(0, i, 63, i);
730 painter.drawLine(0, i+1, 63, i+1); 732 painter.drawLine(0, i+1, 63, i+1);
731 }; 733 };
732 painter.end(); 734 painter.end();
733 menuBrush.setColor(c); 735 menuBrush.setColor(c);
734 menuBrush.setPixmap(*menuPix); 736 menuBrush.setPixmap(*menuPix);
735 737
736 // pager brush 738 // pager brush
737 c = c.dark(120); 739 c = c.dark(120);
738 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 740 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
739 if(!pix){ 741 if(!pix){
740 int h, s, v; 742 int h, s, v;
741 c.hsv(&h, &s, &v); 743 c.hsv(&h, &s, &v);
742 pix = new QPixmap(*smallBevelFillPix); 744 pix = new QPixmap(*smallBevelFillPix);
743 adjustHSV(*pix, h, s, v); 745 adjustHSV(*pix, h, s, v);
744 smallBevelFillDict.insert(c.rgb(), pix); 746 smallBevelFillDict.insert(c.rgb(), pix);
745 } 747 }
746// pagerHoverBrush.setColor(c); 748// pagerHoverBrush.setColor(c);
747// pagerHoverBrush.setPixmap(*pix); 749// pagerHoverBrush.setPixmap(*pix);
748 750
749 c = c.dark(120); 751 c = c.dark(120);
750 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 752 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
751 if(!pix){ 753 if(!pix){
752 int h, s, v; 754 int h, s, v;
753 c.hsv(&h, &s, &v); 755 c.hsv(&h, &s, &v);
754 pix = new QPixmap(*smallBevelFillPix); 756 pix = new QPixmap(*smallBevelFillPix);
755 adjustHSV(*pix, h, s, v); 757 adjustHSV(*pix, h, s, v);
756 smallBevelFillDict.insert(c.rgb(), pix); 758 smallBevelFillDict.insert(c.rgb(), pix);
757 } 759 }
758// pagerBrush.setColor(c); 760// pagerBrush.setColor(c);
759// pagerBrush.setPixmap(*pix); 761// pagerBrush.setPixmap(*pix);
760 762
761 // background color stuff 763 // background color stuff
762 c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) 764 c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )))
763 : appPal. color ( QPalette::Active, QColorGroup::Background ); 765 : appPal. color ( QPalette::Active, QColorGroup::Background );
764 766
765 c.hsv(&bH, &bS, &bV); 767 c.hsv(&bH, &bS, &bV);
766 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 768 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
767 769
768 // FIXME? 770 // FIXME?
769 if(vsbSliderFillPix) 771 if(vsbSliderFillPix)
770 delete vsbSliderFillPix; 772 delete vsbSliderFillPix;
771 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 773 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
772 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 774 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
773 775
774 // background brush 776 // background brush
775 QPixmap wallPaper(32, 32); 777 QPixmap wallPaper(32, 32);
776 wallPaper.fill(c.rgb()); 778 wallPaper.fill(c.rgb());
777 painter.begin(&wallPaper); 779 painter.begin(&wallPaper);
778 for(i=0; i < 32; i+=4){ 780 for(i=0; i < 32; i+=4){
779 painter.setPen(c.dark(100 + contrast)); 781 painter.setPen(c.dark(100 + contrast));
780 painter.drawLine(0, i, 32, i); 782 painter.drawLine(0, i, 32, i);
781 painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 783 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
782 painter.drawLine(0, i+1, 32, i+1); 784 painter.drawLine(0, i+1, 32, i+1);
783 }; 785 };
784 painter.end(); 786 painter.end();
785 bgBrush.setColor(c); 787 bgBrush.setColor(c);
786 bgBrush.setPixmap(wallPaper); 788 bgBrush.setPixmap(wallPaper);
787 appPal.setBrush(QColorGroup::Background, bgBrush); 789 appPal.setBrush(QColorGroup::Background, bgBrush);
788} 790}
789 791
790void LiquidStyle::polish(QWidget *w) 792void LiquidStyle::polish(QWidget *w)
791{ 793{
792 if(w->inherits("QMenuBar")){ 794 if(w->inherits("QMenuBar")){
793 //((QFrame*)w)->setLineWidth(0); 795 //((QFrame*)w)->setLineWidth(0);
794 w->setBackgroundMode(QWidget::PaletteBackground); 796 w->setBackgroundMode(QWidget::PaletteBackground);
795 w->setBackgroundOrigin(QWidget::ParentOrigin); 797 w->setBackgroundOrigin(QWidget::ParentOrigin);
796 return; 798 return;
797 } 799 }
798 if(w->inherits("QToolBar")){ 800 if(w->inherits("QToolBar")){
799 w->installEventFilter(this); 801 w->installEventFilter(this);
800 w->setBackgroundMode(QWidget::PaletteBackground); 802 w->setBackgroundMode(QWidget::PaletteBackground);
801 w->setBackgroundOrigin(QWidget::WidgetOrigin); 803 w->setBackgroundOrigin(QWidget::WidgetOrigin);
802 return; 804 return;
803 } 805 }
804 if(w->inherits("QPopupMenu")) 806 if(w->inherits("QPopupMenu"))
805 w->setBackgroundMode(QWidget::NoBackground); 807 w->setBackgroundMode(QWidget::NoBackground);
806 else if(w-> testWFlags(Qt::WType_Popup) && 808 else if(w-> testWFlags(Qt::WType_Popup) &&
807 !w->inherits("QListBox") && 809 !w->inherits("QListBox") &&
808 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 810 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
809 w->installEventFilter(menuHandler); 811 w->installEventFilter(menuHandler);
810 } 812 }
811 813
812 if(w->isTopLevel()){ 814 if(w->isTopLevel()){
813 return; 815 return;
814 } 816 }
815 817
816 if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 818 if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
817 w->installEventFilter(this); 819 w->installEventFilter(this);
818 } 820 }
819 821
820 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 822 if(w->inherits("QButton") || w-> inherits("QComboBox")){
821 w-> setBackgroundMode ( QWidget::PaletteBackground ); 823 w-> setBackgroundMode ( QWidget::PaletteBackground );
822 w->setBackgroundOrigin ( QWidget::ParentOrigin); 824 w->setBackgroundOrigin ( QWidget::ParentOrigin);
823 } 825 }
824 826
825 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 827 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
826 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 828 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
827 bool isViewportChild = w->parent() && 829 bool isViewportChild = w->parent() &&
828 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 830 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
829 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 831 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
830 832
831 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 833 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
832 w->setBackgroundMode(QWidget::X11ParentRelative); 834 w->setBackgroundMode(QWidget::X11ParentRelative);
833 return; 835 return;
834 } 836 }
835 if(isViewportChild){ 837 if(isViewportChild){
836 if(w->inherits("QButton") || w->inherits("QComboBox")){ 838 if(w->inherits("QButton") || w->inherits("QComboBox")){
837 if(w->parent()){ // heh, only way to test for KHTML children ;-) 839 if(w->parent()){ // heh, only way to test for KHTML children ;-)
838 if(w->parent()->parent()){ 840 if(w->parent()->parent()){
839 if(w->parent()->parent()->parent() && 841 if(w->parent()->parent()->parent() &&
840 w->parent()->parent()->parent()->inherits("KHTMLView")){ 842 w->parent()->parent()->parent()->inherits("KHTMLView")){
841 w->setAutoMask(true); 843 w->setAutoMask(true);
842 w->setBackgroundMode(QWidget::NoBackground); 844 w->setBackgroundMode(QWidget::NoBackground);
843 } 845 }
844 } 846 }
845 } 847 }
846 return; 848 return;
847 } 849 }
848 } 850 }
849 if(w->inherits("QHeader")){ 851 if(w->inherits("QHeader")){
850 w->setMouseTracking(true); 852 w->setMouseTracking(true);
851 w->installEventFilter(this); 853 w->installEventFilter(this);
852 } 854 }
853 if(w-> inherits("QToolButton")) { 855 if(w-> inherits("QToolButton")) {
854 if (w->parent()->inherits("QToolBar")) { 856 if (w->parent()->inherits("QToolBar")) {
855 ((QToolButton*)w)->setAutoRaise (flatTBButtons); 857 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
856 if ( flatTBButtons ) 858 if ( flatTBButtons )
857 w->setBackgroundOrigin(QWidget::ParentOrigin); 859 w->setBackgroundOrigin(QWidget::ParentOrigin);
858 } 860 }
859 w-> installEventFilter ( this ); 861 w-> installEventFilter ( this );
860 } 862 }
861 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 863 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
862 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 864 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
863 } 865 }
864 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 866 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
865 return; 867 return;
866 } 868 }
867 869
868 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 870 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
869 palette().active().brush(QColorGroup::Background).pixmap()){ 871 palette().active().brush(QColorGroup::Background).pixmap()){
870 qWarning("No parent pixmap for child widget %s", w->className()); 872 qWarning("No parent pixmap for child widget %s", w->className());
871 return; 873 return;
872 } 874 }
873 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 875 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
874 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 876 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
875 if(w->backgroundMode() == QWidget::PaletteBackground || 877 if(w->backgroundMode() == QWidget::PaletteBackground ||
876 w->backgroundMode() == QWidget::PaletteButton){ 878 w->backgroundMode() == QWidget::PaletteButton){
877 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 879 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
878 w->setBackgroundOrigin(QWidget::ParentOrigin); 880 w->setBackgroundOrigin(QWidget::ParentOrigin);
879 // w->setBackgroundMode(QWidget::NoBackground); 881 // w->setBackgroundMode(QWidget::NoBackground);
880 } 882 }
881 } 883 }
882 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 884 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
883 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 885 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
884 else if ( w-> inherits("QFrame") ) 886 else if ( w-> inherits("QFrame") )
885 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 887 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
886 888
887 if ( w->parentWidget()->inherits ( "QWidgetStack" )) { 889 if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
888 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 890 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
889 } 891 }
890} 892}
891 893
892void LiquidStyle::unPolish(QWidget *w) 894void LiquidStyle::unPolish(QWidget *w)
893{ 895{
894 if(w->inherits("QMenuBar")){ 896 if(w->inherits("QMenuBar")){
895 ((QFrame *)w)->setLineWidth(1); 897 ((QFrame *)w)->setLineWidth(1);
896 w->setBackgroundMode(QWidget::PaletteBackground); 898 w->setBackgroundMode(QWidget::PaletteBackground);
897 return; 899 return;
898 } 900 }
899 901
900 if(w->inherits("QPopupMenu")) 902 if(w->inherits("QPopupMenu"))
901 w->setBackgroundMode(QWidget::PaletteButton); 903 w->setBackgroundMode(QWidget::PaletteButton);
902 else if(w-> testWFlags(Qt::WType_Popup) && 904 else if(w-> testWFlags(Qt::WType_Popup) &&
903 !w->inherits("QListBox") && 905 !w->inherits("QListBox") &&
904 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 906 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
905 w->removeEventFilter(menuHandler); 907 w->removeEventFilter(menuHandler);
906 } 908 }
907 909
908 if(w->isTopLevel()) 910 if(w->isTopLevel())
909 return; 911 return;
910 912
911 // for viewport children, don't just check for NoBackground.... 913 // for viewport children, don't just check for NoBackground....
912 bool isViewportChild = w->parent() && 914 bool isViewportChild = w->parent() &&
913 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 915 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
914 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 916 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
915 917
916 w->unsetPalette(); 918 w->unsetPalette();
917 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 919 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
918 if(w->inherits("QPushButton")) 920 if(w->inherits("QPushButton"))
919 w->setBackgroundMode(QWidget::PaletteButton); 921 w->setBackgroundMode(QWidget::PaletteButton);
920 else 922 else
921 w->setBackgroundMode(QWidget::PaletteBackground); 923 w->setBackgroundMode(QWidget::PaletteBackground);
922 } 924 }
923 925
924 if(isViewportChild) 926 if(isViewportChild)
925 w->setAutoMask(false); 927 w->setAutoMask(false);
926 928
927/* 929/*
928 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 930 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
929 w-> setBackgroundMode ( PaletteBackground ); 931 w-> setBackgroundMode ( PaletteBackground );
930 } 932 }
931*/ 933*/
932 if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 934 if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
933 w->removeEventFilter(this); 935 w->removeEventFilter(this);
934 } 936 }
935 if(w->inherits("QButton") || w->inherits("QComboBox")){ 937 if(w->inherits("QButton") || w->inherits("QComboBox")){
936 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 938 if(w->parent() && w->parent()->inherits("KHTMLPart")){
937 w->setAutoMask(false); 939 w->setAutoMask(false);
938 } 940 }
939 } 941 }
940 if(w-> inherits("QToolButton")) { 942 if(w-> inherits("QToolButton")) {
941 w-> removeEventFilter ( this ); 943 w-> removeEventFilter ( this );
942 } 944 }
943 if(w->inherits("QToolBar")){ 945 if(w->inherits("QToolBar")){
944 w->removeEventFilter(this); 946 w->removeEventFilter(this);
945 w->setBackgroundMode(QWidget::PaletteBackground); 947 w->setBackgroundMode(QWidget::PaletteBackground);
946 return; 948 return;
947 } 949 }
948 if(w->inherits("QHeader")){ 950 if(w->inherits("QHeader")){
949 w->setMouseTracking(false); 951 w->setMouseTracking(false);
950 w->removeEventFilter(this); 952 w->removeEventFilter(this);
951 } 953 }
952} 954}
953 955
954void LiquidStyle::polish(QApplication *app) 956void LiquidStyle::polish(QApplication *app)
955{ 957{
956 958
957 QWindowsStyle::polish(app); 959 QWindowsStyle::polish(app);
958 menuAni = app->isEffectEnabled(UI_AnimateMenu); 960 menuAni = app->isEffectEnabled(UI_AnimateMenu);
959 menuFade = app->isEffectEnabled(UI_FadeMenu); 961 menuFade = app->isEffectEnabled(UI_FadeMenu);
960 if(menuAni) 962 if(menuAni)
961 app->setEffectEnabled(UI_AnimateMenu, false); 963 app->setEffectEnabled(UI_AnimateMenu, false);
962 if(menuFade) 964 if(menuFade)
963 app->setEffectEnabled(UI_FadeMenu, false); 965 app->setEffectEnabled(UI_FadeMenu, false);
964 966
965 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 967 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
966 968
967 Config config ( "qpe" ); 969 Config config ( "qpe" );
968 config. setGroup ( "Liquid-Style" ); 970 config. setGroup ( "Liquid-Style" );
969 971
970 // if ( config. readBoolEntry ( "WinDecoration", true )) 972 // if ( config. readBoolEntry ( "WinDecoration", true ))
971 // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 973 // QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
972 974
973 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 975 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
974} 976}
975 977
976void LiquidStyle::unPolish(QApplication *app) 978void LiquidStyle::unPolish(QApplication *app)
977{ 979{
978 QWindowsStyle::unPolish(app); 980 QWindowsStyle::unPolish(app);
979 app->setEffectEnabled(UI_AnimateMenu, menuAni); 981 app->setEffectEnabled(UI_AnimateMenu, menuAni);
980 app->setEffectEnabled(UI_FadeMenu, menuFade); 982 app->setEffectEnabled(UI_FadeMenu, menuFade);
981 983
982 qt_set_draw_menu_bar_impl ( 0 ); 984 qt_set_draw_menu_bar_impl ( 0 );
983 985
984// QApplication::qwsSetDecoration ( new QPEDecoration ( )); 986// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
985} 987}
986 988
987 989
988/* !! HACK !! Beware 990/* !! HACK !! Beware
989 * 991 *
990 * TT forgot to make the QProgressBar widget styleable in Qt 2.x 992 * TT forgot to make the QProgressBar widget styleable in Qt 2.x
991 * So the only way to customize the drawing, is to intercept the 993 * So the only way to customize the drawing, is to intercept the
992 * paint event - since we have to use protected functions, we need 994 * paint event - since we have to use protected functions, we need
993 * to derive a "hack" class from QProgressBar and do the painting 995 * to derive a "hack" class from QProgressBar and do the painting
994 * in there. 996 * in there.
995 * 997 *
996 * - sandman 998 * - sandman
997 */ 999 */
998 1000
999class HackProgressBar : public QProgressBar { 1001class HackProgressBar : public QProgressBar {
1000public: 1002public:
1001 HackProgressBar ( ); 1003 HackProgressBar ( );
1002 1004
1003 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) 1005 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix )
1004 { 1006 {
1005 QPainter p( this ); 1007 QPainter p( this );
1006 1008
1007 if ( !contentsRect().contains( event->rect() ) ) { 1009 if ( !contentsRect().contains( event->rect() ) ) {
1008 p.save(); 1010 p.save();
1009 p.setClipRegion( event->region().intersect(frameRect()) ); 1011 p.setClipRegion( event->region().intersect(frameRect()) );
1010 drawFrame( &p); 1012 drawFrame( &p);
1011 p.restore(); 1013 p.restore();
1012 } 1014 }
1013 if ( event->rect().intersects( contentsRect() )) { 1015 if ( event->rect().intersects( contentsRect() )) {
1014 p.setClipRegion( event->region().intersect( contentsRect() ) ); 1016 p.setClipRegion( event->region().intersect( contentsRect() ) );
1015 1017
1016 int x, y, w, h; 1018 int x, y, w, h;
1017 contentsRect ( ). rect ( &x, &y, &w, &h ); 1019 contentsRect ( ). rect ( &x, &y, &w, &h );
1018 1020
1019 int prog = progress ( ); 1021 int prog = progress ( );
1020 int total = totalSteps ( ); 1022 int total = totalSteps ( );
1021 if ( prog < 0 ) 1023 if ( prog < 0 )
1022 prog = 0; 1024 prog = 0;
1023 if ( total <= 0 ) 1025 if ( total <= 0 )
1024 total = 1; 1026 total = 1;
1025 int bw = w * prog / total; 1027 int bw = w * prog / total;
1026 if ( bw > w ) 1028 if ( bw > w )
1027 bw = w; 1029 bw = w;
1028 1030
1029 p.setPen(g.button().dark(130)); 1031 p.setPen(g.button().dark(130));
1030 p.drawRect(x, y, bw, h); 1032 p.drawRect(x, y, bw, h);
1031 p.setPen(g.button().light(120)); 1033 p.setPen(g.button().light(120));
1032 p.drawRect(x+1, y+1, bw-2, h-2); 1034 p.drawRect(x+1, y+1, bw-2, h-2);
1033 1035
1034 if(bw >= 4 && h >= 4 && pix) 1036 if(bw >= 4 && h >= 4 && pix)
1035 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); 1037 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix);
1036 1038
1037 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { 1039 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
1038 QString pstr; 1040 QString pstr;
1039 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); 1041 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ());
1040 p. setPen ( g.text());//g.highlightedText ( )); 1042 p. setPen ( g.text());//g.highlightedText ( ));
1041 p. drawText (x,y,w-1,h-1,AlignCenter,pstr); 1043 p. drawText (x,y,w-1,h-1,AlignCenter,pstr);
1042 } 1044 }
1043 } 1045 }
1044 } 1046 }
1045}; 1047};
1046 1048
1047 1049
1048/* 1050/*
1049 * The same for QToolButton: 1051 * The same for QToolButton:
1050 * TT hardcoded the drawing of the focus rect ... 1052 * TT hardcoded the drawing of the focus rect ...
1051 * 1053 *
1052 * - sandman 1054 * - sandman
1053 */ 1055 */
1054 1056
1055 1057
1056class HackToolButton : public QToolButton { 1058class HackToolButton : public QToolButton {
1057public: 1059public:
1058 HackToolButton ( ); 1060 HackToolButton ( );
1059 1061
1060 void paint ( QPaintEvent *ev ) 1062 void paint ( QPaintEvent *ev )
1061 { 1063 {
1062 erase ( ev-> region ( )); 1064 erase ( ev-> region ( ));
1063 QPainter p ( this ); 1065 QPainter p ( this );
1064 style ( ). drawToolButton ( this, &p ); 1066 style ( ). drawToolButton ( this, &p );
1065 drawButtonLabel ( &p ); 1067 drawButtonLabel ( &p );
1066 } 1068 }
1067}; 1069};
1068 1070
1069/* 1071/*
1070 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1072 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1071 * force everything to erase and repaint on resize. This is going away, I'm 1073 * force everything to erase and repaint on resize. This is going away, I'm
1072 * trying to get shaped widgets to work right without masking. QPushButton, 1074 * trying to get shaped widgets to work right without masking. QPushButton,
1073 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1075 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1074 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1076 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1075 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1077 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1076 * caches them in QPixmapCache, which is bad for doing things like hover 1078 * caches them in QPixmapCache, which is bad for doing things like hover
1077 * because the style methods aren't called in paintEvents if everything 1079 * because the style methods aren't called in paintEvents if everything
1078 * is cached. We use our own Paint event handler instead. Taskbuttons and 1080 * is cached. We use our own Paint event handler instead. Taskbuttons and
1079 * pager buttons draw into a pixmap buffer, so we handle those with palette 1081 * pager buttons draw into a pixmap buffer, so we handle those with palette
1080 * modifications. For QHeader, different header items are actually one widget 1082 * modifications. For QHeader, different header items are actually one widget
1081 * that draws multiple items, so we need to check which ID is hightlighted 1083 * that draws multiple items, so we need to check which ID is hightlighted
1082 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1084 * and draw it. Finally, we also check enter and leave events for QLineEdit,
1083 * since if it's inside a combobox we want to highlight the combobox during 1085 * since if it's inside a combobox we want to highlight the combobox during
1084 * hovering in the edit. 1086 * hovering in the edit.
1085 */ 1087 */
1086bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1088bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1087{ 1089{
1088 if(obj->inherits("QToolBar")){ 1090 if(obj->inherits("QToolBar")){
1089 if(ev->type() == QEvent::Resize){ 1091 if(ev->type() == QEvent::Resize){
1090 const QObjectList *tbChildList = obj->children(); 1092 const QObjectList *tbChildList = obj->children();
1091 QObjectListIt it(*tbChildList); 1093 QObjectListIt it(*tbChildList);
1092 QObject *child; 1094 QObject *child;
1093 while((child = it.current()) != NULL){ 1095 while((child = it.current()) != NULL){
1094 ++it; 1096 ++it;
1095 if(child->isWidgetType()) 1097 if(child->isWidgetType())
1096 ((QWidget *)child)->repaint(true); 1098 ((QWidget *)child)->repaint(true);
1097 } 1099 }
1098 1100
1099 } 1101 }
1100 } 1102 }
1101 else if(obj->inherits("QToolButton")){ 1103 else if(obj->inherits("QToolButton")){
1102 QToolButton *btn = (QToolButton *)obj; 1104 QToolButton *btn = (QToolButton *)obj;
1103 if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () 1105 if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise ()
1104 if(btn->isEnabled()){ 1106 if(btn->isEnabled()){
1105 highlightWidget = btn; 1107 highlightWidget = btn;
1106 btn->repaint(false); 1108 btn->repaint(false);
1107 } 1109 }
1108 } 1110 }
1109 else if(ev->type() == QEvent::FocusOut ){ 1111 else if(ev->type() == QEvent::FocusOut ){
1110 if(btn == highlightWidget){ 1112 if(btn == highlightWidget){
1111 highlightWidget = NULL; 1113 highlightWidget = NULL;
1112 btn->repaint(false); 1114 btn->repaint(false);
1113 } 1115 }
1114 } 1116 }
1115 else if(ev->type() == QEvent::Paint) { 1117 else if(ev->type() == QEvent::Paint) {
1116 (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev ); 1118 (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev );
1117 return true; 1119 return true;
1118 } 1120 }
1119 } 1121 }
1120 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ 1122 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){
1121 QButton *btn = (QButton *)obj; 1123 QButton *btn = (QButton *)obj;
1122 bool isRadio = obj->inherits("QRadioButton"); 1124 bool isRadio = obj->inherits("QRadioButton");
1123 if(ev->type() == QEvent::Paint){ 1125 if(ev->type() == QEvent::Paint){
1124 //if(btn->autoMask()) 1126 //if(btn->autoMask())
1125 btn->erase(); 1127 btn->erase();
1126 QPainter p; 1128 QPainter p;
1127 p.begin(btn); 1129 p.begin(btn);
1128 QFontMetrics fm = btn->fontMetrics(); 1130 QFontMetrics fm = btn->fontMetrics();
1129 QSize lsz = fm.size(ShowPrefix, btn->text()); 1131 QSize lsz = fm.size(ShowPrefix, btn->text());
1130 QSize sz = isRadio ? exclusiveIndicatorSize() 1132 QSize sz = isRadio ? exclusiveIndicatorSize()
1131 : indicatorSize(); 1133 : indicatorSize();
1132 1134
1133/* 1135/*
1134 if(btn->hasFocus()){ 1136 if(btn->hasFocus()){
1135 QRect r = QRect(0, 0, btn->width(), btn->height()); 1137 QRect r = QRect(0, 0, btn->width(), btn->height());
1136 p.setPen(btn->colorGroup().button().dark(140)); 1138 p.setPen(btn->colorGroup().button().dark(140));
1137 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1139 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1138 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1140 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1139 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1141 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1140 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1142 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1141 } 1143 }
1142*/ 1144*/
1143 int x = 0; 1145 int x = 0;
1144 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1146 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1145 if(isRadio) 1147 if(isRadio)
1146 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1148 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1147 btn->colorGroup(), btn->isOn(), 1149 btn->colorGroup(), btn->isOn(),
1148 btn->isDown(), btn->isEnabled()); 1150 btn->isDown(), btn->isEnabled());
1149 else 1151 else
1150 drawIndicator(&p, x, y, sz.width(), sz.height(), 1152 drawIndicator(&p, x, y, sz.width(), sz.height(),
1151 btn->colorGroup(), btn->state(), btn->isDown(), 1153 btn->colorGroup(), btn->state(), btn->isDown(),
1152 btn->isEnabled()); 1154 btn->isEnabled());
1153 x = sz.width() + 6; 1155 x = sz.width() + 6;
1154 y = 0; 1156 y = 0;
1155 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), 1157 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1),
1156 btn->height(), AlignLeft|AlignVCenter|ShowPrefix, 1158 btn->height(), AlignLeft|AlignVCenter|ShowPrefix,
1157 btn->colorGroup(), btn->isEnabled(), 1159 btn->colorGroup(), btn->isEnabled(),
1158 btn->pixmap(), btn->text()); 1160 btn->pixmap(), btn->text());
1159 p.end(); 1161 p.end();
1160 return(true); 1162 return(true);
1161 } 1163 }
1162 } 1164 }
1163 else if(obj->inherits("QHeader")){ 1165 else if(obj->inherits("QHeader")){
1164 QHeader *hw = (QHeader *)obj; 1166 QHeader *hw = (QHeader *)obj;
1165 if(ev->type() == QEvent::Enter){ 1167 if(ev->type() == QEvent::Enter){
1166 currentHeader = hw; 1168 currentHeader = hw;
1167 headerHoverID = -1; 1169 headerHoverID = -1;
1168 } 1170 }
1169 else if(ev->type() == QEvent::Leave){ 1171 else if(ev->type() == QEvent::Leave){
1170 currentHeader = NULL; 1172 currentHeader = NULL;
1171 if(headerHoverID != -1){ 1173 if(headerHoverID != -1){
1172 hw->repaint(hw->sectionPos(headerHoverID), 0, 1174 hw->repaint(hw->sectionPos(headerHoverID), 0,
1173 hw->sectionSize(headerHoverID), hw->height()); 1175 hw->sectionSize(headerHoverID), hw->height());
1174 } 1176 }
1175 headerHoverID = -1; 1177 headerHoverID = -1;
1176 } 1178 }
1177 else if(ev->type() == QEvent::MouseMove){ 1179 else if(ev->type() == QEvent::MouseMove){
1178 QMouseEvent *me = (QMouseEvent *)ev; 1180 QMouseEvent *me = (QMouseEvent *)ev;
1179 int oldHeader = headerHoverID; 1181 int oldHeader = headerHoverID;
1180 headerHoverID = hw->sectionAt(me->x()); 1182 headerHoverID = hw->sectionAt(me->x());
1181 if(oldHeader != headerHoverID){ 1183 if(oldHeader != headerHoverID){
1182 // reset old header 1184 // reset old header
1183 if(oldHeader != -1){ 1185 if(oldHeader != -1){
1184 hw->repaint(hw->sectionPos(oldHeader), 0, 1186 hw->repaint(hw->sectionPos(oldHeader), 0,
1185 hw->sectionSize(oldHeader), hw->height()); 1187 hw->sectionSize(oldHeader), hw->height());
1186 } 1188 }
1187 if(headerHoverID != -1){ 1189 if(headerHoverID != -1){
1188 hw->repaint(hw->sectionPos(headerHoverID), 0, 1190 hw->repaint(hw->sectionPos(headerHoverID), 0,
1189 hw->sectionSize(headerHoverID), hw->height()); 1191 hw->sectionSize(headerHoverID), hw->height());
1190 } 1192 }
1191 } 1193 }
1192 } 1194 }
1193 } 1195 }
1194 else if (obj-> inherits( "QProgressBar" )) { 1196 else if (obj-> inherits( "QProgressBar" )) {
1195 if ( ev->type() == QEvent::Paint ) { 1197 if ( ev->type() == QEvent::Paint ) {
1196 HackProgressBar *p = (HackProgressBar *) obj; 1198 HackProgressBar *p = (HackProgressBar *) obj;
1197 const QColorGroup &g = p-> colorGroup ( ); 1199 const QColorGroup &g = p-> colorGroup ( );
1198 1200
1199 QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1201 QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1200 if(!pix){ 1202 if(!pix){
1201 int h, s, v; 1203 int h, s, v;
1202 g.button().dark(120).hsv(&h, &s, &v); 1204 g.button().dark(120).hsv(&h, &s, &v);
1203 pix = new QPixmap(*bevelFillPix); 1205 pix = new QPixmap(*bevelFillPix);
1204 adjustHSV(*pix, h, s, v); 1206 adjustHSV(*pix, h, s, v);
1205 bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1207 bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1206 } 1208 }
1207 p-> paint ((QPaintEvent *) ev, g, pix ); 1209 p-> paint ((QPaintEvent *) ev, g, pix );
1208 return true; 1210 return true;
1209 } 1211 }
1210 } 1212 }
1211 return false ; 1213 return false ;
1212} 1214}
1213 1215
1214void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, 1216void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h,
1215 const QColorGroup &g, bool sunken, 1217 const QColorGroup &g, bool sunken,
1216 const QBrush *) 1218 const QBrush *)
1217{ 1219{
1218 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), 1220 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(),
1219 x, y, w, h); 1221 x, y, w, h);
1220} 1222}
1221 1223
1222void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, 1224void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h,
1223 const QColorGroup &g, bool sunken, 1225 const QColorGroup &g, bool sunken,
1224 const QBrush *) 1226 const QBrush *)
1225{ 1227{
1226 if(p->device()->devType() != QInternal::Widget){ 1228 if(p->device()->devType() != QInternal::Widget){
1227 // drawing into a temp pixmap, don't use mask 1229 // drawing into a temp pixmap, don't use mask
1228 QColor c = sunken ? g.button() : g.background(); 1230 QColor c = sunken ? g.button() : g.background();
1229 p->setPen(c.dark(130)); 1231 p->setPen(c.dark(130));
1230 p->drawRect(x, y, w, h); 1232 p->drawRect(x, y, w, h);
1231 p->setPen(c.light(105)); 1233 p->setPen(c.light(105));
1232 p->drawRect(x+1, y+1, w-2, h-2); 1234 p->drawRect(x+1, y+1, w-2, h-2);
1233 1235
1234 1236
1235 // fill 1237 // fill
1236 QPixmap *pix = bevelFillDict.find(c.rgb()); 1238 QPixmap *pix = bevelFillDict.find(c.rgb());
1237 if(!pix){ 1239 if(!pix){
1238 int h, s, v; 1240 int h, s, v;
1239 c.hsv(&h, &s, &v); 1241 c.hsv(&h, &s, &v);
1240 pix = new QPixmap(*bevelFillPix); 1242 pix = new QPixmap(*bevelFillPix);
1241 adjustHSV(*pix, h, s, v); 1243 adjustHSV(*pix, h, s, v);
1242 bevelFillDict.insert(c.rgb(), pix); 1244 bevelFillDict.insert(c.rgb(), pix);
1243 } 1245 }
1244 1246
1245 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1247 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1246 } 1248 }
1247 else{ 1249 else{
1248 drawClearBevel(p, x, y, w, h, sunken ? g.button() : 1250 drawClearBevel(p, x, y, w, h, sunken ? g.button() :
1249 highlightWidget == p->device() ? g.button().light(110) : 1251 highlightWidget == p->device() ? g.button().light(110) :
1250 g.background(), g.background()); 1252 g.background(), g.background());
1251 } 1253 }
1252} 1254}
1253 1255
1254void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) 1256void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p)
1255{ 1257{
1256 QRect r = btn->rect(); 1258 QRect r = btn->rect();
1257 bool sunken = btn->isOn() || btn->isDown(); 1259 bool sunken = btn->isOn() || btn->isDown();
1258 QColorGroup g = btn->colorGroup(); 1260 QColorGroup g = btn->colorGroup();
1259 1261
1260 1262
1261 //int dw = buttonDefaultIndicatorWidth(); 1263 //int dw = buttonDefaultIndicatorWidth();
1262 if(btn->hasFocus() || btn->isDefault()){ 1264 if(btn->hasFocus() || btn->isDefault()){
1263 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 1265 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
1264 QPixmap *pix = bevelFillDict.find(c.rgb()); 1266 QPixmap *pix = bevelFillDict.find(c.rgb());
1265 if(!pix){ 1267 if(!pix){
1266 int h, s, v; 1268 int h, s, v;
1267 c.hsv(&h, &s, &v); 1269 c.hsv(&h, &s, &v);
1268 pix = new QPixmap(*bevelFillPix); 1270 pix = new QPixmap(*bevelFillPix);
1269 adjustHSV(*pix, h, s, v); 1271 adjustHSV(*pix, h, s, v);
1270 bevelFillDict.insert(c.rgb(), pix); 1272 bevelFillDict.insert(c.rgb(), pix);
1271 } 1273 }
1272 p->setPen(c.dark(150)); 1274 p->setPen(c.dark(150));
1273 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1275 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1274 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1276 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1275 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1277 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1276 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1278 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1277 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1279 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1278 } 1280 }
1279 1281
1280 QColor newColor = btn == highlightWidget || sunken ? 1282 QColor newColor = btn == highlightWidget || sunken ?
1281 g.button().light(120) : g.button(); 1283 g.button().light(120) : g.button();
1282 1284
1283 drawRoundButton(p, newColor, g.background(), 1285 drawRoundButton(p, newColor, g.background(),
1284 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), 1286 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(),
1285 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), 1287 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(),
1286 btn->autoMask()); 1288 btn->autoMask());
1287} 1289}
1288 1290
1289void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) 1291void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p)
1290{ 1292{
1291 int x1, y1, x2, y2, w, h; 1293 int x1, y1, x2, y2, w, h;
1292 btn->rect().coords(&x1, &y1, &x2, &y2); 1294 btn->rect().coords(&x1, &y1, &x2, &y2);
1293 w = btn->width(); 1295 w = btn->width();
1294 h = btn->height(); 1296 h = btn->height();
1295 1297
1296 bool act = btn->isOn() || btn->isDown(); 1298 bool act = btn->isOn() || btn->isDown();
1297 if(act){ 1299 if(act){
1298 ++x1, ++y1; 1300 ++x1, ++y1;
1299 } 1301 }
1300 1302
1301 // Draw iconset first, if any 1303 // Draw iconset first, if any
1302 if ( btn->iconSet() && !btn->iconSet()->isNull() ) 1304 if ( btn->iconSet() && !btn->iconSet()->isNull() )
1303 { 1305 {
1304 QIconSet::Mode mode = btn->isEnabled() 1306 QIconSet::Mode mode = btn->isEnabled()
1305 ? QIconSet::Normal : QIconSet::Disabled; 1307 ? QIconSet::Normal : QIconSet::Disabled;
1306 if ( mode == QIconSet::Normal && btn->hasFocus() ) 1308 if ( mode == QIconSet::Normal && btn->hasFocus() )
1307 mode = QIconSet::Active; 1309 mode = QIconSet::Active;
1308 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); 1310 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode );
1309 int pixw = pixmap.width(); 1311 int pixw = pixmap.width();
1310 int pixh = pixmap.height(); 1312 int pixh = pixmap.height();
1311 1313
1312 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); 1314 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap );
1313 x1 += pixw + 8; 1315 x1 += pixw + 8;
1314 w -= pixw + 8; 1316 w -= pixw + 8;
1315 } 1317 }
1316 1318
1317 if(act){ 1319 if(act){
1318 QFont font = btn->font(); 1320 QFont font = btn->font();
1319 font.setBold(true); 1321 font.setBold(true);
1320 p->setFont(font); 1322 p->setFont(font);
1321 QColor shadow(btn->colorGroup().button().dark(130)); 1323 QColor shadow(btn->colorGroup().button().dark(130));
1322 drawItem( p, x1+1, y1+1, w, h, 1324 drawItem( p, x1+1, y1+1, w, h,
1323 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1325 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1324 btn->pixmap(), btn->text(), -1, 1326 btn->pixmap(), btn->text(), -1,
1325 &shadow); 1327 &shadow);
1326 1328
1327 drawItem( p, x1, y1, w, h, 1329 drawItem( p, x1, y1, w, h,
1328 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1330 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1329 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light()); 1331 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light());
1330 } 1332 }
1331 else{ 1333 else{
1332 /* Too blurry 1334 /* Too blurry
1333 drawItem( p, x1+1, y1+1, w, h, 1335 drawItem( p, x1+1, y1+1, w, h,
1334 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1336 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1335 btn->pixmap(), btn->text(), -1, 1337 btn->pixmap(), btn->text(), -1,
1336 &btn->colorGroup().button().dark(115)); 1338 &btn->colorGroup().button().dark(115));
1337 */ 1339 */
1338 drawItem( p, x1, y1, w, h, 1340 drawItem( p, x1, y1, w, h,
1339 AlignCenter | ShowPrefix, 1341 AlignCenter | ShowPrefix,
1340 btn->colorGroup(), btn->isEnabled(), 1342 btn->colorGroup(), btn->isEnabled(),
1341 btn->pixmap(), btn->text(), -1, 1343 btn->pixmap(), btn->text(), -1,
1342 &btn->colorGroup().buttonText()); 1344 &btn->colorGroup().buttonText());
1343 } 1345 }
1344} 1346}
1345 1347
1346void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h) 1348void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h)
1347{ 1349{
1348 int x2 = x+w-1; 1350 int x2 = x+w-1;
1349 int y2 = y+h-1; 1351 int y2 = y+h-1;
1350 1352
1351 p->setPen(Qt::color1); 1353 p->setPen(Qt::color1);
1352 p->fillRect(x, y, w, h, Qt::color0); 1354 p->fillRect(x, y, w, h, Qt::color0);
1353 if(w < 21 || h < 21){ 1355 if(w < 21 || h < 21){
1354 // outer rect 1356 // outer rect
1355 p->drawLine(x, y+2, x, y2-2); // l 1357 p->drawLine(x, y+2, x, y2-2); // l
1356 p->drawLine(x2, y+2, x2, y2-2); // r 1358 p->drawLine(x2, y+2, x2, y2-2); // r
1357 p->drawLine(x+2, y, x2-2, y); // t 1359 p->drawLine(x+2, y, x2-2, y); // t
1358 p->drawLine(x+2, y2, x2-2, y2); // b 1360 p->drawLine(x+2, y2, x2-2, y2); // b
1359 p->drawLine(x+1, y+1, x2-1, y+1); // top second line 1361 p->drawLine(x+1, y+1, x2-1, y+1); // top second line
1360 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line 1362 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line
1361 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1); 1363 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1);
1362 } 1364 }
1363 else{ 1365 else{
1364 int x2 = x+w-1; 1366 int x2 = x+w-1;
1365 int y2 = y+h-1; 1367 int y2 = y+h-1;
1366 int bx2 = htmlBtnMaskBmp.width()-1; 1368 int bx2 = htmlBtnMaskBmp.width()-1;
1367 int by2 = htmlBtnMaskBmp.height()-1; 1369 int by2 = htmlBtnMaskBmp.height()-1;
1368 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl 1370 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl
1369 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr 1371 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr
1370 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl 1372 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl
1371 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br 1373 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br
1372 // fills 1374 // fills
1373 p->fillRect(10, 0, w-20, 10, Qt::color1); // top 1375 p->fillRect(10, 0, w-20, 10, Qt::color1); // top
1374 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1376 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1375 p->fillRect(0, 10, w, h-20, Qt::color1); // middle 1377 p->fillRect(0, 10, w, h-20, Qt::color1); // middle
1376 } 1378 }
1377} 1379}
1378 1380
1379void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, 1381void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
1380 const QColorGroup &g, bool sunken, 1382 const QColorGroup &g, bool sunken,
1381 const QBrush */*fill*/) 1383 const QBrush */*fill*/)
1382{ 1384{
1383 if(currentHeader && p->device() == currentHeader){ 1385 if(currentHeader && p->device() == currentHeader){
1384 int id = currentHeader->sectionAt(x); 1386 int id = currentHeader->sectionAt(x);
1385 bool isHeaderHover = id != -1 && id == headerHoverID; 1387 bool isHeaderHover = id != -1 && id == headerHoverID;
1386 drawClearBevel(p, x, y, w, h, sunken ? 1388 drawClearBevel(p, x, y, w, h, sunken ?
1387 g.button() : isHeaderHover ? g.button().light(110) : 1389 g.button() : isHeaderHover ? g.button().light(110) :
1388 g.background(), g.background()); 1390 g.background(), g.background());
1389 } 1391 }
1390 else 1392 else
1391 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), 1393 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(),
1392 g.background()); 1394 g.background());
1393} 1395}
1394 1396
1395QRect LiquidStyle::buttonRect(int x, int y, int w, int h) 1397QRect LiquidStyle::buttonRect(int x, int y, int w, int h)
1396{ 1398{
1397 return(QRect(x+5, y+5, w-10, h-10)); 1399 return(QRect(x+5, y+5, w-10, h-10));
1398} 1400}
1399 1401
1400void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, 1402void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
1401 const QColorGroup &g, bool sunken, 1403 const QColorGroup &g, bool sunken,
1402 bool edit, bool, const QBrush *) 1404 bool edit, bool, const QBrush *)
1403{ 1405{
1404 bool isActive = false; 1406 bool isActive = false;
1405 if (( painter->device()->devType() == QInternal::Widget ) && 1407 if (( painter->device()->devType() == QInternal::Widget ) &&
1406 ( 1408 (
1407 ( qApp-> focusWidget ( ) == painter-> device ( )) || 1409 ( qApp-> focusWidget ( ) == painter-> device ( )) ||
1408 ( 1410 (
1409 edit && 1411 edit &&
1410 ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) && 1412 ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
1411 ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( )) 1413 ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ) ||
1414 qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->listBox ( ))
1412 ) 1415 )
1413 ) 1416 )
1414 ) { 1417 ) {
1415 isActive = true; 1418 isActive = true;
1416 } 1419 }
1417 1420
1418 bool isMasked = false; 1421 bool isMasked = false;
1419 if(painter->device()->devType() == QInternal::Widget) 1422 if(painter->device()->devType() == QInternal::Widget)
1420 isMasked = ((QWidget*)painter->device())->autoMask(); 1423 isMasked = ((QWidget*)painter->device())->autoMask();
1421 // TODO: Do custom code, don't just call drawRoundButton into a pixmap 1424 // TODO: Do custom code, don't just call drawRoundButton into a pixmap
1422 QPixmap tmpPix(w, h); 1425 QPixmap tmpPix(w, h);
1423 QPainter p(&tmpPix); 1426 QPainter p(&tmpPix);
1424 1427
1425 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, 1428 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
1426 sunken, false, isMasked); 1429 sunken, false, isMasked);
1427 if(!isActive){ 1430 if(!isActive){
1428 p.setClipRect(0, 0, w-17, h); 1431 p.setClipRect(0, 0, w-17, h);
1429 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, 1432 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
1430 sunken, false, isMasked); 1433 sunken, false, isMasked);
1431 } 1434 }
1432 p.end(); 1435 p.end();
1433 int x2 = x+w-1; 1436 int x2 = x+w-1;
1434 int y2 = y+h-1; 1437 int y2 = y+h-1;
1435 int bx2 = btnMaskBmp.width()-1; 1438 int bx2 = btnMaskBmp.width()-1;
1436 int by2 = btnMaskBmp.height()-1; 1439 int by2 = btnMaskBmp.height()-1;
1437 QBitmap btnMask(w, h); 1440 QBitmap btnMask(w, h);
1438 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 1441 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
1439 p.begin(&btnMask); 1442 p.begin(&btnMask);
1440 p.fillRect(0, 0, w, h, Qt::color0); 1443 p.fillRect(0, 0, w, h, Qt::color0);
1441 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 1444 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
1442 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 1445 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
1443 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 1446 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
1444 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 1447 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
1445 // fills 1448 // fills
1446 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 1449 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
1447 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1450 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1448 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 1451 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
1449 p.end(); 1452 p.end();
1450 tmpPix.setMask(btnMask); 1453 tmpPix.setMask(btnMask);
1451 1454
1452 painter->drawPixmap(x, y, tmpPix); 1455 painter->drawPixmap(x, y, tmpPix);
1453 1456
1454 painter->setPen(g.button().dark(120)); 1457 painter->setPen(g.button().dark(120));
1455 painter->drawLine(x2-16, y+1, x2-16, y2-1); 1458 painter->drawLine(x2-16, y+1, x2-16, y2-1);
1456 1459
1457 if(edit){ 1460 if(edit){
1458 painter->setPen(g.mid()); 1461 painter->setPen(g.mid());
1459 painter->drawRect(x+8, y+2, w-25, h-4); 1462 painter->drawRect(x+8, y+2, w-25, h-4);
1460 } 1463 }
1461 int arrow_h = h / 3; 1464 int arrow_h = h / 3;
1462 int arrow_w = arrow_h; 1465 int arrow_w = arrow_h;
1463 int arrow_x = w - arrow_w - 6; 1466 int arrow_x = w - arrow_w - 6;
1464 int arrow_y = (h - arrow_h) / 2; 1467 int arrow_y = (h - arrow_h) / 2;
1465 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true); 1468 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true);
1466} 1469}
1467 1470
1468void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h) 1471void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h)
1469{ 1472{
1470 drawButtonMask(p, x, y, w, h); 1473 drawButtonMask(p, x, y, w, h);
1471} 1474}
1472 1475
1473QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h) 1476QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h)
1474{ 1477{
1475 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6)); 1478 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6));
1476 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); 1479 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6));
1477} 1480}
1478 1481
1479QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) 1482QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/)
1480{ 1483{
1481 return QRect ( ); 1484 return QRect ( );
1482 1485
1483// return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1486// return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1484} 1487}
1485 1488
1486void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, 1489void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
1487 int sliderStart, uint controls, 1490 int sliderStart, uint controls,
1488 uint activeControl) 1491 uint activeControl)
1489{ 1492{
1490 int sliderMin, sliderMax, sliderLength, buttonDim; 1493 int sliderMin, sliderMax, sliderLength, buttonDim;
1491 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1494 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1492 1495
1493 if (sliderStart > sliderMax) 1496 if (sliderStart > sliderMax)
1494 sliderStart = sliderMax; 1497 sliderStart = sliderMax;
1495 1498
1496 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1499 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1497 QColorGroup g = sb->colorGroup(); 1500 QColorGroup g = sb->colorGroup();
1498 QRect addB, subHC, subB; 1501 QRect addB, subHC, subB;
1499 QRect addPageR, subPageR, sliderR; 1502 QRect addPageR, subPageR, sliderR;
1500 int addX, addY, subX, subY; 1503 int addX, addY, subX, subY;
1501 int len = horiz ? sb->width() : sb->height(); 1504 int len = horiz ? sb->width() : sb->height();
1502 int extent = horiz ? sb->height() : sb->width(); 1505 int extent = horiz ? sb->height() : sb->width();
1503 1506
1504 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar 1507 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar
1505 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now. 1508 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now.
1506 bool brokenApp; 1509 bool brokenApp;
1507 if(extent == 16) 1510 if(extent == 16)
1508 brokenApp = true; 1511 brokenApp = true;
1509 else 1512 else
1510 brokenApp = false; 1513 brokenApp = false;
1511 1514
1512 if (horiz) { 1515 if (horiz) {
1513 subY = addY = ( extent - buttonDim ) / 2; 1516 subY = addY = ( extent - buttonDim ) / 2;
1514 subX = 0; 1517 subX = 0;
1515 addX = len - buttonDim; 1518 addX = len - buttonDim;
1516 if(sbBuffer.size() != sb->size()) 1519 if(sbBuffer.size() != sb->size())
1517 sbBuffer.resize(sb->size()); 1520 sbBuffer.resize(sb->size());
1518 } 1521 }
1519 else { 1522 else {
1520 subX = addX = ( extent - buttonDim ) / 2; 1523 subX = addX = ( extent - buttonDim ) / 2;
1521 subY = 0; 1524 subY = 0;
1522 addY = len - buttonDim; 1525 addY = len - buttonDim;
1523 if(sbBuffer.size() != sb->size()) 1526 if(sbBuffer.size() != sb->size())
1524 sbBuffer.resize(sb->size()); 1527 sbBuffer.resize(sb->size());
1525 } 1528 }
1526 subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); 1529 subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
1527 addB.setRect( addX,addY,buttonDim,buttonDim ); 1530 addB.setRect( addX,addY,buttonDim,buttonDim );
1528 if(horiz) 1531 if(horiz)
1529 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); 1532 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
1530 else 1533 else
1531 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim ); 1534 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim );
1532 1535
1533 int sliderEnd = sliderStart + sliderLength; 1536 int sliderEnd = sliderStart + sliderLength;
1534 int sliderW = extent; 1537 int sliderW = extent;
1535 1538
1536 if (horiz) { 1539 if (horiz) {
1537 subPageR.setRect( subB.right() + 1, 0, 1540 subPageR.setRect( subB.right() + 1, 0,
1538 sliderStart - subB.right() - 1 , sliderW ); 1541 sliderStart - subB.right() - 1 , sliderW );
1539 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW ); 1542 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW );
1540 sliderR .setRect( sliderStart, 0, sliderLength, sliderW ); 1543 sliderR .setRect( sliderStart, 0, sliderLength, sliderW );
1541 } 1544 }
1542 else { 1545 else {
1543 subPageR.setRect( 0, subB.bottom() + 1, sliderW, 1546 subPageR.setRect( 0, subB.bottom() + 1, sliderW,
1544 sliderStart - subB.bottom() - 1 ); 1547 sliderStart - subB.bottom() - 1 );
1545 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd); 1548 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd);
1546 sliderR .setRect( 0, sliderStart, sliderW, sliderLength ); 1549 sliderR .setRect( 0, sliderStart, sliderW, sliderLength );
1547 } 1550 }
1548 1551
1549 bool maxed = sb->maxValue() == sb->minValue(); 1552 bool maxed = sb->maxValue() == sb->minValue();
1550 1553
1551 QPainter painter; 1554 QPainter painter;
1552 if(!horiz){ 1555 if(!horiz){
1553 painter.begin(&sbBuffer); 1556 painter.begin(&sbBuffer);
1554 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); 1557 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
1555 if(sliderR.height() >= 8){ 1558 if(sliderR.height() >= 8){
1556 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, 1559 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
1557 13, 8); 1560 13, 8);
1558 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg)); 1561 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg));
1559 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13, 1562 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13,
1560 bgR.height()-16, *getPixmap(VSBSliderMidBg)); 1563 bgR.height()-16, *getPixmap(VSBSliderMidBg));
1561 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix, 1564 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix,
1562 0, 0, 13, 8); 1565 0, 0, 13, 8);
1563 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg)); 1566 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg));
1564 } 1567 }
1565 else{ 1568 else{
1566 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(), 1569 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(),
1567 *getPixmap(VSBSliderMidBg)); 1570 *getPixmap(VSBSliderMidBg));
1568 painter.setPen(g.background().dark(210)); 1571 painter.setPen(g.background().dark(210));
1569 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1); 1572 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1);
1570 painter.setPen(g.mid()); 1573 painter.setPen(g.mid());
1571 painter.drawPoint(bgR.x()+1, bgR.y()); 1574 painter.drawPoint(bgR.x()+1, bgR.y());
1572 painter.drawPoint(bgR.x()+13, bgR.y()); 1575 painter.drawPoint(bgR.x()+13, bgR.y());
1573 painter.drawPoint(bgR.x()+1, bgR.bottom()-1); 1576 painter.drawPoint(bgR.x()+1, bgR.bottom()-1);
1574 painter.drawPoint(bgR.x()+13, bgR.bottom()-1); 1577 painter.drawPoint(bgR.x()+13, bgR.bottom()-1);
1575 } 1578 }
1576 if(controls & Slider){ 1579 if(controls & Slider){
1577 if(sliderR.height() >= 16){ 1580 if(sliderR.height() >= 16){
1578 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop)); 1581 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop));
1579 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, 1582 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13,
1580 sliderR.height()-16, *getPixmap(VSBSliderMid)); 1583 sliderR.height()-16, *getPixmap(VSBSliderMid));
1581 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm)); 1584 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm));
1582 } 1585 }
1583 else if(sliderR.height() >= 8){ 1586 else if(sliderR.height() >= 8){
1584 int m = sliderR.height()/2; 1587 int m = sliderR.height()/2;
1585 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m); 1588 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m);
1586 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1589 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1587 } 1590 }
1588 else{ 1591 else{
1589 painter.setPen(g.button().dark(210)); 1592 painter.setPen(g.button().dark(210));
1590 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(), 1593 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(),
1591 13, sliderR.height()); 1594 13, sliderR.height());
1592 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, 1595 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1,
1593 11, sliderR.height()-2, 1596 11, sliderR.height()-2,
1594 *getPixmap(VSBSliderMid), 1, 0); 1597 *getPixmap(VSBSliderMid), 1, 0);
1595 } 1598 }
1596 } 1599 }
1597 painter.setPen(g.mid()); 1600 painter.setPen(g.mid());
1598 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom()); 1601 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom());
1599 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom()); 1602 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom());
1600 if(brokenApp && (controls & Slider)){ 1603 if(brokenApp && (controls & Slider)){
1601 painter.setPen(g.background()); 1604 painter.setPen(g.background());
1602 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1, 1605 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1,
1603 bgR.bottom()); 1606 bgR.bottom());
1604 } 1607 }
1605 painter.end(); 1608 painter.end();
1606 } 1609 }
1607 else{ 1610 else{
1608 painter.begin(&sbBuffer); 1611 painter.begin(&sbBuffer);
1609 QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); 1612 QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
1610 if(sliderR.width() >= 8){ 1613 if(sliderR.width() >= 8){
1611 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, 1614 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
1612 8, 13); 1615 8, 13);
1613 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg)); 1616 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg));
1614 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16, 1617 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16,
1615 13, *getPixmap(HSBSliderMidBg)); 1618 13, *getPixmap(HSBSliderMidBg));
1616 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix, 1619 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix,
1617 0, 0, 8, 13); 1620 0, 0, 8, 13);
1618 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg)); 1621 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg));
1619 } 1622 }
1620 else{ 1623 else{
1621 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13, 1624 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13,
1622 *getPixmap(HSBSliderMidBg)); 1625 *getPixmap(HSBSliderMidBg));
1623 painter.setPen(g.background().dark(210)); 1626 painter.setPen(g.background().dark(210));
1624 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13); 1627 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13);
1625 painter.setPen(g.mid()); 1628 painter.setPen(g.mid());
1626 painter.drawPoint(bgR.x(), bgR.y()+1); 1629 painter.drawPoint(bgR.x(), bgR.y()+1);
1627 painter.drawPoint(bgR.x(), bgR.bottom()-1); 1630 painter.drawPoint(bgR.x(), bgR.bottom()-1);
1628 painter.drawPoint(bgR.right()-1, bgR.y()+1); 1631 painter.drawPoint(bgR.right()-1, bgR.y()+1);
1629 painter.drawPoint(bgR.right()-1, bgR.bottom()-1); 1632 painter.drawPoint(bgR.right()-1, bgR.bottom()-1);
1630 } 1633 }
1631 if(controls & Slider){ 1634 if(controls & Slider){
1632 if(sliderR.width() >= 16){ 1635 if(sliderR.width() >= 16){
1633 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1636 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1634 *getPixmap(HSBSliderTop)); 1637 *getPixmap(HSBSliderTop));
1635 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, 1638 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16,
1636 13, *getPixmap(HSBSliderMid)); 1639 13, *getPixmap(HSBSliderMid));
1637 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1640 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1638 *getPixmap(HSBSliderBtm)); 1641 *getPixmap(HSBSliderBtm));
1639 } 1642 }
1640 else if(sliderR.width() >= 8){ 1643 else if(sliderR.width() >= 8){
1641 int m = sliderR.width()/2; 1644 int m = sliderR.width()/2;
1642 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1645 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1643 *getPixmap(HSBSliderTop), 0, 0, m, 13); 1646 *getPixmap(HSBSliderTop), 0, 0, m, 13);
1644 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1647 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1645 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); 1648 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
1646 } 1649 }
1647 else{ 1650 else{
1648 painter.setPen(g.button().dark(210)); 1651 painter.setPen(g.button().dark(210));
1649 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, 1652 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1,
1650 sliderR.width(), 13); 1653 sliderR.width(), 13);
1651 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, 1654 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
1652 sliderR.width()-2, 11, 1655 sliderR.width()-2, 11,
1653 *getPixmap(HSBSliderMid), 0, 1); 1656 *getPixmap(HSBSliderMid), 0, 1);
1654 } 1657 }
1655 } 1658 }
1656 painter.setPen(g.mid()); 1659 painter.setPen(g.mid());
1657 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y()); 1660 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y());
1658 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom()); 1661 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom());
1659 if(brokenApp && (controls & Slider)){ 1662 if(brokenApp && (controls & Slider)){
1660 painter.setPen(g.background()); 1663 painter.setPen(g.background());
1661 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(), 1664 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(),
1662 bgR.bottom()-1); 1665 bgR.bottom()-1);
1663 } 1666 }
1664 painter.end(); 1667 painter.end();
1665 } 1668 }
1666 1669
1667 if ( controls & AddLine ) { 1670 if ( controls & AddLine ) {
1668 drawSBButton(p, addB, g, activeControl == AddLine); 1671 drawSBButton(p, addB, g, activeControl == AddLine);
1669 drawArrow( p, horiz ? RightArrow : DownArrow, 1672 drawArrow( p, horiz ? RightArrow : DownArrow,
1670 false, addB.x()+4, addB.y()+4, 1673 false, addB.x()+4, addB.y()+4,
1671 addB.width()-8, addB.height()-8, g, !maxed); 1674 addB.width()-8, addB.height()-8, g, !maxed);
1672 } 1675 }
1673 if ( controls & SubLine ) { 1676 if ( controls & SubLine ) {
1674 // drawSBButton(p, subB, g, activeControl == SubLine); 1677 // drawSBButton(p, subB, g, activeControl == SubLine);
1675 // drawArrow( p, horiz ? LeftArrow : UpArrow, 1678 // drawArrow( p, horiz ? LeftArrow : UpArrow,
1676 // false, subB.x()+4, subB.y()+4, 1679 // false, subB.x()+4, subB.y()+4,
1677 // subB.width()-8, subB.height()-8, g, !maxed); 1680 // subB.width()-8, subB.height()-8, g, !maxed);
1678 drawSBButton(p, subHC, g, activeControl == SubLine); 1681 drawSBButton(p, subHC, g, activeControl == SubLine);
1679 drawArrow( p, horiz ? LeftArrow : UpArrow, 1682 drawArrow( p, horiz ? LeftArrow : UpArrow,
1680 false, subHC.x()+4, subHC.y()+4, 1683 false, subHC.x()+4, subHC.y()+4,
1681 subHC.width()-8, subHC.height()-8, g, !maxed); 1684 subHC.width()-8, subHC.height()-8, g, !maxed);
1682 } 1685 }
1683 1686
1684 if(controls & AddPage){ 1687 if(controls & AddPage){
1685 if(addPageR.width()){ 1688 if(addPageR.width()){
1686 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer, 1689 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer,
1687 addPageR.x(), addPageR.y(), addPageR.width(), 1690 addPageR.x(), addPageR.y(), addPageR.width(),
1688 addPageR.height()); 1691 addPageR.height());
1689 } 1692 }
1690 } 1693 }
1691 if(controls & SubPage){ 1694 if(controls & SubPage){
1692 if(subPageR.height()){ 1695 if(subPageR.height()){
1693 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer, 1696 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer,
1694 subPageR.x(), subPageR.y(), subPageR.width(), 1697 subPageR.x(), subPageR.y(), subPageR.width(),
1695 subPageR.height()); 1698 subPageR.height());
1696 } 1699 }
1697 } 1700 }
1698 if ( controls & Slider ) { 1701 if ( controls & Slider ) {
1699 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer, 1702 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer,
1700 sliderR.x(), sliderR.y(), sliderR.width(), 1703 sliderR.x(), sliderR.y(), sliderR.width(),
1701 sliderR.height()); 1704 sliderR.height());
1702 } 1705 }
1703} 1706}
1704 1707
1705void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, 1708void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
1706 bool down, bool /*fast*/) 1709 bool down, bool /*fast*/)
1707{ 1710{
1708 p->setPen(g.mid()); 1711 p->setPen(g.mid());
1709 p->drawRect(r); 1712 p->drawRect(r);
1710 QColor c(down ? g.button() : g.background()); 1713 QColor c(down ? g.button() : g.background());
1711 QPixmap *pix = bevelFillDict.find(c.rgb()); 1714 QPixmap *pix = bevelFillDict.find(c.rgb());
1712 if(!pix){ 1715 if(!pix){
1713 int h, s, v; 1716 int h, s, v;
1714 c.hsv(&h, &s, &v); 1717 c.hsv(&h, &s, &v);
1715 pix = new QPixmap(*bevelFillPix); 1718 pix = new QPixmap(*bevelFillPix);
1716 adjustHSV(*pix, h, s, v); 1719 adjustHSV(*pix, h, s, v);
1717 bevelFillDict.insert(c.rgb(), pix); 1720 bevelFillDict.insert(c.rgb(), pix);
1718 } 1721 }
1719 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1722 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1720 1723
1721} 1724}
1722 1725
1723void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, 1726void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g,
1724 bool horiz) 1727 bool horiz)
1725{ 1728{
1726 if(horiz){ 1729 if(horiz){
1727 if(r.width() >= 15){ 1730 if(r.width() >= 15){
1728 int y = r.y()+3; 1731 int y = r.y()+3;
1729 int x = r.x() + (r.width()-7)/2; 1732 int x = r.x() + (r.width()-7)/2;
1730 int y2 = r.bottom()-3; 1733 int y2 = r.bottom()-3;
1731 p->setPen(g.light()); 1734 p->setPen(g.light());
1732 p->drawLine(x, y, x, y2); 1735 p->drawLine(x, y, x, y2);
1733 p->drawLine(x+3, y, x+3, y2); 1736 p->drawLine(x+3, y, x+3, y2);
1734 p->drawLine(x+6, y, x+6, y2); 1737 p->drawLine(x+6, y, x+6, y2);
1735 1738
1736 p->setPen(g.mid()); 1739 p->setPen(g.mid());
1737 p->drawLine(x+1, y, x+1, y2); 1740 p->drawLine(x+1, y, x+1, y2);
1738 p->drawLine(x+4, y, x+4, y2); 1741 p->drawLine(x+4, y, x+4, y2);
1739 p->drawLine(x+7, y, x+7, y2); 1742 p->drawLine(x+7, y, x+7, y2);
1740 } 1743 }
1741 } 1744 }
1742 else{ 1745 else{
1743 if(r.height() >= 15){ 1746 if(r.height() >= 15){
1744 int x = r.x()+3; 1747 int x = r.x()+3;
1745 int y = r.y() + (r.height()-7)/2; 1748 int y = r.y() + (r.height()-7)/2;
1746 int x2 = r.right()-3; 1749 int x2 = r.right()-3;
1747 p->setPen(g.light()); 1750 p->setPen(g.light());
1748 p->drawLine(x, y, x2, y); 1751 p->drawLine(x, y, x2, y);
1749 p->drawLine(x, y+3, x2, y+3); 1752 p->drawLine(x, y+3, x2, y+3);
1750 p->drawLine(x, y+6, x2, y+6); 1753 p->drawLine(x, y+6, x2, y+6);
1751 1754
1752 p->setPen(g.mid()); 1755 p->setPen(g.mid());
1753 p->drawLine(x, y+1, x2, y+1); 1756 p->drawLine(x, y+1, x2, y+1);
1754 p->drawLine(x, y+4, x2, y+4); 1757 p->drawLine(x, y+4, x2, y+4);
1755 p->drawLine(x, y+7, x2, y+7); 1758 p->drawLine(x, y+7, x2, y+7);
1756 } 1759 }
1757 } 1760 }
1758 1761
1759} 1762}
1760 1763
1761 1764
1762void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin, 1765void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin,
1763 int &sliderMax, int &sliderLength, 1766 int &sliderMax, int &sliderLength,
1764 int &buttonDim) 1767 int &buttonDim)
1765{ 1768{
1766 1769
1767 int maxLength; 1770 int maxLength;
1768 int b = 0; 1771 int b = 0;
1769 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1772 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1770 int length = horiz ? sb->width() : sb->height(); 1773 int length = horiz ? sb->width() : sb->height();
1771 int extent = horiz ? sb->height() : sb->width(); 1774 int extent = horiz ? sb->height() : sb->width();
1772 1775
1773 if ( length > ( extent - b*2 - 1 )*2 + b*2 ) 1776 if ( length > ( extent - b*2 - 1 )*2 + b*2 )
1774 buttonDim = extent - b*2; 1777 buttonDim = extent - b*2;
1775 else 1778 else
1776 buttonDim = ( length - b*2 )/2 - 1; 1779 buttonDim = ( length - b*2 )/2 - 1;
1777 1780
1778 sliderMin = b + 0; // buttonDim; 1781 sliderMin = b + 0; // buttonDim;
1779 maxLength = length - b*2 - buttonDim*2; // 3; 1782 maxLength = length - b*2 - buttonDim*2; // 3;
1780 1783
1781 if ( sb->maxValue() == sb->minValue() ) { 1784 if ( sb->maxValue() == sb->minValue() ) {
1782 sliderLength = maxLength; 1785 sliderLength = maxLength;
1783 } else { 1786 } else {
1784 sliderLength = (sb->pageStep()*maxLength)/ 1787 sliderLength = (sb->pageStep()*maxLength)/
1785 (sb->maxValue()-sb->minValue()+sb->pageStep()); 1788 (sb->maxValue()-sb->minValue()+sb->pageStep());
1786 uint range = sb->maxValue()-sb->minValue(); 1789 uint range = sb->maxValue()-sb->minValue();
1787 if ( sliderLength < 9 || range > INT_MAX/2 ) 1790 if ( sliderLength < 9 || range > INT_MAX/2 )
1788 sliderLength = 9; 1791 sliderLength = 9;
1789 if ( sliderLength > maxLength ) 1792 if ( sliderLength > maxLength )
1790 sliderLength = maxLength; 1793 sliderLength = maxLength;
1791 } 1794 }
1792 sliderMax = sliderMin + maxLength - sliderLength; 1795 sliderMax = sliderMin + maxLength - sliderLength;
1793 1796
1794} 1797}
1795 1798
1796QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb, 1799QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb,
1797 int sliderStart, 1800 int sliderStart,
1798 const QPoint &p) 1801 const QPoint &p)
1799{ 1802{
1800 if ( !sb->rect().contains( p ) ) 1803 if ( !sb->rect().contains( p ) )
1801 return NoScroll; 1804 return NoScroll;
1802 int sliderMin, sliderMax, sliderLength, buttonDim, pos; 1805 int sliderMin, sliderMax, sliderLength, buttonDim, pos;
1803 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1806 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1804 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y(); 1807 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y();
1805 if ( pos < sliderMin ) 1808 if ( pos < sliderMin )
1806 return SubLine; 1809 return SubLine;
1807 if ( pos < sliderStart ) 1810 if ( pos < sliderStart )
1808 return SubPage; 1811 return SubPage;
1809 if ( pos < sliderStart + sliderLength ) 1812 if ( pos < sliderStart + sliderLength )
1810 return Slider; 1813 return Slider;
1811 if ( pos < sliderMax + sliderLength) 1814 if ( pos < sliderMax + sliderLength)
1812 return AddPage; 1815 return AddPage;
1813 if(pos > sliderMax + sliderLength + 16) 1816 if(pos > sliderMax + sliderLength + 16)
1814 return AddLine; 1817 return AddLine;
1815 1818
1816 return SubLine; 1819 return SubLine;
1817} 1820}
1818 1821
1819#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1822#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1820 1823
1821 1824
1822QSize LiquidStyle::exclusiveIndicatorSize() const 1825QSize LiquidStyle::exclusiveIndicatorSize() const
1823{ 1826{
1824 return(QSize(16, 16)); 1827 return(QSize(16, 16));
1825} 1828}
1826 1829
1827void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, 1830void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
1828 int /*h*/, const QColorGroup &/*g*/, bool on, 1831 int /*h*/, const QColorGroup &/*g*/, bool on,
1829 bool down, bool) 1832 bool down, bool)
1830{ 1833{
1831 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1834 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1832 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1835 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1833 && ((QWidget*)p->device())->autoMask(); 1836 && ((QWidget*)p->device())->autoMask();
1834 1837
1835 if(isMasked){ 1838 if(isMasked){
1836 if(on || down){ 1839 if(on || down){
1837 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) : 1840 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) :
1838 *getPixmap(HTMLRadioDown)); 1841 *getPixmap(HTMLRadioDown));
1839 } 1842 }
1840 else 1843 else
1841 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) : 1844 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) :
1842 *getPixmap(HTMLRadio)); 1845 *getPixmap(HTMLRadio));
1843 1846
1844 } 1847 }
1845 else{ 1848 else{
1846 if(on || down){ 1849 if(on || down){
1847 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) : 1850 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) :
1848 *getPixmap(RadioOn)); 1851 *getPixmap(RadioOn));
1849 } 1852 }
1850 else 1853 else
1851 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) : 1854 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) :
1852 *getPixmap(RadioOff)); 1855 *getPixmap(RadioOff));
1853 } 1856 }
1854} 1857}
1855 1858
1856void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, 1859void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w,
1857 int h, bool) 1860 int h, bool)
1858{ 1861{
1859 p->fillRect(x, y, w, h, Qt::color0); 1862 p->fillRect(x, y, w, h, Qt::color0);
1860 p->setPen(Qt::color1); 1863 p->setPen(Qt::color1);
1861 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask()); 1864 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask());
1862} 1865}
1863 1866
1864 1867
1865QSize LiquidStyle::indicatorSize() const 1868QSize LiquidStyle::indicatorSize() const
1866{ 1869{
1867 return(QSize(20, 22)); 1870 return(QSize(20, 22));
1868} 1871}
1869 1872
1870void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1873void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1871 const QColorGroup &/*g*/, int state, bool /*down*/, bool) 1874 const QColorGroup &/*g*/, int state, bool /*down*/, bool)
1872{ 1875{
1873 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1876 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1874 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1877 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1875 && ((QWidget*)p->device())->autoMask(); 1878 && ((QWidget*)p->device())->autoMask();
1876 if(isMasked){ 1879 if(isMasked){
1877 if(state != QButton::Off){ 1880 if(state != QButton::Off){
1878 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) : 1881 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) :
1879 *getPixmap(HTMLCBDown)); 1882 *getPixmap(HTMLCBDown));
1880 } 1883 }
1881 else 1884 else
1882 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) : 1885 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) :
1883 *getPixmap(HTMLCB)); 1886 *getPixmap(HTMLCB));
1884 1887
1885 } 1888 }
1886 else{ 1889 else{
1887 if(state != QButton::Off){ 1890 if(state != QButton::Off){
1888 p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) : 1891 p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) :
1889 *getPixmap(CBDown)); 1892 *getPixmap(CBDown));
1890 /* Todo - tristate 1893 /* Todo - tristate
1891 if(state == QButton::On){ 1894 if(state == QButton::On){
1892 p->setPen(Qt::black); 1895 p->setPen(Qt::black);
1893 p->drawPixmap(3, 3, xBmp); 1896 p->drawPixmap(3, 3, xBmp);
1894 } 1897 }
1895 else{ 1898 else{
1896 p->setPen(g.dark()); 1899 p->setPen(g.dark());
1897 p->drawRect(x+2, y+2, w-4, h-4); 1900 p->drawRect(x+2, y+2, w-4, h-4);
1898 p->setPen(Qt::black); 1901 p->setPen(Qt::black);
1899 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); 1902 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2);
1900 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); 1903 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2);
1901 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); 1904 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2);
1902 }*/ 1905 }*/
1903 } 1906 }
1904 else 1907 else
1905 p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB)); 1908 p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB));
1906 } 1909 }
1907} 1910}
1908 1911
1909void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1912void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1910 int /*state*/) 1913 int /*state*/)
1911{ 1914{
1912 // needed for some reason by KHtml, even tho it's all filled ;P 1915 // needed for some reason by KHtml, even tho it's all filled ;P
1913 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 1916 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
1914 1917
1915} 1918}
1916 1919
1917void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 1920void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
1918 const QColorGroup &/*g*/, Orientation orient, 1921 const QColorGroup &/*g*/, Orientation orient,
1919 bool, bool) 1922 bool, bool)
1920{ 1923{
1921 QWidget *parent = (QWidget *)p->device(); 1924 QWidget *parent = (QWidget *)p->device();
1922 p->setBrushOrigin(parent->pos()); 1925 p->setBrushOrigin(parent->pos());
1923 parent->erase(x, y, w, h); 1926 parent->erase(x, y, w, h);
1924 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1927 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1925 *getPixmap(VSlider)); 1928 *getPixmap(VSlider));
1926} 1929}
1927 1930
1928void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1931void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1929 Orientation orient, bool, bool) 1932 Orientation orient, bool, bool)
1930{ 1933{
1931 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1934 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1932 *getPixmap(VSlider)->mask()); 1935 *getPixmap(VSlider)->mask());
1933} 1936}
1934 1937
1935int LiquidStyle::sliderLength() const 1938int LiquidStyle::sliderLength() const
1936{ 1939{
1937 return(10); 1940 return(10);
1938} 1941}
1939 1942
1940#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1943#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1941 1944
1942void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, 1945void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x,
1943 int y, int w, int h, const QColorGroup &g, 1946 int y, int w, int h, const QColorGroup &g,
1944 bool enabled, const QBrush *) 1947 bool enabled, const QBrush *)
1945{ 1948{
1946 static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5}; 1949 static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5};
1947 static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6}; 1950 static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6};
1948 static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7}; 1951 static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7};
1949 static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4}; 1952 static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4};
1950 1953
1951 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); 1954 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid());
1952 if(w > 8){ 1955 if(w > 8){
1953 x = x + (w-8)/2; 1956 x = x + (w-8)/2;
1954 y = y + (h-8)/2; 1957 y = y + (h-8)/2;
1955 } 1958 }
1956 1959
1957 QPointArray a; 1960 QPointArray a;
1958 switch(type){ 1961 switch(type){
1959 case Qt::UpArrow: 1962 case Qt::UpArrow:
1960 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); 1963 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow);
1961 break; 1964 break;
1962 case Qt::DownArrow: 1965 case Qt::DownArrow:
1963 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); 1966 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow);
1964 break; 1967 break;
1965 case Qt::LeftArrow: 1968 case Qt::LeftArrow:
1966 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); 1969 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow);
1967 break; 1970 break;
1968 default: 1971 default:
1969 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); 1972 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow);
1970 break; 1973 break;
1971 } 1974 }
1972 1975
1973 a.translate(x, y); 1976 a.translate(x, y);
1974 p->drawLineSegments(a); 1977 p->drawLineSegments(a);
1975} 1978}
1976 1979
1977 1980
1978void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 1981void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1979 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 1982 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
1980 { 1983 {
1981 if(active){ 1984 if(active){
1982 x -= 2; // Bug in Qt/E 1985 x -= 2; // Bug in Qt/E
1983 y -= 2; 1986 y -= 2;
1984 w += 2; 1987 w += 2;
1985 h += 2; 1988 h += 2;
1986 } 1989 }
1987 1990
1988 QWidget *parent = (QWidget *)p->device(); 1991 QWidget *parent = (QWidget *)p->device();
1989 p->setBrushOrigin(parent->pos()); 1992 p->setBrushOrigin(parent->pos());
1990 parent->erase(x, y, w, h); 1993 parent->erase(x, y, w, h);
1991 1994
1992 if(menuHandler->useShadowText()){ 1995 if(menuHandler->useShadowText()){
1993 QColor shadow; 1996 QColor shadow;
1994 if(p->device() && p->device()->devType() == QInternal::Widget && 1997 if(p->device() && p->device()->devType() == QInternal::Widget &&
1995 ((QWidget *)p->device())->inherits("QMenuBar")){ 1998 ((QWidget *)p->device())->inherits("QMenuBar")){
1996 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1999 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1997 g.background().dark(130); 2000 g.background().dark(130);
1998 } 2001 }
1999 else 2002 else
2000 shadow = g.background().dark(130); 2003 shadow = g.background().dark(130);
2001 2004
2002 QPixmap *dummy = 0; 2005 QPixmap *dummy = 0;
2003 2006
2004 if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { 2007 if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) {
2005 dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); 2008 dummy = new QPixmap ( mi-> pixmap ( )-> size ( ));
2006 QBitmap dummy_mask ( dummy-> size ( )); 2009 QBitmap dummy_mask ( dummy-> size ( ));
2007 dummy_mask. fill ( color1 ); 2010 dummy_mask. fill ( color1 );
2008 dummy-> setMask ( dummy_mask ); 2011 dummy-> setMask ( dummy_mask );
2009 } 2012 }
2010 2013
2011 if(active){ 2014 if(active){
2012 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2015 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2013 QApplication::style().drawItem(p, x+1, y+1, w, h, 2016 QApplication::style().drawItem(p, x+1, y+1, w, h,
2014 AlignCenter|ShowPrefix|DontClip|SingleLine, 2017 AlignCenter|ShowPrefix|DontClip|SingleLine,
2015 g, mi->isEnabled(), dummy, mi->text(), 2018 g, mi->isEnabled(), dummy, mi->text(),
2016 -1, &shadow); 2019 -1, &shadow);
2017 QApplication::style().drawItem(p, x, y, w, h, 2020 QApplication::style().drawItem(p, x, y, w, h,
2018 AlignCenter|ShowPrefix|DontClip|SingleLine, 2021 AlignCenter|ShowPrefix|DontClip|SingleLine,
2019 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 2022 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2020 -1, &g.text()); 2023 -1, &g.text());
2021 } 2024 }
2022 else{ 2025 else{
2023 QApplication::style().drawItem(p, x+1, y+1, w, h, 2026 QApplication::style().drawItem(p, x+1, y+1, w, h,
2024 AlignCenter|ShowPrefix|DontClip|SingleLine, 2027 AlignCenter|ShowPrefix|DontClip|SingleLine,
2025 g, mi->isEnabled(), dummy, mi->text(), 2028 g, mi->isEnabled(), dummy, mi->text(),
2026 -1, &shadow); 2029 -1, &shadow);
2027 QApplication::style().drawItem(p, x, y, w, h, 2030 QApplication::style().drawItem(p, x, y, w, h,
2028 AlignCenter|ShowPrefix|DontClip|SingleLine, 2031 AlignCenter|ShowPrefix|DontClip|SingleLine,
2029 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 2032 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2030 -1, &g.text()); 2033 -1, &g.text());
2031 } 2034 }
2032 delete dummy; 2035 delete dummy;
2033 } 2036 }
2034 else{ 2037 else{
2035 if(active) 2038 if(active)
2036 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2039 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2037 QApplication::style().drawItem(p, x, y, w, h, 2040 QApplication::style().drawItem(p, x, y, w, h,
2038 AlignCenter|ShowPrefix|DontClip|SingleLine, 2041 AlignCenter|ShowPrefix|DontClip|SingleLine,
2039 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 2042 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2040 -1, &g.text()); 2043 -1, &g.text());
2041 } 2044 }
2042} 2045}
2043 2046
2044void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 2047void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
2045 const QColorGroup &g, int /*lineWidth*/, 2048 const QColorGroup &g, int /*lineWidth*/,
2046 const QBrush * /*fill*/) 2049 const QBrush * /*fill*/)
2047{ 2050{
2048 QColor c; 2051 QColor c;
2049 switch(menuHandler->transType()){ 2052 switch(menuHandler->transType()){
2050 case None: 2053 case None:
2051 case StippledBg: 2054 case StippledBg:
2052 case TransStippleBg: 2055 case TransStippleBg:
2053 c = g.background(); 2056 c = g.background();
2054 break; 2057 break;
2055 case StippledBtn: 2058 case StippledBtn:
2056 case TransStippleBtn: 2059 case TransStippleBtn:
2057 c = g.button(); 2060 c = g.button();
2058 break; 2061 break;
2059 default: 2062 default:
2060 c = menuHandler->bgColor(); 2063 c = menuHandler->bgColor();
2061 } 2064 }
2062 p->setPen(c.dark(140)); 2065 p->setPen(c.dark(140));
2063 p->drawRect(x, y, w, h); 2066 p->drawRect(x, y, w, h);
2064 p->setPen(c.light(120)); 2067 p->setPen(c.light(120));
2065 p->drawRect(x+1, y+1, w-2, h-2); 2068 p->drawRect(x+1, y+1, w-2, h-2);
2066} 2069}
2067 2070
2068void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, 2071void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw,
2069 int tab, QMenuItem* mi, 2072 int tab, QMenuItem* mi,
2070 const QPalette& pal, bool act, 2073 const QPalette& pal, bool act,
2071 bool enabled, int x, int y, int w, int h) 2074 bool enabled, int x, int y, int w, int h)
2072{ 2075{
2073static const int motifItemFrame = 2; 2076static const int motifItemFrame = 2;
2074static const int motifItemHMargin = 3; 2077static const int motifItemHMargin = 3;
2075static const int motifItemVMargin = 2; 2078static const int motifItemVMargin = 2;
2076static const int motifArrowHMargin = 6; 2079static const int motifArrowHMargin = 6;
2077static const int windowsRightBorder = 12; 2080static const int windowsRightBorder = 12;
2078 2081
2079 maxpmw = QMAX( maxpmw, 20 ); 2082 maxpmw = QMAX( maxpmw, 20 );
2080 2083
2081 2084
2082 bool dis = !enabled; 2085 bool dis = !enabled;
2083 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 2086 QColorGroup itemg = dis ? pal.disabled() : pal.active();
2084 2087
2085 int checkcol = maxpmw; 2088 int checkcol = maxpmw;
2086 if(act){ 2089 if(act){
2087 2090
2088 // FIXME 2091 // FIXME
2089 drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background()); 2092 drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background());
2090 } 2093 }
2091 //else if(((QWidget*)p->device())->backgroundPixmap()){ 2094 //else if(((QWidget*)p->device())->backgroundPixmap()){
2092 // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(), 2095 // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(),
2093 // x, y, w, h); 2096 // x, y, w, h);
2094 //} 2097 //}
2095 else{ 2098 else{
2096 if(menuHandler->transType() == None){ 2099 if(menuHandler->transType() == None){
2097 p->fillRect(x, y, w, h, pal.active().background()); 2100 p->fillRect(x, y, w, h, pal.active().background());
2098 } 2101 }
2099 else if(menuHandler->transType() == StippledBg){ 2102 else if(menuHandler->transType() == StippledBg){
2100 p->fillRect(x, y, w, h, bgBrush); 2103 p->fillRect(x, y, w, h, bgBrush);
2101 } 2104 }
2102 else if(menuHandler->transType() == StippledBtn){ 2105 else if(menuHandler->transType() == StippledBtn){
2103 p->fillRect(x, y, w, h, menuBrush); 2106 p->fillRect(x, y, w, h, menuBrush);
2104 } 2107 }
2105 else{ 2108 else{
2106 QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 2109 QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
2107 if(pix) 2110 if(pix)
2108 p->drawPixmap(x, y, *pix, x, y, w, h); 2111 p->drawPixmap(x, y, *pix, x, y, w, h);
2109 } 2112 }
2110 } 2113 }
2111 2114
2112 if(!mi) 2115 if(!mi)
2113 return; 2116 return;
2114 2117
2115 QColor discol; 2118 QColor discol;
2116 if (dis) { 2119 if (dis) {
2117 discol = itemg.mid(); 2120 discol = itemg.mid();
2118 p->setPen(discol); 2121 p->setPen(discol);
2119 } 2122 }
2120 2123
2121 QColorGroup cg2(itemg); 2124 QColorGroup cg2(itemg);
2122 2125
2123 if(menuHandler->transType() == Custom){ 2126 if(menuHandler->transType() == Custom){
2124 cg2.setColor(QColorGroup::Foreground, menuHandler->textColor()); 2127 cg2.setColor(QColorGroup::Foreground, menuHandler->textColor());
2125 cg2.setColor(QColorGroup::Text, menuHandler->textColor()); 2128 cg2.setColor(QColorGroup::Text, menuHandler->textColor());
2126 cg2.setColor(QColorGroup::Light, menuHandler->textColor().light(120)); 2129 cg2.setColor(QColorGroup::Light, menuHandler->textColor().light(120));
2127 cg2.setColor(QColorGroup::Mid, menuHandler->textColor().dark(120)); 2130 cg2.setColor(QColorGroup::Mid, menuHandler->textColor().dark(120));
2128 } 2131 }
2129 else{ 2132 else{
2130 cg2 = QColorGroup(discol, itemg.highlight(), black, black, 2133 cg2 = QColorGroup(discol, itemg.highlight(), black, black,
2131 dis ? discol : black, discol, black); 2134 dis ? discol : black, discol, black);
2132 } 2135 }
2133 2136
2134 if(mi->isSeparator()){ 2137 if(mi->isSeparator()){
2135 QColor c; 2138 QColor c;
2136 switch(menuHandler->transType()){ 2139 switch(menuHandler->transType()){
2137 case None: 2140 case None:
2138 case StippledBg: 2141 case StippledBg:
2139 case TransStippleBg: 2142 case TransStippleBg:
2140 c = QApplication::palette().active().background(); 2143 c = QApplication::palette().active().background();
2141 break; 2144 break;
2142 case StippledBtn: 2145 case StippledBtn:
2143 case TransStippleBtn: 2146 case TransStippleBtn:
2144 c = QApplication::palette().active().button(); 2147 c = QApplication::palette().active().button();
2145 break; 2148 break;
2146 default: 2149 default:
2147 c = menuHandler->bgColor(); 2150 c = menuHandler->bgColor();
2148 } 2151 }
2149 p->setPen(c.dark(140)); 2152 p->setPen(c.dark(140));
2150 p->drawLine(x, y, x+w, y ); 2153 p->drawLine(x, y, x+w, y );
2151 p->setPen(c.light(115)); 2154 p->setPen(c.light(115));
2152 p->drawLine(x, y+1, x+w, y+1 ); 2155 p->drawLine(x, y+1, x+w, y+1 );
2153 return; 2156 return;
2154 } 2157 }
2155 if(mi->iconSet()) { 2158 if(mi->iconSet()) {
2156 QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; 2159 QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal;
2157 if (!dis) 2160 if (!dis)
2158 mode = QIconSet::Active; 2161 mode = QIconSet::Active;
2159 QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode); 2162 QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode);
2160 int pixw = pixmap.width(); 2163 int pixw = pixmap.width();
2161 int pixh = pixmap.height(); 2164 int pixh = pixmap.height();
2162 QRect cr(x, y, checkcol, h); 2165 QRect cr(x, y, checkcol, h);
2163 QRect pmr(0, 0, pixw, pixh); 2166 QRect pmr(0, 0, pixw, pixh);
2164 pmr.moveCenter( cr.center() ); 2167 pmr.moveCenter( cr.center() );
2165 p->setPen(itemg.highlightedText()); 2168 p->setPen(itemg.highlightedText());
2166 p->drawPixmap(pmr.topLeft(), pixmap ); 2169 p->drawPixmap(pmr.topLeft(), pixmap );
2167 2170
2168 } 2171 }
2169 else if(checkable) { 2172 else if(checkable) {
2170 int mw = checkcol + motifItemFrame; 2173 int mw = checkcol + motifItemFrame;
2171 int mh = h - 2*motifItemFrame; 2174 int mh = h - 2*motifItemFrame;
2172 if (mi->isChecked()){ 2175 if (mi->isChecked()){
2173 drawCheckMark( p, x + motifItemFrame, 2176 drawCheckMark( p, x + motifItemFrame,
2174 y+motifItemFrame, mw, mh, cg2, act, dis ); 2177 y+motifItemFrame, mw, mh, cg2, act, dis );
2175 } 2178 }
2176 } 2179 }
2177 if(menuHandler->transType() == Custom) 2180 if(menuHandler->transType() == Custom)
2178 p->setPen(menuHandler->textColor()); 2181 p->setPen(menuHandler->textColor());
2179 else 2182 else
2180 p->setPen(itemg.text()); 2183 p->setPen(itemg.text());
2181 2184
2182 2185
2183 int xm = motifItemFrame + checkcol + motifItemHMargin; 2186 int xm = motifItemFrame + checkcol + motifItemHMargin;
2184 QString s = mi->text(); 2187 QString s = mi->text();
2185 if (!s.isNull()) { 2188 if (!s.isNull()) {
2186 int t = s.find( '\t' ); 2189 int t = s.find( '\t' );
2187 int m = motifItemVMargin; 2190 int m = motifItemVMargin;
2188 const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; 2191 const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
2189 QPen oldPen = p->pen(); 2192 QPen oldPen = p->pen();
2190 if(menuHandler->useShadowText()){ 2193 if(menuHandler->useShadowText()){
2191 if(menuHandler->transType() == Custom) 2194 if(menuHandler->transType() == Custom)
2192 p->setPen(menuHandler->bgColor().dark(130)); 2195 p->setPen(menuHandler->bgColor().dark(130));
2193 else if(menuHandler->transType() == StippledBtn || 2196 else if(menuHandler->transType() == StippledBtn ||
2194 menuHandler->transType() == TransStippleBtn) 2197 menuHandler->transType() == TransStippleBtn)
2195 p->setPen(itemg.button().dark(130)); 2198 p->setPen(itemg.button().dark(130));
2196 else 2199 else
2197 p->setPen(bgBrush.color().dark(130)); 2200 p->setPen(bgBrush.color().dark(130));
2198 2201
2199 if (t >= 0) { 2202 if (t >= 0) {
2200 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+2, 2203 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+2,
2201 y+m+2, tab-1, h-2*m-1, text_flags, s.mid( t+1 )); 2204 y+m+2, tab-1, h-2*m-1, text_flags, s.mid( t+1 ));
2202 } 2205 }
2203 p->drawText(x+xm+1, y+m+1, w-xm-tab, h-2*m-1, text_flags, s, t); 2206 p->drawText(x+xm+1, y+m+1, w-xm-tab, h-2*m-1, text_flags, s, t);
2204 } 2207 }
2205 p->setPen(oldPen); 2208 p->setPen(oldPen);
2206 if (t >= 0) { 2209 if (t >= 0) {
2207 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, 2210 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1,
2208 y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); 2211 y+m+1, tab, h-2*m, text_flags, s.mid( t+1 ));
2209 } 2212 }
2210 p->drawText(x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t); 2213 p->drawText(x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t);
2211 2214
2212 } 2215 }
2213 else if (mi->pixmap()) { 2216 else if (mi->pixmap()) {
2214 QPixmap *pixmap = mi->pixmap(); 2217 QPixmap *pixmap = mi->pixmap();
2215 if (pixmap->depth() == 1) 2218 if (pixmap->depth() == 1)
2216 p->setBackgroundMode(OpaqueMode); 2219 p->setBackgroundMode(OpaqueMode);
2217 p->drawPixmap( x+xm, y+motifItemFrame, *pixmap); 2220 p->drawPixmap( x+xm, y+motifItemFrame, *pixmap);
2218 if (pixmap->depth() == 1) 2221 if (pixmap->depth() == 1)
2219 p->setBackgroundMode(TransparentMode); 2222 p->setBackgroundMode(TransparentMode);
2220 } 2223 }
2221 if (mi->popup()) { 2224 if (mi->popup()) {
2222 int dim = (h-2*motifItemFrame) / 2; 2225 int dim = (h-2*motifItemFrame) / 2;
2223 drawArrow(p, RightArrow, true, 2226 drawArrow(p, RightArrow, true,
2224 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2, 2227 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2,
2225 dim, dim, cg2, TRUE); 2228 dim, dim, cg2, TRUE);
2226 } 2229 }
2227} 2230}
2228 2231
2229int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, 2232int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi,
2230 const QFontMetrics &fm) 2233 const QFontMetrics &fm)
2231{ 2234{
2232 if (mi->isSeparator()) 2235 if (mi->isSeparator())
2233 return 2; 2236 return 2;
2234 2237
2235 int h = 0; 2238 int h = 0;
2236 if (mi->pixmap()) 2239 if (mi->pixmap())
2237 h = mi->pixmap()->height(); 2240 h = mi->pixmap()->height();
2238 2241
2239 if (mi->iconSet()) 2242 if (mi->iconSet())
2240 h = QMAX(mi->iconSet()-> 2243 h = QMAX(mi->iconSet()->
2241 pixmap(QIconSet::Small, QIconSet::Normal).height(), h); 2244 pixmap(QIconSet::Small, QIconSet::Normal).height(), h);
2242 2245
2243 h = QMAX(fm.height() + 4, h); 2246 h = QMAX(fm.height() + 4, h);
2244 2247
2245 // we want a minimum size of 18 2248 // we want a minimum size of 18
2246 h = QMAX(h, 18); 2249 h = QMAX(h, 18);
2247 2250
2248 return h; 2251 return h;
2249} 2252}
2250 2253
2251 2254
2252void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, 2255void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r,
2253 const QColorGroup &g, const QColor *c, 2256 const QColorGroup &g, const QColor *c,
2254 bool atBorder) 2257 bool atBorder)
2255{ 2258{
2256 // are we painting a widget? 2259 // are we painting a widget?
2257 if(p->device()->devType() == QInternal::Widget){ 2260 if(p->device()->devType() == QInternal::Widget){
2258 // if so does it use a special focus rectangle? 2261 // if so does it use a special focus rectangle?
2259 QWidget *w = (QWidget *)p->device(); 2262 QWidget *w = (QWidget *)p->device();
2260 if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ 2263 if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){
2261 return; 2264 return;
2262 } 2265 }
2263 else{ 2266 else{
2264 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 2267 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
2265 } 2268 }
2266 } 2269 }
2267 else 2270 else
2268 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 2271 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
2269 2272
2270} 2273}
2271 2274
2272void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) 2275void LiquidStyle::polishPopupMenu(QPopupMenu *mnu)
2273{ 2276{
2274 mnu->installEventFilter(menuHandler); 2277 mnu->installEventFilter(menuHandler);
2275 QWindowsStyle::polishPopupMenu(mnu); 2278 QWindowsStyle::polishPopupMenu(mnu);
2276} 2279}
2277 2280
2278void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, 2281void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
2279 bool selected) 2282 bool selected)
2280{ 2283{
2281 if(tabBar->shape() != QTabBar::RoundedAbove){ 2284 if(tabBar->shape() != QTabBar::RoundedAbove){
2282 QWindowsStyle::drawTab(p, tabBar, tab, selected); 2285 QWindowsStyle::drawTab(p, tabBar, tab, selected);
2283 return; 2286 return;
2284 } 2287 }
2285 QPixmap tilePix; 2288 QPixmap tilePix;
2286 QRect r = tab->rect(); 2289 QRect r = tab->rect();
2287 //QPixmap *pix = selected ? tabBar->hasFocus() ? pixmaps[TabFocus] : 2290 //QPixmap *pix = selected ? tabBar->hasFocus() ? pixmaps[TabFocus] :
2288 // pixmaps[TabDown] : pixmaps[Tab]; 2291 // pixmaps[TabDown] : pixmaps[Tab];
2289 2292
2290 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab); 2293 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab);
2291 p->drawPixmap(r.x(), r.y(), *pix, 0, 0, 9, r.height()); 2294 p->drawPixmap(r.x(), r.y(), *pix, 0, 0, 9, r.height());
2292 p->drawPixmap(r.right()-9, r.y(), *pix, pix->width()-9, 0, 9, r.height()); 2295 p->drawPixmap(r.right()-9, r.y(), *pix, pix->width()-9, 0, 9, r.height());
2293 tilePix.resize(pix->width()-18, r.height()); 2296 tilePix.resize(pix->width()-18, r.height());
2294 bitBlt(&tilePix, 0, 0, pix, 9, 0, pix->width()-18, r.height()); 2297 bitBlt(&tilePix, 0, 0, pix, 9, 0, pix->width()-18, r.height());
2295 p->drawTiledPixmap(r.x()+9, r.y(), r.width()-18, r.height(), tilePix); 2298 p->drawTiledPixmap(r.x()+9, r.y(), r.width()-18, r.height(), tilePix);
2296 QColor c = tabBar->colorGroup().button(); 2299 QColor c = tabBar->colorGroup().button();
2297 if(!selected){ 2300 if(!selected){
2298 p->setPen(c.dark(130)); 2301 p->setPen(c.dark(130));
2299 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom()); 2302 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom());
2300 } 2303 }
2301 2304
2302 /* 2305 /*
2303 p->setPen(c.light(110)); 2306 p->setPen(c.light(110));
2304 p->drawLine(r.x(), r.bottom()+1, r.right(), r.bottom()+1); 2307 p->drawLine(r.x(), r.bottom()+1, r.right(), r.bottom()+1);
2305 p->setPen(c); 2308 p->setPen(c);
2306 p->drawLine(r.x(), r.bottom()+2, r.right(), r.bottom()+2); 2309 p->drawLine(r.x(), r.bottom()+2, r.right(), r.bottom()+2);
2307 p->setPen(c.light(110)); 2310 p->setPen(c.light(110));
2308 p->drawLine(r.x(), r.bottom()+3, r.right(), r.bottom()+3); 2311 p->drawLine(r.x(), r.bottom()+3, r.right(), r.bottom()+3);
2309 p->setPen(c.light(120)); 2312 p->setPen(c.light(120));
2310 p->drawLine(r.x(), r.bottom()+4, r.right(), r.bottom()+4); 2313 p->drawLine(r.x(), r.bottom()+4, r.right(), r.bottom()+4);
2311 */ 2314 */
2312 2315
2313 /* 2316 /*
2314 QColor c = tabBar->colorGroup().button(); 2317 QColor c = tabBar->colorGroup().button();
2315 pix = bevelFillDict.find(c.rgb()); 2318 pix = bevelFillDict.find(c.rgb());
2316 if(!pix){ 2319 if(!pix){
2317 int h, s, v; 2320 int h, s, v;
2318 c.hsv(&h, &s, &v); 2321 c.hsv(&h, &s, &v);
2319 pix = new QPixmap(*bevelFillPix); 2322 pix = new QPixmap(*bevelFillPix);
2320 adjustHSV(*pix, h, s); 2323 adjustHSV(*pix, h, s);
2321 bevelFillDict.insert(c.rgb(), pix); 2324 bevelFillDict.insert(c.rgb(), pix);
2322 }*/ 2325 }*/
2323 2326
2324 /* 2327 /*
2325 QRect r = tab->rect(); 2328 QRect r = tab->rect();
2326 QColorGroup g = tabBar->colorGroup(); 2329 QColorGroup g = tabBar->colorGroup();
2327 if(!selected){ 2330 if(!selected){
2328 r.setY(r.y()+1); 2331 r.setY(r.y()+1);
2329 p->setPen(g.dark()); 2332 p->setPen(g.dark());
2330 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom()-2); 2333 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom()-2);
2331 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y()); 2334 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y());
2332 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y()); 2335 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y());
2333 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-2); 2336 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-2);
2334 2337
2335 p->setPen(g.midlight()); 2338 p->setPen(g.midlight());
2336 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom()); 2339 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom());
2337 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1); 2340 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1);
2338 p->drawLine(r.x()+5, r.y()+1, r.right()-2, r.y()+1); 2341 p->drawLine(r.x()+5, r.y()+1, r.right()-2, r.y()+1);
2339 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom()); 2342 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom());
2340 2343
2341 p->setPen(g.mid()); 2344 p->setPen(g.mid());
2342 p->drawPoint(r.right()-1, r.y()+1); 2345 p->drawPoint(r.right()-1, r.y()+1);
2343 p->drawLine(r.x()+4, r.y()+2, r.right()-1, r.y()+2); 2346 p->drawLine(r.x()+4, r.y()+2, r.right()-1, r.y()+2);
2344 p->drawLine(r.x()+3, r.y()+3, r.right()-1, r.y()+3); 2347 p->drawLine(r.x()+3, r.y()+3, r.right()-1, r.y()+3);
2345 2348
2346 p->fillRect(r.x()+2, r.y()+4, r.width()-3, r.height()-6, 2349 p->fillRect(r.x()+2, r.y()+4, r.width()-3, r.height()-6,
2347 g.brush(QColorGroup::Mid)); 2350 g.brush(QColorGroup::Mid));
2348 2351
2349 p->setPen(g.light()); 2352 p->setPen(g.light());
2350 p->drawLine(r.x(), r.bottom()-1, r.right(), r.bottom()-1); 2353 p->drawLine(r.x(), r.bottom()-1, r.right(), r.bottom()-1);
2351 2354
2352 } 2355 }
2353 else{ 2356 else{
2354 p->setPen(g.light()); 2357 p->setPen(g.light());
2355 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom()); 2358 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom());
2356 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y()); 2359 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y());
2357 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y()); 2360 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y());
2358 p->setPen(g.dark()); 2361 p->setPen(g.dark());
2359 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()); 2362 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom());
2360 2363
2361 p->setPen(g.midlight()); 2364 p->setPen(g.midlight());
2362 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom()); 2365 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom());
2363 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1); 2366 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1);
2364 p->drawLine(r.x()+5, r.y()+1, r.right() - 2, r.y()+1); 2367 p->drawLine(r.x()+5, r.y()+1, r.right() - 2, r.y()+1);
2365 p->setPen(g.mid()); 2368 p->setPen(g.mid());
2366 p->drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()); 2369 p->drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom());
2367 }*/ 2370 }*/
2368 2371
2369} 2372}
2370 2373
2371 2374
2372 2375
2373void LiquidStyle::drawTabMask(QPainter *p, const QTabBar*, QTab *tab, 2376void LiquidStyle::drawTabMask(QPainter *p, const QTabBar*, QTab *tab,
2374 bool selected) 2377 bool selected)
2375 2378
2376 2379
2377{ 2380{
2378 //p->fillRect(tab->rect(), Qt::color1); 2381 //p->fillRect(tab->rect(), Qt::color1);
2379 QRect r = tab->rect(); 2382 QRect r = tab->rect();
2380 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab); 2383 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab);
2381 p->drawPixmap(r.x(), r.y(), *pix->mask(), 0, 0, 9, r.height()); 2384 p->drawPixmap(r.x(), r.y(), *pix->mask(), 0, 0, 9, r.height());
2382 p->drawPixmap(r.right()-9, r.y(), *pix->mask(), pix->width()-9, 0, 9, r.height()); 2385 p->drawPixmap(r.right()-9, r.y(), *pix->mask(), pix->width()-9, 0, 9, r.height());
2383 p->fillRect(r.x()+9, r.y(), r.width()-18, r.height(), Qt::color1); 2386 p->fillRect(r.x()+9, r.y(), r.width()-18, r.height(), Qt::color1);
2384} 2387}
2385 2388
2386void LiquidStyle::tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame, 2389void LiquidStyle::tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame,
2387 int &overlap) 2390 int &overlap)
2388{ 2391{
2389 if(t->shape() == QTabBar::RoundedAbove){ 2392 if(t->shape() == QTabBar::RoundedAbove){
2390 overlap = 1; 2393 overlap = 1;
2391 hFrame = 18; // was 24 2394 hFrame = 18; // was 24
2392 vFrame = 8; // was 10 2395 vFrame = 8; // was 10
2393 } 2396 }
2394 else 2397 else
2395 QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 2398 QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
2396} 2399}
2397 2400
2398 2401
2399 2402
2400void LiquidStyle::drawSplitter(QPainter *p, int x, int y, int w, int h, 2403void LiquidStyle::drawSplitter(QPainter *p, int x, int y, int w, int h,
2401 const QColorGroup &g, Orientation) 2404 const QColorGroup &g, Orientation)
2402{ 2405{
2403 drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? 2406 drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ?
2404 g.button().light(120) : g.button(), g.background()); 2407 g.button().light(120) : g.button(), g.background());
2405} 2408}
2406 2409
2407 2410
2408void LiquidStyle::drawPanel(QPainter *p, int x, int y, int w, int h, 2411void LiquidStyle::drawPanel(QPainter *p, int x, int y, int w, int h,
2409 const QColorGroup &g, bool sunken, 2412 const QColorGroup &g, bool sunken,
2410 int lineWidth, const QBrush *fill) 2413 int lineWidth, const QBrush *fill)
2411{ 2414{
2412 if(p->device()->devType() == QInternal::Widget && 2415 if(p->device()->devType() == QInternal::Widget &&
2413 ((QWidget *)p->device())->inherits("QLineEdit")){ 2416 ((QWidget *)p->device())->inherits("QLineEdit")){
2414 int x2 = x+w-1; 2417 int x2 = x+w-1;
2415 int y2 = y+h-1; 2418 int y2 = y+h-1;
2416 p->setPen(g.dark()); 2419 p->setPen(g.dark());
2417 p->drawRect(x, y, w, h); 2420 p->drawRect(x, y, w, h);
2418 p->setPen(g.mid()); 2421 p->setPen(g.mid());
2419 p->drawLine(x+1, y+1, x2-2, y+1); 2422 p->drawLine(x+1, y+1, x2-2, y+1);
2420 p->drawLine(x+1, y+1, x+1, y2-1); 2423 p->drawLine(x+1, y+1, x+1, y2-1);
2421 } 2424 }
2422 else if(lineWidth != 2 || !sunken) 2425 else if(lineWidth != 2 || !sunken)
2423 QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 2426 QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
2424 else{ 2427 else{
2425 QPen oldPen = p->pen(); 2428 QPen oldPen = p->pen();
2426 int x2 = x+w-1; 2429 int x2 = x+w-1;
2427 int y2 = y+h-1; 2430 int y2 = y+h-1;
2428 p->setPen(g.light()); 2431 p->setPen(g.light());
2429 p->drawLine(x, y2, x2, y2); 2432 p->drawLine(x, y2, x2, y2);
2430 p->drawLine(x2, y, x2, y2); 2433 p->drawLine(x2, y, x2, y2);
2431 p->setPen(g.mid()); 2434 p->setPen(g.mid());
2432 p->drawLine(x, y, x2, y); 2435 p->drawLine(x, y, x2, y);
2433 p->drawLine(x, y, x, y2); 2436 p->drawLine(x, y, x, y2);
2434 2437
2435 p->setPen(g.midlight()); 2438 p->setPen(g.midlight());
2436 p->drawLine(x+1, y2-1, x2-1, y2-1); 2439 p->drawLine(x+1, y2-1, x2-1, y2-1);
2437 p->drawLine(x2-1, y+1, x2-1, y2-1); 2440 p->drawLine(x2-1, y+1, x2-1, y2-1);
2438 p->setPen(g.dark()); 2441 p->setPen(g.dark());
2439 p->drawLine(x+1, y+1, x2-1, y+1); 2442 p->drawLine(x+1, y+1, x2-1, y+1);
2440 p->drawLine(x+1, y+1, x+1, y2-1); 2443 p->drawLine(x+1, y+1, x+1, y2-1);
2441 p->setPen(oldPen); 2444 p->setPen(oldPen);
2442 if(fill){ 2445 if(fill){
2443 // I believe here we are only supposed to fill if there is a 2446 // I believe here we are only supposed to fill if there is a
2444 // specified fill brush... 2447 // specified fill brush...
2445 p->fillRect(x+2, y+2, w-4, h-4, *fill); 2448 p->fillRect(x+2, y+2, w-4, h-4, *fill);
2446 } 2449 }
2447 } 2450 }
2448} 2451}
2449 2452
2450 2453
2451void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) 2454void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v)
2452{ 2455{
2453 QBitmap *maskBmp = NULL; 2456 QBitmap *maskBmp = NULL;
2454 if(pix.mask()) 2457 if(pix.mask())
2455 maskBmp = new QBitmap(*pix.mask()); 2458 maskBmp = new QBitmap(*pix.mask());
2456 QImage img = pix.convertToImage(); 2459 QImage img = pix.convertToImage();
2457 if(img.depth() != 32) 2460 if(img.depth() != 32)
2458 img = img.convertDepth(32); 2461 img = img.convertDepth(32);
2459 unsigned int *data = (unsigned int *)img.bits(); 2462 unsigned int *data = (unsigned int *)img.bits();
2460 int total = img.width()*img.height(); 2463 int total = img.width()*img.height();
2461 int current; 2464 int current;
2462 QColor c; 2465 QColor c;
2463 int oldH, oldS, oldV; 2466 int oldH, oldS, oldV;
2464 if(v < 235) 2467 if(v < 235)
2465 v += 20; 2468 v += 20;
2466 else 2469 else
2467 v = 255; 2470 v = 255;
2468 float intensity = v/255.0; 2471 float intensity = v/255.0;
2469 2472
2470 for(current=0; current<total; ++current){ 2473 for(current=0; current<total; ++current){
2471 c.setRgb(data[current]); 2474 c.setRgb(data[current]);
2472 c.hsv(&oldH, &oldS, &oldV); 2475 c.hsv(&oldH, &oldS, &oldV);
2473 oldV = (int)(oldV*intensity); 2476 oldV = (int)(oldV*intensity);
2474 c.setHsv(h, s, oldV); 2477 c.setHsv(h, s, oldV);
2475 data[current] = c.rgb(); 2478 data[current] = c.rgb();
2476 } 2479 }
2477 pix.convertFromImage(img); 2480 pix.convertFromImage(img);
2478 if(maskBmp) 2481 if(maskBmp)
2479 pix.setMask(*maskBmp); 2482 pix.setMask(*maskBmp);
2480} 2483}
2481 2484
2482void LiquidStyle::intensity(QPixmap &pix, float percent) 2485void LiquidStyle::intensity(QPixmap &pix, float percent)
2483{ 2486{
2484 QImage image = pix.convertToImage(); 2487 QImage image = pix.convertToImage();
2485 int i, tmp, r, g, b; 2488 int i, tmp, r, g, b;
2486 int segColors = image.depth() > 8 ? 256 : image.numColors(); 2489 int segColors = image.depth() > 8 ? 256 : image.numColors();
2487 unsigned char *segTbl = new unsigned char[segColors]; 2490 unsigned char *segTbl = new unsigned char[segColors];
2488 int pixels = image.depth() > 8 ? image.width()*image.height() : 2491 int pixels = image.depth() > 8 ? image.width()*image.height() :
2489 image.numColors(); 2492 image.numColors();
2490 unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() : 2493 unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() :
2491 (unsigned int *)image.colorTable(); 2494 (unsigned int *)image.colorTable();
2492 2495
2493 bool brighten = (percent >= 0); 2496 bool brighten = (percent >= 0);
2494 if(percent < 0) 2497 if(percent < 0)
2495 percent = -percent; 2498 percent = -percent;
2496 2499
2497 if(brighten){ // keep overflow check out of loops 2500 if(brighten){ // keep overflow check out of loops
2498 for(i=0; i < segColors; ++i){ 2501 for(i=0; i < segColors; ++i){
2499 tmp = (int)(i*percent); 2502 tmp = (int)(i*percent);
2500 if(tmp > 255) 2503 if(tmp > 255)
2501 tmp = 255; 2504 tmp = 255;
2502 segTbl[i] = tmp; 2505 segTbl[i] = tmp;
2503 } 2506 }
2504 } 2507 }
2505 else{ 2508 else{
2506 for(i=0; i < segColors; ++i){ 2509 for(i=0; i < segColors; ++i){
2507 tmp = (int)(i*percent); 2510 tmp = (int)(i*percent);
2508 if(tmp < 0) 2511 if(tmp < 0)
2509 tmp = 0; 2512 tmp = 0;
2510 segTbl[i] = tmp; 2513 segTbl[i] = tmp;
2511 } 2514 }
2512 } 2515 }
2513 2516
2514 if(brighten){ // same here 2517 if(brighten){ // same here
2515 for(i=0; i < pixels; ++i){ 2518 for(i=0; i < pixels; ++i){
2516 r = qRed(data[i]); 2519 r = qRed(data[i]);
2517 g = qGreen(data[i]); 2520 g = qGreen(data[i]);
2518 b = qBlue(data[i]); 2521 b = qBlue(data[i]);
2519 r = r + segTbl[r] > 255 ? 255 : r + segTbl[r]; 2522 r = r + segTbl[r] > 255 ? 255 : r + segTbl[r];
2520 g = g + segTbl[g] > 255 ? 255 : g + segTbl[g]; 2523 g = g + segTbl[g] > 255 ? 255 : g + segTbl[g];
2521 b = b + segTbl[b] > 255 ? 255 : b + segTbl[b]; 2524 b = b + segTbl[b] > 255 ? 255 : b + segTbl[b];
2522 data[i] = qRgb(r, g, b); 2525 data[i] = qRgb(r, g, b);
2523 } 2526 }
2524 } 2527 }
2525 else{ 2528 else{
2526 for(i=0; i < pixels; ++i){ 2529 for(i=0; i < pixels; ++i){
2527 r = qRed(data[i]); 2530 r = qRed(data[i]);
2528 g = qGreen(data[i]); 2531 g = qGreen(data[i]);
2529 b = qBlue(data[i]); 2532 b = qBlue(data[i]);
2530 r = r - segTbl[r] < 0 ? 0 : r - segTbl[r]; 2533 r = r - segTbl[r] < 0 ? 0 : r - segTbl[r];
2531 g = g - segTbl[g] < 0 ? 0 : g - segTbl[g]; 2534 g = g - segTbl[g] < 0 ? 0 : g - segTbl[g];
2532 b = b - segTbl[b] < 0 ? 0 : b - segTbl[b]; 2535 b = b - segTbl[b] < 0 ? 0 : b - segTbl[b];
2533 data[i] = qRgb(r, g, b); 2536 data[i] = qRgb(r, g, b);
2534 } 2537 }
2535 } 2538 }
2536 delete [] segTbl; 2539 delete [] segTbl;
2537 pix.convertFromImage(image); 2540 pix.convertFromImage(image);
2538} 2541}
2539 2542
2540void LiquidStyle::drawRoundRect(QPainter *p, int x, int y, int w, int h) 2543void LiquidStyle::drawRoundRect(QPainter *p, int x, int y, int w, int h)
2541{ 2544{
2542 int x2 = x+w-1; 2545 int x2 = x+w-1;
2543 int y2 = y+h-1; 2546 int y2 = y+h-1;
2544 p->drawLine(x+1, y, x2-1, y); 2547 p->drawLine(x+1, y, x2-1, y);
2545 p->drawLine(x, y+1, x, y2-1); 2548 p->drawLine(x, y+1, x, y2-1);
2546 p->drawLine(x+1, y2, x2-1, y2); 2549 p->drawLine(x+1, y2, x2-1, y2);
2547 p->drawLine(x2, y+1, x2, y2-1); 2550 p->drawLine(x2, y+1, x2, y2-1);
2548} 2551}
2549 2552
2550void LiquidStyle::drawSliderGroove (QPainter * p, int x, int y, int w, int h, 2553void LiquidStyle::drawSliderGroove (QPainter * p, int x, int y, int w, int h,
2551 const QColorGroup &g, QCOORD, 2554 const QColorGroup &g, QCOORD,
2552 Orientation orient) 2555 Orientation orient)
2553{ 2556{
2554 bool isFocus = ((QWidget *)p->device())->hasFocus(); 2557 bool isFocus = ((QWidget *)p->device())->hasFocus();
2555 QColor c = isFocus ? g.background().dark(120) : g.background(); 2558 QColor c = isFocus ? g.background().dark(120) : g.background();
2556 if(orient == Qt::Horizontal){ 2559 if(orient == Qt::Horizontal){
2557 int x2 = x+w-1; 2560 int x2 = x+w-1;
2558 y+=2; 2561 y+=2;
2559 p->setPen(c.dark(130)); 2562 p->setPen(c.dark(130));
2560 p->drawLine(x+1, y, x2-1, y); 2563 p->drawLine(x+1, y, x2-1, y);
2561 p->setPen(c.dark(150)); 2564 p->setPen(c.dark(150));
2562 p->drawLine(x, y+1, x2, y+1); 2565 p->drawLine(x, y+1, x2, y+1);
2563 p->setPen(c.dark(125)); 2566 p->setPen(c.dark(125));
2564 p->drawLine(x, y+2, x2, y+2); 2567 p->drawLine(x, y+2, x2, y+2);
2565 p->setPen(c.dark(130)); 2568 p->setPen(c.dark(130));
2566 p->drawLine(x, y+3, x2, y+3); 2569 p->drawLine(x, y+3, x2, y+3);
2567 p->setPen(c.dark(120)); 2570 p->setPen(c.dark(120));
2568 p->drawLine(x, y+4, x2, y+4); 2571 p->drawLine(x, y+4, x2, y+4);
2569 p->setPen(c.light(110)); 2572 p->setPen(c.light(110));
2570 p->drawLine(x+1, y+5, x2-1, y+5); 2573 p->drawLine(x+1, y+5, x2-1, y+5);
2571 } 2574 }
2572 else{ 2575 else{
2573 int y2 = y+h-1; 2576 int y2 = y+h-1;
2574 x+=2; 2577 x+=2;
2575 p->setPen(c.dark(130)); 2578 p->setPen(c.dark(130));
2576 p->drawLine(x, y+1, x, y2-1); 2579 p->drawLine(x, y+1, x, y2-1);
2577 p->setPen(c.dark(150)); 2580 p->setPen(c.dark(150));
2578 p->drawLine(x+1, y, x+1, y2); 2581 p->drawLine(x+1, y, x+1, y2);
2579 p->setPen(c.dark(125)); 2582 p->setPen(c.dark(125));
2580 p->drawLine(x+2, y, x+2, y2); 2583 p->drawLine(x+2, y, x+2, y2);
2581 p->setPen(c.dark(130)); 2584 p->setPen(c.dark(130));
2582 p->drawLine(x+3, y, x+3, y2); 2585 p->drawLine(x+3, y, x+3, y2);
2583 p->setPen(c.dark(120)); 2586 p->setPen(c.dark(120));
2584 p->drawLine(x+4, y, x+4, y2); 2587 p->drawLine(x+4, y, x+4, y2);
2585 p->setPen(c.light(110)); 2588 p->setPen(c.light(110));
2586 p->drawLine(x+5, y+1, x+5, y2-1); 2589 p->drawLine(x+5, y+1, x+5, y2-1);
2587 } 2590 }
2588 //QWindowsStyle::drawSliderGroove(p, x, y, w, h, g, c, orient); 2591 //QWindowsStyle::drawSliderGroove(p, x, y, w, h, g, c, orient);
2589 2592
2590} 2593}
2591 2594
2592void LiquidStyle::drawSliderGrooveMask (QPainter * p, int x, int y, int w, 2595void LiquidStyle::drawSliderGrooveMask (QPainter * p, int x, int y, int w,
2593 int h, QCOORD, Orientation orient) 2596 int h, QCOORD, Orientation orient)
2594{ 2597{
2595 p->fillRect(x, y, w, h, Qt::color0); 2598 p->fillRect(x, y, w, h, Qt::color0);
2596 p->setPen(Qt::color1); 2599 p->setPen(Qt::color1);
2597 if(orient == Qt::Horizontal){ 2600 if(orient == Qt::Horizontal){
2598 int x2 = x+w-1; 2601 int x2 = x+w-1;
2599 y+=2; 2602 y+=2;
2600 p->drawLine(x+1, y, x2-1, y); 2603 p->drawLine(x+1, y, x2-1, y);
2601 p->fillRect(x, y+1, w, 4, Qt::color1); 2604 p->fillRect(x, y+1, w, 4, Qt::color1);
2602 p->drawLine(x+1, y+5, x2-1, y+5); 2605 p->drawLine(x+1, y+5, x2-1, y+5);
2603 } 2606 }
2604 else{ 2607 else{
2605 int y2 = y+h-1; 2608 int y2 = y+h-1;
2606 x+=2; 2609 x+=2;
2607 p->drawLine(x, y+1, x, y2-1); 2610 p->drawLine(x, y+1, x, y2-1);
2608 p->fillRect(x+1, y, 4, h, Qt::color1); 2611 p->fillRect(x+1, y, 4, h, Qt::color1);
2609 p->drawLine(x+5, y+1, x+5, y2-1); 2612 p->drawLine(x+5, y+1, x+5, y2-1);
2610 } 2613 }
2611} 2614}
2612 2615
2613 2616
2614/* vim: set noet sw=8 ts=8: */ 2617/* vim: set noet sw=8 ts=8: */