summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-29 11:35:14 (UTC)
committer sandman <sandman>2002-11-29 11:35:14 (UTC)
commit3abc1725d255b507f42bcf060018d3ce0b461f4d (patch) (unidiff)
treeaf6b2ca73fbc570f104f44223ba7d7d201553cc6
parent96d75cae7e5f270a543b0eb6138c6967577f2b11 (diff)
downloadopie-3abc1725d255b507f42bcf060018d3ce0b461f4d.zip
opie-3abc1725d255b507f42bcf060018d3ce0b461f4d.tar.gz
opie-3abc1725d255b507f42bcf060018d3ce0b461f4d.tar.bz2
Not making at least qDebug outputs on every QToolButton redraw may speed
things up a bit ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp7
-rw-r--r--noncore/styles/liquid/opie-liquid.diff137
2 files changed, 61 insertions, 83 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index daac22c..e6d8310 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,2621 +1,2614 @@
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 38
39#include <stdio.h> 39#include <stdio.h>
40 40
41#include "htmlmasks.h" 41#include "htmlmasks.h"
42#include "embeddata.h" 42#include "embeddata.h"
43 43
44typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 44typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
45 QColorGroup &, bool, bool); 45 QColorGroup &, bool, bool);
46 46
47QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 47QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
48 48
49void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 49void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
50{ 50{
51 QImage img(pix.convertToImage()); 51 QImage img(pix.convertToImage());
52 QImageEffect::fade(img, 0.9, color); 52 QImageEffect::fade(img, 0.9, color);
53 int x, y; 53 int x, y;
54 int r, g, b; 54 int r, g, b;
55 for(y=0; y < img.height(); y+=3){ 55 for(y=0; y < img.height(); y+=3){
56 unsigned int *data = (unsigned int *) img.scanLine(y); 56 unsigned int *data = (unsigned int *) img.scanLine(y);
57 for(x=0; x < img.width(); ++x){ 57 for(x=0; x < img.width(); ++x){
58 r = qRed(data[x]); 58 r = qRed(data[x]);
59 g = qGreen(data[x]); 59 g = qGreen(data[x]);
60 b = qBlue(data[x]); 60 b = qBlue(data[x]);
61 if(r-10) 61 if(r-10)
62 r-=10; 62 r-=10;
63 if(g-10) 63 if(g-10)
64 g-=10; 64 g-=10;
65 if(b-10) 65 if(b-10)
66 b-=10; 66 b-=10;
67 data[x] = qRgb(r, g, b); 67 data[x] = qRgb(r, g, b);
68 } 68 }
69 } 69 }
70 pix.convertFromImage(img); 70 pix.convertFromImage(img);
71} 71}
72 72
73TransMenuHandler::TransMenuHandler(QObject *parent) 73TransMenuHandler::TransMenuHandler(QObject *parent)
74 : QObject(parent) 74 : QObject(parent)
75{ 75{
76 pixDict.setAutoDelete(true); 76 pixDict.setAutoDelete(true);
77 reloadSettings(); 77 reloadSettings();
78} 78}
79 79
80void TransMenuHandler::reloadSettings() 80void TransMenuHandler::reloadSettings()
81{ 81{
82 pixDict.clear(); 82 pixDict.clear();
83 83
84 Config config ( "qpe" ); 84 Config config ( "qpe" );
85 config. setGroup ( "Liquid-Style" ); 85 config. setGroup ( "Liquid-Style" );
86 86
87 type = config. readNumEntry("Type", TransStippleBg); 87 type = config. readNumEntry("Type", TransStippleBg);
88 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 88 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
89 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 89 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
90 opacity = config. readNumEntry("Opacity", 10); 90 opacity = config. readNumEntry("Opacity", 10);
91 if ( opacity < -20 ) 91 if ( opacity < -20 )
92 opacity = 20; 92 opacity = 20;
93 else if ( opacity > 20 ) 93 else if ( opacity > 20 )
94 opacity = 20; 94 opacity = 20;
95 95
96 shadowText = config. readBoolEntry("ShadowText", true); 96 shadowText = config. readBoolEntry("ShadowText", true);
97} 97}
98 98
99bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 99bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
100{ 100{
101 QWidget *p = (QWidget *)obj; 101 QWidget *p = (QWidget *)obj;
102 102
103 if(ev->type() == QEvent::Show){ 103 if(ev->type() == QEvent::Show){
104 if(type == TransStippleBg || type == TransStippleBtn || 104 if(type == TransStippleBg || type == TransStippleBtn ||
105 type == Custom){ 105 type == Custom){
106 QApplication::syncX(); 106 QApplication::syncX();
107 QPixmap *pix = new QPixmap; 107 QPixmap *pix = new QPixmap;
108 if(p->testWFlags(Qt::WType_Popup)){ 108 if(p->testWFlags(Qt::WType_Popup)){
109 QRect r(p->x(), p->y(), p->width(), p->height()); 109 QRect r(p->x(), p->y(), p->width(), p->height());
110 QRect deskR = QApplication::desktop()->rect(); 110 QRect deskR = QApplication::desktop()->rect();
111 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 111 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
112 r.setBottom(deskR.bottom()); 112 r.setBottom(deskR.bottom());
113 r.setRight(deskR.right()); 113 r.setRight(deskR.right());
114 } 114 }
115 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 115 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
116 r.width(), r.height()); 116 r.width(), r.height());
117 } 117 }
118 else{ // tear off menu 118 else{ // tear off menu
119 pix->resize(p->width(), p->height()); 119 pix->resize(p->width(), p->height());
120 pix->fill(Qt::black.rgb()); 120 pix->fill(Qt::black.rgb());
121 } 121 }
122 if(type == TransStippleBg){ 122 if(type == TransStippleBg){
123 stripePixmap(*pix, p->colorGroup().background()); 123 stripePixmap(*pix, p->colorGroup().background());
124 } 124 }
125 else if(type == TransStippleBtn){ 125 else if(type == TransStippleBtn){
126 stripePixmap(*pix, p->colorGroup().button()); 126 stripePixmap(*pix, p->colorGroup().button());
127 } 127 }
128 else{ 128 else{
129 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 129 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
130 } 130 }
131 131
132 pixDict.insert(p->winId(), pix); 132 pixDict.insert(p->winId(), pix);
133 133
134 if ( !p->inherits("QPopupMenu")) 134 if ( !p->inherits("QPopupMenu"))
135 p->setBackgroundPixmap(*pix); 135 p->setBackgroundPixmap(*pix);
136 136
137 QObjectList *ol = p-> queryList("QWidget"); 137 QObjectList *ol = p-> queryList("QWidget");
138 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 138 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
139 QWidget *wid = (QWidget *) it.current ( ); 139 QWidget *wid = (QWidget *) it.current ( );
140 140
141 wid-> setBackgroundPixmap(*pix); 141 wid-> setBackgroundPixmap(*pix);
142 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 142 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
143 } 143 }
144 delete ol; 144 delete ol;
145 } 145 }
146 } 146 }
147 else if(ev->type() == QEvent::Hide){ 147 else if(ev->type() == QEvent::Hide){
148 if(type == TransStippleBg || type == TransStippleBtn || 148 if(type == TransStippleBg || type == TransStippleBtn ||
149 type == Custom){ 149 type == Custom){
150// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 150// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
151 151
152 pixDict.remove(p->winId()); 152 pixDict.remove(p->winId());
153 if ( !p->inherits("QPopupMenu")) 153 if ( !p->inherits("QPopupMenu"))
154 p->setBackgroundMode(QWidget::PaletteBackground); 154 p->setBackgroundMode(QWidget::PaletteBackground);
155 155
156 QObjectList *ol = p-> queryList("QWidget"); 156 QObjectList *ol = p-> queryList("QWidget");
157 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 157 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
158 QWidget *wid = (QWidget *) it.current ( ); 158 QWidget *wid = (QWidget *) it.current ( );
159 159
160 wid-> setBackgroundMode( QWidget::PaletteBackground ); 160 wid-> setBackgroundMode( QWidget::PaletteBackground );
161 } 161 }
162 delete ol; 162 delete ol;
163 } 163 }
164 } 164 }
165 return(false); 165 return(false);
166} 166}
167 167
168 168
169static int qt_version ( ) 169static int qt_version ( )
170{ 170{
171 const char *qver = qVersion ( ); 171 const char *qver = qVersion ( );
172 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 172 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
173} 173}
174 174
175 175
176LiquidStyle::LiquidStyle() 176LiquidStyle::LiquidStyle()
177 :QWindowsStyle() 177 :QWindowsStyle()
178{ 178{
179 setName ( "LiquidStyle" ); 179 setName ( "LiquidStyle" );
180 180
181 oldqte = ( qt_version ( ) < 234 ); 181 oldqte = ( qt_version ( ) < 234 );
182 flatTBButtons = false; 182 flatTBButtons = false;
183 currentHeader = 0; 183 currentHeader = 0;
184 184
185 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 185 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
186 btnMaskBmp.setMask(btnMaskBmp); 186 btnMaskBmp.setMask(btnMaskBmp);
187 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 187 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
188 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 188 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
189 headerHoverID = -1; 189 headerHoverID = -1;
190 highlightWidget = NULL; 190 highlightWidget = NULL;
191 setButtonDefaultIndicatorWidth(0); 191 setButtonDefaultIndicatorWidth(0);
192 btnDict.setAutoDelete(true); 192 btnDict.setAutoDelete(true);
193 bevelFillDict.setAutoDelete(true); 193 bevelFillDict.setAutoDelete(true);
194 smallBevelFillDict.setAutoDelete(true); 194 smallBevelFillDict.setAutoDelete(true);
195 195
196 rMatrix.rotate(270.0); 196 rMatrix.rotate(270.0);
197 btnBorderPix = new QPixmap; 197 btnBorderPix = new QPixmap;
198 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 198 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
199 btnBlendPix = new QPixmap; 199 btnBlendPix = new QPixmap;
200 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 200 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
201 bevelFillPix = new QPixmap; 201 bevelFillPix = new QPixmap;
202 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 202 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
203 smallBevelFillPix = new QPixmap; 203 smallBevelFillPix = new QPixmap;
204 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 204 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
205 // new stuff 205 // new stuff
206 vsbSliderFillPix = menuPix = NULL; 206 vsbSliderFillPix = menuPix = NULL;
207 menuHandler = new TransMenuHandler(this); 207 menuHandler = new TransMenuHandler(this);
208 setScrollBarExtent(15, 15); 208 setScrollBarExtent(15, 15);
209 int i; 209 int i;
210 for(i=0; i < BITMAP_ITEMS; ++i){ 210 for(i=0; i < BITMAP_ITEMS; ++i){
211 pixmaps[i] = NULL; 211 pixmaps[i] = NULL;
212 } 212 }
213 oldSliderThickness = sliderThickness(); 213 oldSliderThickness = sliderThickness();
214 setSliderThickness(11); 214 setSliderThickness(11);
215} 215}
216 216
217LiquidStyle::~LiquidStyle() 217LiquidStyle::~LiquidStyle()
218{ 218{
219 if(btnBorderPix) 219 if(btnBorderPix)
220 delete btnBorderPix; 220 delete btnBorderPix;
221 if(btnBlendPix) 221 if(btnBlendPix)
222 delete btnBlendPix; 222 delete btnBlendPix;
223 if(bevelFillPix) 223 if(bevelFillPix)
224 delete bevelFillPix; 224 delete bevelFillPix;
225 if(smallBevelFillPix) 225 if(smallBevelFillPix)
226 delete smallBevelFillPix; 226 delete smallBevelFillPix;
227 if(vsbSliderFillPix) 227 if(vsbSliderFillPix)
228 delete vsbSliderFillPix; 228 delete vsbSliderFillPix;
229 if(menuPix) 229 if(menuPix)
230 delete menuPix; 230 delete menuPix;
231 231
232 setScrollBarExtent(16, 16); 232 setScrollBarExtent(16, 16);
233 setSliderThickness(oldSliderThickness); 233 setSliderThickness(oldSliderThickness);
234 int i; 234 int i;
235 for(i=0; i < BITMAP_ITEMS; ++i){ 235 for(i=0; i < BITMAP_ITEMS; ++i){
236 if(pixmaps[i]) 236 if(pixmaps[i])
237 delete pixmaps[i]; 237 delete pixmaps[i];
238 } 238 }
239} 239}
240 240
241void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 241void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
242 const QColor &c, const QColor &bg) 242 const QColor &c, const QColor &bg)
243{ 243{
244 244
245 QPen oldPen = p->pen(); // headers need this 245 QPen oldPen = p->pen(); // headers need this
246 int x2 = x+w-1; 246 int x2 = x+w-1;
247 int y2 = y+h-1; 247 int y2 = y+h-1;
248 // outer dark rect 248 // outer dark rect
249 p->setPen(c.dark(130)); 249 p->setPen(c.dark(130));
250 p->drawLine(x, y+2, x, y2-2); // l 250 p->drawLine(x, y+2, x, y2-2); // l
251 p->drawLine(x2, y+2, x2, y2-2); // r 251 p->drawLine(x2, y+2, x2, y2-2); // r
252 p->drawLine(x+2, y, x2-2, y); // t 252 p->drawLine(x+2, y, x2-2, y); // t
253 p->drawLine(x+2, y2, x2-2, y2); // b 253 p->drawLine(x+2, y2, x2-2, y2); // b
254 p->drawPoint(x+1, y+1); // tl 254 p->drawPoint(x+1, y+1); // tl
255 p->drawPoint(x2-1, y+1); // tr 255 p->drawPoint(x2-1, y+1); // tr
256 p->drawPoint(x+1, y2-1); // bl 256 p->drawPoint(x+1, y2-1); // bl
257 p->drawPoint(x2-1, y2-1); // br 257 p->drawPoint(x2-1, y2-1); // br
258 258
259 // inner top light lines 259 // inner top light lines
260 p->setPen(c.light(105)); 260 p->setPen(c.light(105));
261 p->drawLine(x+2, y+1, x2-2, y+1); 261 p->drawLine(x+2, y+1, x2-2, y+1);
262 p->drawLine(x+1, y+2, x2-1, y+2); 262 p->drawLine(x+1, y+2, x2-1, y+2);
263 p->drawLine(x+1, y+3, x+2, y+3); 263 p->drawLine(x+1, y+3, x+2, y+3);
264 p->drawLine(x2-2, y+3, x2-1, y+3); 264 p->drawLine(x2-2, y+3, x2-1, y+3);
265 p->drawPoint(x+1, y+4); 265 p->drawPoint(x+1, y+4);
266 p->drawPoint(x2-1, y+4); 266 p->drawPoint(x2-1, y+4);
267 267
268 // inner bottom light lines 268 // inner bottom light lines
269 p->setPen(c.light(110)); 269 p->setPen(c.light(110));
270 p->drawLine(x+2, y2-1, x2-2, y2-1); 270 p->drawLine(x+2, y2-1, x2-2, y2-1);
271 p->drawLine(x+1, y2-2, x2-1, y2-2); 271 p->drawLine(x+1, y2-2, x2-1, y2-2);
272 p->drawLine(x+1, y2-3, x+2, y2-3); 272 p->drawLine(x+1, y2-3, x+2, y2-3);
273 p->drawLine(x2-2, y2-3, x2-1, y2-3); 273 p->drawLine(x2-2, y2-3, x2-1, y2-3);
274 p->drawPoint(x+1, y2-4); 274 p->drawPoint(x+1, y2-4);
275 p->drawPoint(x2-1, y2-4); 275 p->drawPoint(x2-1, y2-4);
276 276
277 // inner left mid lines 277 // inner left mid lines
278 //p->setPen(c.light(105)); 278 //p->setPen(c.light(105));
279 p->setPen(c); 279 p->setPen(c);
280 p->drawLine(x+1, y+5, x+1, y2-5); 280 p->drawLine(x+1, y+5, x+1, y2-5);
281 p->drawLine(x+2, y+4, x+2, y2-4); 281 p->drawLine(x+2, y+4, x+2, y2-4);
282 282
283 // inner right mid lines 283 // inner right mid lines
284 p->drawLine(x2-1, y+5, x2-1, y2-5); 284 p->drawLine(x2-1, y+5, x2-1, y2-5);
285 p->drawLine(x2-2, y+4, x2-2, y2-4); 285 p->drawLine(x2-2, y+4, x2-2, y2-4);
286 286
287 // fill 287 // fill
288 QPixmap *pix; 288 QPixmap *pix;
289 if(h >= 32){ 289 if(h >= 32){
290 pix = bevelFillDict.find(c.rgb()); 290 pix = bevelFillDict.find(c.rgb());
291 if(!pix){ 291 if(!pix){
292 int h, s, v; 292 int h, s, v;
293 c.hsv(&h, &s, &v); 293 c.hsv(&h, &s, &v);
294 pix = new QPixmap(*bevelFillPix); 294 pix = new QPixmap(*bevelFillPix);
295 adjustHSV(*pix, h, s, v); 295 adjustHSV(*pix, h, s, v);
296 bevelFillDict.insert(c.rgb(), pix); 296 bevelFillDict.insert(c.rgb(), pix);
297 } 297 }
298 } 298 }
299 else{ 299 else{
300 pix = smallBevelFillDict.find(c.rgb()); 300 pix = smallBevelFillDict.find(c.rgb());
301 if(!pix){ 301 if(!pix){
302 int h, s, v; 302 int h, s, v;
303 c.hsv(&h, &s, &v); 303 c.hsv(&h, &s, &v);
304 pix = new QPixmap(*smallBevelFillPix); 304 pix = new QPixmap(*smallBevelFillPix);
305 adjustHSV(*pix, h, s, v); 305 adjustHSV(*pix, h, s, v);
306 smallBevelFillDict.insert(c.rgb(), pix); 306 smallBevelFillDict.insert(c.rgb(), pix);
307 } 307 }
308 } 308 }
309 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); 309 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix);
310 // blend 310 // blend
311 int red, green, blue; 311 int red, green, blue;
312 QColor btnColor(c.dark(130)); 312 QColor btnColor(c.dark(130));
313 red = (btnColor.red() >> 1) + (bg.red() >> 1); 313 red = (btnColor.red() >> 1) + (bg.red() >> 1);
314 green = (btnColor.green() >> 1) + (bg.green() >> 1); 314 green = (btnColor.green() >> 1) + (bg.green() >> 1);
315 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); 315 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1);
316 btnColor.setRgb(red, green, blue); 316 btnColor.setRgb(red, green, blue);
317 317
318 p->setPen(btnColor); 318 p->setPen(btnColor);
319 p->drawPoint(x+1, y); 319 p->drawPoint(x+1, y);
320 p->drawPoint(x, y+1); 320 p->drawPoint(x, y+1);
321 p->drawPoint(x+1, y2); 321 p->drawPoint(x+1, y2);
322 p->drawPoint(x, y2-1); 322 p->drawPoint(x, y2-1);
323 323
324 p->drawPoint(x2-1, y); 324 p->drawPoint(x2-1, y);
325 p->drawPoint(x2, y+1); 325 p->drawPoint(x2, y+1);
326 p->drawPoint(x2-1, y2); 326 p->drawPoint(x2-1, y2);
327 p->drawPoint(x2, y2-1); 327 p->drawPoint(x2, y2-1);
328 328
329 p->setPen(oldPen); 329 p->setPen(oldPen);
330 330
331} 331}
332 332
333void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, 333void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
334 const QColor &back, int x, int y, int w, int h, 334 const QColor &back, int x, int y, int w, int h,
335 bool supportPushDown, bool pushedDown, 335 bool supportPushDown, bool pushedDown,
336 bool autoDefault, bool isMasked) 336 bool autoDefault, bool isMasked)
337{ 337{
338 if(w < 21 || h < 21){ 338 if(w < 21 || h < 21){
339 drawClearBevel(painter, x, y, w, h, c, back); 339 drawClearBevel(painter, x, y, w, h, c, back);
340 return; 340 return;
341 } 341 }
342 if(supportPushDown){ 342 if(supportPushDown){
343 --w, --h; 343 --w, --h;
344 } 344 }
345 /* We don't make the round buttons smaller, since they don't look as good 345 /* We don't make the round buttons smaller, since they don't look as good
346 if(autoDefault){ 346 if(autoDefault){
347 w = w-buttonDefaultIndicatorWidth()*2; 347 w = w-buttonDefaultIndicatorWidth()*2;
348 h = h-buttonDefaultIndicatorWidth()*2; 348 h = h-buttonDefaultIndicatorWidth()*2;
349 }*/ 349 }*/
350 350
351 351
352 QPixmap *pix = btnDict.find(c.rgb()); 352 QPixmap *pix = btnDict.find(c.rgb());
353 if(!pix){ 353 if(!pix){
354 int h, s, v; 354 int h, s, v;
355 c.hsv(&h, &s, &v); 355 c.hsv(&h, &s, &v);
356 pix = new QPixmap(*btnBorderPix); 356 pix = new QPixmap(*btnBorderPix);
357 adjustHSV(*pix, h, s, v); 357 adjustHSV(*pix, h, s, v);
358 btnDict.insert(c.rgb(), pix); 358 btnDict.insert(c.rgb(), pix);
359 } 359 }
360 int x2 = x+w-1; 360 int x2 = x+w-1;
361 int y2 = y+h-1; 361 int y2 = y+h-1;
362 int bx2 = pix->width()-1; 362 int bx2 = pix->width()-1;
363 int by2 = pix->height()-1; 363 int by2 = pix->height()-1;
364 364
365 QPixmap tmpPix(w, h); 365 QPixmap tmpPix(w, h);
366 QPixmap tilePix; 366 QPixmap tilePix;
367 QPainter p; 367 QPainter p;
368 p.begin(&tmpPix); 368 p.begin(&tmpPix);
369 369
370 // do the fill 370 // do the fill
371 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 371 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
372 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 372 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 373 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 374 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
375 375
376 // edges 376 // edges
377 tilePix.resize(pix->width()-20, 10); 377 tilePix.resize(pix->width()-20, 10);
378 // top 378 // top
379 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 379 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
380 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 380 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
381 // bottom 381 // bottom
382 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 382 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
383 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 383 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
384 // left 384 // left
385 tilePix.resize(10, pix->height()-20); 385 tilePix.resize(10, pix->height()-20);
386 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 386 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
387 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 387 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
388 // right 388 // right
389 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 389 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
390 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 390 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
391 391
392 // middle 392 // middle
393 tilePix.resize(pix->width()-20, pix->height()-20); 393 tilePix.resize(pix->width()-20, pix->height()-20);
394 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); 394 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20);
395 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); 395 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix);
396 396
397 397
398 // do the blend 398 // do the blend
399 QBitmap blendMask; 399 QBitmap blendMask;
400 if(!isMasked){ 400 if(!isMasked){
401 //QRgb bgRgb = back.rgb(); 401 //QRgb bgRgb = back.rgb();
402 //QRgb fgRgb = c.rgb(); 402 //QRgb fgRgb = c.rgb();
403 //int r, g, b; 403 //int r, g, b;
404 404
405 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); 405 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25);
406 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); 406 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25);
407 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); 407 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25);
408 //QColor blendColor(r, g, b); 408 //QColor blendColor(r, g, b);
409 int hue, sat, v1, v2; 409 int hue, sat, v1, v2;
410 QColor blendColor(autoDefault ? c : back); 410 QColor blendColor(autoDefault ? c : back);
411 back.hsv(&hue, &sat, &v1); 411 back.hsv(&hue, &sat, &v1);
412 blendColor.hsv(&hue, &sat, &v2); 412 blendColor.hsv(&hue, &sat, &v2);
413 if(v2 > v1) 413 if(v2 > v1)
414 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); 414 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25));
415 415
416 pix = btnBorderDict.find(blendColor.rgb()); 416 pix = btnBorderDict.find(blendColor.rgb());
417 if(!pix){ 417 if(!pix){
418 int h, s, v; 418 int h, s, v;
419 blendColor.hsv(&h, &s, &v); 419 blendColor.hsv(&h, &s, &v);
420 pix = new QPixmap(*btnBlendPix); 420 pix = new QPixmap(*btnBlendPix);
421 adjustHSV(*pix, h, s, v); 421 adjustHSV(*pix, h, s, v);
422 btnBorderDict.insert(blendColor.rgb(), pix); 422 btnBorderDict.insert(blendColor.rgb(), pix);
423 } 423 }
424 } 424 }
425 else{ 425 else{
426 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : 426 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) :
427 getPixmap(HTMLBtnBorder); 427 getPixmap(HTMLBtnBorder);
428 } 428 }
429 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 429 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
430 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 430 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 431 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 432 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
433 433
434 // edges 434 // edges
435 tilePix.resize(pix->width()-20, 10); 435 tilePix.resize(pix->width()-20, 10);
436 blendMask.resize(pix->width()-20, 10); 436 blendMask.resize(pix->width()-20, 10);
437 // top 437 // top
438 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 438 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
439 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); 439 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10);
440 tilePix.setMask(blendMask); 440 tilePix.setMask(blendMask);
441 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 441 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
442 // bottom 442 // bottom
443 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 443 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); 444 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20);
445 tilePix.setMask(blendMask); 445 tilePix.setMask(blendMask);
446 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 446 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
447 // left 447 // left
448 tilePix.resize(10, pix->height()-20); 448 tilePix.resize(10, pix->height()-20);
449 blendMask.resize(10, pix->height()-20); 449 blendMask.resize(10, pix->height()-20);
450 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 450 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
451 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); 451 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20);
452 tilePix.setMask(blendMask); 452 tilePix.setMask(blendMask);
453 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 453 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
454 // right 454 // right
455 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 455 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); 456 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20);
457 tilePix.setMask(blendMask); 457 tilePix.setMask(blendMask);
458 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 458 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
459 459
460 p.end(); 460 p.end();
461 461
462 // do the button mask - we don't automask buttons 462 // do the button mask - we don't automask buttons
463 QBitmap btnMask(w, h); 463 QBitmap btnMask(w, h);
464 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 464 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
465 p.begin(&btnMask); 465 p.begin(&btnMask);
466 p.fillRect(0, 0, w, h, Qt::color0); 466 p.fillRect(0, 0, w, h, Qt::color0);
467 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 467 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
468 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 468 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 469 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 470 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
471 // fills 471 // fills
472 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 472 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
473 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 473 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
474 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 474 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
475 p.end(); 475 p.end();
476 tmpPix.setMask(btnMask); 476 tmpPix.setMask(btnMask);
477 /*if(autoDefault){ 477 /*if(autoDefault){
478 if(supportPushDown && pushedDown){ 478 if(supportPushDown && pushedDown){
479 painter->drawPixmap(x+3, y+3, tmpPix); 479 painter->drawPixmap(x+3, y+3, tmpPix);
480 } 480 }
481 else{ 481 else{
482 painter->drawPixmap(x+2, y+2, tmpPix); 482 painter->drawPixmap(x+2, y+2, tmpPix);
483 } 483 }
484 } 484 }
485 else */if(supportPushDown && pushedDown) 485 else */if(supportPushDown && pushedDown)
486 painter->drawPixmap(x+1, y+1, tmpPix); 486 painter->drawPixmap(x+1, y+1, tmpPix);
487 else 487 else
488 painter->drawPixmap(x, y, tmpPix); 488 painter->drawPixmap(x, y, tmpPix);
489 489
490 490
491 491
492} 492}
493 493
494 494
495QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, 495QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
496 bool blend) 496 bool blend)
497{ 497{
498 QImage img(qembed_findImage(label)); 498 QImage img(qembed_findImage(label));
499 img.detach(); 499 img.detach();
500 if(img.isNull()){ // shouldn't happen, been tested 500 if(img.isNull()){ // shouldn't happen, been tested
501 qWarning("Invalid embedded label %s", label); 501 qWarning("Invalid embedded label %s", label);
502 return(NULL); 502 return(NULL);
503 } 503 }
504 if(img.depth() != 32) 504 if(img.depth() != 32)
505 img = img.convertDepth(32); 505 img = img.convertDepth(32);
506 unsigned int *data = (unsigned int *)img.bits(); 506 unsigned int *data = (unsigned int *)img.bits();
507 int total = img.width()*img.height(); 507 int total = img.width()*img.height();
508 int current; 508 int current;
509 QColor c; 509 QColor c;
510 int oldH, oldS, oldV; 510 int oldH, oldS, oldV;
511 int alpha; 511 int alpha;
512 if(v < 235) 512 if(v < 235)
513 v += 20; 513 v += 20;
514 else 514 else
515 v = 255; 515 v = 255;
516 float intensity = v/255.0; 516 float intensity = v/255.0;
517 517
518 for(current=0; current<total; ++current){ 518 for(current=0; current<total; ++current){
519 alpha = qAlpha(data[current]); 519 alpha = qAlpha(data[current]);
520 c.setRgb(data[current]); 520 c.setRgb(data[current]);
521 c.hsv(&oldH, &oldS, &oldV); 521 c.hsv(&oldH, &oldS, &oldV);
522 oldV = (int)(oldV*intensity); 522 oldV = (int)(oldV*intensity);
523 c.setHsv(h, s, oldV); 523 c.setHsv(h, s, oldV);
524 if(blend && alpha != 255 && alpha != 0){ 524 if(blend && alpha != 255 && alpha != 0){
525 float srcPercent = ((float)alpha)/255.0; 525 float srcPercent = ((float)alpha)/255.0;
526 float destPercent = 1.0-srcPercent; 526 float destPercent = 1.0-srcPercent;
527 oldH = (int)((srcPercent*h) + (destPercent*bH)); 527 oldH = (int)((srcPercent*h) + (destPercent*bH));
528 oldS = (int)((srcPercent*s) + (destPercent*bS)); 528 oldS = (int)((srcPercent*s) + (destPercent*bS));
529 oldV = (int)((srcPercent*oldV) + (destPercent*bV)); 529 oldV = (int)((srcPercent*oldV) + (destPercent*bV));
530 c.setHsv(oldH, oldS, oldV); 530 c.setHsv(oldH, oldS, oldV);
531 alpha = 255; 531 alpha = 255;
532 } 532 }
533 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); 533 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha);
534 } 534 }
535 QPixmap *pix = new QPixmap; 535 QPixmap *pix = new QPixmap;
536 pix->convertFromImage(img); 536 pix->convertFromImage(img);
537 return(pix); 537 return(pix);
538} 538}
539 539
540 540
541 541
542 542
543QPixmap* LiquidStyle::getPixmap(BitmapData item) 543QPixmap* LiquidStyle::getPixmap(BitmapData item)
544{ 544{
545 545
546 if(pixmaps[item]) 546 if(pixmaps[item])
547 return(pixmaps[item]); 547 return(pixmaps[item]);
548 548
549 switch(item){ 549 switch(item){
550 case HTMLBtnBorder: 550 case HTMLBtnBorder:
551 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); 551 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV);
552 break; 552 break;
553 case HTMLBtnBorderDown: 553 case HTMLBtnBorderDown:
554 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 554 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
555 break; 555 break;
556 556
557 case HTMLCB: 557 case HTMLCB:
558 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 558 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
559 break; 559 break;
560 case HTMLCBHover: 560 case HTMLCBHover:
561 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); 561 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV);
562 break; 562 break;
563 case HTMLCBDown: 563 case HTMLCBDown:
564 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 564 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
565 break; 565 break;
566 case HTMLCBDownHover: 566 case HTMLCBDownHover:
567 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); 567 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV);
568 break; 568 break;
569 569
570 case HTMLRadio: 570 case HTMLRadio:
571 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 571 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
572 break; 572 break;
573 case HTMLRadioHover: 573 case HTMLRadioHover:
574 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); 574 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV);
575 break; 575 break;
576 case HTMLRadioDown: 576 case HTMLRadioDown:
577 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 577 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
578 break; 578 break;
579 case HTMLRadioDownHover: 579 case HTMLRadioDownHover:
580 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); 580 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV);
581 break; 581 break;
582 582
583 case RadioOff: 583 case RadioOff:
584 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); 584 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/);
585 break; 585 break;
586 case RadioOffHover: 586 case RadioOffHover:
587 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); 587 pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/);
588 break; 588 break;
589 case RadioOn: 589 case RadioOn:
590 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); 590 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/);
591 break; 591 break;
592 case RadioOnHover: 592 case RadioOnHover:
593 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); 593 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/);
594 break; 594 break;
595 595
596 case Tab: 596 case Tab:
597 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); 597 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/);
598 break; 598 break;
599 case TabDown: 599 case TabDown:
600 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); 600 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/);
601 break; 601 break;
602 case TabFocus: 602 case TabFocus:
603 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); 603 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/);
604 break; 604 break;
605 605
606 case CB: 606 case CB:
607 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); 607 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/);
608 break; 608 break;
609 case CBHover: 609 case CBHover:
610 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); 610 pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/);
611 break; 611 break;
612 case CBDown: 612 case CBDown:
613 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); 613 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/);
614 break; 614 break;
615 case CBDownHover: 615 case CBDownHover:
616 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); 616 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/);
617 break; 617 break;
618 618
619 case VSlider: 619 case VSlider:
620 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); 620 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true );
621 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 621 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
622 break; 622 break;
623 case VSBSliderTop: 623 case VSBSliderTop:
624 case VSBSliderTopHover: 624 case VSBSliderTopHover:
625 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); 625 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/);
626 break; 626 break;
627 case VSBSliderBtm: 627 case VSBSliderBtm:
628 case VSBSliderBtmHover: 628 case VSBSliderBtmHover:
629 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); 629 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/);
630 break; 630 break;
631 case VSBSliderMid: 631 case VSBSliderMid:
632 case VSBSliderMidHover: 632 case VSBSliderMidHover:
633 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 633 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
634 break; 634 break;
635 case VSBSliderTopBg: 635 case VSBSliderTopBg:
636 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); 636 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/);
637 break; 637 break;
638 case VSBSliderBtmBg: 638 case VSBSliderBtmBg:
639 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); 639 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/);
640 break; 640 break;
641 case VSBSliderMidBg: 641 case VSBSliderMidBg:
642 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 642 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
643 break; 643 break;
644 644
645 case HSlider: 645 case HSlider:
646 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); 646 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/);
647 break; 647 break;
648 case HSBSliderTop: 648 case HSBSliderTop:
649 case HSBSliderTopHover: 649 case HSBSliderTopHover:
650 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); 650 pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true );
651 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 651 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
652 break; 652 break;
653 case HSBSliderBtm: 653 case HSBSliderBtm:
654 case HSBSliderBtmHover: 654 case HSBSliderBtmHover:
655 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); 655 pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true );
656 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 656 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
657 break; 657 break;
658 case HSBSliderMid: 658 case HSBSliderMid:
659 case HSBSliderMidHover: 659 case HSBSliderMidHover:
660 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 660 pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
661 *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 661 *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
662 break; 662 break;
663 case HSBSliderTopBg: 663 case HSBSliderTopBg:
664 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); 664 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true );
665 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 665 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
666 break; 666 break;
667 case HSBSliderBtmBg: 667 case HSBSliderBtmBg:
668 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); 668 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true );
669 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 669 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
670 break; 670 break;
671 case HSBSliderMidBg: 671 case HSBSliderMidBg:
672 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 672 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
673 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 673 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
674 break; 674 break;
675 default: 675 default:
676 break; 676 break;
677 } 677 }
678 return(pixmaps[item]); 678 return(pixmaps[item]);
679} 679}
680 680
681void LiquidStyle::polish(QPalette &appPal) 681void LiquidStyle::polish(QPalette &appPal)
682{ 682{
683 int i; 683 int i;
684 for(i=0; i < BITMAP_ITEMS; ++i){ 684 for(i=0; i < BITMAP_ITEMS; ++i){
685 if(pixmaps[i]){ 685 if(pixmaps[i]){
686 delete pixmaps[i]; 686 delete pixmaps[i];
687 pixmaps[i] = NULL; 687 pixmaps[i] = NULL;
688 } 688 }
689 } 689 }
690 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 690 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
691 btnDict.clear(); 691 btnDict.clear();
692 btnBorderDict.clear(); 692 btnBorderDict.clear();
693 bevelFillDict.clear(); 693 bevelFillDict.clear();
694 smallBevelFillDict.clear(); 694 smallBevelFillDict.clear();
695 695
696 Config config ( "qpe" ); 696 Config config ( "qpe" );
697 config. setGroup ( "Liquid-Style" ); 697 config. setGroup ( "Liquid-Style" );
698 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 698 int contrast = config. readNumEntry ( "StippleContrast", 5 );
699 if ( contrast < 0 ) 699 if ( contrast < 0 )
700 contrast = 0; 700 contrast = 0;
701 else if ( contrast > 10 ) 701 else if ( contrast > 10 )
702 contrast = 10; 702 contrast = 10;
703 703
704// QPalette pal = QApplication::palette(); 704// QPalette pal = QApplication::palette();
705 705
706 // button color stuff 706 // button color stuff
707 config. setGroup ( "Appearance" ); 707 config. setGroup ( "Appearance" );
708 QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) 708 QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )))
709 : appPal. color ( QPalette::Active, QColorGroup::Button ); 709 : appPal. color ( QPalette::Active, QColorGroup::Button );
710 if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) 710 if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
711 : appPal. color ( QPalette::Active, QColorGroup::Background ))) { 711 : appPal. color ( QPalette::Active, QColorGroup::Background ))) {
712 // force button color to be different from background 712 // force button color to be different from background
713 QBrush btnBrush(QColor(200, 202, 228)); 713 QBrush btnBrush(QColor(200, 202, 228));
714 appPal.setBrush(QColorGroup::Button, btnBrush); 714 appPal.setBrush(QColorGroup::Button, btnBrush);
715 } 715 }
716 c.hsv(&btnH, &btnS, &btnV); 716 c.hsv(&btnH, &btnS, &btnV);
717 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 717 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
718 718
719 // menu pixmap 719 // menu pixmap
720 if(!menuPix){ 720 if(!menuPix){
721 menuPix = new QPixmap; 721 menuPix = new QPixmap;
722 menuPix->resize(64, 64); 722 menuPix->resize(64, 64);
723 } 723 }
724 QPainter painter; 724 QPainter painter;
725 menuPix->fill(c.rgb()); 725 menuPix->fill(c.rgb());
726 painter.begin(menuPix); 726 painter.begin(menuPix);
727 painter.setPen(c.dark(105)); 727 painter.setPen(c.dark(105));
728 for(i=0; i < 63; i+=4){ 728 for(i=0; i < 63; i+=4){
729 painter.drawLine(0, i, 63, i); 729 painter.drawLine(0, i, 63, i);
730 painter.drawLine(0, i+1, 63, i+1); 730 painter.drawLine(0, i+1, 63, i+1);
731 }; 731 };
732 painter.end(); 732 painter.end();
733 menuBrush.setColor(c); 733 menuBrush.setColor(c);
734 menuBrush.setPixmap(*menuPix); 734 menuBrush.setPixmap(*menuPix);
735 735
736 // pager brush 736 // pager brush
737 c = c.dark(120); 737 c = c.dark(120);
738 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 738 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
739 if(!pix){ 739 if(!pix){
740 int h, s, v; 740 int h, s, v;
741 c.hsv(&h, &s, &v); 741 c.hsv(&h, &s, &v);
742 pix = new QPixmap(*smallBevelFillPix); 742 pix = new QPixmap(*smallBevelFillPix);
743 adjustHSV(*pix, h, s, v); 743 adjustHSV(*pix, h, s, v);
744 smallBevelFillDict.insert(c.rgb(), pix); 744 smallBevelFillDict.insert(c.rgb(), pix);
745 } 745 }
746// pagerHoverBrush.setColor(c); 746// pagerHoverBrush.setColor(c);
747// pagerHoverBrush.setPixmap(*pix); 747// pagerHoverBrush.setPixmap(*pix);
748 748
749 c = c.dark(120); 749 c = c.dark(120);
750 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 750 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
751 if(!pix){ 751 if(!pix){
752 int h, s, v; 752 int h, s, v;
753 c.hsv(&h, &s, &v); 753 c.hsv(&h, &s, &v);
754 pix = new QPixmap(*smallBevelFillPix); 754 pix = new QPixmap(*smallBevelFillPix);
755 adjustHSV(*pix, h, s, v); 755 adjustHSV(*pix, h, s, v);
756 smallBevelFillDict.insert(c.rgb(), pix); 756 smallBevelFillDict.insert(c.rgb(), pix);
757 } 757 }
758// pagerBrush.setColor(c); 758// pagerBrush.setColor(c);
759// pagerBrush.setPixmap(*pix); 759// pagerBrush.setPixmap(*pix);
760 760
761 // background color stuff 761 // background color stuff
762 c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) 762 c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )))
763 : appPal. color ( QPalette::Active, QColorGroup::Background ); 763 : appPal. color ( QPalette::Active, QColorGroup::Background );
764 764
765 c.hsv(&bH, &bS, &bV); 765 c.hsv(&bH, &bS, &bV);
766 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 766 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
767 767
768 // FIXME? 768 // FIXME?
769 if(vsbSliderFillPix) 769 if(vsbSliderFillPix)
770 delete vsbSliderFillPix; 770 delete vsbSliderFillPix;
771 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 771 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
772 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 772 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
773 773
774 // background brush 774 // background brush
775 QPixmap wallPaper(32, 32); 775 QPixmap wallPaper(32, 32);
776 wallPaper.fill(c.rgb()); 776 wallPaper.fill(c.rgb());
777 painter.begin(&wallPaper); 777 painter.begin(&wallPaper);
778 for(i=0; i < 32; i+=4){ 778 for(i=0; i < 32; i+=4){
779 painter.setPen(c.dark(100 + contrast)); 779 painter.setPen(c.dark(100 + contrast));
780 painter.drawLine(0, i, 32, i); 780 painter.drawLine(0, i, 32, i);
781 painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 781 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
782 painter.drawLine(0, i+1, 32, i+1); 782 painter.drawLine(0, i+1, 32, i+1);
783 }; 783 };
784 painter.end(); 784 painter.end();
785 bgBrush.setColor(c); 785 bgBrush.setColor(c);
786 bgBrush.setPixmap(wallPaper); 786 bgBrush.setPixmap(wallPaper);
787 appPal.setBrush(QColorGroup::Background, bgBrush); 787 appPal.setBrush(QColorGroup::Background, bgBrush);
788} 788}
789 789
790void LiquidStyle::polish(QWidget *w) 790void LiquidStyle::polish(QWidget *w)
791{ 791{
792 if(w->inherits("QMenuBar")){ 792 if(w->inherits("QMenuBar")){
793 //((QFrame*)w)->setLineWidth(0); 793 //((QFrame*)w)->setLineWidth(0);
794 w->setBackgroundMode(QWidget::PaletteBackground); 794 w->setBackgroundMode(QWidget::PaletteBackground);
795 w->setBackgroundOrigin(QWidget::ParentOrigin); 795 w->setBackgroundOrigin(QWidget::ParentOrigin);
796 return; 796 return;
797 } 797 }
798 if(w->inherits("QToolBar")){ 798 if(w->inherits("QToolBar")){
799 w->installEventFilter(this); 799 w->installEventFilter(this);
800 w->setBackgroundMode(QWidget::PaletteBackground); 800 w->setBackgroundMode(QWidget::PaletteBackground);
801 w->setBackgroundOrigin(QWidget::WidgetOrigin); 801 w->setBackgroundOrigin(QWidget::WidgetOrigin);
802 return; 802 return;
803 } 803 }
804 if(w->inherits("QPopupMenu")) 804 if(w->inherits("QPopupMenu"))
805 w->setBackgroundMode(QWidget::NoBackground); 805 w->setBackgroundMode(QWidget::NoBackground);
806 else if(w-> testWFlags(Qt::WType_Popup) && 806 else if(w-> testWFlags(Qt::WType_Popup) &&
807 !w->inherits("QListBox") && 807 !w->inherits("QListBox") &&
808 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 808 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
809 w->installEventFilter(menuHandler); 809 w->installEventFilter(menuHandler);
810 } 810 }
811 811
812 if(w->isTopLevel()){ 812 if(w->isTopLevel()){
813 return; 813 return;
814 } 814 }
815 815
816 if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 816 if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
817 w->installEventFilter(this); 817 w->installEventFilter(this);
818 } 818 }
819 819
820 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 820 if(w->inherits("QButton") || w-> inherits("QComboBox")){
821 w-> setBackgroundMode ( QWidget::PaletteBackground ); 821 w-> setBackgroundMode ( QWidget::PaletteBackground );
822 w->setBackgroundOrigin ( QWidget::ParentOrigin); 822 w->setBackgroundOrigin ( QWidget::ParentOrigin);
823 } 823 }
824 824
825 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 825 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
826 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 826 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
827 bool isViewportChild = w->parent() && 827 bool isViewportChild = w->parent() &&
828 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 828 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
829 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 829 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
830 830
831 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 831 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
832 w->setBackgroundMode(QWidget::X11ParentRelative); 832 w->setBackgroundMode(QWidget::X11ParentRelative);
833 return; 833 return;
834 } 834 }
835 if(isViewportChild){ 835 if(isViewportChild){
836 if(w->inherits("QButton") || w->inherits("QComboBox")){ 836 if(w->inherits("QButton") || w->inherits("QComboBox")){
837 if(w->parent()){ // heh, only way to test for KHTML children ;-) 837 if(w->parent()){ // heh, only way to test for KHTML children ;-)
838 if(w->parent()->parent()){ 838 if(w->parent()->parent()){
839 if(w->parent()->parent()->parent() && 839 if(w->parent()->parent()->parent() &&
840 w->parent()->parent()->parent()->inherits("KHTMLView")){ 840 w->parent()->parent()->parent()->inherits("KHTMLView")){
841 w->setAutoMask(true); 841 w->setAutoMask(true);
842 w->setBackgroundMode(QWidget::NoBackground); 842 w->setBackgroundMode(QWidget::NoBackground);
843 } 843 }
844 } 844 }
845 } 845 }
846 return; 846 return;
847 } 847 }
848 } 848 }
849 if(w->inherits("QHeader")){ 849 if(w->inherits("QHeader")){
850 w->setMouseTracking(true); 850 w->setMouseTracking(true);
851 w->installEventFilter(this); 851 w->installEventFilter(this);
852 } 852 }
853 if(w-> inherits("QToolButton")) { 853 if(w-> inherits("QToolButton")) {
854 if (w->parent()->inherits("QToolBar")) { 854 if (w->parent()->inherits("QToolBar")) {
855 ((QToolButton*)w)->setAutoRaise (flatTBButtons); 855 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
856 if ( flatTBButtons ) 856 if ( flatTBButtons )
857 w->setBackgroundOrigin(QWidget::ParentOrigin); 857 w->setBackgroundOrigin(QWidget::ParentOrigin);
858 } 858 }
859 w-> installEventFilter ( this ); 859 w-> installEventFilter ( this );
860 } 860 }
861 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 861 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
862 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 862 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
863 } 863 }
864 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 864 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
865 return; 865 return;
866 } 866 }
867 867
868 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 868 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
869 palette().active().brush(QColorGroup::Background).pixmap()){ 869 palette().active().brush(QColorGroup::Background).pixmap()){
870 qWarning("No parent pixmap for child widget %s", w->className()); 870 qWarning("No parent pixmap for child widget %s", w->className());
871 return; 871 return;
872 } 872 }
873 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 873 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
874 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 874 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
875 if(w->backgroundMode() == QWidget::PaletteBackground || 875 if(w->backgroundMode() == QWidget::PaletteBackground ||
876 w->backgroundMode() == QWidget::PaletteButton){ 876 w->backgroundMode() == QWidget::PaletteButton){
877 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 877 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
878 w->setBackgroundOrigin(QWidget::ParentOrigin); 878 w->setBackgroundOrigin(QWidget::ParentOrigin);
879 // w->setBackgroundMode(QWidget::NoBackground); 879 // w->setBackgroundMode(QWidget::NoBackground);
880 } 880 }
881 } 881 }
882 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 882 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
883 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 883 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
884 else if ( w-> inherits("QFrame") ) 884 else if ( w-> inherits("QFrame") )
885 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 885 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
886 886
887 if ( w->parentWidget()->inherits ( "QWidgetStack" )) { 887 if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
888 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 888 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
889 } 889 }
890} 890}
891 891
892void LiquidStyle::unPolish(QWidget *w) 892void LiquidStyle::unPolish(QWidget *w)
893{ 893{
894 if(w->inherits("QMenuBar")){ 894 if(w->inherits("QMenuBar")){
895 ((QFrame *)w)->setLineWidth(1); 895 ((QFrame *)w)->setLineWidth(1);
896 w->setBackgroundMode(QWidget::PaletteBackground); 896 w->setBackgroundMode(QWidget::PaletteBackground);
897 return; 897 return;
898 } 898 }
899 899
900 if(w->inherits("QPopupMenu")) 900 if(w->inherits("QPopupMenu"))
901 w->setBackgroundMode(QWidget::PaletteButton); 901 w->setBackgroundMode(QWidget::PaletteButton);
902 else if(w-> testWFlags(Qt::WType_Popup) && 902 else if(w-> testWFlags(Qt::WType_Popup) &&
903 !w->inherits("QListBox") && 903 !w->inherits("QListBox") &&
904 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 904 ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
905 w->removeEventFilter(menuHandler); 905 w->removeEventFilter(menuHandler);
906 } 906 }
907 907
908 if(w->isTopLevel()) 908 if(w->isTopLevel())
909 return; 909 return;
910 910
911 // for viewport children, don't just check for NoBackground.... 911 // for viewport children, don't just check for NoBackground....
912 bool isViewportChild = w->parent() && 912 bool isViewportChild = w->parent() &&
913 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 913 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
914 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 914 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
915 915
916 w->unsetPalette(); 916 w->unsetPalette();
917 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 917 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
918 if(w->inherits("QPushButton")) 918 if(w->inherits("QPushButton"))
919 w->setBackgroundMode(QWidget::PaletteButton); 919 w->setBackgroundMode(QWidget::PaletteButton);
920 else 920 else
921 w->setBackgroundMode(QWidget::PaletteBackground); 921 w->setBackgroundMode(QWidget::PaletteBackground);
922 } 922 }
923 923
924 if(isViewportChild) 924 if(isViewportChild)
925 w->setAutoMask(false); 925 w->setAutoMask(false);
926 926
927/* 927/*
928 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 928 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
929 w-> setBackgroundMode ( PaletteBackground ); 929 w-> setBackgroundMode ( PaletteBackground );
930 } 930 }
931*/ 931*/
932 if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 932 if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
933 w->removeEventFilter(this); 933 w->removeEventFilter(this);
934 } 934 }
935 if(w->inherits("QButton") || w->inherits("QComboBox")){ 935 if(w->inherits("QButton") || w->inherits("QComboBox")){
936 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 936 if(w->parent() && w->parent()->inherits("KHTMLPart")){
937 w->setAutoMask(false); 937 w->setAutoMask(false);
938 } 938 }
939 } 939 }
940 if(w-> inherits("QToolButton")) { 940 if(w-> inherits("QToolButton")) {
941 w-> removeEventFilter ( this ); 941 w-> removeEventFilter ( this );
942 } 942 }
943 if(w->inherits("QToolBar")){ 943 if(w->inherits("QToolBar")){
944 w->removeEventFilter(this); 944 w->removeEventFilter(this);
945 w->setBackgroundMode(QWidget::PaletteBackground); 945 w->setBackgroundMode(QWidget::PaletteBackground);
946 return; 946 return;
947 } 947 }
948 if(w->inherits("QHeader")){ 948 if(w->inherits("QHeader")){
949 w->setMouseTracking(false); 949 w->setMouseTracking(false);
950 w->removeEventFilter(this); 950 w->removeEventFilter(this);
951 } 951 }
952} 952}
953 953
954void LiquidStyle::polish(QApplication *app) 954void LiquidStyle::polish(QApplication *app)
955{ 955{
956 956
957 QWindowsStyle::polish(app); 957 QWindowsStyle::polish(app);
958 menuAni = app->isEffectEnabled(UI_AnimateMenu); 958 menuAni = app->isEffectEnabled(UI_AnimateMenu);
959 menuFade = app->isEffectEnabled(UI_FadeMenu); 959 menuFade = app->isEffectEnabled(UI_FadeMenu);
960 if(menuAni) 960 if(menuAni)
961 app->setEffectEnabled(UI_AnimateMenu, false); 961 app->setEffectEnabled(UI_AnimateMenu, false);
962 if(menuFade) 962 if(menuFade)
963 app->setEffectEnabled(UI_FadeMenu, false); 963 app->setEffectEnabled(UI_FadeMenu, false);
964 964
965 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 965 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
966 966
967 Config config ( "qpe" ); 967 Config config ( "qpe" );
968 config. setGroup ( "Liquid-Style" ); 968 config. setGroup ( "Liquid-Style" );
969 969
970 // if ( config. readBoolEntry ( "WinDecoration", true )) 970 // if ( config. readBoolEntry ( "WinDecoration", true ))
971 // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 971 // QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
972 972
973 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 973 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
974} 974}
975 975
976void LiquidStyle::unPolish(QApplication *app) 976void LiquidStyle::unPolish(QApplication *app)
977{ 977{
978 QWindowsStyle::unPolish(app); 978 QWindowsStyle::unPolish(app);
979 app->setEffectEnabled(UI_AnimateMenu, menuAni); 979 app->setEffectEnabled(UI_AnimateMenu, menuAni);
980 app->setEffectEnabled(UI_FadeMenu, menuFade); 980 app->setEffectEnabled(UI_FadeMenu, menuFade);
981 981
982 qt_set_draw_menu_bar_impl ( 0 ); 982 qt_set_draw_menu_bar_impl ( 0 );
983 983
984// QApplication::qwsSetDecoration ( new QPEDecoration ( )); 984// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
985} 985}
986 986
987 987
988/* !! HACK !! Beware 988/* !! HACK !! Beware
989 * 989 *
990 * TT forgot to make the QProgressBar widget styleable in Qt 2.x 990 * 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 991 * So the only way to customize the drawing, is to intercept the
992 * paint event - since we have to use protected functions, we need 992 * paint event - since we have to use protected functions, we need
993 * to derive a "hack" class from QProgressBar and do the painting 993 * to derive a "hack" class from QProgressBar and do the painting
994 * in there. 994 * in there.
995 * 995 *
996 * - sandman 996 * - sandman
997 */ 997 */
998 998
999class HackProgressBar : public QProgressBar { 999class HackProgressBar : public QProgressBar {
1000public: 1000public:
1001 HackProgressBar ( ); 1001 HackProgressBar ( );
1002 1002
1003 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) 1003 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix )
1004 { 1004 {
1005 QPainter p( this ); 1005 QPainter p( this );
1006 1006
1007 if ( !contentsRect().contains( event->rect() ) ) { 1007 if ( !contentsRect().contains( event->rect() ) ) {
1008 p.save(); 1008 p.save();
1009 p.setClipRegion( event->region().intersect(frameRect()) ); 1009 p.setClipRegion( event->region().intersect(frameRect()) );
1010 drawFrame( &p); 1010 drawFrame( &p);
1011 p.restore(); 1011 p.restore();
1012 } 1012 }
1013 if ( event->rect().intersects( contentsRect() )) { 1013 if ( event->rect().intersects( contentsRect() )) {
1014 p.setClipRegion( event->region().intersect( contentsRect() ) ); 1014 p.setClipRegion( event->region().intersect( contentsRect() ) );
1015 1015
1016 int x, y, w, h; 1016 int x, y, w, h;
1017 contentsRect ( ). rect ( &x, &y, &w, &h ); 1017 contentsRect ( ). rect ( &x, &y, &w, &h );
1018 1018
1019 int prog = progress ( ); 1019 int prog = progress ( );
1020 int total = totalSteps ( ); 1020 int total = totalSteps ( );
1021 if ( prog < 0 ) 1021 if ( prog < 0 )
1022 prog = 0; 1022 prog = 0;
1023 if ( total <= 0 ) 1023 if ( total <= 0 )
1024 total = 1; 1024 total = 1;
1025 int bw = w * prog / total; 1025 int bw = w * prog / total;
1026 if ( bw > w ) 1026 if ( bw > w )
1027 bw = w; 1027 bw = w;
1028 1028
1029 p.setPen(g.button().dark(130)); 1029 p.setPen(g.button().dark(130));
1030 p.drawRect(x, y, bw, h); 1030 p.drawRect(x, y, bw, h);
1031 p.setPen(g.button().light(120)); 1031 p.setPen(g.button().light(120));
1032 p.drawRect(x+1, y+1, bw-2, h-2); 1032 p.drawRect(x+1, y+1, bw-2, h-2);
1033 1033
1034 if(bw >= 4 && h >= 4 && pix) 1034 if(bw >= 4 && h >= 4 && pix)
1035 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); 1035 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix);
1036 1036
1037 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { 1037 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
1038 QString pstr; 1038 QString pstr;
1039 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); 1039 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ());
1040 p. setPen ( g.text());//g.highlightedText ( )); 1040 p. setPen ( g.text());//g.highlightedText ( ));
1041 p. drawText (x,y,w-1,h-1,AlignCenter,pstr); 1041 p. drawText (x,y,w-1,h-1,AlignCenter,pstr);
1042 } 1042 }
1043 } 1043 }
1044 } 1044 }
1045}; 1045};
1046 1046
1047 1047
1048/* 1048/*
1049 * The same for QToolButton: 1049 * The same for QToolButton:
1050 * TT hardcoded the drawing of the focus rect ... 1050 * TT hardcoded the drawing of the focus rect ...
1051 * 1051 *
1052 * - sandman 1052 * - sandman
1053 */ 1053 */
1054 1054
1055 1055
1056class HackToolButton : public QToolButton { 1056class HackToolButton : public QToolButton {
1057public: 1057public:
1058 HackToolButton ( ); 1058 HackToolButton ( );
1059 1059
1060 void paint ( QPaintEvent *ev ) 1060 void paint ( QPaintEvent *ev )
1061 { 1061 {
1062 erase ( ev-> region ( )); 1062 erase ( ev-> region ( ));
1063 QPainter p ( this ); 1063 QPainter p ( this );
1064 style ( ). drawToolButton ( this, &p ); 1064 style ( ). drawToolButton ( this, &p );
1065 drawButtonLabel ( &p ); 1065 drawButtonLabel ( &p );
1066 } 1066 }
1067}; 1067};
1068 1068
1069/* 1069/*
1070 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1070 * 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 1071 * 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, 1072 * trying to get shaped widgets to work right without masking. QPushButton,
1073 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1073 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1074 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1074 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1075 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1075 * 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 1076 * caches them in QPixmapCache, which is bad for doing things like hover
1077 * because the style methods aren't called in paintEvents if everything 1077 * because the style methods aren't called in paintEvents if everything
1078 * is cached. We use our own Paint event handler instead. Taskbuttons and 1078 * 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 1079 * pager buttons draw into a pixmap buffer, so we handle those with palette
1080 * modifications. For QHeader, different header items are actually one widget 1080 * modifications. For QHeader, different header items are actually one widget
1081 * that draws multiple items, so we need to check which ID is hightlighted 1081 * 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, 1082 * 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 1083 * since if it's inside a combobox we want to highlight the combobox during
1084 * hovering in the edit. 1084 * hovering in the edit.
1085 */ 1085 */
1086bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1086bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1087{ 1087{
1088 if(obj->inherits("QToolBar")){ 1088 if(obj->inherits("QToolBar")){
1089 if(ev->type() == QEvent::Resize){ 1089 if(ev->type() == QEvent::Resize){
1090 const QObjectList *tbChildList = obj->children(); 1090 const QObjectList *tbChildList = obj->children();
1091 QObjectListIt it(*tbChildList); 1091 QObjectListIt it(*tbChildList);
1092 QObject *child; 1092 QObject *child;
1093 while((child = it.current()) != NULL){ 1093 while((child = it.current()) != NULL){
1094 ++it; 1094 ++it;
1095 if(child->isWidgetType()) 1095 if(child->isWidgetType())
1096 ((QWidget *)child)->repaint(true); 1096 ((QWidget *)child)->repaint(true);
1097 } 1097 }
1098 1098
1099 } 1099 }
1100 } 1100 }
1101 else if(obj->inherits("QToolButton")){ 1101 else if(obj->inherits("QToolButton")){
1102 QToolButton *btn = (QToolButton *)obj; 1102 QToolButton *btn = (QToolButton *)obj;
1103 if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () 1103 if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise ()
1104 if(btn->isEnabled()){ 1104 if(btn->isEnabled()){
1105 highlightWidget = btn; 1105 highlightWidget = btn;
1106 btn->repaint(false); 1106 btn->repaint(false);
1107
1108 qDebug ( "TB FOCUS IN [%p]", btn );
1109 } 1107 }
1110 } 1108 }
1111 else if(ev->type() == QEvent::FocusOut ){ 1109 else if(ev->type() == QEvent::FocusOut ){
1112 if(btn == highlightWidget){ 1110 if(btn == highlightWidget){
1113 highlightWidget = NULL; 1111 highlightWidget = NULL;
1114 btn->repaint(false); 1112 btn->repaint(false);
1115
1116 qDebug ( "TB FOCUS OUT [%p]", btn );
1117 } 1113 }
1118 } 1114 }
1119 else if(ev->type() == QEvent::Paint) { 1115 else if(ev->type() == QEvent::Paint) {
1120 (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev ); 1116 (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev );
1121 return true; 1117 return true;
1122 } 1118 }
1123 } 1119 }
1124 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ 1120 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){
1125 QButton *btn = (QButton *)obj; 1121 QButton *btn = (QButton *)obj;
1126 bool isRadio = obj->inherits("QRadioButton"); 1122 bool isRadio = obj->inherits("QRadioButton");
1127 if(ev->type() == QEvent::Paint){ 1123 if(ev->type() == QEvent::Paint){
1128 //if(btn->autoMask()) 1124 //if(btn->autoMask())
1129 btn->erase(); 1125 btn->erase();
1130 QPainter p; 1126 QPainter p;
1131 p.begin(btn); 1127 p.begin(btn);
1132 QFontMetrics fm = btn->fontMetrics(); 1128 QFontMetrics fm = btn->fontMetrics();
1133 QSize lsz = fm.size(ShowPrefix, btn->text()); 1129 QSize lsz = fm.size(ShowPrefix, btn->text());
1134 QSize sz = isRadio ? exclusiveIndicatorSize() 1130 QSize sz = isRadio ? exclusiveIndicatorSize()
1135 : indicatorSize(); 1131 : indicatorSize();
1136 1132
1137/* 1133/*
1138 if(btn->hasFocus()){ 1134 if(btn->hasFocus()){
1139 QRect r = QRect(0, 0, btn->width(), btn->height()); 1135 QRect r = QRect(0, 0, btn->width(), btn->height());
1140 p.setPen(btn->colorGroup().button().dark(140)); 1136 p.setPen(btn->colorGroup().button().dark(140));
1141 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1137 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1142 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1138 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1143 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1139 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1144 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1140 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1145 } 1141 }
1146*/ 1142*/
1147 int x = 0; 1143 int x = 0;
1148 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1144 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1149 if(isRadio) 1145 if(isRadio)
1150 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1146 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1151 btn->colorGroup(), btn->isOn(), 1147 btn->colorGroup(), btn->isOn(),
1152 btn->isDown(), btn->isEnabled()); 1148 btn->isDown(), btn->isEnabled());
1153 else 1149 else
1154 drawIndicator(&p, x, y, sz.width(), sz.height(), 1150 drawIndicator(&p, x, y, sz.width(), sz.height(),
1155 btn->colorGroup(), btn->state(), btn->isDown(), 1151 btn->colorGroup(), btn->state(), btn->isDown(),
1156 btn->isEnabled()); 1152 btn->isEnabled());
1157 x = sz.width() + 6; 1153 x = sz.width() + 6;
1158 y = 0; 1154 y = 0;
1159 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), 1155 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1),
1160 btn->height(), AlignLeft|AlignVCenter|ShowPrefix, 1156 btn->height(), AlignLeft|AlignVCenter|ShowPrefix,
1161 btn->colorGroup(), btn->isEnabled(), 1157 btn->colorGroup(), btn->isEnabled(),
1162 btn->pixmap(), btn->text()); 1158 btn->pixmap(), btn->text());
1163 p.end(); 1159 p.end();
1164 return(true); 1160 return(true);
1165 } 1161 }
1166 } 1162 }
1167 else if(obj->inherits("QHeader")){ 1163 else if(obj->inherits("QHeader")){
1168 QHeader *hw = (QHeader *)obj; 1164 QHeader *hw = (QHeader *)obj;
1169 if(ev->type() == QEvent::Enter){ 1165 if(ev->type() == QEvent::Enter){
1170 currentHeader = hw; 1166 currentHeader = hw;
1171 headerHoverID = -1; 1167 headerHoverID = -1;
1172 } 1168 }
1173 else if(ev->type() == QEvent::Leave){ 1169 else if(ev->type() == QEvent::Leave){
1174 currentHeader = NULL; 1170 currentHeader = NULL;
1175 if(headerHoverID != -1){ 1171 if(headerHoverID != -1){
1176 hw->repaint(hw->sectionPos(headerHoverID), 0, 1172 hw->repaint(hw->sectionPos(headerHoverID), 0,
1177 hw->sectionSize(headerHoverID), hw->height()); 1173 hw->sectionSize(headerHoverID), hw->height());
1178 } 1174 }
1179 headerHoverID = -1; 1175 headerHoverID = -1;
1180 } 1176 }
1181 else if(ev->type() == QEvent::MouseMove){ 1177 else if(ev->type() == QEvent::MouseMove){
1182 QMouseEvent *me = (QMouseEvent *)ev; 1178 QMouseEvent *me = (QMouseEvent *)ev;
1183 int oldHeader = headerHoverID; 1179 int oldHeader = headerHoverID;
1184 headerHoverID = hw->sectionAt(me->x()); 1180 headerHoverID = hw->sectionAt(me->x());
1185 if(oldHeader != headerHoverID){ 1181 if(oldHeader != headerHoverID){
1186 // reset old header 1182 // reset old header
1187 if(oldHeader != -1){ 1183 if(oldHeader != -1){
1188 hw->repaint(hw->sectionPos(oldHeader), 0, 1184 hw->repaint(hw->sectionPos(oldHeader), 0,
1189 hw->sectionSize(oldHeader), hw->height()); 1185 hw->sectionSize(oldHeader), hw->height());
1190 } 1186 }
1191 if(headerHoverID != -1){ 1187 if(headerHoverID != -1){
1192 hw->repaint(hw->sectionPos(headerHoverID), 0, 1188 hw->repaint(hw->sectionPos(headerHoverID), 0,
1193 hw->sectionSize(headerHoverID), hw->height()); 1189 hw->sectionSize(headerHoverID), hw->height());
1194 } 1190 }
1195 } 1191 }
1196 } 1192 }
1197 } 1193 }
1198 else if (obj-> inherits( "QProgressBar" )) { 1194 else if (obj-> inherits( "QProgressBar" )) {
1199 if ( ev->type() == QEvent::Paint ) { 1195 if ( ev->type() == QEvent::Paint ) {
1200 HackProgressBar *p = (HackProgressBar *) obj; 1196 HackProgressBar *p = (HackProgressBar *) obj;
1201 const QColorGroup &g = p-> colorGroup ( ); 1197 const QColorGroup &g = p-> colorGroup ( );
1202 1198
1203 QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1199 QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1204 if(!pix){ 1200 if(!pix){
1205 int h, s, v; 1201 int h, s, v;
1206 g.button().dark(120).hsv(&h, &s, &v); 1202 g.button().dark(120).hsv(&h, &s, &v);
1207 pix = new QPixmap(*bevelFillPix); 1203 pix = new QPixmap(*bevelFillPix);
1208 adjustHSV(*pix, h, s, v); 1204 adjustHSV(*pix, h, s, v);
1209 bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1205 bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1210 } 1206 }
1211 p-> paint ((QPaintEvent *) ev, g, pix ); 1207 p-> paint ((QPaintEvent *) ev, g, pix );
1212 return true; 1208 return true;
1213 } 1209 }
1214 } 1210 }
1215 return false ; 1211 return false ;
1216} 1212}
1217 1213
1218void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, 1214void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h,
1219 const QColorGroup &g, bool sunken, 1215 const QColorGroup &g, bool sunken,
1220 const QBrush *) 1216 const QBrush *)
1221{ 1217{
1222 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), 1218 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(),
1223 x, y, w, h); 1219 x, y, w, h);
1224} 1220}
1225 1221
1226void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, 1222void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h,
1227 const QColorGroup &g, bool sunken, 1223 const QColorGroup &g, bool sunken,
1228 const QBrush *) 1224 const QBrush *)
1229{ 1225{
1230 if(p->device()->devType() != QInternal::Widget){ 1226 if(p->device()->devType() != QInternal::Widget){
1231 // drawing into a temp pixmap, don't use mask 1227 // drawing into a temp pixmap, don't use mask
1232 QColor c = sunken ? g.button() : g.background(); 1228 QColor c = sunken ? g.button() : g.background();
1233 p->setPen(c.dark(130)); 1229 p->setPen(c.dark(130));
1234 p->drawRect(x, y, w, h); 1230 p->drawRect(x, y, w, h);
1235 p->setPen(c.light(105)); 1231 p->setPen(c.light(105));
1236 p->drawRect(x+1, y+1, w-2, h-2); 1232 p->drawRect(x+1, y+1, w-2, h-2);
1237 1233
1238 1234
1239 // fill 1235 // fill
1240 QPixmap *pix = bevelFillDict.find(c.rgb()); 1236 QPixmap *pix = bevelFillDict.find(c.rgb());
1241 if(!pix){ 1237 if(!pix){
1242 int h, s, v; 1238 int h, s, v;
1243 c.hsv(&h, &s, &v); 1239 c.hsv(&h, &s, &v);
1244 pix = new QPixmap(*bevelFillPix); 1240 pix = new QPixmap(*bevelFillPix);
1245 adjustHSV(*pix, h, s, v); 1241 adjustHSV(*pix, h, s, v);
1246 bevelFillDict.insert(c.rgb(), pix); 1242 bevelFillDict.insert(c.rgb(), pix);
1247 } 1243 }
1248 1244
1249 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1245 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1250 qDebug ( "DRAW TOOLBUTTON IN PIXMAP" );
1251 } 1246 }
1252 else{ 1247 else{
1253 qDebug ( "DRAW TOOLBUTTON sunken=%d/high=%p/device=%p", sunken, highlightWidget,p->device() );
1254
1255 drawClearBevel(p, x, y, w, h, sunken ? g.button() : 1248 drawClearBevel(p, x, y, w, h, sunken ? g.button() :
1256 highlightWidget == p->device() ? g.button().light(110) : 1249 highlightWidget == p->device() ? g.button().light(110) :
1257 g.background(), g.background()); 1250 g.background(), g.background());
1258 } 1251 }
1259} 1252}
1260 1253
1261void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) 1254void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p)
1262{ 1255{
1263 QRect r = btn->rect(); 1256 QRect r = btn->rect();
1264 bool sunken = btn->isOn() || btn->isDown(); 1257 bool sunken = btn->isOn() || btn->isDown();
1265 QColorGroup g = btn->colorGroup(); 1258 QColorGroup g = btn->colorGroup();
1266 1259
1267 1260
1268 //int dw = buttonDefaultIndicatorWidth(); 1261 //int dw = buttonDefaultIndicatorWidth();
1269 if(btn->hasFocus() || btn->isDefault()){ 1262 if(btn->hasFocus() || btn->isDefault()){
1270 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 1263 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
1271 QPixmap *pix = bevelFillDict.find(c.rgb()); 1264 QPixmap *pix = bevelFillDict.find(c.rgb());
1272 if(!pix){ 1265 if(!pix){
1273 int h, s, v; 1266 int h, s, v;
1274 c.hsv(&h, &s, &v); 1267 c.hsv(&h, &s, &v);
1275 pix = new QPixmap(*bevelFillPix); 1268 pix = new QPixmap(*bevelFillPix);
1276 adjustHSV(*pix, h, s, v); 1269 adjustHSV(*pix, h, s, v);
1277 bevelFillDict.insert(c.rgb(), pix); 1270 bevelFillDict.insert(c.rgb(), pix);
1278 } 1271 }
1279 p->setPen(c.dark(150)); 1272 p->setPen(c.dark(150));
1280 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1273 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1281 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1274 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1282 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1275 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1283 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1276 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1284 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1277 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1285 } 1278 }
1286 1279
1287 QColor newColor = btn == highlightWidget || sunken ? 1280 QColor newColor = btn == highlightWidget || sunken ?
1288 g.button().light(120) : g.button(); 1281 g.button().light(120) : g.button();
1289 1282
1290 drawRoundButton(p, newColor, g.background(), 1283 drawRoundButton(p, newColor, g.background(),
1291 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), 1284 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(),
1292 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), 1285 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(),
1293 btn->autoMask()); 1286 btn->autoMask());
1294} 1287}
1295 1288
1296void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) 1289void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p)
1297{ 1290{
1298 int x1, y1, x2, y2, w, h; 1291 int x1, y1, x2, y2, w, h;
1299 btn->rect().coords(&x1, &y1, &x2, &y2); 1292 btn->rect().coords(&x1, &y1, &x2, &y2);
1300 w = btn->width(); 1293 w = btn->width();
1301 h = btn->height(); 1294 h = btn->height();
1302 1295
1303 bool act = btn->isOn() || btn->isDown(); 1296 bool act = btn->isOn() || btn->isDown();
1304 if(act){ 1297 if(act){
1305 ++x1, ++y1; 1298 ++x1, ++y1;
1306 } 1299 }
1307 1300
1308 // Draw iconset first, if any 1301 // Draw iconset first, if any
1309 if ( btn->iconSet() && !btn->iconSet()->isNull() ) 1302 if ( btn->iconSet() && !btn->iconSet()->isNull() )
1310 { 1303 {
1311 QIconSet::Mode mode = btn->isEnabled() 1304 QIconSet::Mode mode = btn->isEnabled()
1312 ? QIconSet::Normal : QIconSet::Disabled; 1305 ? QIconSet::Normal : QIconSet::Disabled;
1313 if ( mode == QIconSet::Normal && btn->hasFocus() ) 1306 if ( mode == QIconSet::Normal && btn->hasFocus() )
1314 mode = QIconSet::Active; 1307 mode = QIconSet::Active;
1315 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); 1308 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode );
1316 int pixw = pixmap.width(); 1309 int pixw = pixmap.width();
1317 int pixh = pixmap.height(); 1310 int pixh = pixmap.height();
1318 1311
1319 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); 1312 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap );
1320 x1 += pixw + 8; 1313 x1 += pixw + 8;
1321 w -= pixw + 8; 1314 w -= pixw + 8;
1322 } 1315 }
1323 1316
1324 if(act){ 1317 if(act){
1325 QFont font = btn->font(); 1318 QFont font = btn->font();
1326 font.setBold(true); 1319 font.setBold(true);
1327 p->setFont(font); 1320 p->setFont(font);
1328 QColor shadow(btn->colorGroup().button().dark(130)); 1321 QColor shadow(btn->colorGroup().button().dark(130));
1329 drawItem( p, x1+1, y1+1, w, h, 1322 drawItem( p, x1+1, y1+1, w, h,
1330 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1323 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1331 btn->pixmap(), btn->text(), -1, 1324 btn->pixmap(), btn->text(), -1,
1332 &shadow); 1325 &shadow);
1333 1326
1334 drawItem( p, x1, y1, w, h, 1327 drawItem( p, x1, y1, w, h,
1335 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1328 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1336 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light()); 1329 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light());
1337 } 1330 }
1338 else{ 1331 else{
1339 /* Too blurry 1332 /* Too blurry
1340 drawItem( p, x1+1, y1+1, w, h, 1333 drawItem( p, x1+1, y1+1, w, h,
1341 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1334 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1342 btn->pixmap(), btn->text(), -1, 1335 btn->pixmap(), btn->text(), -1,
1343 &btn->colorGroup().button().dark(115)); 1336 &btn->colorGroup().button().dark(115));
1344 */ 1337 */
1345 drawItem( p, x1, y1, w, h, 1338 drawItem( p, x1, y1, w, h,
1346 AlignCenter | ShowPrefix, 1339 AlignCenter | ShowPrefix,
1347 btn->colorGroup(), btn->isEnabled(), 1340 btn->colorGroup(), btn->isEnabled(),
1348 btn->pixmap(), btn->text(), -1, 1341 btn->pixmap(), btn->text(), -1,
1349 &btn->colorGroup().buttonText()); 1342 &btn->colorGroup().buttonText());
1350 } 1343 }
1351} 1344}
1352 1345
1353void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h) 1346void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h)
1354{ 1347{
1355 int x2 = x+w-1; 1348 int x2 = x+w-1;
1356 int y2 = y+h-1; 1349 int y2 = y+h-1;
1357 1350
1358 p->setPen(Qt::color1); 1351 p->setPen(Qt::color1);
1359 p->fillRect(x, y, w, h, Qt::color0); 1352 p->fillRect(x, y, w, h, Qt::color0);
1360 if(w < 21 || h < 21){ 1353 if(w < 21 || h < 21){
1361 // outer rect 1354 // outer rect
1362 p->drawLine(x, y+2, x, y2-2); // l 1355 p->drawLine(x, y+2, x, y2-2); // l
1363 p->drawLine(x2, y+2, x2, y2-2); // r 1356 p->drawLine(x2, y+2, x2, y2-2); // r
1364 p->drawLine(x+2, y, x2-2, y); // t 1357 p->drawLine(x+2, y, x2-2, y); // t
1365 p->drawLine(x+2, y2, x2-2, y2); // b 1358 p->drawLine(x+2, y2, x2-2, y2); // b
1366 p->drawLine(x+1, y+1, x2-1, y+1); // top second line 1359 p->drawLine(x+1, y+1, x2-1, y+1); // top second line
1367 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line 1360 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line
1368 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1); 1361 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1);
1369 } 1362 }
1370 else{ 1363 else{
1371 int x2 = x+w-1; 1364 int x2 = x+w-1;
1372 int y2 = y+h-1; 1365 int y2 = y+h-1;
1373 int bx2 = htmlBtnMaskBmp.width()-1; 1366 int bx2 = htmlBtnMaskBmp.width()-1;
1374 int by2 = htmlBtnMaskBmp.height()-1; 1367 int by2 = htmlBtnMaskBmp.height()-1;
1375 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl 1368 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl
1376 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr 1369 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr
1377 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl 1370 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl
1378 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br 1371 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br
1379 // fills 1372 // fills
1380 p->fillRect(10, 0, w-20, 10, Qt::color1); // top 1373 p->fillRect(10, 0, w-20, 10, Qt::color1); // top
1381 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1374 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1382 p->fillRect(0, 10, w, h-20, Qt::color1); // middle 1375 p->fillRect(0, 10, w, h-20, Qt::color1); // middle
1383 } 1376 }
1384} 1377}
1385 1378
1386void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, 1379void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
1387 const QColorGroup &g, bool sunken, 1380 const QColorGroup &g, bool sunken,
1388 const QBrush */*fill*/) 1381 const QBrush */*fill*/)
1389{ 1382{
1390 if(currentHeader && p->device() == currentHeader){ 1383 if(currentHeader && p->device() == currentHeader){
1391 int id = currentHeader->sectionAt(x); 1384 int id = currentHeader->sectionAt(x);
1392 bool isHeaderHover = id != -1 && id == headerHoverID; 1385 bool isHeaderHover = id != -1 && id == headerHoverID;
1393 drawClearBevel(p, x, y, w, h, sunken ? 1386 drawClearBevel(p, x, y, w, h, sunken ?
1394 g.button() : isHeaderHover ? g.button().light(110) : 1387 g.button() : isHeaderHover ? g.button().light(110) :
1395 g.background(), g.background()); 1388 g.background(), g.background());
1396 } 1389 }
1397 else 1390 else
1398 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), 1391 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(),
1399 g.background()); 1392 g.background());
1400} 1393}
1401 1394
1402QRect LiquidStyle::buttonRect(int x, int y, int w, int h) 1395QRect LiquidStyle::buttonRect(int x, int y, int w, int h)
1403{ 1396{
1404 return(QRect(x+5, y+5, w-10, h-10)); 1397 return(QRect(x+5, y+5, w-10, h-10));
1405} 1398}
1406 1399
1407void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, 1400void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
1408 const QColorGroup &g, bool sunken, 1401 const QColorGroup &g, bool sunken,
1409 bool edit, bool, const QBrush *) 1402 bool edit, bool, const QBrush *)
1410{ 1403{
1411 bool isActive = false; 1404 bool isActive = false;
1412 if (( painter->device()->devType() == QInternal::Widget ) && 1405 if (( painter->device()->devType() == QInternal::Widget ) &&
1413 ( 1406 (
1414 ( qApp-> focusWidget ( ) == painter-> device ( )) || 1407 ( qApp-> focusWidget ( ) == painter-> device ( )) ||
1415 ( 1408 (
1416 edit && 1409 edit &&
1417 ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) && 1410 ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
1418 ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( )) 1411 ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ))
1419 ) 1412 )
1420 ) 1413 )
1421 ) { 1414 ) {
1422 isActive = true; 1415 isActive = true;
1423 } 1416 }
1424 1417
1425 bool isMasked = false; 1418 bool isMasked = false;
1426 if(painter->device()->devType() == QInternal::Widget) 1419 if(painter->device()->devType() == QInternal::Widget)
1427 isMasked = ((QWidget*)painter->device())->autoMask(); 1420 isMasked = ((QWidget*)painter->device())->autoMask();
1428 // TODO: Do custom code, don't just call drawRoundButton into a pixmap 1421 // TODO: Do custom code, don't just call drawRoundButton into a pixmap
1429 QPixmap tmpPix(w, h); 1422 QPixmap tmpPix(w, h);
1430 QPainter p(&tmpPix); 1423 QPainter p(&tmpPix);
1431 1424
1432 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, 1425 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
1433 sunken, false, isMasked); 1426 sunken, false, isMasked);
1434 if(!isActive){ 1427 if(!isActive){
1435 p.setClipRect(0, 0, w-17, h); 1428 p.setClipRect(0, 0, w-17, h);
1436 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, 1429 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
1437 sunken, false, isMasked); 1430 sunken, false, isMasked);
1438 } 1431 }
1439 p.end(); 1432 p.end();
1440 int x2 = x+w-1; 1433 int x2 = x+w-1;
1441 int y2 = y+h-1; 1434 int y2 = y+h-1;
1442 int bx2 = btnMaskBmp.width()-1; 1435 int bx2 = btnMaskBmp.width()-1;
1443 int by2 = btnMaskBmp.height()-1; 1436 int by2 = btnMaskBmp.height()-1;
1444 QBitmap btnMask(w, h); 1437 QBitmap btnMask(w, h);
1445 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 1438 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
1446 p.begin(&btnMask); 1439 p.begin(&btnMask);
1447 p.fillRect(0, 0, w, h, Qt::color0); 1440 p.fillRect(0, 0, w, h, Qt::color0);
1448 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 1441 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
1449 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 1442 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
1450 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 1443 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
1451 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 1444 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
1452 // fills 1445 // fills
1453 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 1446 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
1454 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1447 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1455 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 1448 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
1456 p.end(); 1449 p.end();
1457 tmpPix.setMask(btnMask); 1450 tmpPix.setMask(btnMask);
1458 1451
1459 painter->drawPixmap(x, y, tmpPix); 1452 painter->drawPixmap(x, y, tmpPix);
1460 1453
1461 painter->setPen(g.button().dark(120)); 1454 painter->setPen(g.button().dark(120));
1462 painter->drawLine(x2-16, y+1, x2-16, y2-1); 1455 painter->drawLine(x2-16, y+1, x2-16, y2-1);
1463 1456
1464 if(edit){ 1457 if(edit){
1465 painter->setPen(g.mid()); 1458 painter->setPen(g.mid());
1466 painter->drawRect(x+8, y+2, w-25, h-4); 1459 painter->drawRect(x+8, y+2, w-25, h-4);
1467 } 1460 }
1468 int arrow_h = h / 3; 1461 int arrow_h = h / 3;
1469 int arrow_w = arrow_h; 1462 int arrow_w = arrow_h;
1470 int arrow_x = w - arrow_w - 6; 1463 int arrow_x = w - arrow_w - 6;
1471 int arrow_y = (h - arrow_h) / 2; 1464 int arrow_y = (h - arrow_h) / 2;
1472 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true); 1465 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true);
1473} 1466}
1474 1467
1475void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h) 1468void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h)
1476{ 1469{
1477 drawButtonMask(p, x, y, w, h); 1470 drawButtonMask(p, x, y, w, h);
1478} 1471}
1479 1472
1480QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h) 1473QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h)
1481{ 1474{
1482 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6)); 1475 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6));
1483 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); 1476 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6));
1484} 1477}
1485 1478
1486QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) 1479QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/)
1487{ 1480{
1488 return QRect ( ); 1481 return QRect ( );
1489 1482
1490// return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1483// return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1491} 1484}
1492 1485
1493void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, 1486void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
1494 int sliderStart, uint controls, 1487 int sliderStart, uint controls,
1495 uint activeControl) 1488 uint activeControl)
1496{ 1489{
1497 int sliderMin, sliderMax, sliderLength, buttonDim; 1490 int sliderMin, sliderMax, sliderLength, buttonDim;
1498 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1491 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1499 1492
1500 if (sliderStart > sliderMax) 1493 if (sliderStart > sliderMax)
1501 sliderStart = sliderMax; 1494 sliderStart = sliderMax;
1502 1495
1503 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1496 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1504 QColorGroup g = sb->colorGroup(); 1497 QColorGroup g = sb->colorGroup();
1505 QRect addB, subHC, subB; 1498 QRect addB, subHC, subB;
1506 QRect addPageR, subPageR, sliderR; 1499 QRect addPageR, subPageR, sliderR;
1507 int addX, addY, subX, subY; 1500 int addX, addY, subX, subY;
1508 int len = horiz ? sb->width() : sb->height(); 1501 int len = horiz ? sb->width() : sb->height();
1509 int extent = horiz ? sb->height() : sb->width(); 1502 int extent = horiz ? sb->height() : sb->width();
1510 1503
1511 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar 1504 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar
1512 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now. 1505 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now.
1513 bool brokenApp; 1506 bool brokenApp;
1514 if(extent == 16) 1507 if(extent == 16)
1515 brokenApp = true; 1508 brokenApp = true;
1516 else 1509 else
1517 brokenApp = false; 1510 brokenApp = false;
1518 1511
1519 if (horiz) { 1512 if (horiz) {
1520 subY = addY = ( extent - buttonDim ) / 2; 1513 subY = addY = ( extent - buttonDim ) / 2;
1521 subX = 0; 1514 subX = 0;
1522 addX = len - buttonDim; 1515 addX = len - buttonDim;
1523 if(sbBuffer.size() != sb->size()) 1516 if(sbBuffer.size() != sb->size())
1524 sbBuffer.resize(sb->size()); 1517 sbBuffer.resize(sb->size());
1525 } 1518 }
1526 else { 1519 else {
1527 subX = addX = ( extent - buttonDim ) / 2; 1520 subX = addX = ( extent - buttonDim ) / 2;
1528 subY = 0; 1521 subY = 0;
1529 addY = len - buttonDim; 1522 addY = len - buttonDim;
1530 if(sbBuffer.size() != sb->size()) 1523 if(sbBuffer.size() != sb->size())
1531 sbBuffer.resize(sb->size()); 1524 sbBuffer.resize(sb->size());
1532 } 1525 }
1533 subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); 1526 subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
1534 addB.setRect( addX,addY,buttonDim,buttonDim ); 1527 addB.setRect( addX,addY,buttonDim,buttonDim );
1535 if(horiz) 1528 if(horiz)
1536 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); 1529 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
1537 else 1530 else
1538 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim ); 1531 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim );
1539 1532
1540 int sliderEnd = sliderStart + sliderLength; 1533 int sliderEnd = sliderStart + sliderLength;
1541 int sliderW = extent; 1534 int sliderW = extent;
1542 1535
1543 if (horiz) { 1536 if (horiz) {
1544 subPageR.setRect( subB.right() + 1, 0, 1537 subPageR.setRect( subB.right() + 1, 0,
1545 sliderStart - subB.right() - 1 , sliderW ); 1538 sliderStart - subB.right() - 1 , sliderW );
1546 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW ); 1539 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW );
1547 sliderR .setRect( sliderStart, 0, sliderLength, sliderW ); 1540 sliderR .setRect( sliderStart, 0, sliderLength, sliderW );
1548 } 1541 }
1549 else { 1542 else {
1550 subPageR.setRect( 0, subB.bottom() + 1, sliderW, 1543 subPageR.setRect( 0, subB.bottom() + 1, sliderW,
1551 sliderStart - subB.bottom() - 1 ); 1544 sliderStart - subB.bottom() - 1 );
1552 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd); 1545 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd);
1553 sliderR .setRect( 0, sliderStart, sliderW, sliderLength ); 1546 sliderR .setRect( 0, sliderStart, sliderW, sliderLength );
1554 } 1547 }
1555 1548
1556 bool maxed = sb->maxValue() == sb->minValue(); 1549 bool maxed = sb->maxValue() == sb->minValue();
1557 1550
1558 QPainter painter; 1551 QPainter painter;
1559 if(!horiz){ 1552 if(!horiz){
1560 painter.begin(&sbBuffer); 1553 painter.begin(&sbBuffer);
1561 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); 1554 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
1562 if(sliderR.height() >= 8){ 1555 if(sliderR.height() >= 8){
1563 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, 1556 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
1564 13, 8); 1557 13, 8);
1565 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg)); 1558 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg));
1566 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13, 1559 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13,
1567 bgR.height()-16, *getPixmap(VSBSliderMidBg)); 1560 bgR.height()-16, *getPixmap(VSBSliderMidBg));
1568 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix, 1561 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix,
1569 0, 0, 13, 8); 1562 0, 0, 13, 8);
1570 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg)); 1563 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg));
1571 } 1564 }
1572 else{ 1565 else{
1573 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(), 1566 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(),
1574 *getPixmap(VSBSliderMidBg)); 1567 *getPixmap(VSBSliderMidBg));
1575 painter.setPen(g.background().dark(210)); 1568 painter.setPen(g.background().dark(210));
1576 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1); 1569 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1);
1577 painter.setPen(g.mid()); 1570 painter.setPen(g.mid());
1578 painter.drawPoint(bgR.x()+1, bgR.y()); 1571 painter.drawPoint(bgR.x()+1, bgR.y());
1579 painter.drawPoint(bgR.x()+13, bgR.y()); 1572 painter.drawPoint(bgR.x()+13, bgR.y());
1580 painter.drawPoint(bgR.x()+1, bgR.bottom()-1); 1573 painter.drawPoint(bgR.x()+1, bgR.bottom()-1);
1581 painter.drawPoint(bgR.x()+13, bgR.bottom()-1); 1574 painter.drawPoint(bgR.x()+13, bgR.bottom()-1);
1582 } 1575 }
1583 if(controls & Slider){ 1576 if(controls & Slider){
1584 if(sliderR.height() >= 16){ 1577 if(sliderR.height() >= 16){
1585 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop)); 1578 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop));
1586 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, 1579 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13,
1587 sliderR.height()-16, *getPixmap(VSBSliderMid)); 1580 sliderR.height()-16, *getPixmap(VSBSliderMid));
1588 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm)); 1581 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm));
1589 } 1582 }
1590 else if(sliderR.height() >= 8){ 1583 else if(sliderR.height() >= 8){
1591 int m = sliderR.height()/2; 1584 int m = sliderR.height()/2;
1592 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m); 1585 painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m);
1593 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1586 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1594 } 1587 }
1595 else{ 1588 else{
1596 painter.setPen(g.button().dark(210)); 1589 painter.setPen(g.button().dark(210));
1597 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(), 1590 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(),
1598 13, sliderR.height()); 1591 13, sliderR.height());
1599 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, 1592 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1,
1600 11, sliderR.height()-2, 1593 11, sliderR.height()-2,
1601 *getPixmap(VSBSliderMid), 1, 0); 1594 *getPixmap(VSBSliderMid), 1, 0);
1602 } 1595 }
1603 } 1596 }
1604 painter.setPen(g.mid()); 1597 painter.setPen(g.mid());
1605 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom()); 1598 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom());
1606 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom()); 1599 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom());
1607 if(brokenApp && (controls & Slider)){ 1600 if(brokenApp && (controls & Slider)){
1608 painter.setPen(g.background()); 1601 painter.setPen(g.background());
1609 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1, 1602 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1,
1610 bgR.bottom()); 1603 bgR.bottom());
1611 } 1604 }
1612 painter.end(); 1605 painter.end();
1613 } 1606 }
1614 else{ 1607 else{
1615 painter.begin(&sbBuffer); 1608 painter.begin(&sbBuffer);
1616 QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); 1609 QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
1617 if(sliderR.width() >= 8){ 1610 if(sliderR.width() >= 8){
1618 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, 1611 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
1619 8, 13); 1612 8, 13);
1620 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg)); 1613 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg));
1621 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16, 1614 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16,
1622 13, *getPixmap(HSBSliderMidBg)); 1615 13, *getPixmap(HSBSliderMidBg));
1623 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix, 1616 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix,
1624 0, 0, 8, 13); 1617 0, 0, 8, 13);
1625 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg)); 1618 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg));
1626 } 1619 }
1627 else{ 1620 else{
1628 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13, 1621 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13,
1629 *getPixmap(HSBSliderMidBg)); 1622 *getPixmap(HSBSliderMidBg));
1630 painter.setPen(g.background().dark(210)); 1623 painter.setPen(g.background().dark(210));
1631 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13); 1624 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13);
1632 painter.setPen(g.mid()); 1625 painter.setPen(g.mid());
1633 painter.drawPoint(bgR.x(), bgR.y()+1); 1626 painter.drawPoint(bgR.x(), bgR.y()+1);
1634 painter.drawPoint(bgR.x(), bgR.bottom()-1); 1627 painter.drawPoint(bgR.x(), bgR.bottom()-1);
1635 painter.drawPoint(bgR.right()-1, bgR.y()+1); 1628 painter.drawPoint(bgR.right()-1, bgR.y()+1);
1636 painter.drawPoint(bgR.right()-1, bgR.bottom()-1); 1629 painter.drawPoint(bgR.right()-1, bgR.bottom()-1);
1637 } 1630 }
1638 if(controls & Slider){ 1631 if(controls & Slider){
1639 if(sliderR.width() >= 16){ 1632 if(sliderR.width() >= 16){
1640 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1633 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1641 *getPixmap(HSBSliderTop)); 1634 *getPixmap(HSBSliderTop));
1642 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, 1635 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16,
1643 13, *getPixmap(HSBSliderMid)); 1636 13, *getPixmap(HSBSliderMid));
1644 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1637 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1645 *getPixmap(HSBSliderBtm)); 1638 *getPixmap(HSBSliderBtm));
1646 } 1639 }
1647 else if(sliderR.width() >= 8){ 1640 else if(sliderR.width() >= 8){
1648 int m = sliderR.width()/2; 1641 int m = sliderR.width()/2;
1649 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1642 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1650 *getPixmap(HSBSliderTop), 0, 0, m, 13); 1643 *getPixmap(HSBSliderTop), 0, 0, m, 13);
1651 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1644 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1652 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); 1645 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
1653 } 1646 }
1654 else{ 1647 else{
1655 painter.setPen(g.button().dark(210)); 1648 painter.setPen(g.button().dark(210));
1656 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, 1649 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1,
1657 sliderR.width(), 13); 1650 sliderR.width(), 13);
1658 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, 1651 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
1659 sliderR.width()-2, 11, 1652 sliderR.width()-2, 11,
1660 *getPixmap(HSBSliderMid), 0, 1); 1653 *getPixmap(HSBSliderMid), 0, 1);
1661 } 1654 }
1662 } 1655 }
1663 painter.setPen(g.mid()); 1656 painter.setPen(g.mid());
1664 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y()); 1657 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y());
1665 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom()); 1658 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom());
1666 if(brokenApp && (controls & Slider)){ 1659 if(brokenApp && (controls & Slider)){
1667 painter.setPen(g.background()); 1660 painter.setPen(g.background());
1668 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(), 1661 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(),
1669 bgR.bottom()-1); 1662 bgR.bottom()-1);
1670 } 1663 }
1671 painter.end(); 1664 painter.end();
1672 } 1665 }
1673 1666
1674 if ( controls & AddLine ) { 1667 if ( controls & AddLine ) {
1675 drawSBButton(p, addB, g, activeControl == AddLine); 1668 drawSBButton(p, addB, g, activeControl == AddLine);
1676 drawArrow( p, horiz ? RightArrow : DownArrow, 1669 drawArrow( p, horiz ? RightArrow : DownArrow,
1677 false, addB.x()+4, addB.y()+4, 1670 false, addB.x()+4, addB.y()+4,
1678 addB.width()-8, addB.height()-8, g, !maxed); 1671 addB.width()-8, addB.height()-8, g, !maxed);
1679 } 1672 }
1680 if ( controls & SubLine ) { 1673 if ( controls & SubLine ) {
1681 // drawSBButton(p, subB, g, activeControl == SubLine); 1674 // drawSBButton(p, subB, g, activeControl == SubLine);
1682 // drawArrow( p, horiz ? LeftArrow : UpArrow, 1675 // drawArrow( p, horiz ? LeftArrow : UpArrow,
1683 // false, subB.x()+4, subB.y()+4, 1676 // false, subB.x()+4, subB.y()+4,
1684 // subB.width()-8, subB.height()-8, g, !maxed); 1677 // subB.width()-8, subB.height()-8, g, !maxed);
1685 drawSBButton(p, subHC, g, activeControl == SubLine); 1678 drawSBButton(p, subHC, g, activeControl == SubLine);
1686 drawArrow( p, horiz ? LeftArrow : UpArrow, 1679 drawArrow( p, horiz ? LeftArrow : UpArrow,
1687 false, subHC.x()+4, subHC.y()+4, 1680 false, subHC.x()+4, subHC.y()+4,
1688 subHC.width()-8, subHC.height()-8, g, !maxed); 1681 subHC.width()-8, subHC.height()-8, g, !maxed);
1689 } 1682 }
1690 1683
1691 if(controls & AddPage){ 1684 if(controls & AddPage){
1692 if(addPageR.width()){ 1685 if(addPageR.width()){
1693 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer, 1686 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer,
1694 addPageR.x(), addPageR.y(), addPageR.width(), 1687 addPageR.x(), addPageR.y(), addPageR.width(),
1695 addPageR.height()); 1688 addPageR.height());
1696 } 1689 }
1697 } 1690 }
1698 if(controls & SubPage){ 1691 if(controls & SubPage){
1699 if(subPageR.height()){ 1692 if(subPageR.height()){
1700 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer, 1693 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer,
1701 subPageR.x(), subPageR.y(), subPageR.width(), 1694 subPageR.x(), subPageR.y(), subPageR.width(),
1702 subPageR.height()); 1695 subPageR.height());
1703 } 1696 }
1704 } 1697 }
1705 if ( controls & Slider ) { 1698 if ( controls & Slider ) {
1706 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer, 1699 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer,
1707 sliderR.x(), sliderR.y(), sliderR.width(), 1700 sliderR.x(), sliderR.y(), sliderR.width(),
1708 sliderR.height()); 1701 sliderR.height());
1709 } 1702 }
1710} 1703}
1711 1704
1712void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, 1705void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
1713 bool down, bool /*fast*/) 1706 bool down, bool /*fast*/)
1714{ 1707{
1715 p->setPen(g.mid()); 1708 p->setPen(g.mid());
1716 p->drawRect(r); 1709 p->drawRect(r);
1717 QColor c(down ? g.button() : g.background()); 1710 QColor c(down ? g.button() : g.background());
1718 QPixmap *pix = bevelFillDict.find(c.rgb()); 1711 QPixmap *pix = bevelFillDict.find(c.rgb());
1719 if(!pix){ 1712 if(!pix){
1720 int h, s, v; 1713 int h, s, v;
1721 c.hsv(&h, &s, &v); 1714 c.hsv(&h, &s, &v);
1722 pix = new QPixmap(*bevelFillPix); 1715 pix = new QPixmap(*bevelFillPix);
1723 adjustHSV(*pix, h, s, v); 1716 adjustHSV(*pix, h, s, v);
1724 bevelFillDict.insert(c.rgb(), pix); 1717 bevelFillDict.insert(c.rgb(), pix);
1725 } 1718 }
1726 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1719 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1727 1720
1728} 1721}
1729 1722
1730void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, 1723void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g,
1731 bool horiz) 1724 bool horiz)
1732{ 1725{
1733 if(horiz){ 1726 if(horiz){
1734 if(r.width() >= 15){ 1727 if(r.width() >= 15){
1735 int y = r.y()+3; 1728 int y = r.y()+3;
1736 int x = r.x() + (r.width()-7)/2; 1729 int x = r.x() + (r.width()-7)/2;
1737 int y2 = r.bottom()-3; 1730 int y2 = r.bottom()-3;
1738 p->setPen(g.light()); 1731 p->setPen(g.light());
1739 p->drawLine(x, y, x, y2); 1732 p->drawLine(x, y, x, y2);
1740 p->drawLine(x+3, y, x+3, y2); 1733 p->drawLine(x+3, y, x+3, y2);
1741 p->drawLine(x+6, y, x+6, y2); 1734 p->drawLine(x+6, y, x+6, y2);
1742 1735
1743 p->setPen(g.mid()); 1736 p->setPen(g.mid());
1744 p->drawLine(x+1, y, x+1, y2); 1737 p->drawLine(x+1, y, x+1, y2);
1745 p->drawLine(x+4, y, x+4, y2); 1738 p->drawLine(x+4, y, x+4, y2);
1746 p->drawLine(x+7, y, x+7, y2); 1739 p->drawLine(x+7, y, x+7, y2);
1747 } 1740 }
1748 } 1741 }
1749 else{ 1742 else{
1750 if(r.height() >= 15){ 1743 if(r.height() >= 15){
1751 int x = r.x()+3; 1744 int x = r.x()+3;
1752 int y = r.y() + (r.height()-7)/2; 1745 int y = r.y() + (r.height()-7)/2;
1753 int x2 = r.right()-3; 1746 int x2 = r.right()-3;
1754 p->setPen(g.light()); 1747 p->setPen(g.light());
1755 p->drawLine(x, y, x2, y); 1748 p->drawLine(x, y, x2, y);
1756 p->drawLine(x, y+3, x2, y+3); 1749 p->drawLine(x, y+3, x2, y+3);
1757 p->drawLine(x, y+6, x2, y+6); 1750 p->drawLine(x, y+6, x2, y+6);
1758 1751
1759 p->setPen(g.mid()); 1752 p->setPen(g.mid());
1760 p->drawLine(x, y+1, x2, y+1); 1753 p->drawLine(x, y+1, x2, y+1);
1761 p->drawLine(x, y+4, x2, y+4); 1754 p->drawLine(x, y+4, x2, y+4);
1762 p->drawLine(x, y+7, x2, y+7); 1755 p->drawLine(x, y+7, x2, y+7);
1763 } 1756 }
1764 } 1757 }
1765 1758
1766} 1759}
1767 1760
1768 1761
1769void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin, 1762void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin,
1770 int &sliderMax, int &sliderLength, 1763 int &sliderMax, int &sliderLength,
1771 int &buttonDim) 1764 int &buttonDim)
1772{ 1765{
1773 1766
1774 int maxLength; 1767 int maxLength;
1775 int b = 0; 1768 int b = 0;
1776 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1769 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1777 int length = horiz ? sb->width() : sb->height(); 1770 int length = horiz ? sb->width() : sb->height();
1778 int extent = horiz ? sb->height() : sb->width(); 1771 int extent = horiz ? sb->height() : sb->width();
1779 1772
1780 if ( length > ( extent - b*2 - 1 )*2 + b*2 ) 1773 if ( length > ( extent - b*2 - 1 )*2 + b*2 )
1781 buttonDim = extent - b*2; 1774 buttonDim = extent - b*2;
1782 else 1775 else
1783 buttonDim = ( length - b*2 )/2 - 1; 1776 buttonDim = ( length - b*2 )/2 - 1;
1784 1777
1785 sliderMin = b + 0; // buttonDim; 1778 sliderMin = b + 0; // buttonDim;
1786 maxLength = length - b*2 - buttonDim*2; // 3; 1779 maxLength = length - b*2 - buttonDim*2; // 3;
1787 1780
1788 if ( sb->maxValue() == sb->minValue() ) { 1781 if ( sb->maxValue() == sb->minValue() ) {
1789 sliderLength = maxLength; 1782 sliderLength = maxLength;
1790 } else { 1783 } else {
1791 sliderLength = (sb->pageStep()*maxLength)/ 1784 sliderLength = (sb->pageStep()*maxLength)/
1792 (sb->maxValue()-sb->minValue()+sb->pageStep()); 1785 (sb->maxValue()-sb->minValue()+sb->pageStep());
1793 uint range = sb->maxValue()-sb->minValue(); 1786 uint range = sb->maxValue()-sb->minValue();
1794 if ( sliderLength < 9 || range > INT_MAX/2 ) 1787 if ( sliderLength < 9 || range > INT_MAX/2 )
1795 sliderLength = 9; 1788 sliderLength = 9;
1796 if ( sliderLength > maxLength ) 1789 if ( sliderLength > maxLength )
1797 sliderLength = maxLength; 1790 sliderLength = maxLength;
1798 } 1791 }
1799 sliderMax = sliderMin + maxLength - sliderLength; 1792 sliderMax = sliderMin + maxLength - sliderLength;
1800 1793
1801} 1794}
1802 1795
1803QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb, 1796QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb,
1804 int sliderStart, 1797 int sliderStart,
1805 const QPoint &p) 1798 const QPoint &p)
1806{ 1799{
1807 if ( !sb->rect().contains( p ) ) 1800 if ( !sb->rect().contains( p ) )
1808 return NoScroll; 1801 return NoScroll;
1809 int sliderMin, sliderMax, sliderLength, buttonDim, pos; 1802 int sliderMin, sliderMax, sliderLength, buttonDim, pos;
1810 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1803 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1811 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y(); 1804 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y();
1812 if ( pos < sliderMin ) 1805 if ( pos < sliderMin )
1813 return SubLine; 1806 return SubLine;
1814 if ( pos < sliderStart ) 1807 if ( pos < sliderStart )
1815 return SubPage; 1808 return SubPage;
1816 if ( pos < sliderStart + sliderLength ) 1809 if ( pos < sliderStart + sliderLength )
1817 return Slider; 1810 return Slider;
1818 if ( pos < sliderMax + sliderLength) 1811 if ( pos < sliderMax + sliderLength)
1819 return AddPage; 1812 return AddPage;
1820 if(pos > sliderMax + sliderLength + 16) 1813 if(pos > sliderMax + sliderLength + 16)
1821 return AddLine; 1814 return AddLine;
1822 1815
1823 return SubLine; 1816 return SubLine;
1824} 1817}
1825 1818
1826#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1819#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1827 1820
1828 1821
1829QSize LiquidStyle::exclusiveIndicatorSize() const 1822QSize LiquidStyle::exclusiveIndicatorSize() const
1830{ 1823{
1831 return(QSize(16, 16)); 1824 return(QSize(16, 16));
1832} 1825}
1833 1826
1834void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, 1827void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
1835 int /*h*/, const QColorGroup &/*g*/, bool on, 1828 int /*h*/, const QColorGroup &/*g*/, bool on,
1836 bool down, bool) 1829 bool down, bool)
1837{ 1830{
1838 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1831 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1839 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1832 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1840 && ((QWidget*)p->device())->autoMask(); 1833 && ((QWidget*)p->device())->autoMask();
1841 1834
1842 if(isMasked){ 1835 if(isMasked){
1843 if(on || down){ 1836 if(on || down){
1844 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) : 1837 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) :
1845 *getPixmap(HTMLRadioDown)); 1838 *getPixmap(HTMLRadioDown));
1846 } 1839 }
1847 else 1840 else
1848 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) : 1841 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) :
1849 *getPixmap(HTMLRadio)); 1842 *getPixmap(HTMLRadio));
1850 1843
1851 } 1844 }
1852 else{ 1845 else{
1853 if(on || down){ 1846 if(on || down){
1854 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) : 1847 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) :
1855 *getPixmap(RadioOn)); 1848 *getPixmap(RadioOn));
1856 } 1849 }
1857 else 1850 else
1858 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) : 1851 p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) :
1859 *getPixmap(RadioOff)); 1852 *getPixmap(RadioOff));
1860 } 1853 }
1861} 1854}
1862 1855
1863void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, 1856void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w,
1864 int h, bool) 1857 int h, bool)
1865{ 1858{
1866 p->fillRect(x, y, w, h, Qt::color0); 1859 p->fillRect(x, y, w, h, Qt::color0);
1867 p->setPen(Qt::color1); 1860 p->setPen(Qt::color1);
1868 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask()); 1861 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask());
1869} 1862}
1870 1863
1871 1864
1872QSize LiquidStyle::indicatorSize() const 1865QSize LiquidStyle::indicatorSize() const
1873{ 1866{
1874 return(QSize(20, 22)); 1867 return(QSize(20, 22));
1875} 1868}
1876 1869
1877void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1870void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1878 const QColorGroup &/*g*/, int state, bool /*down*/, bool) 1871 const QColorGroup &/*g*/, int state, bool /*down*/, bool)
1879{ 1872{
1880 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1873 bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1881 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1874 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1882 && ((QWidget*)p->device())->autoMask(); 1875 && ((QWidget*)p->device())->autoMask();
1883 if(isMasked){ 1876 if(isMasked){
1884 if(state != QButton::Off){ 1877 if(state != QButton::Off){
1885 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) : 1878 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) :
1886 *getPixmap(HTMLCBDown)); 1879 *getPixmap(HTMLCBDown));
1887 } 1880 }
1888 else 1881 else
1889 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) : 1882 p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) :
1890 *getPixmap(HTMLCB)); 1883 *getPixmap(HTMLCB));
1891 1884
1892 } 1885 }
1893 else{ 1886 else{
1894 if(state != QButton::Off){ 1887 if(state != QButton::Off){
1895 p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) : 1888 p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) :
1896 *getPixmap(CBDown)); 1889 *getPixmap(CBDown));
1897 /* Todo - tristate 1890 /* Todo - tristate
1898 if(state == QButton::On){ 1891 if(state == QButton::On){
1899 p->setPen(Qt::black); 1892 p->setPen(Qt::black);
1900 p->drawPixmap(3, 3, xBmp); 1893 p->drawPixmap(3, 3, xBmp);
1901 } 1894 }
1902 else{ 1895 else{
1903 p->setPen(g.dark()); 1896 p->setPen(g.dark());
1904 p->drawRect(x+2, y+2, w-4, h-4); 1897 p->drawRect(x+2, y+2, w-4, h-4);
1905 p->setPen(Qt::black); 1898 p->setPen(Qt::black);
1906 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); 1899 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2);
1907 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); 1900 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2);
1908 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); 1901 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2);
1909 }*/ 1902 }*/
1910 } 1903 }
1911 else 1904 else
1912 p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB)); 1905 p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB));
1913 } 1906 }
1914} 1907}
1915 1908
1916void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1909void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1917 int /*state*/) 1910 int /*state*/)
1918{ 1911{
1919 // needed for some reason by KHtml, even tho it's all filled ;P 1912 // needed for some reason by KHtml, even tho it's all filled ;P
1920 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 1913 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
1921 1914
1922} 1915}
1923 1916
1924void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 1917void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
1925 const QColorGroup &/*g*/, Orientation orient, 1918 const QColorGroup &/*g*/, Orientation orient,
1926 bool, bool) 1919 bool, bool)
1927{ 1920{
1928 QWidget *parent = (QWidget *)p->device(); 1921 QWidget *parent = (QWidget *)p->device();
1929 p->setBrushOrigin(parent->pos()); 1922 p->setBrushOrigin(parent->pos());
1930 parent->erase(x, y, w, h); 1923 parent->erase(x, y, w, h);
1931 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1924 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1932 *getPixmap(VSlider)); 1925 *getPixmap(VSlider));
1933} 1926}
1934 1927
1935void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1928void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1936 Orientation orient, bool, bool) 1929 Orientation orient, bool, bool)
1937{ 1930{
1938 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1931 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1939 *getPixmap(VSlider)->mask()); 1932 *getPixmap(VSlider)->mask());
1940} 1933}
1941 1934
1942int LiquidStyle::sliderLength() const 1935int LiquidStyle::sliderLength() const
1943{ 1936{
1944 return(10); 1937 return(10);
1945} 1938}
1946 1939
1947#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1940#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1948 1941
1949void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, 1942void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x,
1950 int y, int w, int h, const QColorGroup &g, 1943 int y, int w, int h, const QColorGroup &g,
1951 bool enabled, const QBrush *) 1944 bool enabled, const QBrush *)
1952{ 1945{
1953 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}; 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};
1954 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}; 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};
1955 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}; 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};
1956 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}; 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};
1957 1950
1958 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); 1951 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid());
1959 if(w > 8){ 1952 if(w > 8){
1960 x = x + (w-8)/2; 1953 x = x + (w-8)/2;
1961 y = y + (h-8)/2; 1954 y = y + (h-8)/2;
1962 } 1955 }
1963 1956
1964 QPointArray a; 1957 QPointArray a;
1965 switch(type){ 1958 switch(type){
1966 case Qt::UpArrow: 1959 case Qt::UpArrow:
1967 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); 1960 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow);
1968 break; 1961 break;
1969 case Qt::DownArrow: 1962 case Qt::DownArrow:
1970 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); 1963 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow);
1971 break; 1964 break;
1972 case Qt::LeftArrow: 1965 case Qt::LeftArrow:
1973 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); 1966 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow);
1974 break; 1967 break;
1975 default: 1968 default:
1976 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); 1969 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow);
1977 break; 1970 break;
1978 } 1971 }
1979 1972
1980 a.translate(x, y); 1973 a.translate(x, y);
1981 p->drawLineSegments(a); 1974 p->drawLineSegments(a);
1982} 1975}
1983 1976
1984 1977
1985void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 1978void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1986 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 1979 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
1987 { 1980 {
1988 if(active){ 1981 if(active){
1989 x -= 2; // Bug in Qt/E 1982 x -= 2; // Bug in Qt/E
1990 y -= 2; 1983 y -= 2;
1991 w += 2; 1984 w += 2;
1992 h += 2; 1985 h += 2;
1993 } 1986 }
1994 1987
1995 QWidget *parent = (QWidget *)p->device(); 1988 QWidget *parent = (QWidget *)p->device();
1996 p->setBrushOrigin(parent->pos()); 1989 p->setBrushOrigin(parent->pos());
1997 parent->erase(x, y, w, h); 1990 parent->erase(x, y, w, h);
1998 1991
1999 if(menuHandler->useShadowText()){ 1992 if(menuHandler->useShadowText()){
2000 QColor shadow; 1993 QColor shadow;
2001 if(p->device() && p->device()->devType() == QInternal::Widget && 1994 if(p->device() && p->device()->devType() == QInternal::Widget &&
2002 ((QWidget *)p->device())->inherits("QMenuBar")){ 1995 ((QWidget *)p->device())->inherits("QMenuBar")){
2003 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1996 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
2004 g.background().dark(130); 1997 g.background().dark(130);
2005 } 1998 }
2006 else 1999 else
2007 shadow = g.background().dark(130); 2000 shadow = g.background().dark(130);
2008 2001
2009 QPixmap *dummy = 0; 2002 QPixmap *dummy = 0;
2010 2003
2011 if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { 2004 if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) {
2012 dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); 2005 dummy = new QPixmap ( mi-> pixmap ( )-> size ( ));
2013 QBitmap dummy_mask ( dummy-> size ( )); 2006 QBitmap dummy_mask ( dummy-> size ( ));
2014 dummy_mask. fill ( color1 ); 2007 dummy_mask. fill ( color1 );
2015 dummy-> setMask ( dummy_mask ); 2008 dummy-> setMask ( dummy_mask );
2016 } 2009 }
2017 2010
2018 if(active){ 2011 if(active){
2019 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2012 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2020 QApplication::style().drawItem(p, x+1, y+1, w, h, 2013 QApplication::style().drawItem(p, x+1, y+1, w, h,
2021 AlignCenter|ShowPrefix|DontClip|SingleLine, 2014 AlignCenter|ShowPrefix|DontClip|SingleLine,
2022 g, mi->isEnabled(), dummy, mi->text(), 2015 g, mi->isEnabled(), dummy, mi->text(),
2023 -1, &shadow); 2016 -1, &shadow);
2024 QApplication::style().drawItem(p, x, y, w, h, 2017 QApplication::style().drawItem(p, x, y, w, h,
2025 AlignCenter|ShowPrefix|DontClip|SingleLine, 2018 AlignCenter|ShowPrefix|DontClip|SingleLine,
2026 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 2019 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2027 -1, &g.text()); 2020 -1, &g.text());
2028 } 2021 }
2029 else{ 2022 else{
2030 QApplication::style().drawItem(p, x+1, y+1, w, h, 2023 QApplication::style().drawItem(p, x+1, y+1, w, h,
2031 AlignCenter|ShowPrefix|DontClip|SingleLine, 2024 AlignCenter|ShowPrefix|DontClip|SingleLine,
2032 g, mi->isEnabled(), dummy, mi->text(), 2025 g, mi->isEnabled(), dummy, mi->text(),
2033 -1, &shadow); 2026 -1, &shadow);
2034 QApplication::style().drawItem(p, x, y, w, h, 2027 QApplication::style().drawItem(p, x, y, w, h,
2035 AlignCenter|ShowPrefix|DontClip|SingleLine, 2028 AlignCenter|ShowPrefix|DontClip|SingleLine,
2036 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 2029 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2037 -1, &g.text()); 2030 -1, &g.text());
2038 } 2031 }
2039 delete dummy; 2032 delete dummy;
2040 } 2033 }
2041 else{ 2034 else{
2042 if(active) 2035 if(active)
2043 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2036 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2044 QApplication::style().drawItem(p, x, y, w, h, 2037 QApplication::style().drawItem(p, x, y, w, h,
2045 AlignCenter|ShowPrefix|DontClip|SingleLine, 2038 AlignCenter|ShowPrefix|DontClip|SingleLine,
2046 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 2039 g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
2047 -1, &g.text()); 2040 -1, &g.text());
2048 } 2041 }
2049} 2042}
2050 2043
2051void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 2044void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
2052 const QColorGroup &g, int /*lineWidth*/, 2045 const QColorGroup &g, int /*lineWidth*/,
2053 const QBrush * /*fill*/) 2046 const QBrush * /*fill*/)
2054{ 2047{
2055 QColor c; 2048 QColor c;
2056 switch(menuHandler->transType()){ 2049 switch(menuHandler->transType()){
2057 case None: 2050 case None:
2058 case StippledBg: 2051 case StippledBg:
2059 case TransStippleBg: 2052 case TransStippleBg:
2060 c = g.background(); 2053 c = g.background();
2061 break; 2054 break;
2062 case StippledBtn: 2055 case StippledBtn:
2063 case TransStippleBtn: 2056 case TransStippleBtn:
2064 c = g.button(); 2057 c = g.button();
2065 break; 2058 break;
2066 default: 2059 default:
2067 c = menuHandler->bgColor(); 2060 c = menuHandler->bgColor();
2068 } 2061 }
2069 p->setPen(c.dark(140)); 2062 p->setPen(c.dark(140));
2070 p->drawRect(x, y, w, h); 2063 p->drawRect(x, y, w, h);
2071 p->setPen(c.light(120)); 2064 p->setPen(c.light(120));
2072 p->drawRect(x+1, y+1, w-2, h-2); 2065 p->drawRect(x+1, y+1, w-2, h-2);
2073} 2066}
2074 2067
2075void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, 2068void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw,
2076 int tab, QMenuItem* mi, 2069 int tab, QMenuItem* mi,
2077 const QPalette& pal, bool act, 2070 const QPalette& pal, bool act,
2078 bool enabled, int x, int y, int w, int h) 2071 bool enabled, int x, int y, int w, int h)
2079{ 2072{
2080static const int motifItemFrame = 2; 2073static const int motifItemFrame = 2;
2081static const int motifItemHMargin = 3; 2074static const int motifItemHMargin = 3;
2082static const int motifItemVMargin = 2; 2075static const int motifItemVMargin = 2;
2083static const int motifArrowHMargin = 6; 2076static const int motifArrowHMargin = 6;
2084static const int windowsRightBorder = 12; 2077static const int windowsRightBorder = 12;
2085 2078
2086 maxpmw = QMAX( maxpmw, 20 ); 2079 maxpmw = QMAX( maxpmw, 20 );
2087 2080
2088 2081
2089 bool dis = !enabled; 2082 bool dis = !enabled;
2090 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 2083 QColorGroup itemg = dis ? pal.disabled() : pal.active();
2091 2084
2092 int checkcol = maxpmw; 2085 int checkcol = maxpmw;
2093 if(act){ 2086 if(act){
2094 2087
2095 // FIXME 2088 // FIXME
2096 drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background()); 2089 drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background());
2097 } 2090 }
2098 //else if(((QWidget*)p->device())->backgroundPixmap()){ 2091 //else if(((QWidget*)p->device())->backgroundPixmap()){
2099 // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(), 2092 // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(),
2100 // x, y, w, h); 2093 // x, y, w, h);
2101 //} 2094 //}
2102 else{ 2095 else{
2103 if(menuHandler->transType() == None){ 2096 if(menuHandler->transType() == None){
2104 p->fillRect(x, y, w, h, pal.active().background()); 2097 p->fillRect(x, y, w, h, pal.active().background());
2105 } 2098 }
2106 else if(menuHandler->transType() == StippledBg){ 2099 else if(menuHandler->transType() == StippledBg){
2107 p->fillRect(x, y, w, h, bgBrush); 2100 p->fillRect(x, y, w, h, bgBrush);
2108 } 2101 }
2109 else if(menuHandler->transType() == StippledBtn){ 2102 else if(menuHandler->transType() == StippledBtn){
2110 p->fillRect(x, y, w, h, menuBrush); 2103 p->fillRect(x, y, w, h, menuBrush);
2111 } 2104 }
2112 else{ 2105 else{
2113 QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 2106 QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
2114 if(pix) 2107 if(pix)
2115 p->drawPixmap(x, y, *pix, x, y, w, h); 2108 p->drawPixmap(x, y, *pix, x, y, w, h);
2116 } 2109 }
2117 } 2110 }
2118 2111
2119 if(!mi) 2112 if(!mi)
2120 return; 2113 return;
2121 2114
2122 QColor discol; 2115 QColor discol;
2123 if (dis) { 2116 if (dis) {
2124 discol = itemg.mid(); 2117 discol = itemg.mid();
2125 p->setPen(discol); 2118 p->setPen(discol);
2126 } 2119 }
2127 2120
2128 QColorGroup cg2(itemg); 2121 QColorGroup cg2(itemg);
2129 2122
2130 if(menuHandler->transType() == Custom){ 2123 if(menuHandler->transType() == Custom){
2131 cg2.setColor(QColorGroup::Foreground, menuHandler->textColor()); 2124 cg2.setColor(QColorGroup::Foreground, menuHandler->textColor());
2132 cg2.setColor(QColorGroup::Text, menuHandler->textColor()); 2125 cg2.setColor(QColorGroup::Text, menuHandler->textColor());
2133 cg2.setColor(QColorGroup::Light, menuHandler->textColor().light(120)); 2126 cg2.setColor(QColorGroup::Light, menuHandler->textColor().light(120));
2134 cg2.setColor(QColorGroup::Mid, menuHandler->textColor().dark(120)); 2127 cg2.setColor(QColorGroup::Mid, menuHandler->textColor().dark(120));
2135 } 2128 }
2136 else{ 2129 else{
2137 cg2 = QColorGroup(discol, itemg.highlight(), black, black, 2130 cg2 = QColorGroup(discol, itemg.highlight(), black, black,
2138 dis ? discol : black, discol, black); 2131 dis ? discol : black, discol, black);
2139 } 2132 }
2140 2133
2141 if(mi->isSeparator()){ 2134 if(mi->isSeparator()){
2142 QColor c; 2135 QColor c;
2143 switch(menuHandler->transType()){ 2136 switch(menuHandler->transType()){
2144 case None: 2137 case None:
2145 case StippledBg: 2138 case StippledBg:
2146 case TransStippleBg: 2139 case TransStippleBg:
2147 c = QApplication::palette().active().background(); 2140 c = QApplication::palette().active().background();
2148 break; 2141 break;
2149 case StippledBtn: 2142 case StippledBtn:
2150 case TransStippleBtn: 2143 case TransStippleBtn:
2151 c = QApplication::palette().active().button(); 2144 c = QApplication::palette().active().button();
2152 break; 2145 break;
2153 default: 2146 default:
2154 c = menuHandler->bgColor(); 2147 c = menuHandler->bgColor();
2155 } 2148 }
2156 p->setPen(c.dark(140)); 2149 p->setPen(c.dark(140));
2157 p->drawLine(x, y, x+w, y ); 2150 p->drawLine(x, y, x+w, y );
2158 p->setPen(c.light(115)); 2151 p->setPen(c.light(115));
2159 p->drawLine(x, y+1, x+w, y+1 ); 2152 p->drawLine(x, y+1, x+w, y+1 );
2160 return; 2153 return;
2161 } 2154 }
2162 if(mi->iconSet()) { 2155 if(mi->iconSet()) {
2163 QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal; 2156 QIconSet::Mode mode = dis? QIconSet::Disabled : QIconSet::Normal;
2164 if (!dis) 2157 if (!dis)
2165 mode = QIconSet::Active; 2158 mode = QIconSet::Active;
2166 QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode); 2159 QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode);
2167 int pixw = pixmap.width(); 2160 int pixw = pixmap.width();
2168 int pixh = pixmap.height(); 2161 int pixh = pixmap.height();
2169 QRect cr(x, y, checkcol, h); 2162 QRect cr(x, y, checkcol, h);
2170 QRect pmr(0, 0, pixw, pixh); 2163 QRect pmr(0, 0, pixw, pixh);
2171 pmr.moveCenter( cr.center() ); 2164 pmr.moveCenter( cr.center() );
2172 p->setPen(itemg.highlightedText()); 2165 p->setPen(itemg.highlightedText());
2173 p->drawPixmap(pmr.topLeft(), pixmap ); 2166 p->drawPixmap(pmr.topLeft(), pixmap );
2174 2167
2175 } 2168 }
2176 else if(checkable) { 2169 else if(checkable) {
2177 int mw = checkcol + motifItemFrame; 2170 int mw = checkcol + motifItemFrame;
2178 int mh = h - 2*motifItemFrame; 2171 int mh = h - 2*motifItemFrame;
2179 if (mi->isChecked()){ 2172 if (mi->isChecked()){
2180 drawCheckMark( p, x + motifItemFrame, 2173 drawCheckMark( p, x + motifItemFrame,
2181 y+motifItemFrame, mw, mh, cg2, act, dis ); 2174 y+motifItemFrame, mw, mh, cg2, act, dis );
2182 } 2175 }
2183 } 2176 }
2184 if(menuHandler->transType() == Custom) 2177 if(menuHandler->transType() == Custom)
2185 p->setPen(menuHandler->textColor()); 2178 p->setPen(menuHandler->textColor());
2186 else 2179 else
2187 p->setPen(itemg.text()); 2180 p->setPen(itemg.text());
2188 2181
2189 2182
2190 int xm = motifItemFrame + checkcol + motifItemHMargin; 2183 int xm = motifItemFrame + checkcol + motifItemHMargin;
2191 QString s = mi->text(); 2184 QString s = mi->text();
2192 if (!s.isNull()) { 2185 if (!s.isNull()) {
2193 int t = s.find( '\t' ); 2186 int t = s.find( '\t' );
2194 int m = motifItemVMargin; 2187 int m = motifItemVMargin;
2195 const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; 2188 const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
2196 QPen oldPen = p->pen(); 2189 QPen oldPen = p->pen();
2197 if(menuHandler->useShadowText()){ 2190 if(menuHandler->useShadowText()){
2198 if(menuHandler->transType() == Custom) 2191 if(menuHandler->transType() == Custom)
2199 p->setPen(menuHandler->bgColor().dark(130)); 2192 p->setPen(menuHandler->bgColor().dark(130));
2200 else if(menuHandler->transType() == StippledBtn || 2193 else if(menuHandler->transType() == StippledBtn ||
2201 menuHandler->transType() == TransStippleBtn) 2194 menuHandler->transType() == TransStippleBtn)
2202 p->setPen(itemg.button().dark(130)); 2195 p->setPen(itemg.button().dark(130));
2203 else 2196 else
2204 p->setPen(bgBrush.color().dark(130)); 2197 p->setPen(bgBrush.color().dark(130));
2205 2198
2206 if (t >= 0) { 2199 if (t >= 0) {
2207 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+2, 2200 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+2,
2208 y+m+2, tab-1, h-2*m-1, text_flags, s.mid( t+1 )); 2201 y+m+2, tab-1, h-2*m-1, text_flags, s.mid( t+1 ));
2209 } 2202 }
2210 p->drawText(x+xm+1, y+m+1, w-xm-tab, h-2*m-1, text_flags, s, t); 2203 p->drawText(x+xm+1, y+m+1, w-xm-tab, h-2*m-1, text_flags, s, t);
2211 } 2204 }
2212 p->setPen(oldPen); 2205 p->setPen(oldPen);
2213 if (t >= 0) { 2206 if (t >= 0) {
2214 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, 2207 p->drawText(x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1,
2215 y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); 2208 y+m+1, tab, h-2*m, text_flags, s.mid( t+1 ));
2216 } 2209 }
2217 p->drawText(x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t); 2210 p->drawText(x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t);
2218 2211
2219 } 2212 }
2220 else if (mi->pixmap()) { 2213 else if (mi->pixmap()) {
2221 QPixmap *pixmap = mi->pixmap(); 2214 QPixmap *pixmap = mi->pixmap();
2222 if (pixmap->depth() == 1) 2215 if (pixmap->depth() == 1)
2223 p->setBackgroundMode(OpaqueMode); 2216 p->setBackgroundMode(OpaqueMode);
2224 p->drawPixmap( x+xm, y+motifItemFrame, *pixmap); 2217 p->drawPixmap( x+xm, y+motifItemFrame, *pixmap);
2225 if (pixmap->depth() == 1) 2218 if (pixmap->depth() == 1)
2226 p->setBackgroundMode(TransparentMode); 2219 p->setBackgroundMode(TransparentMode);
2227 } 2220 }
2228 if (mi->popup()) { 2221 if (mi->popup()) {
2229 int dim = (h-2*motifItemFrame) / 2; 2222 int dim = (h-2*motifItemFrame) / 2;
2230 drawArrow(p, RightArrow, true, 2223 drawArrow(p, RightArrow, true,
2231 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2, 2224 x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2,
2232 dim, dim, cg2, TRUE); 2225 dim, dim, cg2, TRUE);
2233 } 2226 }
2234} 2227}
2235 2228
2236int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi, 2229int LiquidStyle::popupMenuItemHeight(bool /*checkable*/, QMenuItem *mi,
2237 const QFontMetrics &fm) 2230 const QFontMetrics &fm)
2238{ 2231{
2239 if (mi->isSeparator()) 2232 if (mi->isSeparator())
2240 return 2; 2233 return 2;
2241 2234
2242 int h = 0; 2235 int h = 0;
2243 if (mi->pixmap()) 2236 if (mi->pixmap())
2244 h = mi->pixmap()->height(); 2237 h = mi->pixmap()->height();
2245 2238
2246 if (mi->iconSet()) 2239 if (mi->iconSet())
2247 h = QMAX(mi->iconSet()-> 2240 h = QMAX(mi->iconSet()->
2248 pixmap(QIconSet::Small, QIconSet::Normal).height(), h); 2241 pixmap(QIconSet::Small, QIconSet::Normal).height(), h);
2249 2242
2250 h = QMAX(fm.height() + 4, h); 2243 h = QMAX(fm.height() + 4, h);
2251 2244
2252 // we want a minimum size of 18 2245 // we want a minimum size of 18
2253 h = QMAX(h, 18); 2246 h = QMAX(h, 18);
2254 2247
2255 return h; 2248 return h;
2256} 2249}
2257 2250
2258 2251
2259void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, 2252void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r,
2260 const QColorGroup &g, const QColor *c, 2253 const QColorGroup &g, const QColor *c,
2261 bool atBorder) 2254 bool atBorder)
2262{ 2255{
2263 // are we painting a widget? 2256 // are we painting a widget?
2264 if(p->device()->devType() == QInternal::Widget){ 2257 if(p->device()->devType() == QInternal::Widget){
2265 // if so does it use a special focus rectangle? 2258 // if so does it use a special focus rectangle?
2266 QWidget *w = (QWidget *)p->device(); 2259 QWidget *w = (QWidget *)p->device();
2267 if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ 2260 if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){
2268 return; 2261 return;
2269 } 2262 }
2270 else{ 2263 else{
2271 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 2264 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
2272 } 2265 }
2273 } 2266 }
2274 else 2267 else
2275 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 2268 QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
2276 2269
2277} 2270}
2278 2271
2279void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) 2272void LiquidStyle::polishPopupMenu(QPopupMenu *mnu)
2280{ 2273{
2281 mnu->installEventFilter(menuHandler); 2274 mnu->installEventFilter(menuHandler);
2282 QWindowsStyle::polishPopupMenu(mnu); 2275 QWindowsStyle::polishPopupMenu(mnu);
2283} 2276}
2284 2277
2285void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, 2278void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
2286 bool selected) 2279 bool selected)
2287{ 2280{
2288 if(tabBar->shape() != QTabBar::RoundedAbove){ 2281 if(tabBar->shape() != QTabBar::RoundedAbove){
2289 QWindowsStyle::drawTab(p, tabBar, tab, selected); 2282 QWindowsStyle::drawTab(p, tabBar, tab, selected);
2290 return; 2283 return;
2291 } 2284 }
2292 QPixmap tilePix; 2285 QPixmap tilePix;
2293 QRect r = tab->rect(); 2286 QRect r = tab->rect();
2294 //QPixmap *pix = selected ? tabBar->hasFocus() ? pixmaps[TabFocus] : 2287 //QPixmap *pix = selected ? tabBar->hasFocus() ? pixmaps[TabFocus] :
2295 // pixmaps[TabDown] : pixmaps[Tab]; 2288 // pixmaps[TabDown] : pixmaps[Tab];
2296 2289
2297 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab); 2290 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab);
2298 p->drawPixmap(r.x(), r.y(), *pix, 0, 0, 9, r.height()); 2291 p->drawPixmap(r.x(), r.y(), *pix, 0, 0, 9, r.height());
2299 p->drawPixmap(r.right()-9, r.y(), *pix, pix->width()-9, 0, 9, r.height()); 2292 p->drawPixmap(r.right()-9, r.y(), *pix, pix->width()-9, 0, 9, r.height());
2300 tilePix.resize(pix->width()-18, r.height()); 2293 tilePix.resize(pix->width()-18, r.height());
2301 bitBlt(&tilePix, 0, 0, pix, 9, 0, pix->width()-18, r.height()); 2294 bitBlt(&tilePix, 0, 0, pix, 9, 0, pix->width()-18, r.height());
2302 p->drawTiledPixmap(r.x()+9, r.y(), r.width()-18, r.height(), tilePix); 2295 p->drawTiledPixmap(r.x()+9, r.y(), r.width()-18, r.height(), tilePix);
2303 QColor c = tabBar->colorGroup().button(); 2296 QColor c = tabBar->colorGroup().button();
2304 if(!selected){ 2297 if(!selected){
2305 p->setPen(c.dark(130)); 2298 p->setPen(c.dark(130));
2306 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom()); 2299 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom());
2307 } 2300 }
2308 2301
2309 /* 2302 /*
2310 p->setPen(c.light(110)); 2303 p->setPen(c.light(110));
2311 p->drawLine(r.x(), r.bottom()+1, r.right(), r.bottom()+1); 2304 p->drawLine(r.x(), r.bottom()+1, r.right(), r.bottom()+1);
2312 p->setPen(c); 2305 p->setPen(c);
2313 p->drawLine(r.x(), r.bottom()+2, r.right(), r.bottom()+2); 2306 p->drawLine(r.x(), r.bottom()+2, r.right(), r.bottom()+2);
2314 p->setPen(c.light(110)); 2307 p->setPen(c.light(110));
2315 p->drawLine(r.x(), r.bottom()+3, r.right(), r.bottom()+3); 2308 p->drawLine(r.x(), r.bottom()+3, r.right(), r.bottom()+3);
2316 p->setPen(c.light(120)); 2309 p->setPen(c.light(120));
2317 p->drawLine(r.x(), r.bottom()+4, r.right(), r.bottom()+4); 2310 p->drawLine(r.x(), r.bottom()+4, r.right(), r.bottom()+4);
2318 */ 2311 */
2319 2312
2320 /* 2313 /*
2321 QColor c = tabBar->colorGroup().button(); 2314 QColor c = tabBar->colorGroup().button();
2322 pix = bevelFillDict.find(c.rgb()); 2315 pix = bevelFillDict.find(c.rgb());
2323 if(!pix){ 2316 if(!pix){
2324 int h, s, v; 2317 int h, s, v;
2325 c.hsv(&h, &s, &v); 2318 c.hsv(&h, &s, &v);
2326 pix = new QPixmap(*bevelFillPix); 2319 pix = new QPixmap(*bevelFillPix);
2327 adjustHSV(*pix, h, s); 2320 adjustHSV(*pix, h, s);
2328 bevelFillDict.insert(c.rgb(), pix); 2321 bevelFillDict.insert(c.rgb(), pix);
2329 }*/ 2322 }*/
2330 2323
2331 /* 2324 /*
2332 QRect r = tab->rect(); 2325 QRect r = tab->rect();
2333 QColorGroup g = tabBar->colorGroup(); 2326 QColorGroup g = tabBar->colorGroup();
2334 if(!selected){ 2327 if(!selected){
2335 r.setY(r.y()+1); 2328 r.setY(r.y()+1);
2336 p->setPen(g.dark()); 2329 p->setPen(g.dark());
2337 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom()-2); 2330 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom()-2);
2338 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y()); 2331 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y());
2339 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y()); 2332 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y());
2340 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-2); 2333 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-2);
2341 2334
2342 p->setPen(g.midlight()); 2335 p->setPen(g.midlight());
2343 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom()); 2336 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom());
2344 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1); 2337 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1);
2345 p->drawLine(r.x()+5, r.y()+1, r.right()-2, r.y()+1); 2338 p->drawLine(r.x()+5, r.y()+1, r.right()-2, r.y()+1);
2346 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom()); 2339 p->drawLine(r.x(), r.bottom(), r.right(), r.bottom());
2347 2340
2348 p->setPen(g.mid()); 2341 p->setPen(g.mid());
2349 p->drawPoint(r.right()-1, r.y()+1); 2342 p->drawPoint(r.right()-1, r.y()+1);
2350 p->drawLine(r.x()+4, r.y()+2, r.right()-1, r.y()+2); 2343 p->drawLine(r.x()+4, r.y()+2, r.right()-1, r.y()+2);
2351 p->drawLine(r.x()+3, r.y()+3, r.right()-1, r.y()+3); 2344 p->drawLine(r.x()+3, r.y()+3, r.right()-1, r.y()+3);
2352 2345
2353 p->fillRect(r.x()+2, r.y()+4, r.width()-3, r.height()-6, 2346 p->fillRect(r.x()+2, r.y()+4, r.width()-3, r.height()-6,
2354 g.brush(QColorGroup::Mid)); 2347 g.brush(QColorGroup::Mid));
2355 2348
2356 p->setPen(g.light()); 2349 p->setPen(g.light());
2357 p->drawLine(r.x(), r.bottom()-1, r.right(), r.bottom()-1); 2350 p->drawLine(r.x(), r.bottom()-1, r.right(), r.bottom()-1);
2358 2351
2359 } 2352 }
2360 else{ 2353 else{
2361 p->setPen(g.light()); 2354 p->setPen(g.light());
2362 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom()); 2355 p->drawLine(r.x(), r.y()+4, r.x(), r.bottom());
2363 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y()); 2356 p->drawLine(r.x(), r.y()+4, r.x()+4, r.y());
2364 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y()); 2357 p->drawLine(r.x()+4, r.y(), r.right()-1, r.y());
2365 p->setPen(g.dark()); 2358 p->setPen(g.dark());
2366 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()); 2359 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom());
2367 2360
2368 p->setPen(g.midlight()); 2361 p->setPen(g.midlight());
2369 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom()); 2362 p->drawLine(r.x()+1, r.y()+4, r.x()+1, r.bottom());
2370 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1); 2363 p->drawLine(r.x()+1, r.y()+4, r.x()+4, r.y()+1);
2371 p->drawLine(r.x()+5, r.y()+1, r.right() - 2, r.y()+1); 2364 p->drawLine(r.x()+5, r.y()+1, r.right() - 2, r.y()+1);
2372 p->setPen(g.mid()); 2365 p->setPen(g.mid());
2373 p->drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()); 2366 p->drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom());
2374 }*/ 2367 }*/
2375 2368
2376} 2369}
2377 2370
2378 2371
2379 2372
2380void LiquidStyle::drawTabMask(QPainter *p, const QTabBar*, QTab *tab, 2373void LiquidStyle::drawTabMask(QPainter *p, const QTabBar*, QTab *tab,
2381 bool selected) 2374 bool selected)
2382 2375
2383 2376
2384{ 2377{
2385 //p->fillRect(tab->rect(), Qt::color1); 2378 //p->fillRect(tab->rect(), Qt::color1);
2386 QRect r = tab->rect(); 2379 QRect r = tab->rect();
2387 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab); 2380 QPixmap *pix = selected ? getPixmap(TabDown) : getPixmap(Tab);
2388 p->drawPixmap(r.x(), r.y(), *pix->mask(), 0, 0, 9, r.height()); 2381 p->drawPixmap(r.x(), r.y(), *pix->mask(), 0, 0, 9, r.height());
2389 p->drawPixmap(r.right()-9, r.y(), *pix->mask(), pix->width()-9, 0, 9, r.height()); 2382 p->drawPixmap(r.right()-9, r.y(), *pix->mask(), pix->width()-9, 0, 9, r.height());
2390 p->fillRect(r.x()+9, r.y(), r.width()-18, r.height(), Qt::color1); 2383 p->fillRect(r.x()+9, r.y(), r.width()-18, r.height(), Qt::color1);
2391} 2384}
2392 2385
2393void LiquidStyle::tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame, 2386void LiquidStyle::tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame,
2394 int &overlap) 2387 int &overlap)
2395{ 2388{
2396 if(t->shape() == QTabBar::RoundedAbove){ 2389 if(t->shape() == QTabBar::RoundedAbove){
2397 overlap = 1; 2390 overlap = 1;
2398 hFrame = 18; // was 24 2391 hFrame = 18; // was 24
2399 vFrame = 8; // was 10 2392 vFrame = 8; // was 10
2400 } 2393 }
2401 else 2394 else
2402 QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 2395 QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
2403} 2396}
2404 2397
2405 2398
2406 2399
2407void LiquidStyle::drawSplitter(QPainter *p, int x, int y, int w, int h, 2400void LiquidStyle::drawSplitter(QPainter *p, int x, int y, int w, int h,
2408 const QColorGroup &g, Orientation) 2401 const QColorGroup &g, Orientation)
2409{ 2402{
2410 drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? 2403 drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ?
2411 g.button().light(120) : g.button(), g.background()); 2404 g.button().light(120) : g.button(), g.background());
2412} 2405}
2413 2406
2414 2407
2415void LiquidStyle::drawPanel(QPainter *p, int x, int y, int w, int h, 2408void LiquidStyle::drawPanel(QPainter *p, int x, int y, int w, int h,
2416 const QColorGroup &g, bool sunken, 2409 const QColorGroup &g, bool sunken,
2417 int lineWidth, const QBrush *fill) 2410 int lineWidth, const QBrush *fill)
2418{ 2411{
2419 if(p->device()->devType() == QInternal::Widget && 2412 if(p->device()->devType() == QInternal::Widget &&
2420 ((QWidget *)p->device())->inherits("QLineEdit")){ 2413 ((QWidget *)p->device())->inherits("QLineEdit")){
2421 int x2 = x+w-1; 2414 int x2 = x+w-1;
2422 int y2 = y+h-1; 2415 int y2 = y+h-1;
2423 p->setPen(g.dark()); 2416 p->setPen(g.dark());
2424 p->drawRect(x, y, w, h); 2417 p->drawRect(x, y, w, h);
2425 p->setPen(g.mid()); 2418 p->setPen(g.mid());
2426 p->drawLine(x+1, y+1, x2-2, y+1); 2419 p->drawLine(x+1, y+1, x2-2, y+1);
2427 p->drawLine(x+1, y+1, x+1, y2-1); 2420 p->drawLine(x+1, y+1, x+1, y2-1);
2428 } 2421 }
2429 else if(lineWidth != 2 || !sunken) 2422 else if(lineWidth != 2 || !sunken)
2430 QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 2423 QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
2431 else{ 2424 else{
2432 QPen oldPen = p->pen(); 2425 QPen oldPen = p->pen();
2433 int x2 = x+w-1; 2426 int x2 = x+w-1;
2434 int y2 = y+h-1; 2427 int y2 = y+h-1;
2435 p->setPen(g.light()); 2428 p->setPen(g.light());
2436 p->drawLine(x, y2, x2, y2); 2429 p->drawLine(x, y2, x2, y2);
2437 p->drawLine(x2, y, x2, y2); 2430 p->drawLine(x2, y, x2, y2);
2438 p->setPen(g.mid()); 2431 p->setPen(g.mid());
2439 p->drawLine(x, y, x2, y); 2432 p->drawLine(x, y, x2, y);
2440 p->drawLine(x, y, x, y2); 2433 p->drawLine(x, y, x, y2);
2441 2434
2442 p->setPen(g.midlight()); 2435 p->setPen(g.midlight());
2443 p->drawLine(x+1, y2-1, x2-1, y2-1); 2436 p->drawLine(x+1, y2-1, x2-1, y2-1);
2444 p->drawLine(x2-1, y+1, x2-1, y2-1); 2437 p->drawLine(x2-1, y+1, x2-1, y2-1);
2445 p->setPen(g.dark()); 2438 p->setPen(g.dark());
2446 p->drawLine(x+1, y+1, x2-1, y+1); 2439 p->drawLine(x+1, y+1, x2-1, y+1);
2447 p->drawLine(x+1, y+1, x+1, y2-1); 2440 p->drawLine(x+1, y+1, x+1, y2-1);
2448 p->setPen(oldPen); 2441 p->setPen(oldPen);
2449 if(fill){ 2442 if(fill){
2450 // I believe here we are only supposed to fill if there is a 2443 // I believe here we are only supposed to fill if there is a
2451 // specified fill brush... 2444 // specified fill brush...
2452 p->fillRect(x+2, y+2, w-4, h-4, *fill); 2445 p->fillRect(x+2, y+2, w-4, h-4, *fill);
2453 } 2446 }
2454 } 2447 }
2455} 2448}
2456 2449
2457 2450
2458void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) 2451void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v)
2459{ 2452{
2460 QBitmap *maskBmp = NULL; 2453 QBitmap *maskBmp = NULL;
2461 if(pix.mask()) 2454 if(pix.mask())
2462 maskBmp = new QBitmap(*pix.mask()); 2455 maskBmp = new QBitmap(*pix.mask());
2463 QImage img = pix.convertToImage(); 2456 QImage img = pix.convertToImage();
2464 if(img.depth() != 32) 2457 if(img.depth() != 32)
2465 img = img.convertDepth(32); 2458 img = img.convertDepth(32);
2466 unsigned int *data = (unsigned int *)img.bits(); 2459 unsigned int *data = (unsigned int *)img.bits();
2467 int total = img.width()*img.height(); 2460 int total = img.width()*img.height();
2468 int current; 2461 int current;
2469 QColor c; 2462 QColor c;
2470 int oldH, oldS, oldV; 2463 int oldH, oldS, oldV;
2471 if(v < 235) 2464 if(v < 235)
2472 v += 20; 2465 v += 20;
2473 else 2466 else
2474 v = 255; 2467 v = 255;
2475 float intensity = v/255.0; 2468 float intensity = v/255.0;
2476 2469
2477 for(current=0; current<total; ++current){ 2470 for(current=0; current<total; ++current){
2478 c.setRgb(data[current]); 2471 c.setRgb(data[current]);
2479 c.hsv(&oldH, &oldS, &oldV); 2472 c.hsv(&oldH, &oldS, &oldV);
2480 oldV = (int)(oldV*intensity); 2473 oldV = (int)(oldV*intensity);
2481 c.setHsv(h, s, oldV); 2474 c.setHsv(h, s, oldV);
2482 data[current] = c.rgb(); 2475 data[current] = c.rgb();
2483 } 2476 }
2484 pix.convertFromImage(img); 2477 pix.convertFromImage(img);
2485 if(maskBmp) 2478 if(maskBmp)
2486 pix.setMask(*maskBmp); 2479 pix.setMask(*maskBmp);
2487} 2480}
2488 2481
2489void LiquidStyle::intensity(QPixmap &pix, float percent) 2482void LiquidStyle::intensity(QPixmap &pix, float percent)
2490{ 2483{
2491 QImage image = pix.convertToImage(); 2484 QImage image = pix.convertToImage();
2492 int i, tmp, r, g, b; 2485 int i, tmp, r, g, b;
2493 int segColors = image.depth() > 8 ? 256 : image.numColors(); 2486 int segColors = image.depth() > 8 ? 256 : image.numColors();
2494 unsigned char *segTbl = new unsigned char[segColors]; 2487 unsigned char *segTbl = new unsigned char[segColors];
2495 int pixels = image.depth() > 8 ? image.width()*image.height() : 2488 int pixels = image.depth() > 8 ? image.width()*image.height() :
2496 image.numColors(); 2489 image.numColors();
2497 unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() : 2490 unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() :
2498 (unsigned int *)image.colorTable(); 2491 (unsigned int *)image.colorTable();
2499 2492
2500 bool brighten = (percent >= 0); 2493 bool brighten = (percent >= 0);
2501 if(percent < 0) 2494 if(percent < 0)
2502 percent = -percent; 2495 percent = -percent;
2503 2496
2504 if(brighten){ // keep overflow check out of loops 2497 if(brighten){ // keep overflow check out of loops
2505 for(i=0; i < segColors; ++i){ 2498 for(i=0; i < segColors; ++i){
2506 tmp = (int)(i*percent); 2499 tmp = (int)(i*percent);
2507 if(tmp > 255) 2500 if(tmp > 255)
2508 tmp = 255; 2501 tmp = 255;
2509 segTbl[i] = tmp; 2502 segTbl[i] = tmp;
2510 } 2503 }
2511 } 2504 }
2512 else{ 2505 else{
2513 for(i=0; i < segColors; ++i){ 2506 for(i=0; i < segColors; ++i){
2514 tmp = (int)(i*percent); 2507 tmp = (int)(i*percent);
2515 if(tmp < 0) 2508 if(tmp < 0)
2516 tmp = 0; 2509 tmp = 0;
2517 segTbl[i] = tmp; 2510 segTbl[i] = tmp;
2518 } 2511 }
2519 } 2512 }
2520 2513
2521 if(brighten){ // same here 2514 if(brighten){ // same here
2522 for(i=0; i < pixels; ++i){ 2515 for(i=0; i < pixels; ++i){
2523 r = qRed(data[i]); 2516 r = qRed(data[i]);
2524 g = qGreen(data[i]); 2517 g = qGreen(data[i]);
2525 b = qBlue(data[i]); 2518 b = qBlue(data[i]);
2526 r = r + segTbl[r] > 255 ? 255 : r + segTbl[r]; 2519 r = r + segTbl[r] > 255 ? 255 : r + segTbl[r];
2527 g = g + segTbl[g] > 255 ? 255 : g + segTbl[g]; 2520 g = g + segTbl[g] > 255 ? 255 : g + segTbl[g];
2528 b = b + segTbl[b] > 255 ? 255 : b + segTbl[b]; 2521 b = b + segTbl[b] > 255 ? 255 : b + segTbl[b];
2529 data[i] = qRgb(r, g, b); 2522 data[i] = qRgb(r, g, b);
2530 } 2523 }
2531 } 2524 }
2532 else{ 2525 else{
2533 for(i=0; i < pixels; ++i){ 2526 for(i=0; i < pixels; ++i){
2534 r = qRed(data[i]); 2527 r = qRed(data[i]);
2535 g = qGreen(data[i]); 2528 g = qGreen(data[i]);
2536 b = qBlue(data[i]); 2529 b = qBlue(data[i]);
2537 r = r - segTbl[r] < 0 ? 0 : r - segTbl[r]; 2530 r = r - segTbl[r] < 0 ? 0 : r - segTbl[r];
2538 g = g - segTbl[g] < 0 ? 0 : g - segTbl[g]; 2531 g = g - segTbl[g] < 0 ? 0 : g - segTbl[g];
2539 b = b - segTbl[b] < 0 ? 0 : b - segTbl[b]; 2532 b = b - segTbl[b] < 0 ? 0 : b - segTbl[b];
2540 data[i] = qRgb(r, g, b); 2533 data[i] = qRgb(r, g, b);
2541 } 2534 }
2542 } 2535 }
2543 delete [] segTbl; 2536 delete [] segTbl;
2544 pix.convertFromImage(image); 2537 pix.convertFromImage(image);
2545} 2538}
2546 2539
2547void LiquidStyle::drawRoundRect(QPainter *p, int x, int y, int w, int h) 2540void LiquidStyle::drawRoundRect(QPainter *p, int x, int y, int w, int h)
2548{ 2541{
2549 int x2 = x+w-1; 2542 int x2 = x+w-1;
2550 int y2 = y+h-1; 2543 int y2 = y+h-1;
2551 p->drawLine(x+1, y, x2-1, y); 2544 p->drawLine(x+1, y, x2-1, y);
2552 p->drawLine(x, y+1, x, y2-1); 2545 p->drawLine(x, y+1, x, y2-1);
2553 p->drawLine(x+1, y2, x2-1, y2); 2546 p->drawLine(x+1, y2, x2-1, y2);
2554 p->drawLine(x2, y+1, x2, y2-1); 2547 p->drawLine(x2, y+1, x2, y2-1);
2555} 2548}
2556 2549
2557void LiquidStyle::drawSliderGroove (QPainter * p, int x, int y, int w, int h, 2550void LiquidStyle::drawSliderGroove (QPainter * p, int x, int y, int w, int h,
2558 const QColorGroup &g, QCOORD, 2551 const QColorGroup &g, QCOORD,
2559 Orientation orient) 2552 Orientation orient)
2560{ 2553{
2561 bool isFocus = ((QWidget *)p->device())->hasFocus(); 2554 bool isFocus = ((QWidget *)p->device())->hasFocus();
2562 QColor c = isFocus ? g.background().dark(120) : g.background(); 2555 QColor c = isFocus ? g.background().dark(120) : g.background();
2563 if(orient == Qt::Horizontal){ 2556 if(orient == Qt::Horizontal){
2564 int x2 = x+w-1; 2557 int x2 = x+w-1;
2565 y+=2; 2558 y+=2;
2566 p->setPen(c.dark(130)); 2559 p->setPen(c.dark(130));
2567 p->drawLine(x+1, y, x2-1, y); 2560 p->drawLine(x+1, y, x2-1, y);
2568 p->setPen(c.dark(150)); 2561 p->setPen(c.dark(150));
2569 p->drawLine(x, y+1, x2, y+1); 2562 p->drawLine(x, y+1, x2, y+1);
2570 p->setPen(c.dark(125)); 2563 p->setPen(c.dark(125));
2571 p->drawLine(x, y+2, x2, y+2); 2564 p->drawLine(x, y+2, x2, y+2);
2572 p->setPen(c.dark(130)); 2565 p->setPen(c.dark(130));
2573 p->drawLine(x, y+3, x2, y+3); 2566 p->drawLine(x, y+3, x2, y+3);
2574 p->setPen(c.dark(120)); 2567 p->setPen(c.dark(120));
2575 p->drawLine(x, y+4, x2, y+4); 2568 p->drawLine(x, y+4, x2, y+4);
2576 p->setPen(c.light(110)); 2569 p->setPen(c.light(110));
2577 p->drawLine(x+1, y+5, x2-1, y+5); 2570 p->drawLine(x+1, y+5, x2-1, y+5);
2578 } 2571 }
2579 else{ 2572 else{
2580 int y2 = y+h-1; 2573 int y2 = y+h-1;
2581 x+=2; 2574 x+=2;
2582 p->setPen(c.dark(130)); 2575 p->setPen(c.dark(130));
2583 p->drawLine(x, y+1, x, y2-1); 2576 p->drawLine(x, y+1, x, y2-1);
2584 p->setPen(c.dark(150)); 2577 p->setPen(c.dark(150));
2585 p->drawLine(x+1, y, x+1, y2); 2578 p->drawLine(x+1, y, x+1, y2);
2586 p->setPen(c.dark(125)); 2579 p->setPen(c.dark(125));
2587 p->drawLine(x+2, y, x+2, y2); 2580 p->drawLine(x+2, y, x+2, y2);
2588 p->setPen(c.dark(130)); 2581 p->setPen(c.dark(130));
2589 p->drawLine(x+3, y, x+3, y2); 2582 p->drawLine(x+3, y, x+3, y2);
2590 p->setPen(c.dark(120)); 2583 p->setPen(c.dark(120));
2591 p->drawLine(x+4, y, x+4, y2); 2584 p->drawLine(x+4, y, x+4, y2);
2592 p->setPen(c.light(110)); 2585 p->setPen(c.light(110));
2593 p->drawLine(x+5, y+1, x+5, y2-1); 2586 p->drawLine(x+5, y+1, x+5, y2-1);
2594 } 2587 }
2595 //QWindowsStyle::drawSliderGroove(p, x, y, w, h, g, c, orient); 2588 //QWindowsStyle::drawSliderGroove(p, x, y, w, h, g, c, orient);
2596 2589
2597} 2590}
2598 2591
2599void LiquidStyle::drawSliderGrooveMask (QPainter * p, int x, int y, int w, 2592void LiquidStyle::drawSliderGrooveMask (QPainter * p, int x, int y, int w,
2600 int h, QCOORD, Orientation orient) 2593 int h, QCOORD, Orientation orient)
2601{ 2594{
2602 p->fillRect(x, y, w, h, Qt::color0); 2595 p->fillRect(x, y, w, h, Qt::color0);
2603 p->setPen(Qt::color1); 2596 p->setPen(Qt::color1);
2604 if(orient == Qt::Horizontal){ 2597 if(orient == Qt::Horizontal){
2605 int x2 = x+w-1; 2598 int x2 = x+w-1;
2606 y+=2; 2599 y+=2;
2607 p->drawLine(x+1, y, x2-1, y); 2600 p->drawLine(x+1, y, x2-1, y);
2608 p->fillRect(x, y+1, w, 4, Qt::color1); 2601 p->fillRect(x, y+1, w, 4, Qt::color1);
2609 p->drawLine(x+1, y+5, x2-1, y+5); 2602 p->drawLine(x+1, y+5, x2-1, y+5);
2610 } 2603 }
2611 else{ 2604 else{
2612 int y2 = y+h-1; 2605 int y2 = y+h-1;
2613 x+=2; 2606 x+=2;
2614 p->drawLine(x, y+1, x, y2-1); 2607 p->drawLine(x, y+1, x, y2-1);
2615 p->fillRect(x+1, y, 4, h, Qt::color1); 2608 p->fillRect(x+1, y, 4, h, Qt::color1);
2616 p->drawLine(x+5, y+1, x+5, y2-1); 2609 p->drawLine(x+5, y+1, x+5, y2-1);
2617 } 2610 }
2618} 2611}
2619 2612
2620 2613
2621/* vim: set noet sw=8 ts=8: */ 2614/* vim: set noet sw=8 ts=8: */
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff
index d90433c..9ae24cc 100644
--- a/noncore/styles/liquid/opie-liquid.diff
+++ b/noncore/styles/liquid/opie-liquid.diff
@@ -1,2262 +1,2247 @@
1This is a patch to mosfet's liquid 0.7. 1This is a patch to mosfet's liquid 0.7.
2Features: 2Features:
3 - Qt-only 3 - Qt-only
4 - works with Qt/E on QPE/OPIE 4 - works with Qt/E on QPE/OPIE
5 5
6 --- -2002-11-21 20:45:47.000000000 +0100 6 --- -2002-11-29 12:30:34.000000000 +0100
7 +++ liquid.h2002-11-18 03:32:40.000000000 +0100 7 +++ liquid.h2002-11-18 03:32:40.000000000 +0100
8@@ -2,7 +2,7 @@ 8@@ -2,7 +2,7 @@
9 #define LIQUID_STYLE_H 9 #define LIQUID_STYLE_H
10 10
11 11
12-#include <kstyle.h> 12-#include <kstyle.h>
13+#include <qwindowsstyle.h> 13+#include <qwindowsstyle.h>
14 #include <qpainter.h> 14 #include <qpainter.h>
15 #include <qdrawutil.h> 15 #include <qdrawutil.h>
16 #include <qpalette.h> 16 #include <qpalette.h>
17@@ -20,7 +20,7 @@ 17@@ -20,7 +20,7 @@
18 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 18 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
19 */ 19 */
20 20
21-class KPixmap; 21-class KPixmap;
22+class QPixmap; 22+class QPixmap;
23 23
24 #define BITMAP_ITEMS 41 24 #define BITMAP_ITEMS 41
25 #define LIQUID_MENU_CHANGE 667 25 #define LIQUID_MENU_CHANGE 667
26@@ -50,24 +50,22 @@ 26@@ -50,24 +50,22 @@
27 ~TransMenuHandler(){;} 27 ~TransMenuHandler(){;}
28 void reloadSettings(); 28 void reloadSettings();
29 int transType(){return(type);} 29 int transType(){return(type);}
30- KPixmap *pixmap(WId id){return(pixDict.find(id));} 30- KPixmap *pixmap(WId id){return(pixDict.find(id));}
31+ QPixmap *pixmap(WId id){return(pixDict.find(id));} 31+ QPixmap *pixmap(WId id){return(pixDict.find(id));}
32 const QColor& textColor(){return(fgColor);} 32 const QColor& textColor(){return(fgColor);}
33 const QColor& bgColor(){return(color);} 33 const QColor& bgColor(){return(color);}
34 bool useShadowText(){return(shadowText);} 34 bool useShadowText(){return(shadowText);}
35-protected slots: 35-protected slots:
36- void slotKIPCMessage(int id, int arg); 36- void slotKIPCMessage(int id, int arg);
37 protected: 37 protected:
38 bool eventFilter(QObject *obj, QEvent *ev); 38 bool eventFilter(QObject *obj, QEvent *ev);
39- void stripePixmap(KPixmap &pix, const QColor &color); 39- void stripePixmap(KPixmap &pix, const QColor &color);
40+ void stripePixmap(QPixmap &pix, const QColor &color); 40+ void stripePixmap(QPixmap &pix, const QColor &color);
41 41
42 QColor color, fgColor; 42 QColor color, fgColor;
43 int opacity; 43 int opacity;
44 int type; 44 int type;
45 bool shadowText; 45 bool shadowText;
46- QIntDict<KPixmap>pixDict; 46- QIntDict<KPixmap>pixDict;
47+ QIntDict<QPixmap>pixDict; 47+ QIntDict<QPixmap>pixDict;
48 }; 48 };
49 49
50-class LiquidStyle : public KStyle 50-class LiquidStyle : public KStyle
51+class LiquidStyle : public QWindowsStyle 51+class LiquidStyle : public QWindowsStyle
52 { 52 {
53 friend class TransMenuHandler; 53 friend class TransMenuHandler;
54 public: 54 public:
55@@ -121,33 +119,14 @@ 55@@ -121,33 +119,14 @@
56 bool tickAbove, bool tickBelow); 56 bool tickAbove, bool tickBelow);
57 void drawSliderMask(QPainter *p, int x, int y, int w, int h, 57 void drawSliderMask(QPainter *p, int x, int y, int w, int h,
58 Orientation orient, bool, bool); 58 Orientation orient, bool, bool);
59- void drawKToolBar(QPainter *p, int x, int y, int w, int h, 59- void drawKToolBar(QPainter *p, int x, int y, int w, int h,
60- const QColorGroup &g, KToolBarPos type, 60- const QColorGroup &g, KToolBarPos type,
61- QBrush *fill=NULL); 61- QBrush *fill=NULL);
62- void drawKBarHandle(QPainter *p, int x, int y, int w, int h, 62- void drawKBarHandle(QPainter *p, int x, int y, int w, int h,
63- const QColorGroup &g, 63- const QColorGroup &g,
64- KToolBarPos type, QBrush *fill=NULL); 64- KToolBarPos type, QBrush *fill=NULL);
65- void drawKMenuBar(QPainter *p, int x, int y, int w, int h, 65- void drawKMenuBar(QPainter *p, int x, int y, int w, int h,
66- const QColorGroup &g, bool macMode, 66- const QColorGroup &g, bool macMode,
67- QBrush *fill=NULL); 67- QBrush *fill=NULL);
68- void drawKToolBarButton(QPainter *p, int x, int y, int w, int h, 68- void drawKToolBarButton(QPainter *p, int x, int y, int w, int h,
69- const QColorGroup &g, bool sunken=false, 69- const QColorGroup &g, bool sunken=false,
70- bool raised = true, bool enabled = true, 70- bool raised = true, bool enabled = true,
71- bool popup = false, 71- bool popup = false,
72- KToolButtonType icontext = Icon, 72- KToolButtonType icontext = Icon,
73- const QString& btext=QString::null, 73- const QString& btext=QString::null,
74- const QPixmap *icon=NULL, 74- const QPixmap *icon=NULL,
75- QFont *font=NULL, QWidget *btn=NULL); 75- QFont *font=NULL, QWidget *btn=NULL);
76- void drawKMenuItem(QPainter *p, int x, int y, int w, int h, 76- void drawKMenuItem(QPainter *p, int x, int y, int w, int h,
77- const QColorGroup &g, bool active, 77- const QColorGroup &g, bool active,
78- QMenuItem *item, QBrush *fill=NULL); 78- QMenuItem *item, QBrush *fill=NULL);
79 +void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 79 +void drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
80+ QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); 80+ QMenuItem *mi, QColorGroup &g, bool enabled, bool active );
81+ 81+
82 void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, 82 void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw,
83 int tab, QMenuItem *mi, const QPalette &pal, 83 int tab, QMenuItem *mi, const QPalette &pal,
84 bool act, bool enabled, int x, int y, int w, 84 bool act, bool enabled, int x, int y, int w,
85 int h); 85 int h);
86 int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); 86 int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm);
87- void drawKProgressBlock(QPainter *p, int x, int y, int w, int h, 87- void drawKProgressBlock(QPainter *p, int x, int y, int w, int h,
88- const QColorGroup &g, QBrush *fill); 88- const QColorGroup &g, QBrush *fill);
89 void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, 89 void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g,
90 const QColor *pen, bool atBorder); 90 const QColor *pen, bool atBorder);
91 int defaultFrameWidth() const {return(2);} 91 int defaultFrameWidth() const {return(2);}
92@@ -167,12 +146,6 @@ 92@@ -167,12 +146,6 @@
93 void drawToolButton(QPainter *p, int x, int y, int w, 93 void drawToolButton(QPainter *p, int x, int y, int w,
94 int h, const QColorGroup &g, 94 int h, const QColorGroup &g,
95 bool sunken, const QBrush *fill); 95 bool sunken, const QBrush *fill);
96- void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, 96- void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h,
97- const QColorGroup &g, QBrush *); 97- const QColorGroup &g, QBrush *);
98- void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, 98- void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h,
99- const QColorGroup &g, 99- const QColorGroup &g,
100- const QString &title, bool active, 100- const QString &title, bool active,
101- QPixmap *icon, QBrush *fill); 101- QPixmap *icon, QBrush *fill);
102 // for repainting toolbuttons when the toolbar is resized 102 // for repainting toolbuttons when the toolbar is resized
103 bool eventFilter(QObject *obj, QEvent *ev); 103 bool eventFilter(QObject *obj, QEvent *ev);
104 void drawSliderGroove(QPainter * p, int x, int y, int w, int h, 104 void drawSliderGroove(QPainter * p, int x, int y, int w, int h,
105@@ -198,25 +171,15 @@ 105@@ -198,25 +171,15 @@
106 void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, 106 void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
107 bool down=false, bool fast = true); 107 bool down=false, bool fast = true);
108 void drawRoundRect(QPainter *p, int x, int y, int w, int h); 108 void drawRoundRect(QPainter *p, int x, int y, int w, int h);
109- void loadCustomButtons(); 109- void loadCustomButtons();
110- void applyCustomAttributes(QPushButton *btn); 110- void applyCustomAttributes(QPushButton *btn);
111- void unapplyCustomAttributes(QPushButton *btn); 111- void unapplyCustomAttributes(QPushButton *btn);
112 QPixmap* getPixmap(BitmapData item); 112 QPixmap* getPixmap(BitmapData item);
113 QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); 113 QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false);
114 private: 114 private:
115- bool highcolor; 115- bool highcolor;
116- QColorGroup radioOnGrp; 116- QColorGroup radioOnGrp;
117 +bool oldqte; 117 +bool oldqte;
118 +bool flatTBButtons; 118 +bool flatTBButtons;
119 QWidget *highlightWidget; 119 QWidget *highlightWidget;
120- QBrush wallpaper; 120- QBrush wallpaper;
121- QBitmap lightBmp; 121- QBitmap lightBmp;
122- QBitmap grayBmp; 122- QBitmap grayBmp;
123- QBitmap dgrayBmp; 123- QBitmap dgrayBmp;
124- QBitmap maskBmp; 124- QBitmap maskBmp;
125- QBitmap xBmp; 125- QBitmap xBmp;
126 QBitmap btnMaskBmp, htmlBtnMaskBmp; 126 QBitmap btnMaskBmp, htmlBtnMaskBmp;
127 QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; 127 QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix;
128- QBitmap paper1, paper2, paper3; 128- QBitmap paper1, paper2, paper3;
129- QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; 129- QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush;
130+ QBrush bgBrush, menuBrush; 130+ QBrush bgBrush, menuBrush;
131 bool menuAni, menuFade; 131 bool menuAni, menuFade;
132 132
133 QIntDict<QPixmap>btnDict; 133 QIntDict<QPixmap>btnDict;
134@@ -224,9 +187,6 @@ 134@@ -224,9 +187,6 @@
135 QIntDict<QPixmap>bevelFillDict; 135 QIntDict<QPixmap>bevelFillDict;
136 QIntDict<QPixmap>smallBevelFillDict; 136 QIntDict<QPixmap>smallBevelFillDict;
137 137
138- QList<QColor>customBtnColorList; 138- QList<QColor>customBtnColorList;
139- QList<QPixmap>customBtnIconList; 139- QList<QPixmap>customBtnIconList;
140- QStrList customBtnLabelList; 140- QStrList customBtnLabelList;
141 QPixmap *vsbSliderFillPix; 141 QPixmap *vsbSliderFillPix;
142 TransMenuHandler *menuHandler; 142 TransMenuHandler *menuHandler;
143 QPixmap *pixmaps[BITMAP_ITEMS]; 143 QPixmap *pixmaps[BITMAP_ITEMS];
144 --- -2002-11-21 20:45:47.000000000 +0100 144 --- -2002-11-29 12:30:34.000000000 +0100
145 +++ liquid.cpp2002-11-21 20:27:48.000000000 +0100 145 +++ liquid.cpp2002-11-29 12:30:24.000000000 +0100
146@@ -2,6 +2,9 @@ 146@@ -2,6 +2,9 @@
147 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 147 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
148 */ 148 */
149 149
150+// 150+//
151+// (c) 2002 Robert 'sandman' Griebl 151+// (c) 2002 Robert 'sandman' Griebl
152+// 152+//
153 153
154 154
155 #ifndef INCLUDE_MENUITEM_DEF 155 #ifndef INCLUDE_MENUITEM_DEF
156@@ -10,12 +13,10 @@ 156@@ -10,12 +13,10 @@
157 157
158 #include <qmenudata.h> 158 #include <qmenudata.h>
159 #include "liquid.h" 159 #include "liquid.h"
160-#include <kapp.h> 160-#include <kapp.h>
161-#include <kglobal.h> 161-#include <kglobal.h>
162-#include <kconfig.h> 162-#include <kconfig.h>
163-#include <kdrawutil.h> 163-#include <kdrawutil.h>
164-#include <kglobalsettings.h> 164-#include <kglobalsettings.h>
165-#include <kpixmapeffect.h> 165-#include <kpixmapeffect.h>
166+//#include "liquiddeco.h" 166+//#include "liquiddeco.h"
167+#include <qapplication.h> 167+#include <qapplication.h>
168+#include <qpe/config.h> 168+#include <qpe/config.h>
169+#include "effects.h" 169+#include "effects.h"
170 #include <qpalette.h> 170 #include <qpalette.h>
171 #include <qbitmap.h> 171 #include <qbitmap.h>
172 #include <qtabbar.h> 172 #include <qtabbar.h>
173@@ -25,28 +26,30 @@ 173@@ -25,28 +26,30 @@
174 #include <qtimer.h> 174 #include <qtimer.h>
175 #include <qpixmapcache.h> 175 #include <qpixmapcache.h>
176 #include <qradiobutton.h> 176 #include <qradiobutton.h>
177-#include <kimageeffect.h> 177-#include <kimageeffect.h>
178-#include <ktoolbar.h> 178-#include <ktoolbar.h>
179+#include <qcombobox.h> 179+#include <qcombobox.h>
180 #include <qdrawutil.h> 180 #include <qdrawutil.h>
181 #include <qwidgetlist.h> 181 #include <qwidgetlist.h>
182 #include <qtoolbutton.h> 182 #include <qtoolbutton.h>
183 #include <qheader.h> 183 #include <qheader.h>
184 #include <unistd.h> 184 #include <unistd.h>
185-#include <klocale.h> 185-#include <klocale.h>
186-#include <kiconloader.h> 186-#include <kiconloader.h>
187-#include <kmenubar.h> 187-#include <kmenubar.h>
188-#include <kipc.h> 188-#include <kipc.h>
189+#include <qmenubar.h> 189+#include <qmenubar.h>
190+#include <qprogressbar.h> 190+#include <qprogressbar.h>
191+#include <qlineedit.h> 191+#include <qlineedit.h>
192 192
193-#include <X11/X.h> 193-#include <X11/X.h>
194-#include <X11/Xlib.h> 194-#include <X11/Xlib.h>
195+#include <stdio.h> 195+#include <stdio.h>
196 196
197 #include "htmlmasks.h" 197 #include "htmlmasks.h"
198 #include "embeddata.h" 198 #include "embeddata.h"
199 199
200-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) 200-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color)
201+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 201+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
202+ QColorGroup &, bool, bool); 202+ QColorGroup &, bool, bool);
203+ 203+
204+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 204+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
205+ 205+
206+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 206+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
207 { 207 {
208 QImage img(pix.convertToImage()); 208 QImage img(pix.convertToImage());
209- KImageEffect::fade(img, 0.9, color); 209- KImageEffect::fade(img, 0.9, color);
210+ QImageEffect::fade(img, 0.9, color); 210+ QImageEffect::fade(img, 0.9, color);
211 int x, y; 211 int x, y;
212 int r, g, b; 212 int r, g, b;
213 for(y=0; y < img.height(); y+=3){ 213 for(y=0; y < img.height(); y+=3){
214@@ -71,35 +74,37 @@ 214@@ -71,35 +74,37 @@
215 : QObject(parent) 215 : QObject(parent)
216 { 216 {
217 pixDict.setAutoDelete(true); 217 pixDict.setAutoDelete(true);
218- connect(kapp, SIGNAL(kipcMessage(int, int)), this, 218- connect(kapp, SIGNAL(kipcMessage(int, int)), this,
219- SLOT(slotKIPCMessage(int, int))); 219- SLOT(slotKIPCMessage(int, int)));
220 reloadSettings(); 220 reloadSettings();
221 } 221 }
222 222
223 void TransMenuHandler::reloadSettings() 223 void TransMenuHandler::reloadSettings()
224 { 224 {
225 pixDict.clear(); 225 pixDict.clear();
226- KConfig *config = KGlobal::config(); 226- KConfig *config = KGlobal::config();
227- config->setGroup("MosfetMenus"); 227- config->setGroup("MosfetMenus");
228 228
229- type = config->readNumEntry("Type", TransStippleBg); 229- type = config->readNumEntry("Type", TransStippleBg);
230- color = config->readColorEntry("Color", 230- color = config->readColorEntry("Color",
231- &QApplication::palette().active().button()); 231- &QApplication::palette().active().button());
232- fgColor = config->readColorEntry("TextColor", 232- fgColor = config->readColorEntry("TextColor",
233- &QApplication::palette().active().text()); 233- &QApplication::palette().active().text());
234- opacity = config->readNumEntry("Opacity", 10); 234- opacity = config->readNumEntry("Opacity", 10);
235- shadowText = config->readBoolEntry("ShadowText", true); 235- shadowText = config->readBoolEntry("ShadowText", true);
236+ Config config ( "qpe" ); 236+ Config config ( "qpe" );
237+ config. setGroup ( "Liquid-Style" ); 237+ config. setGroup ( "Liquid-Style" );
238+ 238+
239+ type = config. readNumEntry("Type", TransStippleBg); 239+ type = config. readNumEntry("Type", TransStippleBg);
240+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 240+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
241+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 241+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
242+ opacity = config. readNumEntry("Opacity", 10); 242+ opacity = config. readNumEntry("Opacity", 10);
243+ if ( opacity < -20 ) 243+ if ( opacity < -20 )
244 + opacity = 20; 244 + opacity = 20;
245+ else if ( opacity > 20 ) 245+ else if ( opacity > 20 )
246 + opacity = 20; 246 + opacity = 20;
247+ 247+
248+ shadowText = config. readBoolEntry("ShadowText", true); 248+ shadowText = config. readBoolEntry("ShadowText", true);
249 } 249 }
250 250
251 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 251 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
252 { 252 {
253- QPopupMenu *p = (QPopupMenu *)obj; 253- QPopupMenu *p = (QPopupMenu *)obj;
254+ QWidget *p = (QWidget *)obj; 254+ QWidget *p = (QWidget *)obj;
255 255
256 if(ev->type() == QEvent::Show){ 256 if(ev->type() == QEvent::Show){
257 if(type == TransStippleBg || type == TransStippleBtn || 257 if(type == TransStippleBg || type == TransStippleBtn ||
258 type == Custom){ 258 type == Custom){
259 QApplication::syncX(); 259 QApplication::syncX();
260- KPixmap *pix = new KPixmap; 260- KPixmap *pix = new KPixmap;
261+ QPixmap *pix = new QPixmap; 261+ QPixmap *pix = new QPixmap;
262 if(p->testWFlags(Qt::WType_Popup)){ 262 if(p->testWFlags(Qt::WType_Popup)){
263 QRect r(p->x(), p->y(), p->width(), p->height()); 263 QRect r(p->x(), p->y(), p->width(), p->height());
264 QRect deskR = QApplication::desktop()->rect(); 264 QRect deskR = QApplication::desktop()->rect();
265@@ -107,7 +112,7 @@ 265@@ -107,7 +112,7 @@
266 r.setBottom(deskR.bottom()); 266 r.setBottom(deskR.bottom());
267 r.setRight(deskR.right()); 267 r.setRight(deskR.right());
268 } 268 }
269- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), 269- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(),
270+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 270+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
271 r.width(), r.height()); 271 r.width(), r.height());
272 } 272 }
273 else{ // tear off menu 273 else{ // tear off menu
274@@ -121,82 +126,61 @@ 274@@ -121,82 +126,62 @@
275 stripePixmap(*pix, p->colorGroup().button()); 275 stripePixmap(*pix, p->colorGroup().button());
276 } 276 }
277 else{ 277 else{
278- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 278- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
279+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 279+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
280 } 280 }
281+ 281+
282 pixDict.insert(p->winId(), pix); 282 pixDict.insert(p->winId(), pix);
283+ 283+
284+ if ( !p->inherits("QPopupMenu")) 284+ if ( !p->inherits("QPopupMenu"))
285 + p->setBackgroundPixmap(*pix); 285 + p->setBackgroundPixmap(*pix);
286 + 286 +
287+ QObjectList *ol = p-> queryList("QWidget"); 287+ QObjectList *ol = p-> queryList("QWidget");
288 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 288 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
289 + QWidget *wid = (QWidget *) it.current ( ); 289 + QWidget *wid = (QWidget *) it.current ( );
290 + 290 +
291 + wid-> setBackgroundPixmap(*pix); 291 + wid-> setBackgroundPixmap(*pix);
292 + wid-> setBackgroundOrigin(QWidget::ParentOrigin); 292 + wid-> setBackgroundOrigin(QWidget::ParentOrigin);
293+ } 293+ }
294 + delete ol; 294 + delete ol;
295 } 295 }
296 } 296 }
297 else if(ev->type() == QEvent::Hide){ 297 else if(ev->type() == QEvent::Hide){
298 if(type == TransStippleBg || type == TransStippleBtn || 298 if(type == TransStippleBg || type == TransStippleBtn ||
299 type == Custom){ 299 type == Custom){
300- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 300- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
301- pixDict.remove(p->winId()); 301- pixDict.remove(p->winId());
302- } 302- }
303- } 303- }
304- return(false); 304- return(false);
305-} 305-}
306- 306-
307-void TransMenuHandler::slotKIPCMessage(int id, int) 307-void TransMenuHandler::slotKIPCMessage(int id, int)
308-{ 308-{
309- if(id == LIQUID_MENU_CHANGE){ 309- if(id == LIQUID_MENU_CHANGE){
310- bool oldShadow = shadowText; 310- bool oldShadow = shadowText;
311- 311-
312- KConfig *config = KGlobal::config(); 312- KConfig *config = KGlobal::config();
313- config->reparseConfiguration(); // in case KControl changed values 313- config->reparseConfiguration(); // in case KControl changed values
314+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 314+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
315 315
316- // Make sure no popupmenus are shown. There shouldn't be any because 316- // Make sure no popupmenus are shown. There shouldn't be any because
317- // the user just clicked "Apply", but there can be tear offs ;-) 317- // the user just clicked "Apply", but there can be tear offs ;-)
318- // We just close them so the pixmaps are deleted and regenerated. 318- // We just close them so the pixmaps are deleted and regenerated.
319- QWidgetList *list = QApplication::topLevelWidgets(); 319- QWidgetList *list = QApplication::topLevelWidgets();
320- QWidgetListIt it( *list ); 320- QWidgetListIt it( *list );
321- QWidget *w; 321- QWidget *w;
322- while ((w=it.current()) != 0 ){ 322- while ((w=it.current()) != 0 ){
323- ++it; 323- ++it;
324- if(w->inherits("QPopupMenu")){ 324- if(w->inherits("QPopupMenu")){
325- w->close(); 325- w->close();
326- } 326- }
327- } 327- }
328+ pixDict.remove(p->winId()); 328+ pixDict.remove(p->winId());
329+ if ( !p->inherits("QPopupMenu")) 329+ if ( !p->inherits("QPopupMenu"))
330+ p->setBackgroundMode(QWidget::PaletteBackground); 330+ p->setBackgroundMode(QWidget::PaletteBackground);
331 331
332- reloadSettings(); 332- reloadSettings();
333 + QObjectList *ol = p-> queryList("QWidget"); 333 + QObjectList *ol = p-> queryList("QWidget");
334 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 334 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
335 + QWidget *wid = (QWidget *) it.current ( ); 335 + QWidget *wid = (QWidget *) it.current ( );
336 336
337- // Now repaint menubar if needed 337- // Now repaint menubar if needed
338- if(shadowText != oldShadow){ 338- if(shadowText != oldShadow){
339- it.toFirst(); 339- it.toFirst();
340- while ((w=it.current()) != 0 ){ 340- while ((w=it.current()) != 0 ){
341- ++it; 341- ++it;
342- if(w->inherits("QMenuBar")){ 342- if(w->inherits("QMenuBar")){
343- w->repaint(); 343- w->repaint();
344- }
345- }
344 + wid-> setBackgroundMode( QWidget::PaletteBackground ); 346 + wid-> setBackgroundMode( QWidget::PaletteBackground );
345 }
346 + delete ol;
347 }
348 } 347 }
349- } 348- }
350- else if(id == MOSFET_BUTTON_CHANGE){ 349- else if(id == MOSFET_BUTTON_CHANGE){
351- qWarning("In mosfet button change"); 350- qWarning("In mosfet button change");
352- // really, this should be in LiquidStyle, but what the hell? ;-) 351- // really, this should be in LiquidStyle, but what the hell? ;-)
353- QWidgetList *list = QApplication::allWidgets(); 352- QWidgetList *list = QApplication::allWidgets();
354- QWidgetListIt it( *list ); 353- QWidgetListIt it( *list );
355- QWidget *w; 354- QWidget *w;
356- while ((w=it.current()) != 0 ){ 355- while ((w=it.current()) != 0 ){
357- ++it; 356- ++it;
358- if(w->inherits("QPushButton")){ 357- if(w->inherits("QPushButton")){
359- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); 358- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w);
360- } 359- }
361- } 360- }
362- ((LiquidStyle*)parent())->loadCustomButtons(); 361- ((LiquidStyle*)parent())->loadCustomButtons();
363- it.toFirst(); 362- it.toFirst();
364- while ((w=it.current()) != 0 ){ 363- while ((w=it.current()) != 0 ){
365- ++it; 364- ++it;
366- if(w->inherits("QPushButton")){ 365- if(w->inherits("QPushButton")){
367- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); 366- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w);
368- } 367 + delete ol;
369- } 368 }
369 }
370+ return(false); 370+ return(false);
371+} 371+}
372 372
373- } 373- }
374+ 374+
375+static int qt_version ( ) 375+static int qt_version ( )
376+{ 376+{
377 +const char *qver = qVersion ( ); 377 +const char *qver = qVersion ( );
378 +return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 378 +return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
379 } 379 }
380 380
381+ 381+
382 LiquidStyle::LiquidStyle() 382 LiquidStyle::LiquidStyle()
383- :KStyle() 383- :KStyle()
384+ :QWindowsStyle() 384+ :QWindowsStyle()
385 { 385 {
386+ setName ( "LiquidStyle" ); 386+ setName ( "LiquidStyle" );
387+ 387+
388 +oldqte = ( qt_version ( ) < 234 ); 388 +oldqte = ( qt_version ( ) < 234 );
389 +flatTBButtons = false; 389 +flatTBButtons = false;
390 +currentHeader = 0;
390+ 391+
391 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 392 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
392 btnMaskBmp.setMask(btnMaskBmp); 393 btnMaskBmp.setMask(btnMaskBmp);
393 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 394 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
394@@ -207,12 +191,8 @@ 395@@ -207,12 +192,8 @@
395 btnDict.setAutoDelete(true); 396 btnDict.setAutoDelete(true);
396 bevelFillDict.setAutoDelete(true); 397 bevelFillDict.setAutoDelete(true);
397 smallBevelFillDict.setAutoDelete(true); 398 smallBevelFillDict.setAutoDelete(true);
398- customBtnColorList.setAutoDelete(true); 399- customBtnColorList.setAutoDelete(true);
399- customBtnIconList.setAutoDelete(true); 400- customBtnIconList.setAutoDelete(true);
400- customBtnLabelList.setAutoDelete(true); 401- customBtnLabelList.setAutoDelete(true);
401 402
402 rMatrix.rotate(270.0); 403 rMatrix.rotate(270.0);
403- highcolor = QPixmap::defaultDepth() > 8; 404- highcolor = QPixmap::defaultDepth() > 8;
404 btnBorderPix = new QPixmap; 405 btnBorderPix = new QPixmap;
405 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 406 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
406 btnBlendPix = new QPixmap; 407 btnBlendPix = new QPixmap;
407@@ -572,131 +552,119 @@ 408@@ -572,131 +553,119 @@
408 case HTMLBtnBorderDown: 409 case HTMLBtnBorderDown:
409 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 410 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
410 break; 411 break;
411+ 412+
412 case HTMLCB: 413 case HTMLCB:
413 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 414 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
414 break; 415 break;
415+ case HTMLCBHover: 416+ case HTMLCBHover:
416+ pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); 417+ pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV);
417+ break; 418+ break;
418 case HTMLCBDown: 419 case HTMLCBDown:
419 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 420 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
420 break; 421 break;
421- case HTMLCBHover: 422- case HTMLCBHover:
422- pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); 423- pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV);
423- break; 424- break;
424 case HTMLCBDownHover: 425 case HTMLCBDownHover:
425- pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", 426- pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown",
426- btnHoverH, btnHoverS, 427- btnHoverH, btnHoverS,
427- btnHoverV); 428- btnHoverV);
428+ pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); 429+ pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV);
429 break; 430 break;
430+ 431+
431 case HTMLRadio: 432 case HTMLRadio:
432 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 433 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
433 + break; 434 + break;
434+ case HTMLRadioHover: 435+ case HTMLRadioHover:
435+ pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); 436+ pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV);
436 + break; 437 + break;
437 case HTMLRadioDown: 438 case HTMLRadioDown:
438 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 439 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
439- case HTMLRadioHover: 440- case HTMLRadioHover:
440- pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); 441- pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV);
441 + break; 442 + break;
442 case HTMLRadioDownHover: 443 case HTMLRadioDownHover:
443- pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", 444- pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown",
444- btnHoverH, btnHoverS, 445- btnHoverH, btnHoverS,
445- btnHoverV); 446- btnHoverV);
446+ pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); 447+ pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV);
447 + break; 448 + break;
448+ 449+
449+ case RadioOff: 450+ case RadioOff:
450+ pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); 451+ pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/);
451+ break; 452+ break;
452+ case RadioOffHover: 453+ case RadioOffHover:
453+ pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); 454+ pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/);
454+ break; 455+ break;
455 case RadioOn: 456 case RadioOn:
456- pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); 457- pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true);
457+ pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); 458+ pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/);
458 break; 459 break;
459 case RadioOnHover: 460 case RadioOnHover:
460- pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, 461- pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS,
461- btnHoverV, true); 462- btnHoverV, true);
462+ pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); 463+ pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/);
463 break; 464 break;
464- case RadioOffHover: 465- case RadioOffHover:
465- pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); 466- pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true);
466+ 467+
467+ case Tab: 468+ case Tab:
468+ pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); 469+ pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/);
469 break; 470 break;
470 case TabDown: 471 case TabDown:
471- pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); 472- pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true);
472+ pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); 473+ pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/);
473 break; 474 break;
474 case TabFocus: 475 case TabFocus:
475- pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, 476- pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS,
476- btnHoverS, true); 477- btnHoverS, true);
477- break; 478- break;
478- case CBDown: 479- case CBDown:
479- pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); 480- pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true);
480+ pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); 481+ pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/);
481 break; 482 break;
482- case CBDownHover: 483- case CBDownHover:
483- pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, 484- pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH,
484- btnHoverS, btnHoverV, true); 485- btnHoverS, btnHoverV, true);
485+ 486+
486 +case CB: 487 +case CB:
487+ pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); 488+ pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/);
488 break; 489 break;
489 case CBHover: 490 case CBHover:
490- pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); 491- pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true);
491+ pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); 492+ pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/);
492 break; 493 break;
493- case HSlider: 494- case HSlider:
494- pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 495- pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
495+ case CBDown: 496+ case CBDown:
496+ pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); 497+ pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/);
497+ break; 498 break;
498+ case CBDownHover: 499+ case CBDownHover:
499+ pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); 500+ pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/);
500 break; 501+ break;
501+ 502+
502 case VSlider: 503 case VSlider:
503- pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 504- pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
504+ pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); 505+ pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true );
505 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 506 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
506 break; 507 break;
507- case RadioOff: 508- case RadioOff:
508- pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); 509- pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true);
509- break; 510- break;
510- case Tab: 511- case Tab:
511- pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); 512- pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true);
512- break; 513- break;
513- case CB: 514- case CB:
514- pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); 515- pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true);
515- break; 516- break;
516 case VSBSliderTop: 517 case VSBSliderTop:
517- pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 518- pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
518+ case VSBSliderTopHover: 519+ case VSBSliderTopHover:
519+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); 520+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/);
520 break; 521 break;
521 case VSBSliderBtm: 522 case VSBSliderBtm:
522- pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 523- pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
523+ case VSBSliderBtmHover: 524+ case VSBSliderBtmHover:
524+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); 525+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/);
525 break; 526 break;
526 case VSBSliderMid: 527 case VSBSliderMid:
527- pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 528- pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
528+ case VSBSliderMidHover: 529+ case VSBSliderMidHover:
529+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 530+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
530 break; 531 break;
531- case VSBSliderTopHover: 532- case VSBSliderTopHover:
532- pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 533- pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
533 +case VSBSliderTopBg: 534 +case VSBSliderTopBg:
534+ pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); 535+ pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/);
535 break; 536 break;
536- case VSBSliderBtmHover: 537- case VSBSliderBtmHover:
537- pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 538- pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
538+ case VSBSliderBtmBg: 539+ case VSBSliderBtmBg:
539+ pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); 540+ pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/);
540 break; 541 break;
541- case VSBSliderMidHover: 542- case VSBSliderMidHover:
542- pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 543- pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
543+ case VSBSliderMidBg: 544+ case VSBSliderMidBg:
544+ pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 545+ pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
545 break; 546 break;
546 547
547- case HSBSliderTop: 548- case HSBSliderTop:
548- pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 549- pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
549- *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); 550- *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix);
550- break; 551- break;
551- case HSBSliderBtm: 552- case HSBSliderBtm:
552- pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 553- pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
553- *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); 554- *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix);
554- break; 555- break;
555- case HSBSliderMid: 556- case HSBSliderMid:
556- pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 557- pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
557- *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); 558- *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix);
558 +case HSlider: 559 +case HSlider:
559+ pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); 560+ pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/);
560 break; 561 break;
561+ case HSBSliderTop: 562+ case HSBSliderTop:
562 case HSBSliderTopHover: 563 case HSBSliderTopHover:
563- pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 564- pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
564- *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); 565- *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix);
565+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); 566+ pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true );
566+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 567+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
567 break; 568 break;
568+ case HSBSliderBtm: 569+ case HSBSliderBtm:
569 case HSBSliderBtmHover: 570 case HSBSliderBtmHover:
570- pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 571- pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
571- *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); 572- *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix);
572+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); 573+ pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true );
573+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 574+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
574 break; 575 break;
575+ case HSBSliderMid: 576+ case HSBSliderMid:
576 case HSBSliderMidHover: 577 case HSBSliderMidHover:
577- pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 578- pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
578- *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); 579- *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix);
579- break; 580- break;
580- case VSBSliderTopBg: 581- case VSBSliderTopBg:
581- pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 582- pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
582- break; 583- break;
583- case VSBSliderBtmBg: 584- case VSBSliderBtmBg:
584- pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 585- pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
585- break; 586- break;
586- case VSBSliderMidBg: 587- case VSBSliderMidBg:
587- pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 588- pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
588+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 589+ pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
589+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix); 590+ *pixmaps[item] = pixmaps[item]->xForm(rMatrix);
590 break; 591 break;
591 case HSBSliderTopBg: 592 case HSBSliderTopBg:
592- pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 593- pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
593+ pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); 594+ pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true );
594 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 595 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
595 break; 596 break;
596 case HSBSliderBtmBg: 597 case HSBSliderBtmBg:
597- pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 598- pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
598+ pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true ); 599+ pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true );
599 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 600 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
600 break; 601 break;
601 case HSBSliderMidBg: 602 case HSBSliderMidBg:
602@@ -711,7 +679,6 @@ 603@@ -711,7 +680,6 @@
603 604
604 void LiquidStyle::polish(QPalette &appPal) 605 void LiquidStyle::polish(QPalette &appPal)
605 { 606 {
606- 607-
607 int i; 608 int i;
608 for(i=0; i < BITMAP_ITEMS; ++i){ 609 for(i=0; i < BITMAP_ITEMS; ++i){
609 if(pixmaps[i]){ 610 if(pixmaps[i]){
610@@ -719,31 +686,28 @@ 611@@ -719,31 +687,28 @@
611 pixmaps[i] = NULL; 612 pixmaps[i] = NULL;
612 } 613 }
613 } 614 }
614- QWidgetList *list = QApplication::allWidgets(); 615- QWidgetList *list = QApplication::allWidgets();
615- QWidgetListIt it( *list ); 616- QWidgetListIt it( *list );
616- QWidget *w; 617- QWidget *w;
617- while ((w=it.current()) != 0 ){ 618- while ((w=it.current()) != 0 ){
618- ++it; 619- ++it;
619- if(w->inherits("QPushButton")){ 620- if(w->inherits("QPushButton")){
620- unapplyCustomAttributes((QPushButton *)w); 621- unapplyCustomAttributes((QPushButton *)w);
621- } 622- }
622- } 623- }
623- 624-
624- loadCustomButtons(); 625- loadCustomButtons();
625- lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; 626- lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10;
626+ lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 627+ lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
627 btnDict.clear(); 628 btnDict.clear();
628 btnBorderDict.clear(); 629 btnBorderDict.clear();
629 bevelFillDict.clear(); 630 bevelFillDict.clear();
630 smallBevelFillDict.clear(); 631 smallBevelFillDict.clear();
631 632
632- KConfig *config = KGlobal::config(); 633- KConfig *config = KGlobal::config();
633- QString oldGrp = config->group(); 634- QString oldGrp = config->group();
634- QPalette pal = QApplication::palette(); 635- QPalette pal = QApplication::palette();
635+ Config config ( "qpe" ); 636+ Config config ( "qpe" );
636+ config. setGroup ( "Liquid-Style" ); 637+ config. setGroup ( "Liquid-Style" );
637 +int contrast = config. readNumEntry ( "StippleContrast", 5 ); 638 +int contrast = config. readNumEntry ( "StippleContrast", 5 );
638 +if ( contrast < 0 ) 639 +if ( contrast < 0 )
639 + contrast = 0; 640 + contrast = 0;
640 +else if ( contrast > 10 ) 641 +else if ( contrast > 10 )
641 + contrast = 10; 642 + contrast = 10;
642+ 643+
643+// QPalette pal = QApplication::palette(); 644+// QPalette pal = QApplication::palette();
644 645
645 // button color stuff 646 // button color stuff
646- config->setGroup("General"); 647- config->setGroup("General");
647- QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); 648- QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray);
648- if(c == config->readColorEntry("background", &Qt::lightGray)){ 649- if(c == config->readColorEntry("background", &Qt::lightGray)){
649+ config. setGroup ( "Appearance" ); 650+ config. setGroup ( "Appearance" );
650+ QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) 651+ QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )))
651+ : appPal. color ( QPalette::Active, QColorGroup::Button ); 652+ : appPal. color ( QPalette::Active, QColorGroup::Button );
652+ if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) 653+ if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
653+ : appPal. color ( QPalette::Active, QColorGroup::Background ))) { 654+ : appPal. color ( QPalette::Active, QColorGroup::Background ))) {
654 // force button color to be different from background 655 // force button color to be different from background
655 QBrush btnBrush(QColor(200, 202, 228)); 656 QBrush btnBrush(QColor(200, 202, 228));
656 appPal.setBrush(QColorGroup::Button, btnBrush); 657 appPal.setBrush(QColorGroup::Button, btnBrush);
657@@ -778,8 +742,8 @@ 658@@ -778,8 +743,8 @@
658 adjustHSV(*pix, h, s, v); 659 adjustHSV(*pix, h, s, v);
659 smallBevelFillDict.insert(c.rgb(), pix); 660 smallBevelFillDict.insert(c.rgb(), pix);
660 } 661 }
661- pagerHoverBrush.setColor(c); 662- pagerHoverBrush.setColor(c);
662- pagerHoverBrush.setPixmap(*pix); 663- pagerHoverBrush.setPixmap(*pix);
663+// pagerHoverBrush.setColor(c); 664+// pagerHoverBrush.setColor(c);
664+// pagerHoverBrush.setPixmap(*pix); 665+// pagerHoverBrush.setPixmap(*pix);
665 666
666 c = c.dark(120); 667 c = c.dark(120);
667 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 668 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
668@@ -790,19 +754,13 @@ 669@@ -790,19 +755,13 @@
669 adjustHSV(*pix, h, s, v); 670 adjustHSV(*pix, h, s, v);
670 smallBevelFillDict.insert(c.rgb(), pix); 671 smallBevelFillDict.insert(c.rgb(), pix);
671 } 672 }
672- pagerBrush.setColor(c); 673- pagerBrush.setColor(c);
673- pagerBrush.setPixmap(*pix); 674- pagerBrush.setPixmap(*pix);
674+// pagerBrush.setColor(c); 675+// pagerBrush.setColor(c);
675+// pagerBrush.setPixmap(*pix); 676+// pagerBrush.setPixmap(*pix);
676 677
677 // background color stuff 678 // background color stuff
678- c = config->readColorEntry("background", &Qt::lightGray); 679- c = config->readColorEntry("background", &Qt::lightGray);
679- if(qstrcmp(kapp->argv()[0], "kicker") == 0){ 680- if(qstrcmp(kapp->argv()[0], "kicker") == 0){
680- appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); 681- appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110));
681- appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); 682- appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130));
682- appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); 683- appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110));
683- appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); 684- appPal.setColor(QColorGroup::Light, menuBrush.color().light(115));
684- menuBrush.setColor(c); // hack - used for kicker applets 685- menuBrush.setColor(c); // hack - used for kicker applets
685- appPal.setBrush(QColorGroup::Background, menuBrush); 686- appPal.setBrush(QColorGroup::Background, menuBrush);
686- } 687- }
687+ c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) 688+ c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )))
688+ : appPal. color ( QPalette::Active, QColorGroup::Background ); 689+ : appPal. color ( QPalette::Active, QColorGroup::Background );
689+ 690+
690 c.hsv(&bH, &bS, &bV); 691 c.hsv(&bH, &bS, &bV);
691 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 692 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
692 693
693@@ -817,101 +775,50 @@ 694@@ -817,101 +776,50 @@
694 wallPaper.fill(c.rgb()); 695 wallPaper.fill(c.rgb());
695 painter.begin(&wallPaper); 696 painter.begin(&wallPaper);
696 for(i=0; i < 32; i+=4){ 697 for(i=0; i < 32; i+=4){
697- painter.setPen(c.dark(105)); 698- painter.setPen(c.dark(105));
698+ painter.setPen(c.dark(100 + contrast)); 699+ painter.setPen(c.dark(100 + contrast));
699 painter.drawLine(0, i, 32, i); 700 painter.drawLine(0, i, 32, i);
700- painter.setPen(c.dark(103)); 701- painter.setPen(c.dark(103));
701+ painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 702+ painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
702 painter.drawLine(0, i+1, 32, i+1); 703 painter.drawLine(0, i+1, 32, i+1);
703 }; 704 };
704 painter.end(); 705 painter.end();
705 bgBrush.setColor(c); 706 bgBrush.setColor(c);
706 bgBrush.setPixmap(wallPaper); 707 bgBrush.setPixmap(wallPaper);
707- if(qstrcmp(kapp->argv()[0], "kicker") != 0 && 708- if(qstrcmp(kapp->argv()[0], "kicker") != 0 &&
708- qstrcmp(kapp->argv()[0], "ksplash") != 0){ 709- qstrcmp(kapp->argv()[0], "ksplash") != 0){
709 appPal.setBrush(QColorGroup::Background, bgBrush); 710 appPal.setBrush(QColorGroup::Background, bgBrush);
710- } 711- }
711- 712-
712- // lineedits 713- // lineedits
713- c = config->readColorEntry("windowBackground", &Qt::white); 714- c = config->readColorEntry("windowBackground", &Qt::white);
714- QPixmap basePix; 715- QPixmap basePix;
715- basePix.resize(32, 32); 716- basePix.resize(32, 32);
716- basePix.fill(c.rgb()); 717- basePix.fill(c.rgb());
717- painter.begin(&basePix); 718- painter.begin(&basePix);
718- painter.setPen(c.dark(105)); 719- painter.setPen(c.dark(105));
719- for(i=0; i < 32; i+=4){ 720- for(i=0; i < 32; i+=4){
720- painter.drawLine(0, i, 32, i); 721- painter.drawLine(0, i, 32, i);
721- painter.drawLine(0, i+1, 32, i+1); 722- painter.drawLine(0, i+1, 32, i+1);
722- }; 723- };
723- painter.end(); 724- painter.end();
724- baseBrush.setColor(c); 725- baseBrush.setColor(c);
725- baseBrush.setPixmap(basePix); 726- baseBrush.setPixmap(basePix);
726- it.toFirst(); 727- it.toFirst();
727- while ((w=it.current()) != 0 ){ 728- while ((w=it.current()) != 0 ){
728- ++it; 729- ++it;
729- if(w->inherits("QLineEdit")){ 730- if(w->inherits("QLineEdit")){
730- QPalette pal = w->palette(); 731- QPalette pal = w->palette();
731- pal.setBrush(QColorGroup::Base, baseBrush); 732- pal.setBrush(QColorGroup::Base, baseBrush);
732- w->setPalette(pal); 733- w->setPalette(pal);
733- } 734- }
734- else if(w->inherits("QPushButton")){ 735- else if(w->inherits("QPushButton")){
735- applyCustomAttributes((QPushButton *)w); 736- applyCustomAttributes((QPushButton *)w);
736- } 737- }
737- } 738- }
738- 739-
739- config->setGroup(oldGrp); 740- config->setGroup(oldGrp);
740 } 741 }
741 742
742 void LiquidStyle::polish(QWidget *w) 743 void LiquidStyle::polish(QWidget *w)
743 { 744 {
744 if(w->inherits("QMenuBar")){ 745 if(w->inherits("QMenuBar")){
745- ((QFrame*)w)->setLineWidth(0); 746- ((QFrame*)w)->setLineWidth(0);
746- w->setBackgroundMode(QWidget::NoBackground); 747- w->setBackgroundMode(QWidget::NoBackground);
747+ //((QFrame*)w)->setLineWidth(0); 748+ //((QFrame*)w)->setLineWidth(0);
748+ w->setBackgroundMode(QWidget::PaletteBackground); 749+ w->setBackgroundMode(QWidget::PaletteBackground);
749+ w->setBackgroundOrigin(QWidget::ParentOrigin); 750+ w->setBackgroundOrigin(QWidget::ParentOrigin);
750+ return; 751+ return;
751+ } 752+ }
752+ if(w->inherits("QToolBar")){ 753+ if(w->inherits("QToolBar")){
753+ w->installEventFilter(this); 754+ w->installEventFilter(this);
754+ w->setBackgroundMode(QWidget::PaletteBackground); 755+ w->setBackgroundMode(QWidget::PaletteBackground);
755+ w->setBackgroundOrigin(QWidget::WidgetOrigin); 756+ w->setBackgroundOrigin(QWidget::WidgetOrigin);
756 return; 757 return;
757 } 758 }
758 if(w->inherits("QPopupMenu")) 759 if(w->inherits("QPopupMenu"))
759 w->setBackgroundMode(QWidget::NoBackground); 760 w->setBackgroundMode(QWidget::NoBackground);
760+ else if(w-> testWFlags(Qt::WType_Popup) && 761+ else if(w-> testWFlags(Qt::WType_Popup) &&
761+ !w->inherits("QListBox") && 762+ !w->inherits("QListBox") &&
762+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 763+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
763 + w->installEventFilter(menuHandler); 764 + w->installEventFilter(menuHandler);
764+ } 765+ }
765 766
766 if(w->isTopLevel()){ 767 if(w->isTopLevel()){
767- if(!w->inherits("QPopupMenu") && 768- if(!w->inherits("QPopupMenu") &&
768- qstrcmp(kapp->argv()[0], "kicker") == 0){ 769- qstrcmp(kapp->argv()[0], "kicker") == 0){
769- qWarning("Got panel toplevel %s", w->className()); 770- qWarning("Got panel toplevel %s", w->className());
770- // force extensions and child panels to use proper palette. 771- // force extensions and child panels to use proper palette.
771- if(w->inherits("Panel")){ 772- if(w->inherits("Panel")){
772- qWarning("Setting panel palette"); 773- qWarning("Setting panel palette");
773- w->setPalette(kapp->palette()); 774- w->setPalette(kapp->palette());
774- } 775- }
775- else{ 776- else{
776- // reset palette for everything else 777- // reset palette for everything else
777- QPalette pal = kapp->palette(); 778- QPalette pal = kapp->palette();
778- pal.setBrush(QColorGroup::Background, bgBrush); 779- pal.setBrush(QColorGroup::Background, bgBrush);
779- pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); 780- pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130));
780- pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); 781- pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150));
781- pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); 782- pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110));
782- pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); 783- pal.setColor(QColorGroup::Light, bgBrush.color().light(120));
783- w->setPalette(pal); 784- w->setPalette(pal);
784- } 785- }
785- } 786- }
786 return; 787 return;
787 } 788 }
788- if(qstrcmp(kapp->argv()[0], "kicker") == 0 && 789- if(qstrcmp(kapp->argv()[0], "kicker") == 0 &&
789- w->inherits("KPanelExtension")){ // FIXME - doesn't work 790- w->inherits("KPanelExtension")){ // FIXME - doesn't work
790- w->setPalette(kapp->palette()); 791- w->setPalette(kapp->palette());
791- } 792- }
792 793
793- if(w->inherits("QComboBox") || 794- if(w->inherits("QComboBox") ||
794- w->inherits("QLineEdit") || w->inherits("QRadioButton") || 795- w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
795- w->inherits("QCheckBox") || w->inherits("QScrollBar") || 796- w->inherits("QCheckBox") || w->inherits("QScrollBar") ||
796- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || 797- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") ||
797- w->inherits("TaskContainer")){ 798- w->inherits("TaskContainer")){
798+ if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 799+ if(w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
799 w->installEventFilter(this); 800 w->installEventFilter(this);
800 } 801 }
801- if(w->inherits("QLineEdit")){ 802- if(w->inherits("QLineEdit")){
802- QPalette pal = w->palette(); 803- QPalette pal = w->palette();
803- pal.setBrush(QColorGroup::Base, baseBrush); 804- pal.setBrush(QColorGroup::Base, baseBrush);
804- w->setPalette(pal); 805- w->setPalette(pal);
805- } 806- }
806- if(w->inherits("QPushButton")){ 807- if(w->inherits("QPushButton")){
807- applyCustomAttributes((QPushButton *)w); 808- applyCustomAttributes((QPushButton *)w);
808- w->installEventFilter(this); 809- w->installEventFilter(this);
809+ 810+
810+ if(w->inherits("QButton") || w-> inherits("QComboBox")){ 811+ if(w->inherits("QButton") || w-> inherits("QComboBox")){
811 + w-> setBackgroundMode ( QWidget::PaletteBackground ); 812 + w-> setBackgroundMode ( QWidget::PaletteBackground );
812 + w->setBackgroundOrigin ( QWidget::ParentOrigin); 813 + w->setBackgroundOrigin ( QWidget::ParentOrigin);
813 } 814 }
814 815
815 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 816 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
816@@ -942,11 +849,20 @@ 817@@ -942,11 +850,20 @@
817 w->setMouseTracking(true); 818 w->setMouseTracking(true);
818 w->installEventFilter(this); 819 w->installEventFilter(this);
819 } 820 }
820+ if(w-> inherits("QToolButton")) { 821+ if(w-> inherits("QToolButton")) {
821+ if (w->parent()->inherits("QToolBar")) { 822+ if (w->parent()->inherits("QToolBar")) {
822 + ((QToolButton*)w)->setAutoRaise (flatTBButtons); 823 + ((QToolButton*)w)->setAutoRaise (flatTBButtons);
823 + if ( flatTBButtons ) 824 + if ( flatTBButtons )
824 + w->setBackgroundOrigin(QWidget::ParentOrigin); 825 + w->setBackgroundOrigin(QWidget::ParentOrigin);
825 + } 826 + }
826 + w-> installEventFilter ( this ); 827 + w-> installEventFilter ( this );
827+ } 828+ }
828+ if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 829+ if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
829 + ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 830 + ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
830+ } 831+ }
831 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 832 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
832 return; 833 return;
833 } 834 }
834- if(w->inherits("PanelButtonBase")) 835- if(w->inherits("PanelButtonBase"))
835- return; 836- return;
836 837
837 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 838 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
838 palette().active().brush(QColorGroup::Background).pixmap()){ 839 palette().active().brush(QColorGroup::Background).pixmap()){
839@@ -954,16 +870,21 @@ 840@@ -954,16 +871,21 @@
840 return; 841 return;
841 } 842 }
842 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 843 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
843- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ 844- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){
844 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 845 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
845 if(w->backgroundMode() == QWidget::PaletteBackground || 846 if(w->backgroundMode() == QWidget::PaletteBackground ||
846 w->backgroundMode() == QWidget::PaletteButton){ 847 w->backgroundMode() == QWidget::PaletteButton){
847- w->setBackgroundMode(QWidget::X11ParentRelative); 848- w->setBackgroundMode(QWidget::X11ParentRelative);
848+ w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 849+ w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
849+ w->setBackgroundOrigin(QWidget::ParentOrigin); 850+ w->setBackgroundOrigin(QWidget::ParentOrigin);
850 +// w->setBackgroundMode(QWidget::NoBackground); 851 +// w->setBackgroundMode(QWidget::NoBackground);
851 } 852 }
852 } 853 }
853- if(w->inherits("KToolBar")){ 854- if(w->inherits("KToolBar")){
854- w->installEventFilter(this); 855- w->installEventFilter(this);
855- //w->setBackgroundMode(QWidget::NoBackground); 856- //w->setBackgroundMode(QWidget::NoBackground);
856- return; 857- return;
857+ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 858+ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
858 + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 859 + w-> setBackgroundOrigin ( QWidget::ParentOrigin );
859 +else if ( w-> inherits("QFrame") ) 860 +else if ( w-> inherits("QFrame") )
860 + w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 861 + w->setBackgroundOrigin ( QWidget::WidgetOrigin );
861+ 862+
862 +if ( w->parentWidget()->inherits ( "QWidgetStack" )) { 863 +if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
863 + w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 864 + w->setBackgroundOrigin ( QWidget::WidgetOrigin );
864 } 865 }
865 } 866 }
866 867
867@@ -977,6 +898,11 @@ 868@@ -977,6 +899,11 @@
868 869
869 if(w->inherits("QPopupMenu")) 870 if(w->inherits("QPopupMenu"))
870 w->setBackgroundMode(QWidget::PaletteButton); 871 w->setBackgroundMode(QWidget::PaletteButton);
871+ else if(w-> testWFlags(Qt::WType_Popup) && 872+ else if(w-> testWFlags(Qt::WType_Popup) &&
872+ !w->inherits("QListBox") && 873+ !w->inherits("QListBox") &&
873+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { 874+ ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) {
874 + w->removeEventFilter(menuHandler); 875 + w->removeEventFilter(menuHandler);
875+ } 876+ }
876 877
877 if(w->isTopLevel()) 878 if(w->isTopLevel())
878 return; 879 return;
879@@ -986,7 +912,7 @@ 880@@ -986,7 +913,7 @@
880 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 881 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
881 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 882 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
882 883
883- w->setPalette(QApplication::palette()); 884- w->setPalette(QApplication::palette());
884+ w->unsetPalette(); 885+ w->unsetPalette();
885 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 886 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
886 if(w->inherits("QPushButton")) 887 if(w->inherits("QPushButton"))
887 w->setBackgroundMode(QWidget::PaletteButton); 888 w->setBackgroundMode(QWidget::PaletteButton);
888@@ -997,16 +923,12 @@ 889@@ -997,16 +924,12 @@
889 if(isViewportChild) 890 if(isViewportChild)
890 w->setAutoMask(false); 891 w->setAutoMask(false);
891 892
892- if(w->inherits("QPushButton")){ 893- if(w->inherits("QPushButton")){
893- unapplyCustomAttributes((QPushButton *)w); 894- unapplyCustomAttributes((QPushButton *)w);
894- w->removeEventFilter(this); 895- w->removeEventFilter(this);
895+/* 896+/*
896+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 897+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
897 + w-> setBackgroundMode ( PaletteBackground ); 898 + w-> setBackgroundMode ( PaletteBackground );
898 } 899 }
899- 900-
900- if(w->inherits("QComboBox") || 901- if(w->inherits("QComboBox") ||
901- w->inherits("QLineEdit") || w->inherits("QRadioButton") || 902- w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
902- w->inherits("QCheckBox") || w->inherits("QScrollBar") || 903- w->inherits("QCheckBox") || w->inherits("QScrollBar") ||
903- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || 904- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") ||
904- w->inherits("TaskContainer")){ 905- w->inherits("TaskContainer")){
905+*/ 906+*/
906+ if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) { 907+ if( w->inherits("QRadioButton") || w->inherits("QCheckBox") || w->inherits("QProgressBar")) {
907 w->removeEventFilter(this); 908 w->removeEventFilter(this);
908 } 909 }
909 if(w->inherits("QButton") || w->inherits("QComboBox")){ 910 if(w->inherits("QButton") || w->inherits("QComboBox")){
910@@ -1014,9 +936,12 @@ 911@@ -1014,9 +937,12 @@
911 w->setAutoMask(false); 912 w->setAutoMask(false);
912 } 913 }
913 } 914 }
914- if(w->inherits("KToolBar")){ 915- if(w->inherits("KToolBar")){
915+ if(w-> inherits("QToolButton")) { 916+ if(w-> inherits("QToolButton")) {
916 + w-> removeEventFilter ( this ); 917 + w-> removeEventFilter ( this );
917+ } 918+ }
918+ if(w->inherits("QToolBar")){ 919+ if(w->inherits("QToolBar")){
919 w->removeEventFilter(this); 920 w->removeEventFilter(this);
920- //w->setBackgroundMode(QWidget::PaletteBackground); 921- //w->setBackgroundMode(QWidget::PaletteBackground);
921+ w->setBackgroundMode(QWidget::PaletteBackground); 922+ w->setBackgroundMode(QWidget::PaletteBackground);
922 return; 923 return;
923 } 924 }
924 if(w->inherits("QHeader")){ 925 if(w->inherits("QHeader")){
925@@ -1028,22 +953,118 @@ 926@@ -1028,22 +954,118 @@
926 void LiquidStyle::polish(QApplication *app) 927 void LiquidStyle::polish(QApplication *app)
927 { 928 {
928 929
929- KStyle::polish(app); 930- KStyle::polish(app);
930+ QWindowsStyle::polish(app); 931+ QWindowsStyle::polish(app);
931 menuAni = app->isEffectEnabled(UI_AnimateMenu); 932 menuAni = app->isEffectEnabled(UI_AnimateMenu);
932 menuFade = app->isEffectEnabled(UI_FadeMenu); 933 menuFade = app->isEffectEnabled(UI_FadeMenu);
933 if(menuAni) 934 if(menuAni)
934 app->setEffectEnabled(UI_AnimateMenu, false); 935 app->setEffectEnabled(UI_AnimateMenu, false);
935 if(menuFade) 936 if(menuFade)
936 app->setEffectEnabled(UI_FadeMenu, false); 937 app->setEffectEnabled(UI_FadeMenu, false);
937 + 938 +
938+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 939+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
939+ 940+
940+ Config config ( "qpe" ); 941+ Config config ( "qpe" );
941+ config. setGroup ( "Liquid-Style" ); 942+ config. setGroup ( "Liquid-Style" );
942+ 943+
943 +// if ( config. readBoolEntry ( "WinDecoration", true )) 944 +// if ( config. readBoolEntry ( "WinDecoration", true ))
944 +// QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 945 +// QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
945 + 946 +
946 +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 947 +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
947 } 948 }
948 949
949 void LiquidStyle::unPolish(QApplication *app) 950 void LiquidStyle::unPolish(QApplication *app)
950 { 951 {
951- KStyle::unPolish(app); 952- KStyle::unPolish(app);
952+ QWindowsStyle::unPolish(app); 953+ QWindowsStyle::unPolish(app);
953 app->setEffectEnabled(UI_AnimateMenu, menuAni); 954 app->setEffectEnabled(UI_AnimateMenu, menuAni);
954 app->setEffectEnabled(UI_FadeMenu, menuFade); 955 app->setEffectEnabled(UI_FadeMenu, menuFade);
955+ 956+
956+ qt_set_draw_menu_bar_impl ( 0 ); 957+ qt_set_draw_menu_bar_impl ( 0 );
957+ 958+
958+// QApplication::qwsSetDecoration ( new QPEDecoration ( )); 959+// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
959 } 960 }
960 961
961+ 962+
962+/* !! HACK !! Beware 963+/* !! HACK !! Beware
963+ * 964+ *
964+ * TT forgot to make the QProgressBar widget styleable in Qt 2.x 965+ * TT forgot to make the QProgressBar widget styleable in Qt 2.x
965+ * So the only way to customize the drawing, is to intercept the 966+ * So the only way to customize the drawing, is to intercept the
966+ * paint event - since we have to use protected functions, we need 967+ * paint event - since we have to use protected functions, we need
967+ * to derive a "hack" class from QProgressBar and do the painting 968+ * to derive a "hack" class from QProgressBar and do the painting
968+ * in there. 969+ * in there.
969+ * 970+ *
970+ * - sandman 971+ * - sandman
971+ */ 972+ */
972+ 973+
973+class HackProgressBar : public QProgressBar { 974+class HackProgressBar : public QProgressBar {
974+public: 975+public:
975 +HackProgressBar ( ); 976 +HackProgressBar ( );
976 + 977 +
977 +void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) 978 +void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix )
978 +{ 979 +{
979 + QPainter p( this ); 980 + QPainter p( this );
980+ 981+
981 + if ( !contentsRect().contains( event->rect() ) ) { 982 + if ( !contentsRect().contains( event->rect() ) ) {
982 + p.save(); 983 + p.save();
983 + p.setClipRegion( event->region().intersect(frameRect()) ); 984 + p.setClipRegion( event->region().intersect(frameRect()) );
984 + drawFrame( &p); 985 + drawFrame( &p);
985 + p.restore(); 986 + p.restore();
986 + } 987 + }
987 + if ( event->rect().intersects( contentsRect() )) { 988 + if ( event->rect().intersects( contentsRect() )) {
988 + p.setClipRegion( event->region().intersect( contentsRect() ) ); 989 + p.setClipRegion( event->region().intersect( contentsRect() ) );
989+ 990+
990 + int x, y, w, h; 991 + int x, y, w, h;
991 + contentsRect ( ). rect ( &x, &y, &w, &h ); 992 + contentsRect ( ). rect ( &x, &y, &w, &h );
992+ 993+
993 + int prog = progress ( ); 994 + int prog = progress ( );
994 + int total = totalSteps ( ); 995 + int total = totalSteps ( );
995 + if ( prog < 0 ) 996 + if ( prog < 0 )
996 + prog = 0; 997 + prog = 0;
997 + if ( total <= 0 ) 998 + if ( total <= 0 )
998 + total = 1; 999 + total = 1;
999 + int bw = w * prog / total; 1000 + int bw = w * prog / total;
1000 + if ( bw > w ) 1001 + if ( bw > w )
1001 + bw = w; 1002 + bw = w;
1002+ 1003+
1003 + p.setPen(g.button().dark(130)); 1004 + p.setPen(g.button().dark(130));
1004 + p.drawRect(x, y, bw, h); 1005 + p.drawRect(x, y, bw, h);
1005 + p.setPen(g.button().light(120)); 1006 + p.setPen(g.button().light(120));
1006 + p.drawRect(x+1, y+1, bw-2, h-2); 1007 + p.drawRect(x+1, y+1, bw-2, h-2);
1007+ 1008+
1008 + if(bw >= 4 && h >= 4 && pix) 1009 + if(bw >= 4 && h >= 4 && pix)
1009 + p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); 1010 + p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix);
1010 + 1011 +
1011 + if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { 1012 + if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
1012 + QString pstr; 1013 + QString pstr;
1013 + pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); 1014 + pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ());
1014 + p. setPen ( g.text());//g.highlightedText ( )); 1015 + p. setPen ( g.text());//g.highlightedText ( ));
1015 + p. drawText (x,y,w-1,h-1,AlignCenter,pstr); 1016 + p. drawText (x,y,w-1,h-1,AlignCenter,pstr);
1016 + } 1017 + }
1017 + } 1018 + }
1018 +} 1019 +}
1019+}; 1020+};
1020+ 1021+
1021+ 1022+
1022+/* 1023+/*
1023+ * The same for QToolButton: 1024+ * The same for QToolButton:
1024+ * TT hardcoded the drawing of the focus rect ... 1025+ * TT hardcoded the drawing of the focus rect ...
1025+ * 1026+ *
1026+ * - sandman 1027+ * - sandman
1027+ */ 1028+ */
1028+ 1029+
1029+ 1030+
1030+class HackToolButton : public QToolButton { 1031+class HackToolButton : public QToolButton {
1031+public: 1032+public:
1032 +HackToolButton ( ); 1033 +HackToolButton ( );
1033 + 1034 +
1034 +void paint ( QPaintEvent *ev ) 1035 +void paint ( QPaintEvent *ev )
1035 +{ 1036 +{
1036 + erase ( ev-> region ( )); 1037 + erase ( ev-> region ( ));
1037 + QPainter p ( this ); 1038 + QPainter p ( this );
1038 + style ( ). drawToolButton ( this, &p ); 1039 + style ( ). drawToolButton ( this, &p );
1039 + drawButtonLabel ( &p ); 1040 + drawButtonLabel ( &p );
1040 +} 1041 +}
1041+}; 1042+};
1042+ 1043+
1043 /* 1044 /*
1044 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1045 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1045 * force everything to erase and repaint on resize. This is going away, I'm 1046 * force everything to erase and repaint on resize. This is going away, I'm
1046@@ -1063,7 +1084,7 @@ 1047@@ -1063,7 +1085,7 @@
1047 */ 1048 */
1048 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1049 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1049 { 1050 {
1050- if(obj->inherits("KToolBar")){ 1051- if(obj->inherits("KToolBar")){
1051+ if(obj->inherits("QToolBar")){ 1052+ if(obj->inherits("QToolBar")){
1052 if(ev->type() == QEvent::Resize){ 1053 if(ev->type() == QEvent::Resize){
1053 const QObjectList *tbChildList = obj->children(); 1054 const QObjectList *tbChildList = obj->children();
1054 QObjectListIt it(*tbChildList); 1055 QObjectListIt it(*tbChildList);
1055@@ -1076,116 +1097,27 @@ 1056@@ -1076,116 +1098,23 @@
1056 1057
1057 } 1058 }
1058 } 1059 }
1059- else if(obj->inherits("KMiniPagerButton")){ 1060- else if(obj->inherits("KMiniPagerButton")){
1060- QButton *btn = (QButton *)obj; 1061- QButton *btn = (QButton *)obj;
1061- if(ev->type() == QEvent::Paint){ 1062- if(ev->type() == QEvent::Paint){
1062- if(!(btn->isOn() || btn->isDown())){ 1063- if(!(btn->isOn() || btn->isDown())){
1063- QPalette pal = btn->palette(); 1064- QPalette pal = btn->palette();
1064- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? 1065- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ?
1065- pagerHoverBrush : pagerBrush); 1066- pagerHoverBrush : pagerBrush);
1066- btn->setPalette(pal); 1067- btn->setPalette(pal);
1067- } 1068- }
1068- else{ 1069- else{
1069- QPalette pal = btn->palette(); 1070- QPalette pal = btn->palette();
1070- pal.setBrush(QColorGroup::Dark, 1071- pal.setBrush(QColorGroup::Dark,
1071- QApplication::palette().active().brush(QColorGroup::Dark)); 1072- QApplication::palette().active().brush(QColorGroup::Dark));
1072- btn->setPalette(pal); 1073- btn->setPalette(pal);
1073- 1074-
1074- } 1075- }
1075- } 1076- }
1076- else if(ev->type() == QEvent::Enter){ 1077- else if(ev->type() == QEvent::Enter){
1077- highlightWidget = btn; 1078- highlightWidget = btn;
1078- btn->repaint(false); 1079- btn->repaint(false);
1079- } 1080- }
1080- else if(ev->type() == QEvent::Leave){ 1081- else if(ev->type() == QEvent::Leave){
1081- highlightWidget = NULL; 1082- highlightWidget = NULL;
1082- btn->repaint(false); 1083- btn->repaint(false);
1083- } 1084- }
1084- 1085-
1085- } 1086- }
1086- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || 1087- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") ||
1087- obj->isA("AppletHandle")){ 1088- obj->isA("AppletHandle")){
1088- QWidget *btn = (QWidget *)obj; 1089- QWidget *btn = (QWidget *)obj;
1089- if(ev->type() == QEvent::Enter){ 1090- if(ev->type() == QEvent::Enter){
1090- if(btn->isEnabled()){ 1091- if(btn->isEnabled()){
1091- highlightWidget = btn; 1092- highlightWidget = btn;
1092- btn->repaint(false); 1093- btn->repaint(false);
1093- } 1094- }
1094- } 1095- }
1095- else if(ev->type() == QEvent::Leave){ 1096- else if(ev->type() == QEvent::Leave){
1096- if(btn == highlightWidget){ 1097- if(btn == highlightWidget){
1097- highlightWidget = NULL; 1098- highlightWidget = NULL;
1098- btn->repaint(false); 1099- btn->repaint(false);
1099- } 1100- }
1100- } 1101- }
1101- } 1102- }
1102- else if(obj->inherits("TaskContainer")){ 1103- else if(obj->inherits("TaskContainer")){
1103- QButton *btn = (QButton *)obj; 1104- QButton *btn = (QButton *)obj;
1104- QPalette pal = btn->palette(); 1105- QPalette pal = btn->palette();
1105- if(ev->type() == QEvent::Enter){ 1106- if(ev->type() == QEvent::Enter){
1106- pal.setColor(QColorGroup::Background, pal.active().button().light(110)); 1107- pal.setColor(QColorGroup::Background, pal.active().button().light(110));
1107- btn->setPalette(pal); 1108- btn->setPalette(pal);
1108- } 1109- }
1109- else if(ev->type() == QEvent::Leave){ 1110- else if(ev->type() == QEvent::Leave){
1110- pal.setColor(QColorGroup::Background, 1111- pal.setColor(QColorGroup::Background,
1111- QApplication::palette().active().background()); 1112- QApplication::palette().active().background());
1112- btn->setPalette(pal); 1113- btn->setPalette(pal);
1113- } 1114- }
1114- } 1115- }
1115- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ 1116- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){
1116- QToolButton *btn = (QToolButton *)btn; 1117- QToolButton *btn = (QToolButton *)btn;
1117- if(!btn->autoRaise()){ 1118- if(!btn->autoRaise()){
1118+ else if(obj->inherits("QToolButton")){ 1119+ else if(obj->inherits("QToolButton")){
1119+ QToolButton *btn = (QToolButton *)obj; 1120+ QToolButton *btn = (QToolButton *)obj;
1120+ if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise () 1121+ if(ev->type() == QEvent::FocusIn ){ // && !btn-> autoRaise ()
1121 if(btn->isEnabled()){ 1122 if(btn->isEnabled()){
1122 highlightWidget = btn; 1123 highlightWidget = btn;
1123 btn->repaint(false); 1124 btn->repaint(false);
1124+
1125 + qDebug ( "TB FOCUS IN [%p]", btn );
1126 } 1125 }
1127 } 1126 }
1128- else if(ev->type() == QEvent::Leave){ 1127- else if(ev->type() == QEvent::Leave){
1129- QWidget *btn = (QWidget *)obj; 1128- QWidget *btn = (QWidget *)obj;
1130+ else if(ev->type() == QEvent::FocusOut ){ 1129+ else if(ev->type() == QEvent::FocusOut ){
1131 if(btn == highlightWidget){ 1130 if(btn == highlightWidget){
1132 highlightWidget = NULL; 1131 highlightWidget = NULL;
1133 btn->repaint(false); 1132 btn->repaint(false);
1134+
1135+ qDebug ( "TB FOCUS OUT [%p]", btn );
1136 } 1133 }
1137 } 1134 }
1138- else 1135- else
1139- highlightWidget = NULL; 1136- highlightWidget = NULL;
1140- } 1137- }
1141- else if(obj->inherits("QScrollBar")){ 1138- else if(obj->inherits("QScrollBar")){
1142- QScrollBar *sb = (QScrollBar *)obj; 1139- QScrollBar *sb = (QScrollBar *)obj;
1143- if(ev->type() == QEvent::Enter){ 1140- if(ev->type() == QEvent::Enter){
1144- if(sb->isEnabled()){ 1141- if(sb->isEnabled()){
1145- highlightWidget = sb; 1142- highlightWidget = sb;
1146- sb->repaint(false); 1143- sb->repaint(false);
1147- } 1144- }
1148- } 1145- }
1149- else if(ev->type() == QEvent::Leave){ 1146- else if(ev->type() == QEvent::Leave){
1150- if(sb == highlightWidget && !sb->draggingSlider()){ 1147- if(sb == highlightWidget && !sb->draggingSlider()){
1151- highlightWidget = NULL; 1148- highlightWidget = NULL;
1152- sb->repaint(false); 1149- sb->repaint(false);
1153- } 1150- }
1154- } 1151- }
1155- else if(ev->type() == QEvent::MouseButtonRelease){ 1152- else if(ev->type() == QEvent::MouseButtonRelease){
1156- QMouseEvent *me = (QMouseEvent *)ev; 1153- QMouseEvent *me = (QMouseEvent *)ev;
1157- if(sb == highlightWidget && !sb->rect().contains(me->pos())){ 1154- if(sb == highlightWidget && !sb->rect().contains(me->pos())){
1158- highlightWidget = NULL; 1155- highlightWidget = NULL;
1159- sb->repaint(false); 1156- sb->repaint(false);
1160- } 1157- }
1161- } 1158- }
1162- } 1159- }
1163- else if(obj->inherits("QLineEdit")){ 1160- else if(obj->inherits("QLineEdit")){
1164- if(obj->parent() && obj->parent()->inherits("QComboBox")){ 1161- if(obj->parent() && obj->parent()->inherits("QComboBox")){
1165- QWidget *btn = (QComboBox *)obj->parent(); 1162- QWidget *btn = (QComboBox *)obj->parent();
1166- if(ev->type() == QEvent::Enter){ 1163- if(ev->type() == QEvent::Enter){
1167- if (btn->isEnabled()){ 1164- if (btn->isEnabled()){
1168- highlightWidget = btn; 1165- highlightWidget = btn;
1169- btn->repaint(false); 1166- btn->repaint(false);
1170- } 1167- }
1171- } 1168- }
1172- else if(ev->type() == QEvent::Leave){ 1169- else if(ev->type() == QEvent::Leave){
1173- if (btn == highlightWidget) 1170- if (btn == highlightWidget)
1174- highlightWidget = NULL; 1171- highlightWidget = NULL;
1175- btn->repaint(false); 1172- btn->repaint(false);
1176- } 1173- }
1177+ else if(ev->type() == QEvent::Paint) { 1174+ else if(ev->type() == QEvent::Paint) {
1178 + (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev ); 1175 + (( HackToolButton *) btn )-> paint ((QPaintEvent *) ev );
1179 + return true; 1176 + return true;
1180 } 1177 }
1181 } 1178 }
1182 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ 1179 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){
1183@@ -1201,6 +1133,7 @@ 1180@@ -1201,6 +1130,7 @@
1184 QSize sz = isRadio ? exclusiveIndicatorSize() 1181 QSize sz = isRadio ? exclusiveIndicatorSize()
1185 : indicatorSize(); 1182 : indicatorSize();
1186 1183
1187+/* 1184+/*
1188 if(btn->hasFocus()){ 1185 if(btn->hasFocus()){
1189 QRect r = QRect(0, 0, btn->width(), btn->height()); 1186 QRect r = QRect(0, 0, btn->width(), btn->height());
1190 p.setPen(btn->colorGroup().button().dark(140)); 1187 p.setPen(btn->colorGroup().button().dark(140));
1191@@ -1209,6 +1142,7 @@ 1188@@ -1209,6 +1139,7 @@
1192 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1189 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1193 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1190 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1194 } 1191 }
1195+*/ 1192+*/
1196 int x = 0; 1193 int x = 0;
1197 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1194 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1198 if(isRadio) 1195 if(isRadio)
1199@@ -1228,36 +1162,6 @@ 1196@@ -1228,36 +1159,6 @@
1200 p.end(); 1197 p.end();
1201 return(true); 1198 return(true);
1202 } 1199 }
1203- // for hover, just redraw the indicator (not the text) 1200- // for hover, just redraw the indicator (not the text)
1204- else if((ev->type() == QEvent::Enter && btn->isEnabled()) || 1201- else if((ev->type() == QEvent::Enter && btn->isEnabled()) ||
1205- (ev->type() == QEvent::Leave && btn == highlightWidget)){ 1202- (ev->type() == QEvent::Leave && btn == highlightWidget)){
1206- QButton *btn = (QButton *)obj; 1203- QButton *btn = (QButton *)obj;
1207- bool isRadio = obj->inherits("QRadioButton"); 1204- bool isRadio = obj->inherits("QRadioButton");
1208- 1205-
1209- if(ev->type() == QEvent::Enter) 1206- if(ev->type() == QEvent::Enter)
1210- highlightWidget = btn; 1207- highlightWidget = btn;
1211- else 1208- else
1212- highlightWidget = NULL; 1209- highlightWidget = NULL;
1213- QFontMetrics fm = btn->fontMetrics(); 1210- QFontMetrics fm = btn->fontMetrics();
1214- QSize lsz = fm.size(ShowPrefix, btn->text()); 1211- QSize lsz = fm.size(ShowPrefix, btn->text());
1215- QSize sz = isRadio ? exclusiveIndicatorSize() 1212- QSize sz = isRadio ? exclusiveIndicatorSize()
1216- : indicatorSize(); 1213- : indicatorSize();
1217- int x = 0; 1214- int x = 0;
1218- int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1215- int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1219- //if(btn->autoMask()) 1216- //if(btn->autoMask())
1220- // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); 1217- // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2);
1221- QPainter p; 1218- QPainter p;
1222- p.begin(btn); 1219- p.begin(btn);
1223- if(isRadio) 1220- if(isRadio)
1224- drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1221- drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1225- btn->colorGroup(), btn->isOn(), 1222- btn->colorGroup(), btn->isOn(),
1226- btn->isDown(), btn->isEnabled()); 1223- btn->isDown(), btn->isEnabled());
1227- else 1224- else
1228- drawIndicator(&p, x, y, sz.width(), sz.height(), 1225- drawIndicator(&p, x, y, sz.width(), sz.height(),
1229- btn->colorGroup(), btn->state(), btn->isDown(), 1226- btn->colorGroup(), btn->state(), btn->isDown(),
1230- btn->isEnabled()); 1227- btn->isEnabled());
1231- p.end(); 1228- p.end();
1232- } 1229- }
1233 } 1230 }
1234 else if(obj->inherits("QHeader")){ 1231 else if(obj->inherits("QHeader")){
1235 QHeader *hw = (QHeader *)obj; 1232 QHeader *hw = (QHeader *)obj;
1236@@ -1290,7 +1194,24 @@ 1233@@ -1290,7 +1191,24 @@
1237 } 1234 }
1238 } 1235 }
1239 } 1236 }
1240- return(false); 1237- return(false);
1241+ else if (obj-> inherits( "QProgressBar" )) { 1238+ else if (obj-> inherits( "QProgressBar" )) {
1242 + if ( ev->type() == QEvent::Paint ) { 1239 + if ( ev->type() == QEvent::Paint ) {
1243 + HackProgressBar *p = (HackProgressBar *) obj; 1240 + HackProgressBar *p = (HackProgressBar *) obj;
1244 + const QColorGroup &g = p-> colorGroup ( ); 1241 + const QColorGroup &g = p-> colorGroup ( );
1245 + 1242 +
1246 + QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1243 + QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1247 + if(!pix){ 1244 + if(!pix){
1248 + int h, s, v; 1245 + int h, s, v;
1249 + g.button().dark(120).hsv(&h, &s, &v); 1246 + g.button().dark(120).hsv(&h, &s, &v);
1250 + pix = new QPixmap(*bevelFillPix); 1247 + pix = new QPixmap(*bevelFillPix);
1251 + adjustHSV(*pix, h, s, v); 1248 + adjustHSV(*pix, h, s, v);
1252 + bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1249 + bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1253 + } 1250 + }
1254 + p-> paint ((QPaintEvent *) ev, g, pix ); 1251 + p-> paint ((QPaintEvent *) ev, g, pix );
1255 + return true; 1252 + return true;
1256 + } 1253 + }
1257 + } 1254 + }
1258 +return false ; 1255 +return false ;
1259 } 1256 }
1260 1257
1261 void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, 1258 void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h,
1262@@ -1325,8 +1246,11 @@ 1259@@ -1340,11 +1258,6 @@
1263 }
1264
1265 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1266+ qDebug ( "DRAW TOOLBUTTON IN PIXMAP" );
1267 }
1268 else{
1269 + qDebug ( "DRAW TOOLBUTTON sunken=%d/high=%p/device=%p", sunken, highlightWidget,p->device() );
1270+
1271 drawClearBevel(p, x, y, w, h, sunken ? g.button() :
1272 highlightWidget == p->device() ? g.button().light(110) :
1273 g.background(), g.background());
1274@@ -1340,11 +1264,6 @@
1275 QColorGroup g = btn->colorGroup(); 1260 QColorGroup g = btn->colorGroup();
1276 1261
1277 1262
1278- QColor testColor; 1263- QColor testColor;
1279- if(btn->parent() && btn->parent()->isWidgetType()){ 1264- if(btn->parent() && btn->parent()->isWidgetType()){
1280- testColor = p->backgroundColor(); // remove me 1265- testColor = p->backgroundColor(); // remove me
1281- } 1266- }
1282- 1267-
1283 //int dw = buttonDefaultIndicatorWidth(); 1268 //int dw = buttonDefaultIndicatorWidth();
1284 if(btn->hasFocus() || btn->isDefault()){ 1269 if(btn->hasFocus() || btn->isDefault()){
1285 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 1270 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
1286@@ -1488,7 +1407,20 @@ 1271@@ -1488,7 +1401,20 @@
1287 const QColorGroup &g, bool sunken, 1272 const QColorGroup &g, bool sunken,
1288 bool edit, bool, const QBrush *) 1273 bool edit, bool, const QBrush *)
1289 { 1274 {
1290- bool isHover = highlightWidget == painter->device(); 1275- bool isHover = highlightWidget == painter->device();
1291+ bool isActive = false; 1276+ bool isActive = false;
1292+ if (( painter->device()->devType() == QInternal::Widget ) && 1277+ if (( painter->device()->devType() == QInternal::Widget ) &&
1293+ ( 1278+ (
1294+ ( qApp-> focusWidget ( ) == painter-> device ( )) || 1279+ ( qApp-> focusWidget ( ) == painter-> device ( )) ||
1295+ ( 1280+ (
1296+ edit && 1281+ edit &&
1297+ ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) && 1282+ ((QWidget *) painter-> device ( ))-> inherits ( "QComboBox" ) &&
1298+ ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( )) 1283+ ( qApp-> focusWidget ( ) == ((QComboBox *) painter->device())->lineEdit ( ))
1299+ ) 1284+ )
1300+ ) 1285+ )
1301+ ) { 1286+ ) {
1302 + isActive = true; 1287 + isActive = true;
1303+ } 1288+ }
1304 + 1289 +
1305 bool isMasked = false; 1290 bool isMasked = false;
1306 if(painter->device()->devType() == QInternal::Widget) 1291 if(painter->device()->devType() == QInternal::Widget)
1307 isMasked = ((QWidget*)painter->device())->autoMask(); 1292 isMasked = ((QWidget*)painter->device())->autoMask();
1308@@ -1498,7 +1430,7 @@ 1293@@ -1498,7 +1424,7 @@
1309 1294
1310 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, 1295 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
1311 sunken, false, isMasked); 1296 sunken, false, isMasked);
1312- if(!isHover){ 1297- if(!isHover){
1313+ if(!isActive){ 1298+ if(!isActive){
1314 p.setClipRect(0, 0, w-17, h); 1299 p.setClipRect(0, 0, w-17, h);
1315 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, 1300 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
1316 sunken, false, isMasked); 1301 sunken, false, isMasked);
1317@@ -1550,16 +1482,17 @@ 1302@@ -1550,16 +1476,17 @@
1318 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); 1303 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6));
1319 } 1304 }
1320 1305
1321-QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) 1306-QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h)
1322+QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) 1307+QRect LiquidStyle::comboButtonFocusRect(int /*x*/, int /*y*/, int /*w*/, int /*h*/)
1323 { 1308 {
1324- return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1309- return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1325 +return QRect ( ); 1310 +return QRect ( );
1326 + 1311 +
1327+// return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1312+// return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1328 } 1313 }
1329 1314
1330 void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, 1315 void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
1331 int sliderStart, uint controls, 1316 int sliderStart, uint controls,
1332 uint activeControl) 1317 uint activeControl)
1333 { 1318 {
1334- bool isHover = highlightWidget == p->device(); 1319- bool isHover = highlightWidget == p->device();
1335 int sliderMin, sliderMax, sliderLength, buttonDim; 1320 int sliderMin, sliderMax, sliderLength, buttonDim;
1336 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1321 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1337 1322
1338@@ -1596,7 +1529,7 @@ 1323@@ -1596,7 +1523,7 @@
1339 if(sbBuffer.size() != sb->size()) 1324 if(sbBuffer.size() != sb->size())
1340 sbBuffer.resize(sb->size()); 1325 sbBuffer.resize(sb->size());
1341 } 1326 }
1342- subB.setRect( subX,subY,buttonDim,buttonDim ); 1327- subB.setRect( subX,subY,buttonDim,buttonDim );
1343+ subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); 1328+ subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
1344 addB.setRect( addX,addY,buttonDim,buttonDim ); 1329 addB.setRect( addX,addY,buttonDim,buttonDim );
1345 if(horiz) 1330 if(horiz)
1346 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); 1331 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
1347@@ -1624,7 +1557,7 @@ 1332@@ -1624,7 +1551,7 @@
1348 QPainter painter; 1333 QPainter painter;
1349 if(!horiz){ 1334 if(!horiz){
1350 painter.begin(&sbBuffer); 1335 painter.begin(&sbBuffer);
1351- QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); 1336- QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1);
1352+ QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); 1337+ QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
1353 if(sliderR.height() >= 8){ 1338 if(sliderR.height() >= 8){
1354 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, 1339 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
1355 13, 8); 1340 13, 8);
1356@@ -1648,25 +1581,15 @@ 1341@@ -1648,25 +1575,15 @@
1357 } 1342 }
1358 if(controls & Slider){ 1343 if(controls & Slider){
1359 if(sliderR.height() >= 16){ 1344 if(sliderR.height() >= 16){
1360- painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1345- painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1361- isHover ? *getPixmap(VSBSliderTopHover): 1346- isHover ? *getPixmap(VSBSliderTopHover):
1362- *getPixmap(VSBSliderTop)); 1347- *getPixmap(VSBSliderTop));
1363+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop)); 1348+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop));
1364 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, 1349 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13,
1365- sliderR.height()-16, isHover ? 1350- sliderR.height()-16, isHover ?
1366- *getPixmap(VSBSliderMidHover) : 1351- *getPixmap(VSBSliderMidHover) :
1367- *getPixmap(VSBSliderMid)); 1352- *getPixmap(VSBSliderMid));
1368- painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, 1353- painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8,
1369- isHover ? *getPixmap(VSBSliderBtmHover) : 1354- isHover ? *getPixmap(VSBSliderBtmHover) :
1370- *getPixmap(VSBSliderBtm)); 1355- *getPixmap(VSBSliderBtm));
1371+ sliderR.height()-16, *getPixmap(VSBSliderMid)); 1356+ sliderR.height()-16, *getPixmap(VSBSliderMid));
1372+ painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm)); 1357+ painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, *getPixmap(VSBSliderBtm));
1373 } 1358 }
1374 else if(sliderR.height() >= 8){ 1359 else if(sliderR.height() >= 8){
1375 int m = sliderR.height()/2; 1360 int m = sliderR.height()/2;
1376- painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1361- painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1377- isHover ? *getPixmap(VSBSliderTopHover): 1362- isHover ? *getPixmap(VSBSliderTopHover):
1378- *getPixmap(VSBSliderTop), 0, 0, 13, m); 1363- *getPixmap(VSBSliderTop), 0, 0, 13, m);
1379- painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, 1364- painter.drawPixmap(sliderR.x()+1, sliderR.y()+m,
1380- isHover ? *getPixmap(VSBSliderBtmHover): 1365- isHover ? *getPixmap(VSBSliderBtmHover):
1381- *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1366- *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1382+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m); 1367+ painter.drawPixmap(sliderR.x()+1, sliderR.y(), *getPixmap(VSBSliderTop), 0, 0, 13, m);
1383+ painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1368+ painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1384 } 1369 }
1385 else{ 1370 else{
1386 painter.setPen(g.button().dark(210)); 1371 painter.setPen(g.button().dark(210));
1387@@ -1674,7 +1597,6 @@ 1372@@ -1674,7 +1591,6 @@
1388 13, sliderR.height()); 1373 13, sliderR.height());
1389 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, 1374 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1,
1390 11, sliderR.height()-2, 1375 11, sliderR.height()-2,
1391- isHover ? *getPixmap(VSBSliderMidHover) : 1376- isHover ? *getPixmap(VSBSliderMidHover) :
1392 *getPixmap(VSBSliderMid), 1, 0); 1377 *getPixmap(VSBSliderMid), 1, 0);
1393 } 1378 }
1394 } 1379 }
1395@@ -1690,7 +1612,7 @@ 1380@@ -1690,7 +1606,7 @@
1396 } 1381 }
1397 else{ 1382 else{
1398 painter.begin(&sbBuffer); 1383 painter.begin(&sbBuffer);
1399- QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); 1384- QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height());
1400+ QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); 1385+ QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
1401 if(sliderR.width() >= 8){ 1386 if(sliderR.width() >= 8){
1402 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, 1387 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
1403 8, 13); 1388 8, 13);
1404@@ -1715,22 +1637,17 @@ 1389@@ -1715,22 +1631,17 @@
1405 if(controls & Slider){ 1390 if(controls & Slider){
1406 if(sliderR.width() >= 16){ 1391 if(sliderR.width() >= 16){
1407 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1392 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1408- isHover ? *getPixmap(HSBSliderTopHover) : 1393- isHover ? *getPixmap(HSBSliderTopHover) :
1409 *getPixmap(HSBSliderTop)); 1394 *getPixmap(HSBSliderTop));
1410 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, 1395 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16,
1411- 13, isHover ? *getPixmap(HSBSliderMidHover) : 1396- 13, isHover ? *getPixmap(HSBSliderMidHover) :
1412- *getPixmap(HSBSliderMid)); 1397- *getPixmap(HSBSliderMid));
1413- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1398- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1414- *getPixmap(HSBSliderBtmHover) : 1399- *getPixmap(HSBSliderBtmHover) :
1415+ 13, *getPixmap(HSBSliderMid)); 1400+ 13, *getPixmap(HSBSliderMid));
1416+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1401+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1417 *getPixmap(HSBSliderBtm)); 1402 *getPixmap(HSBSliderBtm));
1418 } 1403 }
1419 else if(sliderR.width() >= 8){ 1404 else if(sliderR.width() >= 8){
1420 int m = sliderR.width()/2; 1405 int m = sliderR.width()/2;
1421 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1406 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1422- isHover ? *getPixmap(HSBSliderTopHover) : 1407- isHover ? *getPixmap(HSBSliderTopHover) :
1423 *getPixmap(HSBSliderTop), 0, 0, m, 13); 1408 *getPixmap(HSBSliderTop), 0, 0, m, 13);
1424- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1409- painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1425- *getPixmap(HSBSliderBtmHover) : 1410- *getPixmap(HSBSliderBtmHover) :
1426+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, 1411+ painter.drawPixmap(sliderR.right()-8, sliderR.y()+1,
1427 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); 1412 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
1428 } 1413 }
1429 else{ 1414 else{
1430@@ -1738,8 +1655,7 @@ 1415@@ -1738,8 +1649,7 @@
1431 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, 1416 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1,
1432 sliderR.width(), 13); 1417 sliderR.width(), 13);
1433 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, 1418 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
1434- sliderR.width()-2, 11, isHover ? 1419- sliderR.width()-2, 11, isHover ?
1435- *getPixmap(HSBSliderMidHover) : 1420- *getPixmap(HSBSliderMidHover) :
1436+ sliderR.width()-2, 11, 1421+ sliderR.width()-2, 11,
1437 *getPixmap(HSBSliderMid), 0, 1); 1422 *getPixmap(HSBSliderMid), 0, 1);
1438 } 1423 }
1439 } 1424 }
1440@@ -1761,10 +1677,10 @@ 1425@@ -1761,10 +1671,10 @@
1441 addB.width()-8, addB.height()-8, g, !maxed); 1426 addB.width()-8, addB.height()-8, g, !maxed);
1442 } 1427 }
1443 if ( controls & SubLine ) { 1428 if ( controls & SubLine ) {
1444- drawSBButton(p, subB, g, activeControl == SubLine); 1429- drawSBButton(p, subB, g, activeControl == SubLine);
1445- drawArrow( p, horiz ? LeftArrow : UpArrow, 1430- drawArrow( p, horiz ? LeftArrow : UpArrow,
1446- false, subB.x()+4, subB.y()+4, 1431- false, subB.x()+4, subB.y()+4,
1447- subB.width()-8, subB.height()-8, g, !maxed); 1432- subB.width()-8, subB.height()-8, g, !maxed);
1448+ // drawSBButton(p, subB, g, activeControl == SubLine); 1433+ // drawSBButton(p, subB, g, activeControl == SubLine);
1449+ // drawArrow( p, horiz ? LeftArrow : UpArrow, 1434+ // drawArrow( p, horiz ? LeftArrow : UpArrow,
1450+ // false, subB.x()+4, subB.y()+4, 1435+ // false, subB.x()+4, subB.y()+4,
1451+ // subB.width()-8, subB.height()-8, g, !maxed); 1436+ // subB.width()-8, subB.height()-8, g, !maxed);
1452 drawSBButton(p, subHC, g, activeControl == SubLine); 1437 drawSBButton(p, subHC, g, activeControl == SubLine);
1453 drawArrow( p, horiz ? LeftArrow : UpArrow, 1438 drawArrow( p, horiz ? LeftArrow : UpArrow,
1454 false, subHC.x()+4, subHC.y()+4, 1439 false, subHC.x()+4, subHC.y()+4,
1455@@ -1865,8 +1781,8 @@ 1440@@ -1865,8 +1775,8 @@
1456 else 1441 else
1457 buttonDim = ( length - b*2 )/2 - 1; 1442 buttonDim = ( length - b*2 )/2 - 1;
1458 1443
1459- sliderMin = b + buttonDim; 1444- sliderMin = b + buttonDim;
1460- maxLength = length - b*2 - buttonDim*3; 1445- maxLength = length - b*2 - buttonDim*3;
1461+ sliderMin = b + 0; // buttonDim; 1446+ sliderMin = b + 0; // buttonDim;
1462+ maxLength = length - b*2 - buttonDim*2; // 3; 1447+ maxLength = length - b*2 - buttonDim*2; // 3;
1463 1448
1464 if ( sb->maxValue() == sb->minValue() ) { 1449 if ( sb->maxValue() == sb->minValue() ) {
1465 sliderLength = maxLength; 1450 sliderLength = maxLength;
1466@@ -1914,31 +1830,31 @@ 1451@@ -1914,31 +1824,31 @@
1467 return(QSize(16, 16)); 1452 return(QSize(16, 16));
1468 } 1453 }
1469 1454
1470-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, 1455-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w,
1471- int h, const QColorGroup &g, bool on, 1456- int h, const QColorGroup &g, bool on,
1472+void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, 1457+void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
1473+ int /*h*/, const QColorGroup &/*g*/, bool on, 1458+ int /*h*/, const QColorGroup &/*g*/, bool on,
1474 bool down, bool) 1459 bool down, bool)
1475 { 1460 {
1476- bool isHover = highlightWidget == p->device(); 1461- bool isHover = highlightWidget == p->device();
1477+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1462+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1478 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1463 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1479 && ((QWidget*)p->device())->autoMask(); 1464 && ((QWidget*)p->device())->autoMask();
1480 1465
1481 if(isMasked){ 1466 if(isMasked){
1482 if(on || down){ 1467 if(on || down){
1483- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : 1468- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) :
1484+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) : 1469+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) :
1485 *getPixmap(HTMLRadioDown)); 1470 *getPixmap(HTMLRadioDown));
1486 } 1471 }
1487 else 1472 else
1488- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : 1473- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) :
1489+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) : 1474+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) :
1490 *getPixmap(HTMLRadio)); 1475 *getPixmap(HTMLRadio));
1491 1476
1492 } 1477 }
1493 else{ 1478 else{
1494 if(on || down){ 1479 if(on || down){
1495- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : 1480- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) :
1496+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) : 1481+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) :
1497 *getPixmap(RadioOn)); 1482 *getPixmap(RadioOn));
1498 } 1483 }
1499 else 1484 else
1500- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : 1485- p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) :
1501+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) : 1486+ p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) :
1502 *getPixmap(RadioOff)); 1487 *getPixmap(RadioOff));
1503 } 1488 }
1504 } 1489 }
1505@@ -1957,25 +1873,25 @@ 1490@@ -1957,25 +1867,25 @@
1506 return(QSize(20, 22)); 1491 return(QSize(20, 22));
1507 } 1492 }
1508 1493
1509-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, 1494-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h,
1510- const QColorGroup &g, int state, bool down, bool) 1495- const QColorGroup &g, int state, bool down, bool)
1511+void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1496+void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1512+ const QColorGroup &/*g*/, int state, bool /*down*/, bool) 1497+ const QColorGroup &/*g*/, int state, bool /*down*/, bool)
1513 { 1498 {
1514- bool isHover = highlightWidget == p->device(); 1499- bool isHover = highlightWidget == p->device();
1515+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); 1500+ bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( ));
1516 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1501 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1517 && ((QWidget*)p->device())->autoMask(); 1502 && ((QWidget*)p->device())->autoMask();
1518 if(isMasked){ 1503 if(isMasked){
1519 if(state != QButton::Off){ 1504 if(state != QButton::Off){
1520- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : 1505- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) :
1521+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) : 1506+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) :
1522 *getPixmap(HTMLCBDown)); 1507 *getPixmap(HTMLCBDown));
1523 } 1508 }
1524 else 1509 else
1525- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : 1510- p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) :
1526+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) : 1511+ p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) :
1527 *getPixmap(HTMLCB)); 1512 *getPixmap(HTMLCB));
1528 1513
1529 } 1514 }
1530 else{ 1515 else{
1531 if(state != QButton::Off){ 1516 if(state != QButton::Off){
1532- p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : 1517- p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) :
1533+ p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) : 1518+ p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) :
1534 *getPixmap(CBDown)); 1519 *getPixmap(CBDown));
1535 /* Todo - tristate 1520 /* Todo - tristate
1536 if(state == QButton::On){ 1521 if(state == QButton::On){
1537@@ -1992,12 +1908,12 @@ 1522@@ -1992,12 +1902,12 @@
1538 }*/ 1523 }*/
1539 } 1524 }
1540 else 1525 else
1541- p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); 1526- p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB));
1542+ p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB)); 1527+ p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB));
1543 } 1528 }
1544 } 1529 }
1545 1530
1546-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, 1531-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h,
1547- int state) 1532- int state)
1548+void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1533+void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1549+ int /*state*/) 1534+ int /*state*/)
1550 { 1535 {
1551 // needed for some reason by KHtml, even tho it's all filled ;P 1536 // needed for some reason by KHtml, even tho it's all filled ;P
1552 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 1537 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
1553@@ -2005,18 +1921,17 @@ 1538@@ -2005,18 +1915,17 @@
1554 } 1539 }
1555 1540
1556 void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 1541 void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
1557- const QColorGroup &g, Orientation orient, 1542- const QColorGroup &g, Orientation orient,
1558+ const QColorGroup &/*g*/, Orientation orient, 1543+ const QColorGroup &/*g*/, Orientation orient,
1559 bool, bool) 1544 bool, bool)
1560 { 1545 {
1561 QWidget *parent = (QWidget *)p->device(); 1546 QWidget *parent = (QWidget *)p->device();
1562 p->setBrushOrigin(parent->pos()); 1547 p->setBrushOrigin(parent->pos());
1563- p->fillRect(x, y, w, h, 1548- p->fillRect(x, y, w, h,
1564- QApplication::palette().active().brush(QColorGroup::Background)); 1549- QApplication::palette().active().brush(QColorGroup::Background));
1565+ parent->erase(x, y, w, h); 1550+ parent->erase(x, y, w, h);
1566 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1551 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1567 *getPixmap(VSlider)); 1552 *getPixmap(VSlider));
1568 } 1553 }
1569 1554
1570-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, 1555-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h,
1571+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1556+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1572 Orientation orient, bool, bool) 1557 Orientation orient, bool, bool)
1573 { 1558 {
1574 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1559 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1575@@ -2065,243 +1980,76 @@ 1560@@ -2065,243 +1974,76 @@
1576 p->drawLineSegments(a); 1561 p->drawLineSegments(a);
1577 } 1562 }
1578 1563
1579-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, 1564-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h,
1580- const QColorGroup &g, KToolBarPos, 1565- const QColorGroup &g, KToolBarPos,
1581- QBrush *) 1566- QBrush *)
1582-{ 1567-{
1583- p->setPen(g.button().dark(120)); 1568- p->setPen(g.button().dark(120));
1584- int x2 = x+w-1; 1569- int x2 = x+w-1;
1585- int y2 = y+h-1; 1570- int y2 = y+h-1;
1586- p->drawLine(x+1, y, x2-1, y); 1571- p->drawLine(x+1, y, x2-1, y);
1587- p->drawLine(x+1, y2, x2-1, y2); 1572- p->drawLine(x+1, y2, x2-1, y2);
1588- p->drawLine(x, y+1, x, y2-1); 1573- p->drawLine(x, y+1, x, y2-1);
1589- p->drawLine(x2, y+1, x2, y2-1); 1574- p->drawLine(x2, y+1, x2, y2-1);
1590- 1575-
1591- p->setPen(g.background()); 1576- p->setPen(g.background());
1592- p->drawPoint(x, y); 1577- p->drawPoint(x, y);
1593- p->drawPoint(x2, y); 1578- p->drawPoint(x2, y);
1594- p->drawPoint(x, y2); 1579- p->drawPoint(x, y2);
1595- p->drawPoint(x2, y2); 1580- p->drawPoint(x2, y2);
1596- 1581-
1597- 1582-
1598- 1583-
1599- // p->drawRect(x, y, w, h); 1584- // p->drawRect(x, y, w, h);
1600- QPixmap *pix = bevelFillDict.find(g.button().rgb()); 1585- QPixmap *pix = bevelFillDict.find(g.button().rgb());
1601- if(!pix){ 1586- if(!pix){
1602- int h, s, v; 1587- int h, s, v;
1603- g.button().hsv(&h, &s, &v); 1588- g.button().hsv(&h, &s, &v);
1604- pix = new QPixmap(*bevelFillPix); 1589- pix = new QPixmap(*bevelFillPix);
1605- adjustHSV(*pix, h, s, v); 1590- adjustHSV(*pix, h, s, v);
1606- bevelFillDict.insert(g.button().rgb(), pix); 1591- bevelFillDict.insert(g.button().rgb(), pix);
1607- } 1592- }
1608- 1593-
1609- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); 1594- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix);
1610-} 1595-}
1611- 1596-
1612-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, 1597-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h,
1613- const QColorGroup &g, bool mac, QBrush *) 1598- const QColorGroup &g, bool mac, QBrush *)
1614-{ 1599-{
1615- if(p->device() && p->device()->devType() == QInternal::Widget && 1600- if(p->device() && p->device()->devType() == QInternal::Widget &&
1616- ((KMenuBar *)p->device())->isTopLevelMenu()){ 1601- ((KMenuBar *)p->device())->isTopLevelMenu()){
1617- p->setPen(Qt::black); 1602- p->setPen(Qt::black);
1618- p->drawRect(x, y, w, h); 1603- p->drawRect(x, y, w, h);
1619- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); 1604- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix);
1620- // left 1605- // left
1621- p->drawLine(x+1, y+1, x+1, y+5); 1606- p->drawLine(x+1, y+1, x+1, y+5);
1622- p->drawLine(x+2, y+1, x+2, y+3); 1607- p->drawLine(x+2, y+1, x+2, y+3);
1623- p->drawLine(x+3, y+1, x+3, y+2); 1608- p->drawLine(x+3, y+1, x+3, y+2);
1624- p->drawLine(x+4, y+1, x+6, y+1); 1609- p->drawLine(x+4, y+1, x+6, y+1);
1625- // right 1610- // right
1626- int x2 = x+w-1; 1611- int x2 = x+w-1;
1627- p->drawLine(x2-1, y+1, x2-1, y+5); 1612- p->drawLine(x2-1, y+1, x2-1, y+5);
1628- p->drawLine(x2-2, y+1, x2-2, y+3); 1613- p->drawLine(x2-2, y+1, x2-2, y+3);
1629- p->drawLine(x2-3, y+1, x2-3, y+2); 1614- p->drawLine(x2-3, y+1, x2-3, y+2);
1630- p->drawLine(x2-4, y+1, x2-6, y+1); 1615- p->drawLine(x2-4, y+1, x2-6, y+1);
1631- } 1616- }
1632- else{ 1617- else{
1633- qDrawShadePanel(p, x, y, w, h, g, false, 1, 1618- qDrawShadePanel(p, x, y, w, h, g, false, 1,
1634- &g.brush(QColorGroup::Background)); 1619- &g.brush(QColorGroup::Background));
1635- } 1620- }
1636
1637-}
1638- 1621-
1622-}
1623
1639-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, 1624-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h,
1640- const QColorGroup &g, KToolBarPos, QBrush *) 1625- const QColorGroup &g, KToolBarPos, QBrush *)
1641+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 1626+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
1642+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 1627+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
1643 { 1628 {
1644- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1629- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
1645-} 1630-}
1646- 1631-
1647-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, 1632-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h,
1648- const QColorGroup &g, bool sunken, 1633- const QColorGroup &g, bool sunken,
1649- bool raised, bool enabled, bool popup, 1634- bool raised, bool enabled, bool popup,
1650- KToolButtonType icontext, 1635- KToolButtonType icontext,
1651- const QString& btext, const QPixmap *pixmap, 1636- const QString& btext, const QPixmap *pixmap,
1652- QFont *font, QWidget *btn) 1637- QFont *font, QWidget *btn)
1653-{ 1638-{
1654- int dx, dy; 1639- int dx, dy;
1655- 1640-
1656- QFontMetrics fm(*font); 1641- QFontMetrics fm(*font);
1657- 1642-
1658- QToolBar* toolbar = 0; 1643- QToolBar* toolbar = 0;
1659- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) 1644- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar"))
1660- toolbar = static_cast<QToolBar*>(btn->parent()); 1645- toolbar = static_cast<QToolBar*>(btn->parent());
1661- 1646-
1662- --w, --h; 1647- --w, --h;
1663- if(sunken) 1648- if(sunken)
1664- ++x, ++y; 1649- ++x, ++y;
1665- 1650-
1666- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : 1651- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) :
1667- g.background()); 1652- g.background());
1668- drawClearBevel(p, x, y, w, h, btnColor, g.background()); 1653- drawClearBevel(p, x, y, w, h, btnColor, g.background());
1669- 1654-
1670- p->setPen(g.text()); 1655- p->setPen(g.text());
1671- 1656-
1672- if (icontext == Icon){ // icon only 1657- if (icontext == Icon){ // icon only
1673- if (pixmap){ 1658- if (pixmap){
1674- dx = ( w - pixmap->width() ) / 2; 1659- dx = ( w - pixmap->width() ) / 2;
1675- dy = ( h - pixmap->height() ) / 2; 1660- dy = ( h - pixmap->height() ) / 2;
1676- if ( sunken ) 1661- if ( sunken )
1677- { 1662- {
1678- ++dx; 1663- ++dx;
1679- ++dy; 1664- ++dy;
1680- } 1665- }
1681- p->drawPixmap( x+dx, y+dy, *pixmap ); 1666- p->drawPixmap( x+dx, y+dy, *pixmap );
1682- } 1667- }
1683- } 1668- }
1684- else if (icontext == IconTextRight){ // icon and text (if any) 1669- else if (icontext == IconTextRight){ // icon and text (if any)
1685- if (pixmap){ 1670- if (pixmap){
1686- dx = 4; 1671- dx = 4;
1687- dy = ( h - pixmap->height() ) / 2; 1672- dy = ( h - pixmap->height() ) / 2;
1688- if ( sunken ){ 1673- if ( sunken ){
1689- ++dx; 1674- ++dx;
1690- ++dy; 1675- ++dy;
1691- } 1676- }
1692- p->drawPixmap( x+dx, y+dy, *pixmap ); 1677- p->drawPixmap( x+dx, y+dy, *pixmap );
1693- } 1678- }
1694- if (!btext.isNull()){ 1679- if (!btext.isNull()){
1695- int tf = AlignVCenter|AlignLeft; 1680- int tf = AlignVCenter|AlignLeft;
1696- if (pixmap) 1681- if (pixmap)
1697- dx= 4 + pixmap->width() + 2; 1682- dx= 4 + pixmap->width() + 2;
1698- else 1683- else
1699- dx= 4; 1684- dx= 4;
1700- dy = 0; 1685- dy = 0;
1701- if ( sunken ){ 1686- if ( sunken ){
1702- ++dx; 1687- ++dx;
1703- ++dy; 1688- ++dy;
1704- } 1689- }
1705- if (font) 1690- if (font)
1706- p->setFont(*font); 1691- p->setFont(*font);
1707- if(raised) 1692- if(raised)
1708- p->setPen(KGlobalSettings::toolBarHighlightColor()); 1693- p->setPen(KGlobalSettings::toolBarHighlightColor());
1709- p->drawText(x+dx, y+dy, w-dx, h, tf, btext); 1694- p->drawText(x+dx, y+dy, w-dx, h, tf, btext);
1710- } 1695- }
1711- } 1696- }
1712- else if (icontext == Text){ // only text, even if there is a icon 1697- else if (icontext == Text){ // only text, even if there is a icon
1713- if (!btext.isNull()){ 1698- if (!btext.isNull()){
1714- int tf = AlignVCenter|AlignLeft; 1699- int tf = AlignVCenter|AlignLeft;
1715- if (!enabled) 1700- if (!enabled)
1716- p->setPen(g.dark()); 1701- p->setPen(g.dark());
1717- dx= (w - fm.width(btext)) / 2; 1702- dx= (w - fm.width(btext)) / 2;
1718- dy= (h - fm.lineSpacing()) / 2; 1703- dy= (h - fm.lineSpacing()) / 2;
1719- if ( sunken ){ 1704- if ( sunken ){
1720- ++dx; 1705- ++dx;
1721- ++dy; 1706- ++dy;
1722- } 1707- }
1723- if (font) 1708- if (font)
1724- p->setFont(*font); 1709- p->setFont(*font);
1725- if(raised) 1710- if(raised)
1726- p->setPen(KGlobalSettings::toolBarHighlightColor()); 1711- p->setPen(KGlobalSettings::toolBarHighlightColor());
1727- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); 1712- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext);
1728- } 1713- }
1729- } 1714- }
1730- else if (icontext == IconTextBottom){ 1715- else if (icontext == IconTextBottom){
1731- if (pixmap){ 1716- if (pixmap){
1732- dx = (w - pixmap->width()) / 2; 1717- dx = (w - pixmap->width()) / 2;
1733- dy = (h - fm.lineSpacing() - pixmap->height()) / 2; 1718- dy = (h - fm.lineSpacing() - pixmap->height()) / 2;
1734- if ( sunken ){ 1719- if ( sunken ){
1735- ++dx; 1720- ++dx;
1736- ++dy; 1721- ++dy;
1737- } 1722- }
1738- p->drawPixmap( x+dx, y+dy, *pixmap ); 1723- p->drawPixmap( x+dx, y+dy, *pixmap );
1739- } 1724- }
1740- if (!btext.isNull()){ 1725- if (!btext.isNull()){
1741- int tf = AlignBottom|AlignHCenter; 1726- int tf = AlignBottom|AlignHCenter;
1742- dy= pixmap->height(); 1727- dy= pixmap->height();
1743- dx = 2; 1728- dx = 2;
1744- if ( sunken ){ 1729- if ( sunken ){
1745- ++dx; 1730- ++dx;
1746- ++dy; 1731- ++dy;
1747- } 1732- }
1748- if (font) 1733- if (font)
1749- p->setFont(*font); 1734- p->setFont(*font);
1750- if(raised) 1735- if(raised)
1751- p->setPen(KGlobalSettings::toolBarHighlightColor()); 1736- p->setPen(KGlobalSettings::toolBarHighlightColor());
1752- p->drawText(x, y, w, h-3, tf, btext); 1737- p->drawText(x, y, w, h-3, tf, btext);
1753- } 1738- }
1754- } 1739- }
1755- if (popup){ 1740- if (popup){
1756- if (enabled) 1741- if (enabled)
1757- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, 1742- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0,
1758- g, true); 1743- g, true);
1759- else 1744- else
1760- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 1745- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5,
1761- 0, 0, g, false); 1746- 0, 0, g, false);
1762+ if(active){ 1747+ if(active){
1763+ x -= 2; // Bug in Qt/E 1748+ x -= 2; // Bug in Qt/E
1764+ y -= 2; 1749+ y -= 2;
1765+ w += 2; 1750+ w += 2;
1766+ h += 2; 1751+ h += 2;
1767 } 1752 }
1768-} 1753-}
1769- 1754-
1770 1755
1771-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, 1756-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h,
1772- const QColorGroup &g, bool active, QMenuItem *mi, 1757- const QColorGroup &g, bool active, QMenuItem *mi,
1773- QBrush *) 1758- QBrush *)
1774-{ 1759-{
1775- if ( p->font() == KGlobalSettings::generalFont() ) 1760- if ( p->font() == KGlobalSettings::generalFont() )
1776- p->setFont( KGlobalSettings::menuFont() ); 1761- p->setFont( KGlobalSettings::menuFont() );
1777+ QWidget *parent = (QWidget *)p->device(); 1762+ QWidget *parent = (QWidget *)p->device();
1778+ p->setBrushOrigin(parent->pos()); 1763+ p->setBrushOrigin(parent->pos());
1779+ parent->erase(x, y, w, h); 1764+ parent->erase(x, y, w, h);
1780 1765
1781 if(menuHandler->useShadowText()){ 1766 if(menuHandler->useShadowText()){
1782 QColor shadow; 1767 QColor shadow;
1783 if(p->device() && p->device()->devType() == QInternal::Widget && 1768 if(p->device() && p->device()->devType() == QInternal::Widget &&
1784- ((QWidget *)p->device())->inherits("KMenuBar")){ 1769- ((QWidget *)p->device())->inherits("KMenuBar")){
1785- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1770- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1786+ ((QWidget *)p->device())->inherits("QMenuBar")){ 1771+ ((QWidget *)p->device())->inherits("QMenuBar")){
1787+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1772+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1788 g.background().dark(130); 1773 g.background().dark(130);
1789 } 1774 }
1790 else 1775 else
1791 shadow = g.background().dark(130); 1776 shadow = g.background().dark(130);
1792 1777
1793 + QPixmap *dummy = 0; 1778 + QPixmap *dummy = 0;
1794 + 1779 +
1795 + if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { 1780 + if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) {
1796 + dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); 1781 + dummy = new QPixmap ( mi-> pixmap ( )-> size ( ));
1797 + QBitmap dummy_mask ( dummy-> size ( )); 1782 + QBitmap dummy_mask ( dummy-> size ( ));
1798 + dummy_mask. fill ( color1 ); 1783 + dummy_mask. fill ( color1 );
1799 + dummy-> setMask ( dummy_mask ); 1784 + dummy-> setMask ( dummy_mask );
1800 + } 1785 + }
1801+ 1786+
1802 if(active){ 1787 if(active){
1803 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 1788 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
1804 QApplication::style().drawItem(p, x+1, y+1, w, h, 1789 QApplication::style().drawItem(p, x+1, y+1, w, h,
1805 AlignCenter|ShowPrefix|DontClip|SingleLine, 1790 AlignCenter|ShowPrefix|DontClip|SingleLine,
1806- g, mi->isEnabled(), NULL, mi->text(), 1791- g, mi->isEnabled(), NULL, mi->text(),
1807+ g, mi->isEnabled(), dummy, mi->text(), 1792+ g, mi->isEnabled(), dummy, mi->text(),
1808 -1, &shadow); 1793 -1, &shadow);
1809 QApplication::style().drawItem(p, x, y, w, h, 1794 QApplication::style().drawItem(p, x, y, w, h,
1810 AlignCenter|ShowPrefix|DontClip|SingleLine, 1795 AlignCenter|ShowPrefix|DontClip|SingleLine,
1811- g, mi->isEnabled(), NULL, mi->text(), 1796- g, mi->isEnabled(), NULL, mi->text(),
1812+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 1797+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1813 -1, &g.text()); 1798 -1, &g.text());
1814 } 1799 }
1815 else{ 1800 else{
1816 QApplication::style().drawItem(p, x+1, y+1, w, h, 1801 QApplication::style().drawItem(p, x+1, y+1, w, h,
1817 AlignCenter|ShowPrefix|DontClip|SingleLine, 1802 AlignCenter|ShowPrefix|DontClip|SingleLine,
1818- g, mi->isEnabled(), NULL, mi->text(), 1803- g, mi->isEnabled(), NULL, mi->text(),
1819+ g, mi->isEnabled(), dummy, mi->text(), 1804+ g, mi->isEnabled(), dummy, mi->text(),
1820 -1, &shadow); 1805 -1, &shadow);
1821 QApplication::style().drawItem(p, x, y, w, h, 1806 QApplication::style().drawItem(p, x, y, w, h,
1822 AlignCenter|ShowPrefix|DontClip|SingleLine, 1807 AlignCenter|ShowPrefix|DontClip|SingleLine,
1823- g, mi->isEnabled(), NULL, mi->text(), 1808- g, mi->isEnabled(), NULL, mi->text(),
1824+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 1809+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1825 -1, &g.text()); 1810 -1, &g.text());
1826 } 1811 }
1827+ delete dummy; 1812+ delete dummy;
1828 } 1813 }
1829 else{ 1814 else{
1830 if(active) 1815 if(active)
1831 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 1816 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
1832 QApplication::style().drawItem(p, x, y, w, h, 1817 QApplication::style().drawItem(p, x, y, w, h,
1833 AlignCenter|ShowPrefix|DontClip|SingleLine, 1818 AlignCenter|ShowPrefix|DontClip|SingleLine,
1834- g, mi->isEnabled(), NULL, mi->text(), 1819- g, mi->isEnabled(), NULL, mi->text(),
1835+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), 1820+ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(),
1836 -1, &g.text()); 1821 -1, &g.text());
1837 } 1822 }
1838 } 1823 }
1839 1824
1840 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 1825 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
1841- const QColorGroup &g, int lineWidth, 1826- const QColorGroup &g, int lineWidth,
1842- const QBrush * fill) 1827- const QBrush * fill)
1843+ const QColorGroup &g, int /*lineWidth*/, 1828+ const QColorGroup &g, int /*lineWidth*/,
1844+ const QBrush * /*fill*/) 1829+ const QBrush * /*fill*/)
1845 { 1830 {
1846 QColor c; 1831 QColor c;
1847 switch(menuHandler->transType()){ 1832 switch(menuHandler->transType()){
1848@@ -2336,8 +2084,6 @@ 1833@@ -2336,8 +2078,6 @@
1849 1834
1850 maxpmw = QMAX( maxpmw, 20 ); 1835 maxpmw = QMAX( maxpmw, 20 );
1851 1836
1852- if ( p->font() == KGlobalSettings::generalFont() ) 1837- if ( p->font() == KGlobalSettings::generalFont() )
1853- p->setFont( KGlobalSettings::menuFont() ); 1838- p->setFont( KGlobalSettings::menuFont() );
1854 1839
1855 bool dis = !enabled; 1840 bool dis = !enabled;
1856 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 1841 QColorGroup itemg = dis ? pal.disabled() : pal.active();
1857@@ -2363,7 +2109,7 @@ 1842@@ -2363,7 +2103,7 @@
1858 p->fillRect(x, y, w, h, menuBrush); 1843 p->fillRect(x, y, w, h, menuBrush);
1859 } 1844 }
1860 else{ 1845 else{
1861- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1846- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1862+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1847+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1863 if(pix) 1848 if(pix)
1864 p->drawPixmap(x, y, *pix, x, y, w, h); 1849 p->drawPixmap(x, y, *pix, x, y, w, h);
1865 } 1850 }
1866@@ -2508,25 +2254,6 @@ 1851@@ -2508,25 +2248,6 @@
1867 return h; 1852 return h;
1868 } 1853 }
1869 1854
1870-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, 1855-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h,
1871- const QColorGroup &g, QBrush *fill) 1856- const QColorGroup &g, QBrush *fill)
1872-{ 1857-{
1873- p->setPen(g.button().dark(130)); 1858- p->setPen(g.button().dark(130));
1874- p->drawRect(x, y, w, h); 1859- p->drawRect(x, y, w, h);
1875- p->setPen(g.button().light(120)); 1860- p->setPen(g.button().light(120));
1876- p->drawRect(x+1, y+1, w-2, h-2); 1861- p->drawRect(x+1, y+1, w-2, h-2);
1877- if(w >= 4 && h >= 4){ 1862- if(w >= 4 && h >= 4){
1878- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1863- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1879- if(!pix){ 1864- if(!pix){
1880- int h, s, v; 1865- int h, s, v;
1881- g.button().dark(120).hsv(&h, &s, &v); 1866- g.button().dark(120).hsv(&h, &s, &v);
1882- pix = new QPixmap(*bevelFillPix); 1867- pix = new QPixmap(*bevelFillPix);
1883- adjustHSV(*pix, h, s, v); 1868- adjustHSV(*pix, h, s, v);
1884- bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1869- bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1885- } 1870- }
1886- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1871- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1887- } 1872- }
1888-} 1873-}
1889 1874
1890 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, 1875 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r,
1891 const QColorGroup &g, const QColor *c, 1876 const QColorGroup &g, const QColor *c,
1892@@ -2536,29 +2263,29 @@ 1877@@ -2536,29 +2257,29 @@
1893 if(p->device()->devType() == QInternal::Widget){ 1878 if(p->device()->devType() == QInternal::Widget){
1894 // if so does it use a special focus rectangle? 1879 // if so does it use a special focus rectangle?
1895 QWidget *w = (QWidget *)p->device(); 1880 QWidget *w = (QWidget *)p->device();
1896- if(w->inherits("QPushButton") || w->inherits("QSlider")){ 1881- if(w->inherits("QPushButton") || w->inherits("QSlider")){
1897+ if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ 1882+ if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){
1898 return; 1883 return;
1899 } 1884 }
1900 else{ 1885 else{
1901- KStyle::drawFocusRect(p, r, g, c, atBorder); 1886- KStyle::drawFocusRect(p, r, g, c, atBorder);
1902+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 1887+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
1903 } 1888 }
1904 } 1889 }
1905 else 1890 else
1906- KStyle::drawFocusRect(p, r, g, c, atBorder); 1891- KStyle::drawFocusRect(p, r, g, c, atBorder);
1907+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 1892+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
1908 1893
1909 } 1894 }
1910 1895
1911 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) 1896 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu)
1912 { 1897 {
1913 mnu->installEventFilter(menuHandler); 1898 mnu->installEventFilter(menuHandler);
1914- KStyle::polishPopupMenu(mnu); 1899- KStyle::polishPopupMenu(mnu);
1915+ QWindowsStyle::polishPopupMenu(mnu); 1900+ QWindowsStyle::polishPopupMenu(mnu);
1916 } 1901 }
1917 1902
1918 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, 1903 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
1919 bool selected) 1904 bool selected)
1920 { 1905 {
1921 if(tabBar->shape() != QTabBar::RoundedAbove){ 1906 if(tabBar->shape() != QTabBar::RoundedAbove){
1922- KStyle::drawTab(p, tabBar, tab, selected); 1907- KStyle::drawTab(p, tabBar, tab, selected);
1923+ QWindowsStyle::drawTab(p, tabBar, tab, selected); 1908+ QWindowsStyle::drawTab(p, tabBar, tab, selected);
1924 return; 1909 return;
1925 } 1910 }
1926 QPixmap tilePix; 1911 QPixmap tilePix;
1927@@ -2671,7 +2398,7 @@ 1912@@ -2671,7 +2392,7 @@
1928 vFrame = 8; // was 10 1913 vFrame = 8; // was 10
1929 } 1914 }
1930 else 1915 else
1931- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1916- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1932+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1917+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1933 } 1918 }
1934 1919
1935 1920
1936@@ -2699,7 +2426,7 @@ 1921@@ -2699,7 +2420,7 @@
1937 p->drawLine(x+1, y+1, x+1, y2-1); 1922 p->drawLine(x+1, y+1, x+1, y2-1);
1938 } 1923 }
1939 else if(lineWidth != 2 || !sunken) 1924 else if(lineWidth != 2 || !sunken)
1940- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1925- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1941+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1926+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1942 else{ 1927 else{
1943 QPen oldPen = p->pen(); 1928 QPen oldPen = p->pen();
1944 int x2 = x+w-1; 1929 int x2 = x+w-1;
1945@@ -2726,105 +2453,6 @@ 1930@@ -2726,105 +2447,6 @@
1946 } 1931 }
1947 } 1932 }
1948 1933
1949-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, 1934-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h,
1950- const QColorGroup &g, QBrush *) 1935- const QColorGroup &g, QBrush *)
1951-{ 1936-{
1952- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1937- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
1953- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? 1938- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ?
1954- g.button().light(120) : g.button(), g.button()); 1939- g.button().light(120) : g.button(), g.button());
1955- /* 1940- /*
1956- if(h > w){ 1941- if(h > w){
1957- int y2 = y+h-1; 1942- int y2 = y+h-1;
1958- 1943-
1959- p->setPen(g.light()); 1944- p->setPen(g.light());
1960- 1945-
1961- p->drawLine(x+1, y+2, x+1, y2-2); 1946- p->drawLine(x+1, y+2, x+1, y2-2);
1962- p->drawLine(x+4, y+2, x+4, y2-2); 1947- p->drawLine(x+4, y+2, x+4, y2-2);
1963- 1948-
1964- p->setPen(g.dark()); 1949- p->setPen(g.dark());
1965- p->drawLine(x+2, y+2, x+2, y2-2); 1950- p->drawLine(x+2, y+2, x+2, y2-2);
1966- p->drawLine(x+5, y+2, x+5, y2-2); 1951- p->drawLine(x+5, y+2, x+5, y2-2);
1967- 1952-
1968- } 1953- }
1969- else{ 1954- else{
1970- int x2 = x+w-1; 1955- int x2 = x+w-1;
1971- 1956-
1972- p->setPen(g.light()); 1957- p->setPen(g.light());
1973- 1958-
1974- p->drawLine(x+2, y+1, x2-2, y+1); 1959- p->drawLine(x+2, y+1, x2-2, y+1);
1975- p->drawLine(x+2, y+4, x2-2, y+4); 1960- p->drawLine(x+2, y+4, x2-2, y+4);
1976- 1961-
1977- p->setPen(g.dark()); 1962- p->setPen(g.dark());
1978- p->drawLine(x+2, y+2, x2-2, y+2); 1963- p->drawLine(x+2, y+2, x2-2, y+2);
1979- p->drawLine(x+2, y+5, x2-2, y+5); 1964- p->drawLine(x+2, y+5, x2-2, y+5);
1980- }*/ 1965- }*/
1981- 1966-
1982-} 1967-}
1983- 1968-
1984-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, 1969-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h,
1985- const QColorGroup &g, 1970- const QColorGroup &g,
1986- const QString &text, bool sunken, 1971- const QString &text, bool sunken,
1987- QPixmap *pixmap, QBrush *) 1972- QPixmap *pixmap, QBrush *)
1988-{ 1973-{
1989- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); 1974- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button));
1990- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); 1975- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button());
1991- p->setPen(g.buttonText()); // Kicker doesn't set this ;-) 1976- p->setPen(g.buttonText()); // Kicker doesn't set this ;-)
1992- 1977-
1993- if(text.isNull() && !pixmap) 1978- if(text.isNull() && !pixmap)
1994- return; 1979- return;
1995- 1980-
1996- const int pxWidth = 20; 1981- const int pxWidth = 20;
1997- int textPos = pxWidth; 1982- int textPos = pxWidth;
1998- QRect br(buttonRect(x, y, w, h)); 1983- QRect br(buttonRect(x, y, w, h));
1999- 1984-
2000- if (sunken) 1985- if (sunken)
2001- p->translate(1,1); 1986- p->translate(1,1);
2002- 1987-
2003- if ( pixmap && !pixmap->isNull() ) { 1988- if ( pixmap && !pixmap->isNull() ) {
2004- int dx = ( pxWidth - pixmap->width() ) / 2; 1989- int dx = ( pxWidth - pixmap->width() ) / 2;
2005- int dy = ( h - pixmap->height() ) / 2; 1990- int dy = ( h - pixmap->height() ) / 2;
2006- p->drawPixmap( br.x()+dx, dy, *pixmap ); 1991- p->drawPixmap( br.x()+dx, dy, *pixmap );
2007- } 1992- }
2008- 1993-
2009- QString s = text; 1994- QString s = text;
2010- static const QString &modStr = KGlobal::staticQString( 1995- static const QString &modStr = KGlobal::staticQString(
2011- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); 1996- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]"));
2012- 1997-
2013- int modStrPos = s.find(modStr); 1998- int modStrPos = s.find(modStr);
2014- 1999-
2015- if (-1 != modStrPos) { 2000- if (-1 != modStrPos) {
2016- 2001-
2017- // +1 because we include a space after the closing brace. 2002- // +1 because we include a space after the closing brace.
2018- s.remove(modStrPos, modStr.length()+1); 2003- s.remove(modStrPos, modStr.length()+1);
2019- 2004-
2020- QPixmap modPixmap = SmallIcon("modified"); 2005- QPixmap modPixmap = SmallIcon("modified");
2021- 2006-
2022- int dx = (pxWidth - modPixmap.width()) / 2; 2007- int dx = (pxWidth - modPixmap.width()) / 2;
2023- int dy = (h - modPixmap.height()) / 2; 2008- int dy = (h - modPixmap.height()) / 2;
2024- 2009-
2025- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); 2010- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap);
2026- 2011-
2027- textPos += pxWidth; 2012- textPos += pxWidth;
2028- } 2013- }
2029- 2014-
2030- if (!s.isEmpty()){ 2015- if (!s.isEmpty()){
2031- if (p->fontMetrics().width(s) > br.width() - textPos) { 2016- if (p->fontMetrics().width(s) > br.width() - textPos) {
2032- 2017-
2033- int maxLen = br.width() - textPos - p->fontMetrics().width("..."); 2018- int maxLen = br.width() - textPos - p->fontMetrics().width("...");
2034- 2019-
2035- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) 2020- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen))
2036- s.truncate(s.length() - 1); 2021- s.truncate(s.length() - 1);
2037- 2022-
2038- s.append("..."); 2023- s.append("...");
2039- } 2024- }
2040- 2025-
2041- p->setPen(g.buttonText()); 2026- p->setPen(g.buttonText());
2042- 2027-
2043- p->drawText(br.x()+ textPos, -1, w-textPos, h, 2028- p->drawText(br.x()+ textPos, -1, w-textPos, h,
2044- AlignLeft|AlignVCenter, s); 2029- AlignLeft|AlignVCenter, s);
2045- } 2030- }
2046- 2031-
2047-} 2032-}
2048 2033
2049 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) 2034 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v)
2050 { 2035 {
2051@@ -2988,110 +2616,5 @@ 2036@@ -2988,110 +2610,5 @@
2052 } 2037 }
2053 } 2038 }
2054 2039
2055-// I'm debating if to use QValueList or QList here. I like QValueList better, 2040-// I'm debating if to use QValueList or QList here. I like QValueList better,
2056-// but QList handles pointers which is good for a lot of empty icons... 2041-// but QList handles pointers which is good for a lot of empty icons...
2057- 2042-
2058-void LiquidStyle::loadCustomButtons() 2043-void LiquidStyle::loadCustomButtons()
2059-{ 2044-{
2060- return; // TODO 2045- return; // TODO
2061- customBtnColorList.clear(); 2046- customBtnColorList.clear();
2062- customBtnIconList.clear(); 2047- customBtnIconList.clear();
2063- customBtnLabelList.clear(); 2048- customBtnLabelList.clear();
2064- 2049-
2065- KConfig *config = KGlobal::config(); 2050- KConfig *config = KGlobal::config();
2066- QString oldGrp = config->group(); 2051- QString oldGrp = config->group();
2067- config->setGroup("MosfetButtons"); 2052- config->setGroup("MosfetButtons");
2068- 2053-
2069- QStrList iconList, colorList; //temp, we store QPixmaps and QColors 2054- QStrList iconList, colorList; //temp, we store QPixmaps and QColors
2070- iconList.setAutoDelete(true); 2055- iconList.setAutoDelete(true);
2071- colorList.setAutoDelete(true); 2056- colorList.setAutoDelete(true);
2072- config->readListEntry("Labels", customBtnLabelList); 2057- config->readListEntry("Labels", customBtnLabelList);
2073- config->readListEntry("Icons", iconList); 2058- config->readListEntry("Icons", iconList);
2074- config->readListEntry("Colors", colorList); 2059- config->readListEntry("Colors", colorList);
2075- 2060-
2076- const char *labelStr = customBtnLabelList.first(); 2061- const char *labelStr = customBtnLabelList.first();
2077- const char *colorStr = colorList.first(); 2062- const char *colorStr = colorList.first();
2078- const char *iconStr = iconList.first(); 2063- const char *iconStr = iconList.first();
2079- 2064-
2080- KIconLoader *ldr = KGlobal::iconLoader(); 2065- KIconLoader *ldr = KGlobal::iconLoader();
2081- while(labelStr != NULL){ 2066- while(labelStr != NULL){
2082- QColor *c = new QColor; 2067- QColor *c = new QColor;
2083- c->setNamedColor(QString(colorStr)); 2068- c->setNamedColor(QString(colorStr));
2084- customBtnColorList.append(c); 2069- customBtnColorList.append(c);
2085- 2070-
2086- QString tmpStr(iconStr); 2071- QString tmpStr(iconStr);
2087- if(!tmpStr.isEmpty()){ 2072- if(!tmpStr.isEmpty()){
2088- QPixmap *pixmap = 2073- QPixmap *pixmap =
2089- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); 2074- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small));
2090- if(pixmap->isNull()){ 2075- if(pixmap->isNull()){
2091- delete pixmap; 2076- delete pixmap;
2092- customBtnIconList.append(NULL); 2077- customBtnIconList.append(NULL);
2093- } 2078- }
2094- else 2079- else
2095- customBtnIconList.append(pixmap); 2080- customBtnIconList.append(pixmap);
2096- } 2081- }
2097- else 2082- else
2098- customBtnIconList.append(NULL); 2083- customBtnIconList.append(NULL);
2099- 2084-
2100- labelStr = customBtnLabelList.next(); 2085- labelStr = customBtnLabelList.next();
2101- colorStr = colorList.next(); 2086- colorStr = colorList.next();
2102- iconStr = iconList.next(); 2087- iconStr = iconList.next();
2103- } 2088- }
2104- config->setGroup(oldGrp); 2089- config->setGroup(oldGrp);
2105-} 2090-}
2106- 2091-
2107-void LiquidStyle::applyCustomAttributes(QPushButton *btn) 2092-void LiquidStyle::applyCustomAttributes(QPushButton *btn)
2108-{ 2093-{
2109- return; // TODO 2094- return; // TODO
2110- QString str = btn->text(); 2095- QString str = btn->text();
2111- if(str.isEmpty()) 2096- if(str.isEmpty())
2112- return; 2097- return;
2113- while(str.contains('&') != 0) 2098- while(str.contains('&') != 0)
2114- str = str.remove(str.find('&'), 1); 2099- str = str.remove(str.find('&'), 1);
2115- 2100-
2116- const char *s; 2101- const char *s;
2117- int idx = 0; 2102- int idx = 0;
2118- for(s = customBtnLabelList.first(); s != NULL; 2103- for(s = customBtnLabelList.first(); s != NULL;
2119- ++idx, s = customBtnLabelList.next()){ 2104- ++idx, s = customBtnLabelList.next()){
2120- if(qstricmp(s, str.latin1()) == 0){ 2105- if(qstricmp(s, str.latin1()) == 0){
2121- QPalette pal = btn->palette(); 2106- QPalette pal = btn->palette();
2122- pal.setColor(QColorGroup::Button, 2107- pal.setColor(QColorGroup::Button,
2123- *customBtnColorList.at(idx)); 2108- *customBtnColorList.at(idx));
2124- btn->setPalette(pal); 2109- btn->setPalette(pal);
2125- /* 2110- /*
2126- if(customBtnIconList.at(idx) != NULL){ 2111- if(customBtnIconList.at(idx) != NULL){
2127- QPixmap *pix = customBtnIconList.at(idx); 2112- QPixmap *pix = customBtnIconList.at(idx);
2128- btn->setIconSet(QIconSet(*pix)); 2113- btn->setIconSet(QIconSet(*pix));
2129- }*/ 2114- }*/
2130- break; 2115- break;
2131- } 2116- }
2132- } 2117- }
2133-} 2118-}
2134- 2119-
2135-void LiquidStyle::unapplyCustomAttributes(QPushButton *btn) 2120-void LiquidStyle::unapplyCustomAttributes(QPushButton *btn)
2136-{ 2121-{
2137- return; // TODO 2122- return; // TODO
2138- QString str = btn->text(); 2123- QString str = btn->text();
2139- if(str.isEmpty()) 2124- if(str.isEmpty())
2140- return; 2125- return;
2141- while(str.contains('&') != 0) 2126- while(str.contains('&') != 0)
2142- str = str.remove(str.find('&'), 1); 2127- str = str.remove(str.find('&'), 1);
2143- 2128-
2144- const char *s; 2129- const char *s;
2145- for(s = customBtnLabelList.first(); s != NULL; s = customBtnLabelList.next()){ 2130- for(s = customBtnLabelList.first(); s != NULL; s = customBtnLabelList.next()){
2146- if(qstricmp(s, str.latin1()) == 0){ 2131- if(qstricmp(s, str.latin1()) == 0){
2147- btn->setPalette(QApplication::palette()); 2132- btn->setPalette(QApplication::palette());
2148- btn->setIconSet(QIconSet()); 2133- btn->setIconSet(QIconSet());
2149- break; 2134- break;
2150- } 2135- }
2151- } 2136- }
2152-} 2137-}
2153- 2138-
2154-#include "liquid.moc" 2139-#include "liquid.moc"
2155- 2140-
2156- 2141-
2157- 2142-
2158- 2143-
2159- 2144-
2160 2145
2161 /* vim: set noet sw=8 ts=8: */ 2146 /* vim: set noet sw=8 ts=8: */
2162 --- -2002-11-21 20:45:47.000000000 +0100 2147 --- -2002-11-29 12:30:35.000000000 +0100
2163 +++ plugin.cpp2002-11-18 18:11:41.000000000 +0100 2148 +++ plugin.cpp2002-11-18 18:11:41.000000000 +0100
2164@@ -1,29 +1,84 @@ 2149@@ -1,29 +1,84 @@
2165+#include <qapplication.h> 2150+#include <qapplication.h>
2166+ 2151+
2167 #include "liquid.h" 2152 #include "liquid.h"
2168-#include <klocale.h> 2153-#include <klocale.h>
2169+#include "liquidset.h" 2154+#include "liquidset.h"
2170+#include "plugin.h" 2155+#include "plugin.h"
2171+ 2156+
2172+ 2157+
2173+ 2158+
2174+LiquidInterface::LiquidInterface ( ) : ref ( 0 ) 2159+LiquidInterface::LiquidInterface ( ) : ref ( 0 )
2175+{ 2160+{
2176 +m_widget = 0; 2161 +m_widget = 0;
2177+} 2162+}
2178+ 2163+
2179+LiquidInterface::~LiquidInterface ( ) 2164+LiquidInterface::~LiquidInterface ( )
2180+{ 2165+{
2181+} 2166+}
2182+ 2167+
2183+QStyle *LiquidInterface::style ( ) 2168+QStyle *LiquidInterface::style ( )
2184+{ 2169+{
2185 +return new LiquidStyle ( ); 2170 +return new LiquidStyle ( );
2186+} 2171+}
2187 2172
2188-extern "C" { 2173-extern "C" {
2189- KStyle* allocate(); 2174- KStyle* allocate();
2190- int minor_version(); 2175- int minor_version();
2191- int major_version(); 2176- int major_version();
2192- const char *description(); 2177- const char *description();
2193+QString LiquidInterface::name ( ) const 2178+QString LiquidInterface::name ( ) const
2194+{ 2179+{
2195 +return qApp-> translate ( "Styles", "Liquid" ); 2180 +return qApp-> translate ( "Styles", "Liquid" );
2196 } 2181 }
2197 2182
2198-KStyle* allocate() 2183-KStyle* allocate()
2199+QString LiquidInterface::description ( ) const 2184+QString LiquidInterface::description ( ) const
2200 { 2185 {
2201- return(new LiquidStyle); 2186- return(new LiquidStyle);
2202 +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); 2187 +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" );
2203 } 2188 }
2204 2189
2205-int minor_version() 2190-int minor_version()
2206+bool LiquidInterface::hasSettings ( ) const 2191+bool LiquidInterface::hasSettings ( ) const
2207 { 2192 {
2208- return(0); 2193- return(0);
2209 +return true; 2194 +return true;
2210 } 2195 }
2211 2196
2212-int major_version() 2197-int major_version()
2213+QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) 2198+QWidget *LiquidInterface::create ( QWidget *parent, const char *name )
2214 { 2199 {
2215- return(1); 2200- return(1);
2216 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); 2201 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" );
2217 + 2202 +
2218 +return m_widget; 2203 +return m_widget;
2219 } 2204 }
2220 2205
2221-const char *description() 2206-const char *description()
2222+bool LiquidInterface::accept ( ) 2207+bool LiquidInterface::accept ( )
2223 { 2208 {
2224- return(i18n("High performance liquid plugin").utf8()); 2209- return(i18n("High performance liquid plugin").utf8());
2225 +if ( !m_widget ) 2210 +if ( !m_widget )
2226 + return false; 2211 + return false;
2227+ 2212+
2228 +return m_widget-> writeConfig ( ); 2213 +return m_widget-> writeConfig ( );
2229 } 2214 }
2230+ 2215+
2231+void LiquidInterface::reject ( ) 2216+void LiquidInterface::reject ( )
2232+{ 2217+{
2233+} 2218+}
2234+ 2219+
2235+ 2220+
2236+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 2221+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
2237+{ 2222+{
2238 +*iface = 0; 2223 +*iface = 0;
2239 + 2224 +
2240 +if ( uuid == IID_QUnknown ) 2225 +if ( uuid == IID_QUnknown )
2241 + *iface = this; 2226 + *iface = this;
2242 +else if ( uuid == IID_Style ) 2227 +else if ( uuid == IID_Style )
2243 + *iface = this; 2228 + *iface = this;
2244 +else if ( uuid == IID_StyleExtended ) 2229 +else if ( uuid == IID_StyleExtended )
2245 + *iface = this; 2230 + *iface = this;
2246 + 2231 +
2247 +if ( *iface ) 2232 +if ( *iface )
2248 + (*iface)-> addRef ( ); 2233 + (*iface)-> addRef ( );
2249 + 2234 +
2250 +return QS_OK; 2235 +return QS_OK;
2251+} 2236+}
2252+ 2237+
2253+Q_EXPORT_INTERFACE() 2238+Q_EXPORT_INTERFACE()
2254+{ 2239+{
2255 +Q_CREATE_INSTANCE( LiquidInterface ) 2240 +Q_CREATE_INSTANCE( LiquidInterface )
2256+} 2241+}
2257+ 2242+
2258+ 2243+
2259+// For Sharp ROM 2244+// For Sharp ROM
2260+ 2245+
2261+extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } 2246+extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } }
2262+extern "C" { void drawmenubaritem ( QStyle *sty, QPainter *p, int x, int y, int w, int h, QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) { return ((LiquidStyle *) sty )-> drawMenuBarItem ( p, x, y, w, h, mi, g, enabled, active ); } } 2247+extern "C" { void drawmenubaritem ( QStyle *sty, QPainter *p, int x, int y, int w, int h, QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) { return ((LiquidStyle *) sty )-> drawMenuBarItem ( p, x, y, w, h, mi, g, enabled, active ); } }