summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-21 01:31:23 (UTC)
committer sandman <sandman>2002-09-21 01:31:23 (UTC)
commit804a06520928973d706bf827209f8a7625010b7f (patch) (unidiff)
tree06865733a58dbd033747ef6ceca9bd6c51f24455
parent6ae824e5c3a555d5129c68d387094d50276742f4 (diff)
downloadopie-804a06520928973d706bf827209f8a7625010b7f.zip
opie-804a06520928973d706bf827209f8a7625010b7f.tar.gz
opie-804a06520928973d706bf827209f8a7625010b7f.tar.bz2
- disable liquid win decoration - this has to be made a separate plugin
- liquid now uses the polished palette for color values (liquid did parse qpe.conf before -- the new Qt/e patch is needed for this to work) - updated QPL diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp23
-rw-r--r--noncore/styles/liquid/opie-liquid.diff128
2 files changed, 87 insertions, 64 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 22bf8af..0d9d259 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,2046 +1,2047 @@
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 6
7#ifndef INCLUDE_MENUITEM_DEF 7#ifndef INCLUDE_MENUITEM_DEF
8#define INCLUDE_MENUITEM_DEF 8#define INCLUDE_MENUITEM_DEF
9#endif 9#endif
10 10
11#include <qmenudata.h> 11#include <qmenudata.h>
12#include "liquid.h" 12#include "liquid.h"
13#include "liquiddeco.h" 13#include "liquiddeco.h"
14#include <qapplication.h> 14#include <qapplication.h>
15#include <qpe/config.h> 15#include <qpe/config.h>
16#include "effects.h" 16#include "effects.h"
17#include <qpalette.h> 17#include <qpalette.h>
18#include <qbitmap.h> 18#include <qbitmap.h>
19#include <qtabbar.h> 19#include <qtabbar.h>
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qobjectlist.h> 21#include <qobjectlist.h>
22#include <qimage.h> 22#include <qimage.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qpixmapcache.h> 24#include <qpixmapcache.h>
25#include <qradiobutton.h> 25#include <qradiobutton.h>
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qwidgetlist.h> 28#include <qwidgetlist.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qheader.h> 30#include <qheader.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <qmenubar.h> 32#include <qmenubar.h>
33 33
34 34
35#include <stdio.h> 35#include <stdio.h>
36 36
37#include "htmlmasks.h" 37#include "htmlmasks.h"
38#include "embeddata.h" 38#include "embeddata.h"
39 39
40typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 40typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
41 QColorGroup &, bool, bool); 41 QColorGroup &, bool, bool);
42 42
43QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 43QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
44 44
45void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 45void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
46{ 46{
47 QImage img(pix.convertToImage()); 47 QImage img(pix.convertToImage());
48 QImageEffect::fade(img, 0.9, color); 48 QImageEffect::fade(img, 0.9, color);
49 int x, y; 49 int x, y;
50 int r, g, b; 50 int r, g, b;
51 for(y=0; y < img.height(); y+=3){ 51 for(y=0; y < img.height(); y+=3){
52 unsigned int *data = (unsigned int *) img.scanLine(y); 52 unsigned int *data = (unsigned int *) img.scanLine(y);
53 for(x=0; x < img.width(); ++x){ 53 for(x=0; x < img.width(); ++x){
54 r = qRed(data[x]); 54 r = qRed(data[x]);
55 g = qGreen(data[x]); 55 g = qGreen(data[x]);
56 b = qBlue(data[x]); 56 b = qBlue(data[x]);
57 if(r-10) 57 if(r-10)
58 r-=10; 58 r-=10;
59 if(g-10) 59 if(g-10)
60 g-=10; 60 g-=10;
61 if(b-10) 61 if(b-10)
62 b-=10; 62 b-=10;
63 data[x] = qRgb(r, g, b); 63 data[x] = qRgb(r, g, b);
64 } 64 }
65 } 65 }
66 pix.convertFromImage(img); 66 pix.convertFromImage(img);
67} 67}
68 68
69TransMenuHandler::TransMenuHandler(QObject *parent) 69TransMenuHandler::TransMenuHandler(QObject *parent)
70 : QObject(parent) 70 : QObject(parent)
71{ 71{
72 pixDict.setAutoDelete(true); 72 pixDict.setAutoDelete(true);
73 reloadSettings(); 73 reloadSettings();
74} 74}
75 75
76void TransMenuHandler::reloadSettings() 76void TransMenuHandler::reloadSettings()
77{ 77{
78 pixDict.clear(); 78 pixDict.clear();
79 79
80 Config config ( "qpe" ); 80 Config config ( "qpe" );
81 config. setGroup ( "Liquid-Style" ); 81 config. setGroup ( "Liquid-Style" );
82 82
83 type = config. readNumEntry("Type", TransStippleBg); 83 type = config. readNumEntry("Type", TransStippleBg);
84 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 84 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
85 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 85 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
86 opacity = config. readNumEntry("Opacity", 10); 86 opacity = config. readNumEntry("Opacity", 10);
87 if ( opacity < -20 ) 87 if ( opacity < -20 )
88 opacity = 20; 88 opacity = 20;
89 else if ( opacity > 20 ) 89 else if ( opacity > 20 )
90 opacity = 20; 90 opacity = 20;
91 91
92 shadowText = config. readBoolEntry("ShadowText", true); 92 shadowText = config. readBoolEntry("ShadowText", true);
93} 93}
94 94
95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 95bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
96{ 96{
97 QWidget *p = (QWidget *)obj; 97 QWidget *p = (QWidget *)obj;
98 98
99 if(ev->type() == QEvent::Show){ 99 if(ev->type() == QEvent::Show){
100 if(type == TransStippleBg || type == TransStippleBtn || 100 if(type == TransStippleBg || type == TransStippleBtn ||
101 type == Custom){ 101 type == Custom){
102 QApplication::syncX(); 102 QApplication::syncX();
103 QPixmap *pix = new QPixmap; 103 QPixmap *pix = new QPixmap;
104 if(p->testWFlags(Qt::WType_Popup)){ 104 if(p->testWFlags(Qt::WType_Popup)){
105 QRect r(p->x(), p->y(), p->width(), p->height()); 105 QRect r(p->x(), p->y(), p->width(), p->height());
106 QRect deskR = QApplication::desktop()->rect(); 106 QRect deskR = QApplication::desktop()->rect();
107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ 107 if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){
108 r.setBottom(deskR.bottom()); 108 r.setBottom(deskR.bottom());
109 r.setRight(deskR.right()); 109 r.setRight(deskR.right());
110 } 110 }
111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 111 *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
112 r.width(), r.height()); 112 r.width(), r.height());
113 } 113 }
114 else{ // tear off menu 114 else{ // tear off menu
115 pix->resize(p->width(), p->height()); 115 pix->resize(p->width(), p->height());
116 pix->fill(Qt::black.rgb()); 116 pix->fill(Qt::black.rgb());
117 } 117 }
118 if(type == TransStippleBg){ 118 if(type == TransStippleBg){
119 stripePixmap(*pix, p->colorGroup().background()); 119 stripePixmap(*pix, p->colorGroup().background());
120 } 120 }
121 else if(type == TransStippleBtn){ 121 else if(type == TransStippleBtn){
122 stripePixmap(*pix, p->colorGroup().button()); 122 stripePixmap(*pix, p->colorGroup().button());
123 } 123 }
124 else{ 124 else{
125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 125 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
126 } 126 }
127 127
128 pixDict.insert(p->winId(), pix); 128 pixDict.insert(p->winId(), pix);
129 129
130 if (!p->inherits("QPopupMenu")) { 130 if (!p->inherits("QPopupMenu")) {
131 p->setBackgroundPixmap(*pix); 131 p->setBackgroundPixmap(*pix);
132 132
133 QObjectList *ol = p-> queryList("QWidget"); 133 QObjectList *ol = p-> queryList("QWidget");
134 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 134 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
135 QWidget *wid = (QWidget *) it.current ( ); 135 QWidget *wid = (QWidget *) it.current ( );
136 136
137 wid-> setBackgroundPixmap(*pix); 137 wid-> setBackgroundPixmap(*pix);
138 wid-> setBackgroundOrigin(QWidget::ParentOrigin); 138 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
139 } 139 }
140 delete ol; 140 delete ol;
141 } 141 }
142 } 142 }
143 } 143 }
144 else if(ev->type() == QEvent::Hide){ 144 else if(ev->type() == QEvent::Hide){
145 if(type == TransStippleBg || type == TransStippleBtn || 145 if(type == TransStippleBg || type == TransStippleBtn ||
146 type == Custom){ 146 type == Custom){
147// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 147// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
148 148
149 pixDict.remove(p->winId()); 149 pixDict.remove(p->winId());
150 if (!p->inherits("QPopupMenu")) { 150 if (!p->inherits("QPopupMenu")) {
151 p->setBackgroundMode(QWidget::PaletteBackground); 151 p->setBackgroundMode(QWidget::PaletteBackground);
152 152
153 QObjectList *ol = p-> queryList("QWidget"); 153 QObjectList *ol = p-> queryList("QWidget");
154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
155 QWidget *wid = (QWidget *) it.current ( ); 155 QWidget *wid = (QWidget *) it.current ( );
156 156
157 wid-> setBackgroundMode( QWidget::PaletteBackground ); 157 wid-> setBackgroundMode( QWidget::PaletteBackground );
158 } 158 }
159 delete ol; 159 delete ol;
160 } 160 }
161 } 161 }
162 } 162 }
163 return(false); 163 return(false);
164} 164}
165 165
166 166
167LiquidStyle::LiquidStyle() 167LiquidStyle::LiquidStyle()
168 :QWindowsStyle() 168 :QWindowsStyle()
169{ 169{
170 setName ( "LiquidStyle" ); 170 setName ( "LiquidStyle" );
171 171
172 flatTBButtons = false; 172 flatTBButtons = false;
173 173
174 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 174 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
175 btnMaskBmp.setMask(btnMaskBmp); 175 btnMaskBmp.setMask(btnMaskBmp);
176 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 176 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
177 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 177 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
178 headerHoverID = -1; 178 headerHoverID = -1;
179 highlightWidget = NULL; 179 highlightWidget = NULL;
180 setButtonDefaultIndicatorWidth(0); 180 setButtonDefaultIndicatorWidth(0);
181 btnDict.setAutoDelete(true); 181 btnDict.setAutoDelete(true);
182 bevelFillDict.setAutoDelete(true); 182 bevelFillDict.setAutoDelete(true);
183 smallBevelFillDict.setAutoDelete(true); 183 smallBevelFillDict.setAutoDelete(true);
184 customBtnColorList.setAutoDelete(true); 184 customBtnColorList.setAutoDelete(true);
185 customBtnIconList.setAutoDelete(true); 185 customBtnIconList.setAutoDelete(true);
186 customBtnLabelList.setAutoDelete(true); 186 customBtnLabelList.setAutoDelete(true);
187 187
188 rMatrix.rotate(270.0); 188 rMatrix.rotate(270.0);
189 highcolor = QPixmap::defaultDepth() > 8; 189 highcolor = QPixmap::defaultDepth() > 8;
190 btnBorderPix = new QPixmap; 190 btnBorderPix = new QPixmap;
191 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 191 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
192 btnBlendPix = new QPixmap; 192 btnBlendPix = new QPixmap;
193 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 193 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
194 bevelFillPix = new QPixmap; 194 bevelFillPix = new QPixmap;
195 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 195 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
196 smallBevelFillPix = new QPixmap; 196 smallBevelFillPix = new QPixmap;
197 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 197 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
198 // new stuff 198 // new stuff
199 vsbSliderFillPix = menuPix = NULL; 199 vsbSliderFillPix = menuPix = NULL;
200 menuHandler = new TransMenuHandler(this); 200 menuHandler = new TransMenuHandler(this);
201 setScrollBarExtent(15, 15); 201 setScrollBarExtent(15, 15);
202 int i; 202 int i;
203 for(i=0; i < BITMAP_ITEMS; ++i){ 203 for(i=0; i < BITMAP_ITEMS; ++i){
204 pixmaps[i] = NULL; 204 pixmaps[i] = NULL;
205 } 205 }
206 oldSliderThickness = sliderThickness(); 206 oldSliderThickness = sliderThickness();
207 setSliderThickness(11); 207 setSliderThickness(11);
208} 208}
209 209
210LiquidStyle::~LiquidStyle() 210LiquidStyle::~LiquidStyle()
211{ 211{
212 if(btnBorderPix) 212 if(btnBorderPix)
213 delete btnBorderPix; 213 delete btnBorderPix;
214 if(btnBlendPix) 214 if(btnBlendPix)
215 delete btnBlendPix; 215 delete btnBlendPix;
216 if(bevelFillPix) 216 if(bevelFillPix)
217 delete bevelFillPix; 217 delete bevelFillPix;
218 if(smallBevelFillPix) 218 if(smallBevelFillPix)
219 delete smallBevelFillPix; 219 delete smallBevelFillPix;
220 if(vsbSliderFillPix) 220 if(vsbSliderFillPix)
221 delete vsbSliderFillPix; 221 delete vsbSliderFillPix;
222 if(menuPix) 222 if(menuPix)
223 delete menuPix; 223 delete menuPix;
224 224
225 setScrollBarExtent(16, 16); 225 setScrollBarExtent(16, 16);
226 setSliderThickness(oldSliderThickness); 226 setSliderThickness(oldSliderThickness);
227 int i; 227 int i;
228 for(i=0; i < BITMAP_ITEMS; ++i){ 228 for(i=0; i < BITMAP_ITEMS; ++i){
229 if(pixmaps[i]) 229 if(pixmaps[i])
230 delete pixmaps[i]; 230 delete pixmaps[i];
231 } 231 }
232} 232}
233 233
234void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 234void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
235 const QColor &c, const QColor &bg) 235 const QColor &c, const QColor &bg)
236{ 236{
237 237
238 QPen oldPen = p->pen(); // headers need this 238 QPen oldPen = p->pen(); // headers need this
239 int x2 = x+w-1; 239 int x2 = x+w-1;
240 int y2 = y+h-1; 240 int y2 = y+h-1;
241 // outer dark rect 241 // outer dark rect
242 p->setPen(c.dark(130)); 242 p->setPen(c.dark(130));
243 p->drawLine(x, y+2, x, y2-2); // l 243 p->drawLine(x, y+2, x, y2-2); // l
244 p->drawLine(x2, y+2, x2, y2-2); // r 244 p->drawLine(x2, y+2, x2, y2-2); // r
245 p->drawLine(x+2, y, x2-2, y); // t 245 p->drawLine(x+2, y, x2-2, y); // t
246 p->drawLine(x+2, y2, x2-2, y2); // b 246 p->drawLine(x+2, y2, x2-2, y2); // b
247 p->drawPoint(x+1, y+1); // tl 247 p->drawPoint(x+1, y+1); // tl
248 p->drawPoint(x2-1, y+1); // tr 248 p->drawPoint(x2-1, y+1); // tr
249 p->drawPoint(x+1, y2-1); // bl 249 p->drawPoint(x+1, y2-1); // bl
250 p->drawPoint(x2-1, y2-1); // br 250 p->drawPoint(x2-1, y2-1); // br
251 251
252 // inner top light lines 252 // inner top light lines
253 p->setPen(c.light(105)); 253 p->setPen(c.light(105));
254 p->drawLine(x+2, y+1, x2-2, y+1); 254 p->drawLine(x+2, y+1, x2-2, y+1);
255 p->drawLine(x+1, y+2, x2-1, y+2); 255 p->drawLine(x+1, y+2, x2-1, y+2);
256 p->drawLine(x+1, y+3, x+2, y+3); 256 p->drawLine(x+1, y+3, x+2, y+3);
257 p->drawLine(x2-2, y+3, x2-1, y+3); 257 p->drawLine(x2-2, y+3, x2-1, y+3);
258 p->drawPoint(x+1, y+4); 258 p->drawPoint(x+1, y+4);
259 p->drawPoint(x2-1, y+4); 259 p->drawPoint(x2-1, y+4);
260 260
261 // inner bottom light lines 261 // inner bottom light lines
262 p->setPen(c.light(110)); 262 p->setPen(c.light(110));
263 p->drawLine(x+2, y2-1, x2-2, y2-1); 263 p->drawLine(x+2, y2-1, x2-2, y2-1);
264 p->drawLine(x+1, y2-2, x2-1, y2-2); 264 p->drawLine(x+1, y2-2, x2-1, y2-2);
265 p->drawLine(x+1, y2-3, x+2, y2-3); 265 p->drawLine(x+1, y2-3, x+2, y2-3);
266 p->drawLine(x2-2, y2-3, x2-1, y2-3); 266 p->drawLine(x2-2, y2-3, x2-1, y2-3);
267 p->drawPoint(x+1, y2-4); 267 p->drawPoint(x+1, y2-4);
268 p->drawPoint(x2-1, y2-4); 268 p->drawPoint(x2-1, y2-4);
269 269
270 // inner left mid lines 270 // inner left mid lines
271 //p->setPen(c.light(105)); 271 //p->setPen(c.light(105));
272 p->setPen(c); 272 p->setPen(c);
273 p->drawLine(x+1, y+5, x+1, y2-5); 273 p->drawLine(x+1, y+5, x+1, y2-5);
274 p->drawLine(x+2, y+4, x+2, y2-4); 274 p->drawLine(x+2, y+4, x+2, y2-4);
275 275
276 // inner right mid lines 276 // inner right mid lines
277 p->drawLine(x2-1, y+5, x2-1, y2-5); 277 p->drawLine(x2-1, y+5, x2-1, y2-5);
278 p->drawLine(x2-2, y+4, x2-2, y2-4); 278 p->drawLine(x2-2, y+4, x2-2, y2-4);
279 279
280 // fill 280 // fill
281 QPixmap *pix; 281 QPixmap *pix;
282 if(h >= 32){ 282 if(h >= 32){
283 pix = bevelFillDict.find(c.rgb()); 283 pix = bevelFillDict.find(c.rgb());
284 if(!pix){ 284 if(!pix){
285 int h, s, v; 285 int h, s, v;
286 c.hsv(&h, &s, &v); 286 c.hsv(&h, &s, &v);
287 pix = new QPixmap(*bevelFillPix); 287 pix = new QPixmap(*bevelFillPix);
288 adjustHSV(*pix, h, s, v); 288 adjustHSV(*pix, h, s, v);
289 bevelFillDict.insert(c.rgb(), pix); 289 bevelFillDict.insert(c.rgb(), pix);
290 } 290 }
291 } 291 }
292 else{ 292 else{
293 pix = smallBevelFillDict.find(c.rgb()); 293 pix = smallBevelFillDict.find(c.rgb());
294 if(!pix){ 294 if(!pix){
295 int h, s, v; 295 int h, s, v;
296 c.hsv(&h, &s, &v); 296 c.hsv(&h, &s, &v);
297 pix = new QPixmap(*smallBevelFillPix); 297 pix = new QPixmap(*smallBevelFillPix);
298 adjustHSV(*pix, h, s, v); 298 adjustHSV(*pix, h, s, v);
299 smallBevelFillDict.insert(c.rgb(), pix); 299 smallBevelFillDict.insert(c.rgb(), pix);
300 } 300 }
301 } 301 }
302 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); 302 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix);
303 // blend 303 // blend
304 int red, green, blue; 304 int red, green, blue;
305 QColor btnColor(c.dark(130)); 305 QColor btnColor(c.dark(130));
306 red = (btnColor.red() >> 1) + (bg.red() >> 1); 306 red = (btnColor.red() >> 1) + (bg.red() >> 1);
307 green = (btnColor.green() >> 1) + (bg.green() >> 1); 307 green = (btnColor.green() >> 1) + (bg.green() >> 1);
308 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); 308 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1);
309 btnColor.setRgb(red, green, blue); 309 btnColor.setRgb(red, green, blue);
310 310
311 p->setPen(btnColor); 311 p->setPen(btnColor);
312 p->drawPoint(x+1, y); 312 p->drawPoint(x+1, y);
313 p->drawPoint(x, y+1); 313 p->drawPoint(x, y+1);
314 p->drawPoint(x+1, y2); 314 p->drawPoint(x+1, y2);
315 p->drawPoint(x, y2-1); 315 p->drawPoint(x, y2-1);
316 316
317 p->drawPoint(x2-1, y); 317 p->drawPoint(x2-1, y);
318 p->drawPoint(x2, y+1); 318 p->drawPoint(x2, y+1);
319 p->drawPoint(x2-1, y2); 319 p->drawPoint(x2-1, y2);
320 p->drawPoint(x2, y2-1); 320 p->drawPoint(x2, y2-1);
321 321
322 p->setPen(oldPen); 322 p->setPen(oldPen);
323 323
324} 324}
325 325
326void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, 326void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
327 const QColor &back, int x, int y, int w, int h, 327 const QColor &back, int x, int y, int w, int h,
328 bool supportPushDown, bool pushedDown, 328 bool supportPushDown, bool pushedDown,
329 bool autoDefault, bool isMasked) 329 bool autoDefault, bool isMasked)
330{ 330{
331 if(w < 21 || h < 21){ 331 if(w < 21 || h < 21){
332 drawClearBevel(painter, x, y, w, h, c, back); 332 drawClearBevel(painter, x, y, w, h, c, back);
333 return; 333 return;
334 } 334 }
335 if(supportPushDown){ 335 if(supportPushDown){
336 --w, --h; 336 --w, --h;
337 } 337 }
338 /* We don't make the round buttons smaller, since they don't look as good 338 /* We don't make the round buttons smaller, since they don't look as good
339 if(autoDefault){ 339 if(autoDefault){
340 w = w-buttonDefaultIndicatorWidth()*2; 340 w = w-buttonDefaultIndicatorWidth()*2;
341 h = h-buttonDefaultIndicatorWidth()*2; 341 h = h-buttonDefaultIndicatorWidth()*2;
342 }*/ 342 }*/
343 343
344 344
345 QPixmap *pix = btnDict.find(c.rgb()); 345 QPixmap *pix = btnDict.find(c.rgb());
346 if(!pix){ 346 if(!pix){
347 int h, s, v; 347 int h, s, v;
348 c.hsv(&h, &s, &v); 348 c.hsv(&h, &s, &v);
349 pix = new QPixmap(*btnBorderPix); 349 pix = new QPixmap(*btnBorderPix);
350 adjustHSV(*pix, h, s, v); 350 adjustHSV(*pix, h, s, v);
351 btnDict.insert(c.rgb(), pix); 351 btnDict.insert(c.rgb(), pix);
352 } 352 }
353 int x2 = x+w-1; 353 int x2 = x+w-1;
354 int y2 = y+h-1; 354 int y2 = y+h-1;
355 int bx2 = pix->width()-1; 355 int bx2 = pix->width()-1;
356 int by2 = pix->height()-1; 356 int by2 = pix->height()-1;
357 357
358 QPixmap tmpPix(w, h); 358 QPixmap tmpPix(w, h);
359 QPixmap tilePix; 359 QPixmap tilePix;
360 QPainter p; 360 QPainter p;
361 p.begin(&tmpPix); 361 p.begin(&tmpPix);
362 362
363 // do the fill 363 // do the fill
364 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 364 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
365 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 365 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr
366 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl 366 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl
367 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br 367 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
368 368
369 // edges 369 // edges
370 tilePix.resize(pix->width()-20, 10); 370 tilePix.resize(pix->width()-20, 10);
371 // top 371 // top
372 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 372 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
373 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 373 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
374 // bottom 374 // bottom
375 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 375 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
376 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 376 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
377 // left 377 // left
378 tilePix.resize(10, pix->height()-20); 378 tilePix.resize(10, pix->height()-20);
379 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 379 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
380 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 380 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
381 // right 381 // right
382 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 382 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
383 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 383 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
384 384
385 // middle 385 // middle
386 tilePix.resize(pix->width()-20, pix->height()-20); 386 tilePix.resize(pix->width()-20, pix->height()-20);
387 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); 387 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20);
388 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); 388 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix);
389 389
390 390
391 // do the blend 391 // do the blend
392 QBitmap blendMask; 392 QBitmap blendMask;
393 if(!isMasked){ 393 if(!isMasked){
394 //QRgb bgRgb = back.rgb(); 394 //QRgb bgRgb = back.rgb();
395 //QRgb fgRgb = c.rgb(); 395 //QRgb fgRgb = c.rgb();
396 //int r, g, b; 396 //int r, g, b;
397 397
398 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); 398 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25);
399 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); 399 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25);
400 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); 400 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25);
401 //QColor blendColor(r, g, b); 401 //QColor blendColor(r, g, b);
402 int hue, sat, v1, v2; 402 int hue, sat, v1, v2;
403 QColor blendColor(autoDefault ? c : back); 403 QColor blendColor(autoDefault ? c : back);
404 back.hsv(&hue, &sat, &v1); 404 back.hsv(&hue, &sat, &v1);
405 blendColor.hsv(&hue, &sat, &v2); 405 blendColor.hsv(&hue, &sat, &v2);
406 if(v2 > v1) 406 if(v2 > v1)
407 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); 407 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25));
408 408
409 pix = btnBorderDict.find(blendColor.rgb()); 409 pix = btnBorderDict.find(blendColor.rgb());
410 if(!pix){ 410 if(!pix){
411 int h, s, v; 411 int h, s, v;
412 blendColor.hsv(&h, &s, &v); 412 blendColor.hsv(&h, &s, &v);
413 pix = new QPixmap(*btnBlendPix); 413 pix = new QPixmap(*btnBlendPix);
414 adjustHSV(*pix, h, s, v); 414 adjustHSV(*pix, h, s, v);
415 btnBorderDict.insert(blendColor.rgb(), pix); 415 btnBorderDict.insert(blendColor.rgb(), pix);
416 } 416 }
417 } 417 }
418 else{ 418 else{
419 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : 419 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) :
420 getPixmap(HTMLBtnBorder); 420 getPixmap(HTMLBtnBorder);
421 } 421 }
422 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 422 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
423 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 423 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr
424 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl 424 p.drawPixmap(0, y2-9, *pix, 0, by2-9, 10, 10); // bl
425 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br 425 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
426 426
427 // edges 427 // edges
428 tilePix.resize(pix->width()-20, 10); 428 tilePix.resize(pix->width()-20, 10);
429 blendMask.resize(pix->width()-20, 10); 429 blendMask.resize(pix->width()-20, 10);
430 // top 430 // top
431 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 431 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
432 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); 432 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10);
433 tilePix.setMask(blendMask); 433 tilePix.setMask(blendMask);
434 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 434 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
435 // bottom 435 // bottom
436 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 436 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
437 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20); 437 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20);
438 tilePix.setMask(blendMask); 438 tilePix.setMask(blendMask);
439 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 439 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
440 // left 440 // left
441 tilePix.resize(10, pix->height()-20); 441 tilePix.resize(10, pix->height()-20);
442 blendMask.resize(10, pix->height()-20); 442 blendMask.resize(10, pix->height()-20);
443 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 443 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
444 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); 444 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20);
445 tilePix.setMask(blendMask); 445 tilePix.setMask(blendMask);
446 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 446 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
447 // right 447 // right
448 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 448 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
449 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20); 449 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20);
450 tilePix.setMask(blendMask); 450 tilePix.setMask(blendMask);
451 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 451 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
452 452
453 p.end(); 453 p.end();
454 454
455 // do the button mask - we don't automask buttons 455 // do the button mask - we don't automask buttons
456 QBitmap btnMask(w, h); 456 QBitmap btnMask(w, h);
457 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 457 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
458 p.begin(&btnMask); 458 p.begin(&btnMask);
459 p.fillRect(0, 0, w, h, Qt::color0); 459 p.fillRect(0, 0, w, h, Qt::color0);
460 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 460 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
461 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 461 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
462 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 462 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
463 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 463 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
464 // fills 464 // fills
465 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 465 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
466 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 466 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
467 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 467 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
468 p.end(); 468 p.end();
469 tmpPix.setMask(btnMask); 469 tmpPix.setMask(btnMask);
470 /*if(autoDefault){ 470 /*if(autoDefault){
471 if(supportPushDown && pushedDown){ 471 if(supportPushDown && pushedDown){
472 painter->drawPixmap(x+3, y+3, tmpPix); 472 painter->drawPixmap(x+3, y+3, tmpPix);
473 } 473 }
474 else{ 474 else{
475 painter->drawPixmap(x+2, y+2, tmpPix); 475 painter->drawPixmap(x+2, y+2, tmpPix);
476 } 476 }
477 } 477 }
478 else */if(supportPushDown && pushedDown) 478 else */if(supportPushDown && pushedDown)
479 painter->drawPixmap(x+1, y+1, tmpPix); 479 painter->drawPixmap(x+1, y+1, tmpPix);
480 else 480 else
481 painter->drawPixmap(x, y, tmpPix); 481 painter->drawPixmap(x, y, tmpPix);
482 482
483 483
484 484
485} 485}
486 486
487 487
488QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, 488QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
489 bool blend) 489 bool blend)
490{ 490{
491 QImage img(qembed_findImage(label)); 491 QImage img(qembed_findImage(label));
492 img.detach(); 492 img.detach();
493 if(img.isNull()){ // shouldn't happen, been tested 493 if(img.isNull()){ // shouldn't happen, been tested
494 qWarning("Invalid embedded label %s", label); 494 qWarning("Invalid embedded label %s", label);
495 return(NULL); 495 return(NULL);
496 } 496 }
497 if(img.depth() != 32) 497 if(img.depth() != 32)
498 img = img.convertDepth(32); 498 img = img.convertDepth(32);
499 unsigned int *data = (unsigned int *)img.bits(); 499 unsigned int *data = (unsigned int *)img.bits();
500 int total = img.width()*img.height(); 500 int total = img.width()*img.height();
501 int current; 501 int current;
502 QColor c; 502 QColor c;
503 int oldH, oldS, oldV; 503 int oldH, oldS, oldV;
504 int alpha; 504 int alpha;
505 if(v < 235) 505 if(v < 235)
506 v += 20; 506 v += 20;
507 else 507 else
508 v = 255; 508 v = 255;
509 float intensity = v/255.0; 509 float intensity = v/255.0;
510 510
511 for(current=0; current<total; ++current){ 511 for(current=0; current<total; ++current){
512 alpha = qAlpha(data[current]); 512 alpha = qAlpha(data[current]);
513 c.setRgb(data[current]); 513 c.setRgb(data[current]);
514 c.hsv(&oldH, &oldS, &oldV); 514 c.hsv(&oldH, &oldS, &oldV);
515 oldV = (int)(oldV*intensity); 515 oldV = (int)(oldV*intensity);
516 c.setHsv(h, s, oldV); 516 c.setHsv(h, s, oldV);
517 if(blend && alpha != 255 && alpha != 0){ 517 if(blend && alpha != 255 && alpha != 0){
518 float srcPercent = ((float)alpha)/255.0; 518 float srcPercent = ((float)alpha)/255.0;
519 float destPercent = 1.0-srcPercent; 519 float destPercent = 1.0-srcPercent;
520 oldH = (int)((srcPercent*h) + (destPercent*bH)); 520 oldH = (int)((srcPercent*h) + (destPercent*bH));
521 oldS = (int)((srcPercent*s) + (destPercent*bS)); 521 oldS = (int)((srcPercent*s) + (destPercent*bS));
522 oldV = (int)((srcPercent*oldV) + (destPercent*bV)); 522 oldV = (int)((srcPercent*oldV) + (destPercent*bV));
523 c.setHsv(oldH, oldS, oldV); 523 c.setHsv(oldH, oldS, oldV);
524 alpha = 255; 524 alpha = 255;
525 } 525 }
526 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); 526 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha);
527 } 527 }
528 QPixmap *pix = new QPixmap; 528 QPixmap *pix = new QPixmap;
529 pix->convertFromImage(img); 529 pix->convertFromImage(img);
530 return(pix); 530 return(pix);
531} 531}
532 532
533 533
534 534
535 535
536QPixmap* LiquidStyle::getPixmap(BitmapData item) 536QPixmap* LiquidStyle::getPixmap(BitmapData item)
537{ 537{
538 538
539 if(pixmaps[item]) 539 if(pixmaps[item])
540 return(pixmaps[item]); 540 return(pixmaps[item]);
541 541
542 switch(item){ 542 switch(item){
543 case HTMLBtnBorder: 543 case HTMLBtnBorder:
544 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); 544 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV);
545 break; 545 break;
546 case HTMLBtnBorderDown: 546 case HTMLBtnBorderDown:
547 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 547 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
548 break; 548 break;
549 case HTMLCB: 549 case HTMLCB:
550 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 550 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
551 break; 551 break;
552 case HTMLCBDown: 552 case HTMLCBDown:
553 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 553 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
554 break; 554 break;
555 case HTMLCBHover: 555 case HTMLCBHover:
556 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); 556 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV);
557 break; 557 break;
558 case HTMLCBDownHover: 558 case HTMLCBDownHover:
559 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", 559 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown",
560 btnHoverH, btnHoverS, 560 btnHoverH, btnHoverS,
561 btnHoverV); 561 btnHoverV);
562 break; 562 break;
563 case HTMLRadio: 563 case HTMLRadio:
564 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 564 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
565 case HTMLRadioDown: 565 case HTMLRadioDown:
566 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 566 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
567 case HTMLRadioHover: 567 case HTMLRadioHover:
568 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); 568 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV);
569 case HTMLRadioDownHover: 569 case HTMLRadioDownHover:
570 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", 570 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown",
571 btnHoverH, btnHoverS, 571 btnHoverH, btnHoverS,
572 btnHoverV); 572 btnHoverV);
573 case RadioOn: 573 case RadioOn:
574 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); 574 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true);
575 break; 575 break;
576 case RadioOnHover: 576 case RadioOnHover:
577 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, 577 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS,
578 btnHoverV, true); 578 btnHoverV, true);
579 break; 579 break;
580 case RadioOffHover: 580 case RadioOffHover:
581 pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); 581 pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true);
582 break; 582 break;
583 case TabDown: 583 case TabDown:
584 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); 584 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true);
585 break; 585 break;
586 case TabFocus: 586 case TabFocus:
587 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, 587 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS,
588 btnHoverS, true); 588 btnHoverS, true);
589 break; 589 break;
590 case CBDown: 590 case CBDown:
591 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); 591 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true);
592 break; 592 break;
593 case CBDownHover: 593 case CBDownHover:
594 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, 594 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH,
595 btnHoverS, btnHoverV, true); 595 btnHoverS, btnHoverV, true);
596 break; 596 break;
597 case CBHover: 597 case CBHover:
598 pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); 598 pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true);
599 break; 599 break;
600 case HSlider: 600 case HSlider:
601 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 601 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
602 break; 602 break;
603 case VSlider: 603 case VSlider:
604 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 604 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
605 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 605 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
606 break; 606 break;
607 case RadioOff: 607 case RadioOff:
608 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); 608 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true);
609 break; 609 break;
610 case Tab: 610 case Tab:
611 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); 611 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true);
612 break; 612 break;
613 case CB: 613 case CB:
614 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); 614 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true);
615 break; 615 break;
616 case VSBSliderTop: 616 case VSBSliderTop:
617 pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 617 pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
618 break; 618 break;
619 case VSBSliderBtm: 619 case VSBSliderBtm:
620 pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 620 pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
621 break; 621 break;
622 case VSBSliderMid: 622 case VSBSliderMid:
623 pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 623 pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
624 break; 624 break;
625 case VSBSliderTopHover: 625 case VSBSliderTopHover:
626 pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 626 pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
627 break; 627 break;
628 case VSBSliderBtmHover: 628 case VSBSliderBtmHover:
629 pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 629 pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
630 break; 630 break;
631 case VSBSliderMidHover: 631 case VSBSliderMidHover:
632 pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 632 pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
633 break; 633 break;
634 634
635 case HSBSliderTop: 635 case HSBSliderTop:
636 pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 636 pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
637 *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); 637 *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix);
638 break; 638 break;
639 case HSBSliderBtm: 639 case HSBSliderBtm:
640 pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 640 pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
641 *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); 641 *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix);
642 break; 642 break;
643 case HSBSliderMid: 643 case HSBSliderMid:
644 pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 644 pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
645 *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); 645 *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix);
646 break; 646 break;
647 case HSBSliderTopHover: 647 case HSBSliderTopHover:
648 pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 648 pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
649 *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); 649 *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix);
650 break; 650 break;
651 case HSBSliderBtmHover: 651 case HSBSliderBtmHover:
652 pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 652 pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
653 *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); 653 *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix);
654 break; 654 break;
655 case HSBSliderMidHover: 655 case HSBSliderMidHover:
656 pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 656 pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
657 *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); 657 *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix);
658 break; 658 break;
659 case VSBSliderTopBg: 659 case VSBSliderTopBg:
660 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 660 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
661 break; 661 break;
662 case VSBSliderBtmBg: 662 case VSBSliderBtmBg:
663 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 663 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
664 break; 664 break;
665 case VSBSliderMidBg: 665 case VSBSliderMidBg:
666 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 666 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
667 break; 667 break;
668 case HSBSliderTopBg: 668 case HSBSliderTopBg:
669 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 669 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
670 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 670 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
671 break; 671 break;
672 case HSBSliderBtmBg: 672 case HSBSliderBtmBg:
673 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 673 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
674 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 674 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
675 break; 675 break;
676 case HSBSliderMidBg: 676 case HSBSliderMidBg:
677 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 677 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
678 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 678 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
679 break; 679 break;
680 default: 680 default:
681 break; 681 break;
682 } 682 }
683 return(pixmaps[item]); 683 return(pixmaps[item]);
684} 684}
685 685
686void LiquidStyle::polish(QPalette &appPal) 686void LiquidStyle::polish(QPalette &appPal)
687{ 687{
688
689 int i; 688 int i;
690 for(i=0; i < BITMAP_ITEMS; ++i){ 689 for(i=0; i < BITMAP_ITEMS; ++i){
691 if(pixmaps[i]){ 690 if(pixmaps[i]){
692 delete pixmaps[i]; 691 delete pixmaps[i];
693 pixmaps[i] = NULL; 692 pixmaps[i] = NULL;
694 } 693 }
695 } 694 }
696 QWidgetList *list = QApplication::allWidgets(); 695 QWidgetList *list = QApplication::allWidgets();
697 QWidgetListIt it( *list ); 696 QWidgetListIt it( *list );
698 QWidget *w; 697 QWidget *w;
699 while ((w=it.current()) != 0 ){ 698 while ((w=it.current()) != 0 ){
700 ++it; 699 ++it;
701 if(w->inherits("QPushButton")){ 700 if(w->inherits("QPushButton")){
702 unapplyCustomAttributes((QPushButton *)w); 701 unapplyCustomAttributes((QPushButton *)w);
703 } 702 }
704 } 703 }
705 704
706 loadCustomButtons(); 705 loadCustomButtons();
707 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
708 btnDict.clear(); 707 btnDict.clear();
709 btnBorderDict.clear(); 708 btnBorderDict.clear();
710 bevelFillDict.clear(); 709 bevelFillDict.clear();
711 smallBevelFillDict.clear(); 710 smallBevelFillDict.clear();
712 711
713 Config config ( "qpe" ); 712 Config config ( "qpe" );
714 config. setGroup ( "Liquid-Style" ); 713 config. setGroup ( "Liquid-Style" );
715 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 714 int contrast = config. readNumEntry ( "StippleContrast", 5 );
716 if ( contrast < 0 ) 715 if ( contrast < 0 )
717 contrast = 0; 716 contrast = 0;
718 else if ( contrast > 10 ) 717 else if ( contrast > 10 )
719 contrast = 10; 718 contrast = 10;
720 719
721 QPalette pal = QApplication::palette(); 720// QPalette pal = QApplication::palette();
722 721
723 // button color stuff 722 // button color stuff
724 config. setGroup ( "Appearance" ); 723 config. setGroup ( "Appearance" );
725 QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 724 QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
726 if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { 725 appPal. color ( QPalette::Active, QColorGroup::Button );
726 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )
727 //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
728 ) {
727 // force button color to be different from background 729 // force button color to be different from background
728 QBrush btnBrush(QColor(200, 202, 228)); 730 QBrush btnBrush(QColor(200, 202, 228));
729 appPal.setBrush(QColorGroup::Button, btnBrush); 731 appPal.setBrush(QColorGroup::Button, btnBrush);
730 } 732 }
731 c.hsv(&btnH, &btnS, &btnV); 733 c.hsv(&btnH, &btnS, &btnV);
732 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 734 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
733 735
734 // menu pixmap 736 // menu pixmap
735 if(!menuPix){ 737 if(!menuPix){
736 menuPix = new QPixmap; 738 menuPix = new QPixmap;
737 menuPix->resize(64, 64); 739 menuPix->resize(64, 64);
738 } 740 }
739 QPainter painter; 741 QPainter painter;
740 menuPix->fill(c.rgb()); 742 menuPix->fill(c.rgb());
741 painter.begin(menuPix); 743 painter.begin(menuPix);
742 painter.setPen(c.dark(105)); 744 painter.setPen(c.dark(105));
743 for(i=0; i < 63; i+=4){ 745 for(i=0; i < 63; i+=4){
744 painter.drawLine(0, i, 63, i); 746 painter.drawLine(0, i, 63, i);
745 painter.drawLine(0, i+1, 63, i+1); 747 painter.drawLine(0, i+1, 63, i+1);
746 }; 748 };
747 painter.end(); 749 painter.end();
748 menuBrush.setColor(c); 750 menuBrush.setColor(c);
749 menuBrush.setPixmap(*menuPix); 751 menuBrush.setPixmap(*menuPix);
750 752
751 // pager brush 753 // pager brush
752 c = c.dark(120); 754 c = c.dark(120);
753 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 755 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
754 if(!pix){ 756 if(!pix){
755 int h, s, v; 757 int h, s, v;
756 c.hsv(&h, &s, &v); 758 c.hsv(&h, &s, &v);
757 pix = new QPixmap(*smallBevelFillPix); 759 pix = new QPixmap(*smallBevelFillPix);
758 adjustHSV(*pix, h, s, v); 760 adjustHSV(*pix, h, s, v);
759 smallBevelFillDict.insert(c.rgb(), pix); 761 smallBevelFillDict.insert(c.rgb(), pix);
760 } 762 }
761 pagerHoverBrush.setColor(c); 763 pagerHoverBrush.setColor(c);
762 pagerHoverBrush.setPixmap(*pix); 764 pagerHoverBrush.setPixmap(*pix);
763 765
764 c = c.dark(120); 766 c = c.dark(120);
765 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 767 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
766 if(!pix){ 768 if(!pix){
767 int h, s, v; 769 int h, s, v;
768 c.hsv(&h, &s, &v); 770 c.hsv(&h, &s, &v);
769 pix = new QPixmap(*smallBevelFillPix); 771 pix = new QPixmap(*smallBevelFillPix);
770 adjustHSV(*pix, h, s, v); 772 adjustHSV(*pix, h, s, v);
771 smallBevelFillDict.insert(c.rgb(), pix); 773 smallBevelFillDict.insert(c.rgb(), pix);
772 } 774 }
773 pagerBrush.setColor(c); 775 pagerBrush.setColor(c);
774 pagerBrush.setPixmap(*pix); 776 pagerBrush.setPixmap(*pix);
775 777
776 // background color stuff 778 // background color stuff
777 c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); 779 c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background );
778 c.hsv(&bH, &bS, &bV); 780 c.hsv(&bH, &bS, &bV);
779 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 781 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
780 782
781 // FIXME? 783 // FIXME?
782 if(vsbSliderFillPix) 784 if(vsbSliderFillPix)
783 delete vsbSliderFillPix; 785 delete vsbSliderFillPix;
784 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 786 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
785 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 787 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
786 788
787 // background brush 789 // background brush
788 QPixmap wallPaper(32, 32); 790 QPixmap wallPaper(32, 32);
789 wallPaper.fill(c.rgb()); 791 wallPaper.fill(c.rgb());
790 painter.begin(&wallPaper); 792 painter.begin(&wallPaper);
791 for(i=0; i < 32; i+=4){ 793 for(i=0; i < 32; i+=4){
792 painter.setPen(c.dark(100 + contrast)); 794 painter.setPen(c.dark(100 + contrast));
793 painter.drawLine(0, i, 32, i); 795 painter.drawLine(0, i, 32, i);
794 painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 796 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
795 painter.drawLine(0, i+1, 32, i+1); 797 painter.drawLine(0, i+1, 32, i+1);
796 }; 798 };
797 painter.end(); 799 painter.end();
798 bgBrush.setColor(c); 800 bgBrush.setColor(c);
799 bgBrush.setPixmap(wallPaper); 801 bgBrush.setPixmap(wallPaper);
800 appPal.setBrush(QColorGroup::Background, bgBrush); 802 appPal.setBrush(QColorGroup::Background, bgBrush);
801 803
802 // lineedits 804 // lineedits
803 c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); 805 c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base );
804 QPixmap basePix; 806 QPixmap basePix;
805 basePix.resize(32, 32); 807 basePix.resize(32, 32);
806 basePix.fill(c.rgb()); 808 basePix.fill(c.rgb());
807 painter.begin(&basePix); 809 painter.begin(&basePix);
808 painter.setPen(c.dark(105)); 810 painter.setPen(c.dark(105));
809 for(i=0; i < 32; i+=4){ 811 for(i=0; i < 32; i+=4){
810 painter.drawLine(0, i, 32, i); 812 painter.drawLine(0, i, 32, i);
811 painter.drawLine(0, i+1, 32, i+1); 813 painter.drawLine(0, i+1, 32, i+1);
812 }; 814 };
813 painter.end(); 815 painter.end();
814 baseBrush.setColor(c); 816 baseBrush.setColor(c);
815 baseBrush.setPixmap(basePix); 817 baseBrush.setPixmap(basePix);
816 it.toFirst(); 818 it.toFirst();
817 while ((w=it.current()) != 0 ){ 819 while ((w=it.current()) != 0 ){
818 ++it; 820 ++it;
819 if(w->inherits("QLineEdit")){ 821 if(w->inherits("QLineEdit")){
820 QPalette pal = w->palette(); 822 QPalette pal = w->palette();
821 pal.setBrush(QColorGroup::Base, baseBrush); 823 pal.setBrush(QColorGroup::Base, baseBrush);
822 w->setPalette(pal); 824 w->setPalette(pal);
823 } 825 }
824 else if(w->inherits("QPushButton")){ 826 else if(w->inherits("QPushButton")){
825 applyCustomAttributes((QPushButton *)w); 827 applyCustomAttributes((QPushButton *)w);
826 } 828 }
827 } 829 }
828
829} 830}
830 831
831void LiquidStyle::polish(QWidget *w) 832void LiquidStyle::polish(QWidget *w)
832{ 833{
833 if(w->inherits("QMenuBar")){ 834 if(w->inherits("QMenuBar")){
834 //((QFrame*)w)->setLineWidth(0); 835 //((QFrame*)w)->setLineWidth(0);
835 w->setBackgroundMode(QWidget::PaletteBackground); 836 w->setBackgroundMode(QWidget::PaletteBackground);
836 w->setBackgroundOrigin(QWidget::ParentOrigin); 837 w->setBackgroundOrigin(QWidget::ParentOrigin);
837 return; 838 return;
838 } 839 }
839 if(w->inherits("QToolBar")){ 840 if(w->inherits("QToolBar")){
840 w->installEventFilter(this); 841 w->installEventFilter(this);
841 w->setBackgroundMode(QWidget::PaletteBackground); 842 w->setBackgroundMode(QWidget::PaletteBackground);
842 w->setBackgroundOrigin(QWidget::WidgetOrigin); 843 w->setBackgroundOrigin(QWidget::WidgetOrigin);
843 return; 844 return;
844 } 845 }
845 if(w->inherits("QPopupMenu")) 846 if(w->inherits("QPopupMenu"))
846 w->setBackgroundMode(QWidget::NoBackground); 847 w->setBackgroundMode(QWidget::NoBackground);
847 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 848 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
848 w->installEventFilter(menuHandler); 849 w->installEventFilter(menuHandler);
849 } 850 }
850 851
851 if(w->isTopLevel()){ 852 if(w->isTopLevel()){
852 return; 853 return;
853 } 854 }
854 855
855 856
856 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 857 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
857 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 858 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
858 859
859 if(w->inherits("QComboBox") || 860 if(w->inherits("QComboBox") ||
860 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 861 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
861 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 862 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
862 w->installEventFilter(this); 863 w->installEventFilter(this);
863 } 864 }
864 if(w->inherits("QLineEdit")){ 865 if(w->inherits("QLineEdit")){
865 QPalette pal = w->palette(); 866 QPalette pal = w->palette();
866 pal.setBrush(QColorGroup::Base, baseBrush); 867 pal.setBrush(QColorGroup::Base, baseBrush);
867 w->setPalette(pal); 868 w->setPalette(pal);
868 } 869 }
869 if(w->inherits("QPushButton")){ 870 if(w->inherits("QPushButton")){
870 applyCustomAttributes((QPushButton *)w); 871 applyCustomAttributes((QPushButton *)w);
871 w->installEventFilter(this); 872 w->installEventFilter(this);
872 } 873 }
873 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 874 if(w->inherits("QButton") || w-> inherits("QComboBox")){
874 w-> setBackgroundMode ( QWidget::PaletteBackground ); 875 w-> setBackgroundMode ( QWidget::PaletteBackground );
875 } 876 }
876 877
877 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 878 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
878 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 879 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
879 bool isViewportChild = w->parent() && 880 bool isViewportChild = w->parent() &&
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 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 884 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
884 w->setBackgroundMode(QWidget::X11ParentRelative); 885 w->setBackgroundMode(QWidget::X11ParentRelative);
885 return; 886 return;
886 } 887 }
887 if(isViewportChild){ 888 if(isViewportChild){
888 if(w->inherits("QButton") || w->inherits("QComboBox")){ 889 if(w->inherits("QButton") || w->inherits("QComboBox")){
889 if(w->parent()){ // heh, only way to test for KHTML children ;-) 890 if(w->parent()){ // heh, only way to test for KHTML children ;-)
890 if(w->parent()->parent()){ 891 if(w->parent()->parent()){
891 if(w->parent()->parent()->parent() && 892 if(w->parent()->parent()->parent() &&
892 w->parent()->parent()->parent()->inherits("KHTMLView")){ 893 w->parent()->parent()->parent()->inherits("KHTMLView")){
893 w->setAutoMask(true); 894 w->setAutoMask(true);
894 w->setBackgroundMode(QWidget::NoBackground); 895 w->setBackgroundMode(QWidget::NoBackground);
895 } 896 }
896 } 897 }
897 } 898 }
898 return; 899 return;
899 } 900 }
900 } 901 }
901 if(w->inherits("QHeader")){ 902 if(w->inherits("QHeader")){
902 w->setMouseTracking(true); 903 w->setMouseTracking(true);
903 w->installEventFilter(this); 904 w->installEventFilter(this);
904 } 905 }
905 if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { 906 if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) {
906 ((QToolButton*)w)->setAutoRaise (flatTBButtons); 907 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
907 if ( flatTBButtons ) 908 if ( flatTBButtons )
908 w->setBackgroundOrigin(QWidget::ParentOrigin); 909 w->setBackgroundOrigin(QWidget::ParentOrigin);
909 } 910 }
910 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 911 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
911 return; 912 return;
912 } 913 }
913 914
914 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 915 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
915 palette().active().brush(QColorGroup::Background).pixmap()){ 916 palette().active().brush(QColorGroup::Background).pixmap()){
916 qWarning("No parent pixmap for child widget %s", w->className()); 917 qWarning("No parent pixmap for child widget %s", w->className());
917 return; 918 return;
918 } 919 }
919 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 920 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
920 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 921 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
921 if(w->backgroundMode() == QWidget::PaletteBackground || 922 if(w->backgroundMode() == QWidget::PaletteBackground ||
922 w->backgroundMode() == QWidget::PaletteButton){ 923 w->backgroundMode() == QWidget::PaletteButton){
923 w->setBackgroundMode(QWidget::X11ParentRelative); 924 w->setBackgroundMode(QWidget::X11ParentRelative);
924 } 925 }
925 } 926 }
926 927
927} 928}
928 929
929void LiquidStyle::unPolish(QWidget *w) 930void LiquidStyle::unPolish(QWidget *w)
930{ 931{
931 if(w->inherits("QMenuBar")){ 932 if(w->inherits("QMenuBar")){
932 ((QFrame *)w)->setLineWidth(1); 933 ((QFrame *)w)->setLineWidth(1);
933 w->setBackgroundMode(QWidget::PaletteBackground); 934 w->setBackgroundMode(QWidget::PaletteBackground);
934 return; 935 return;
935 } 936 }
936 937
937 if(w->inherits("QPopupMenu")) 938 if(w->inherits("QPopupMenu"))
938 w->setBackgroundMode(QWidget::PaletteButton); 939 w->setBackgroundMode(QWidget::PaletteButton);
939 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 940 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
940 w->removeEventFilter(menuHandler); 941 w->removeEventFilter(menuHandler);
941 } 942 }
942 943
943 if(w->isTopLevel()) 944 if(w->isTopLevel())
944 return; 945 return;
945 946
946 // for viewport children, don't just check for NoBackground.... 947 // for viewport children, don't just check for NoBackground....
947 bool isViewportChild = w->parent() && 948 bool isViewportChild = w->parent() &&
948 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 949 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
949 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 950 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
950 951
951 w->setPalette(QApplication::palette()); 952 w->unsetPalette();
952 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 953 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
953 if(w->inherits("QPushButton")) 954 if(w->inherits("QPushButton"))
954 w->setBackgroundMode(QWidget::PaletteButton); 955 w->setBackgroundMode(QWidget::PaletteButton);
955 else 956 else
956 w->setBackgroundMode(QWidget::PaletteBackground); 957 w->setBackgroundMode(QWidget::PaletteBackground);
957 } 958 }
958 959
959 if(isViewportChild) 960 if(isViewportChild)
960 w->setAutoMask(false); 961 w->setAutoMask(false);
961 962
962 if(w->inherits("QPushButton")){ 963 if(w->inherits("QPushButton")){
963 unapplyCustomAttributes((QPushButton *)w); 964 unapplyCustomAttributes((QPushButton *)w);
964 w->removeEventFilter(this); 965 w->removeEventFilter(this);
965 } 966 }
966/* 967/*
967 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 968 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
968 w-> setBackgroundMode ( PaletteBackground ); 969 w-> setBackgroundMode ( PaletteBackground );
969 } 970 }
970*/ 971*/
971 if(w->inherits("QComboBox") || 972 if(w->inherits("QComboBox") ||
972 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 973 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
973 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 974 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
974 w->removeEventFilter(this); 975 w->removeEventFilter(this);
975 } 976 }
976 if(w->inherits("QButton") || w->inherits("QComboBox")){ 977 if(w->inherits("QButton") || w->inherits("QComboBox")){
977 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 978 if(w->parent() && w->parent()->inherits("KHTMLPart")){
978 w->setAutoMask(false); 979 w->setAutoMask(false);
979 } 980 }
980 } 981 }
981 if(w->inherits("QToolBar")){ 982 if(w->inherits("QToolBar")){
982 w->removeEventFilter(this); 983 w->removeEventFilter(this);
983 w->setBackgroundMode(QWidget::PaletteBackground); 984 w->setBackgroundMode(QWidget::PaletteBackground);
984 return; 985 return;
985 } 986 }
986 if(w->inherits("QHeader")){ 987 if(w->inherits("QHeader")){
987 w->setMouseTracking(false); 988 w->setMouseTracking(false);
988 w->removeEventFilter(this); 989 w->removeEventFilter(this);
989 } 990 }
990} 991}
991 992
992void LiquidStyle::polish(QApplication *app) 993void LiquidStyle::polish(QApplication *app)
993{ 994{
994 995
995 QWindowsStyle::polish(app); 996 QWindowsStyle::polish(app);
996 menuAni = app->isEffectEnabled(UI_AnimateMenu); 997 menuAni = app->isEffectEnabled(UI_AnimateMenu);
997 menuFade = app->isEffectEnabled(UI_FadeMenu); 998 menuFade = app->isEffectEnabled(UI_FadeMenu);
998 if(menuAni) 999 if(menuAni)
999 app->setEffectEnabled(UI_AnimateMenu, false); 1000 app->setEffectEnabled(UI_AnimateMenu, false);
1000 if(menuFade) 1001 if(menuFade)
1001 app->setEffectEnabled(UI_FadeMenu, false); 1002 app->setEffectEnabled(UI_FadeMenu, false);
1002 1003
1003 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 1004 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
1004 1005
1005 Config config ( "qpe" ); 1006 Config config ( "qpe" );
1006 config. setGroup ( "Liquid-Style" ); 1007 config. setGroup ( "Liquid-Style" );
1007 1008
1008 if ( config. readBoolEntry ( "WinDecoration", true )) 1009 // if ( config. readBoolEntry ( "WinDecoration", true ))
1009 QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 1010 // QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
1010 1011
1011 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 1012 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
1012} 1013}
1013 1014
1014void LiquidStyle::unPolish(QApplication *app) 1015void LiquidStyle::unPolish(QApplication *app)
1015{ 1016{
1016 QWindowsStyle::unPolish(app); 1017 QWindowsStyle::unPolish(app);
1017 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1018 app->setEffectEnabled(UI_AnimateMenu, menuAni);
1018 app->setEffectEnabled(UI_FadeMenu, menuFade); 1019 app->setEffectEnabled(UI_FadeMenu, menuFade);
1019 1020
1020 qt_set_draw_menu_bar_impl ( 0 ); 1021 qt_set_draw_menu_bar_impl ( 0 );
1021 1022
1022 QApplication::qwsSetDecoration ( new QPEDecoration ( )); 1023// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
1023} 1024}
1024 1025
1025/* 1026/*
1026 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1027 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1027 * force everything to erase and repaint on resize. This is going away, I'm 1028 * force everything to erase and repaint on resize. This is going away, I'm
1028 * trying to get shaped widgets to work right without masking. QPushButton, 1029 * trying to get shaped widgets to work right without masking. QPushButton,
1029 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1030 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1030 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1031 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1031 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1032 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1032 * caches them in QPixmapCache, which is bad for doing things like hover 1033 * caches them in QPixmapCache, which is bad for doing things like hover
1033 * because the style methods aren't called in paintEvents if everything 1034 * because the style methods aren't called in paintEvents if everything
1034 * is cached. We use our own Paint event handler instead. Taskbuttons and 1035 * is cached. We use our own Paint event handler instead. Taskbuttons and
1035 * pager buttons draw into a pixmap buffer, so we handle those with palette 1036 * pager buttons draw into a pixmap buffer, so we handle those with palette
1036 * modifications. For QHeader, different header items are actually one widget 1037 * modifications. For QHeader, different header items are actually one widget
1037 * that draws multiple items, so we need to check which ID is hightlighted 1038 * that draws multiple items, so we need to check which ID is hightlighted
1038 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1039 * and draw it. Finally, we also check enter and leave events for QLineEdit,
1039 * since if it's inside a combobox we want to highlight the combobox during 1040 * since if it's inside a combobox we want to highlight the combobox during
1040 * hovering in the edit. 1041 * hovering in the edit.
1041 */ 1042 */
1042bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1043bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1043{ 1044{
1044 if(obj->inherits("QToolBar")){ 1045 if(obj->inherits("QToolBar")){
1045 if(ev->type() == QEvent::Resize){ 1046 if(ev->type() == QEvent::Resize){
1046 const QObjectList *tbChildList = obj->children(); 1047 const QObjectList *tbChildList = obj->children();
1047 QObjectListIt it(*tbChildList); 1048 QObjectListIt it(*tbChildList);
1048 QObject *child; 1049 QObject *child;
1049 while((child = it.current()) != NULL){ 1050 while((child = it.current()) != NULL){
1050 ++it; 1051 ++it;
1051 if(child->isWidgetType()) 1052 if(child->isWidgetType())
1052 ((QWidget *)child)->repaint(true); 1053 ((QWidget *)child)->repaint(true);
1053 } 1054 }
1054 1055
1055 } 1056 }
1056 } 1057 }
1057 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ 1058 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){
1058 QWidget *btn = (QWidget *)obj; 1059 QWidget *btn = (QWidget *)obj;
1059 if(ev->type() == QEvent::Enter){ 1060 if(ev->type() == QEvent::Enter){
1060 if(btn->isEnabled()){ 1061 if(btn->isEnabled()){
1061 highlightWidget = btn; 1062 highlightWidget = btn;
1062 btn->repaint(false); 1063 btn->repaint(false);
1063 } 1064 }
1064 } 1065 }
1065 else if(ev->type() == QEvent::Leave){ 1066 else if(ev->type() == QEvent::Leave){
1066 if(btn == highlightWidget){ 1067 if(btn == highlightWidget){
1067 highlightWidget = NULL; 1068 highlightWidget = NULL;
1068 btn->repaint(false); 1069 btn->repaint(false);
1069 } 1070 }
1070 } 1071 }
1071 } 1072 }
1072 else if(obj->inherits("QToolButton")){ 1073 else if(obj->inherits("QToolButton")){
1073 QToolButton *btn = (QToolButton *)btn; 1074 QToolButton *btn = (QToolButton *)btn;
1074 if(!btn->autoRaise()){ 1075 if(!btn->autoRaise()){
1075 if(btn->isEnabled()){ 1076 if(btn->isEnabled()){
1076 highlightWidget = btn; 1077 highlightWidget = btn;
1077 btn->repaint(false); 1078 btn->repaint(false);
1078 } 1079 }
1079 } 1080 }
1080 else if(ev->type() == QEvent::Leave){ 1081 else if(ev->type() == QEvent::Leave){
1081 QWidget *btn = (QWidget *)obj; 1082 QWidget *btn = (QWidget *)obj;
1082 if(btn == highlightWidget){ 1083 if(btn == highlightWidget){
1083 highlightWidget = NULL; 1084 highlightWidget = NULL;
1084 btn->repaint(false); 1085 btn->repaint(false);
1085 } 1086 }
1086 } 1087 }
1087 else 1088 else
1088 highlightWidget = NULL; 1089 highlightWidget = NULL;
1089 } 1090 }
1090 else if(obj->inherits("QScrollBar")){ 1091 else if(obj->inherits("QScrollBar")){
1091 QScrollBar *sb = (QScrollBar *)obj; 1092 QScrollBar *sb = (QScrollBar *)obj;
1092 if(ev->type() == QEvent::Enter){ 1093 if(ev->type() == QEvent::Enter){
1093 if(sb->isEnabled()){ 1094 if(sb->isEnabled()){
1094 highlightWidget = sb; 1095 highlightWidget = sb;
1095 sb->repaint(false); 1096 sb->repaint(false);
1096 } 1097 }
1097 } 1098 }
1098 else if(ev->type() == QEvent::Leave){ 1099 else if(ev->type() == QEvent::Leave){
1099 if(sb == highlightWidget && !sb->draggingSlider()){ 1100 if(sb == highlightWidget && !sb->draggingSlider()){
1100 highlightWidget = NULL; 1101 highlightWidget = NULL;
1101 sb->repaint(false); 1102 sb->repaint(false);
1102 } 1103 }
1103 } 1104 }
1104 else if(ev->type() == QEvent::MouseButtonRelease){ 1105 else if(ev->type() == QEvent::MouseButtonRelease){
1105 QMouseEvent *me = (QMouseEvent *)ev; 1106 QMouseEvent *me = (QMouseEvent *)ev;
1106 if(sb == highlightWidget && !sb->rect().contains(me->pos())){ 1107 if(sb == highlightWidget && !sb->rect().contains(me->pos())){
1107 highlightWidget = NULL; 1108 highlightWidget = NULL;
1108 sb->repaint(false); 1109 sb->repaint(false);
1109 } 1110 }
1110 } 1111 }
1111 } 1112 }
1112 else if(obj->inherits("QLineEdit")){ 1113 else if(obj->inherits("QLineEdit")){
1113 if(obj->parent() && obj->parent()->inherits("QComboBox")){ 1114 if(obj->parent() && obj->parent()->inherits("QComboBox")){
1114 QWidget *btn = (QComboBox *)obj->parent(); 1115 QWidget *btn = (QComboBox *)obj->parent();
1115 if(ev->type() == QEvent::Enter){ 1116 if(ev->type() == QEvent::Enter){
1116 if (btn->isEnabled()){ 1117 if (btn->isEnabled()){
1117 highlightWidget = btn; 1118 highlightWidget = btn;
1118 btn->repaint(false); 1119 btn->repaint(false);
1119 } 1120 }
1120 } 1121 }
1121 else if(ev->type() == QEvent::Leave){ 1122 else if(ev->type() == QEvent::Leave){
1122 if (btn == highlightWidget) 1123 if (btn == highlightWidget)
1123 highlightWidget = NULL; 1124 highlightWidget = NULL;
1124 btn->repaint(false); 1125 btn->repaint(false);
1125 } 1126 }
1126 } 1127 }
1127 } 1128 }
1128 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ 1129 else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){
1129 QButton *btn = (QButton *)obj; 1130 QButton *btn = (QButton *)obj;
1130 bool isRadio = obj->inherits("QRadioButton"); 1131 bool isRadio = obj->inherits("QRadioButton");
1131 if(ev->type() == QEvent::Paint){ 1132 if(ev->type() == QEvent::Paint){
1132 //if(btn->autoMask()) 1133 //if(btn->autoMask())
1133 btn->erase(); 1134 btn->erase();
1134 QPainter p; 1135 QPainter p;
1135 p.begin(btn); 1136 p.begin(btn);
1136 QFontMetrics fm = btn->fontMetrics(); 1137 QFontMetrics fm = btn->fontMetrics();
1137 QSize lsz = fm.size(ShowPrefix, btn->text()); 1138 QSize lsz = fm.size(ShowPrefix, btn->text());
1138 QSize sz = isRadio ? exclusiveIndicatorSize() 1139 QSize sz = isRadio ? exclusiveIndicatorSize()
1139 : indicatorSize(); 1140 : indicatorSize();
1140 1141
1141 if(btn->hasFocus()){ 1142 if(btn->hasFocus()){
1142 QRect r = QRect(0, 0, btn->width(), btn->height()); 1143 QRect r = QRect(0, 0, btn->width(), btn->height());
1143 p.setPen(btn->colorGroup().button().dark(140)); 1144 p.setPen(btn->colorGroup().button().dark(140));
1144 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1145 p.drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1145 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1146 p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1146 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1147 p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1147 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1148 p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1148 } 1149 }
1149 int x = 0; 1150 int x = 0;
1150 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1151 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1151 if(isRadio) 1152 if(isRadio)
1152 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1153 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1153 btn->colorGroup(), btn->isOn(), 1154 btn->colorGroup(), btn->isOn(),
1154 btn->isDown(), btn->isEnabled()); 1155 btn->isDown(), btn->isEnabled());
1155 else 1156 else
1156 drawIndicator(&p, x, y, sz.width(), sz.height(), 1157 drawIndicator(&p, x, y, sz.width(), sz.height(),
1157 btn->colorGroup(), btn->state(), btn->isDown(), 1158 btn->colorGroup(), btn->state(), btn->isDown(),
1158 btn->isEnabled()); 1159 btn->isEnabled());
1159 x = sz.width() + 6; 1160 x = sz.width() + 6;
1160 y = 0; 1161 y = 0;
1161 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), 1162 drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1),
1162 btn->height(), AlignLeft|AlignVCenter|ShowPrefix, 1163 btn->height(), AlignLeft|AlignVCenter|ShowPrefix,
1163 btn->colorGroup(), btn->isEnabled(), 1164 btn->colorGroup(), btn->isEnabled(),
1164 btn->pixmap(), btn->text()); 1165 btn->pixmap(), btn->text());
1165 p.end(); 1166 p.end();
1166 return(true); 1167 return(true);
1167 } 1168 }
1168 // for hover, just redraw the indicator (not the text) 1169 // for hover, just redraw the indicator (not the text)
1169 else if((ev->type() == QEvent::Enter && btn->isEnabled()) || 1170 else if((ev->type() == QEvent::Enter && btn->isEnabled()) ||
1170 (ev->type() == QEvent::Leave && btn == highlightWidget)){ 1171 (ev->type() == QEvent::Leave && btn == highlightWidget)){
1171 QButton *btn = (QButton *)obj; 1172 QButton *btn = (QButton *)obj;
1172 bool isRadio = obj->inherits("QRadioButton"); 1173 bool isRadio = obj->inherits("QRadioButton");
1173 1174
1174 if(ev->type() == QEvent::Enter) 1175 if(ev->type() == QEvent::Enter)
1175 highlightWidget = btn; 1176 highlightWidget = btn;
1176 else 1177 else
1177 highlightWidget = NULL; 1178 highlightWidget = NULL;
1178 QFontMetrics fm = btn->fontMetrics(); 1179 QFontMetrics fm = btn->fontMetrics();
1179 QSize lsz = fm.size(ShowPrefix, btn->text()); 1180 QSize lsz = fm.size(ShowPrefix, btn->text());
1180 QSize sz = isRadio ? exclusiveIndicatorSize() 1181 QSize sz = isRadio ? exclusiveIndicatorSize()
1181 : indicatorSize(); 1182 : indicatorSize();
1182 int x = 0; 1183 int x = 0;
1183 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; 1184 int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2;
1184 //if(btn->autoMask()) 1185 //if(btn->autoMask())
1185 // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); 1186 // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2);
1186 QPainter p; 1187 QPainter p;
1187 p.begin(btn); 1188 p.begin(btn);
1188 if(isRadio) 1189 if(isRadio)
1189 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), 1190 drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(),
1190 btn->colorGroup(), btn->isOn(), 1191 btn->colorGroup(), btn->isOn(),
1191 btn->isDown(), btn->isEnabled()); 1192 btn->isDown(), btn->isEnabled());
1192 else 1193 else
1193 drawIndicator(&p, x, y, sz.width(), sz.height(), 1194 drawIndicator(&p, x, y, sz.width(), sz.height(),
1194 btn->colorGroup(), btn->state(), btn->isDown(), 1195 btn->colorGroup(), btn->state(), btn->isDown(),
1195 btn->isEnabled()); 1196 btn->isEnabled());
1196 p.end(); 1197 p.end();
1197 } 1198 }
1198 } 1199 }
1199 else if(obj->inherits("QHeader")){ 1200 else if(obj->inherits("QHeader")){
1200 QHeader *hw = (QHeader *)obj; 1201 QHeader *hw = (QHeader *)obj;
1201 if(ev->type() == QEvent::Enter){ 1202 if(ev->type() == QEvent::Enter){
1202 currentHeader = hw; 1203 currentHeader = hw;
1203 headerHoverID = -1; 1204 headerHoverID = -1;
1204 } 1205 }
1205 else if(ev->type() == QEvent::Leave){ 1206 else if(ev->type() == QEvent::Leave){
1206 currentHeader = NULL; 1207 currentHeader = NULL;
1207 if(headerHoverID != -1){ 1208 if(headerHoverID != -1){
1208 hw->repaint(hw->sectionPos(headerHoverID), 0, 1209 hw->repaint(hw->sectionPos(headerHoverID), 0,
1209 hw->sectionSize(headerHoverID), hw->height()); 1210 hw->sectionSize(headerHoverID), hw->height());
1210 } 1211 }
1211 headerHoverID = -1; 1212 headerHoverID = -1;
1212 } 1213 }
1213 else if(ev->type() == QEvent::MouseMove){ 1214 else if(ev->type() == QEvent::MouseMove){
1214 QMouseEvent *me = (QMouseEvent *)ev; 1215 QMouseEvent *me = (QMouseEvent *)ev;
1215 int oldHeader = headerHoverID; 1216 int oldHeader = headerHoverID;
1216 headerHoverID = hw->sectionAt(me->x()); 1217 headerHoverID = hw->sectionAt(me->x());
1217 if(oldHeader != headerHoverID){ 1218 if(oldHeader != headerHoverID){
1218 // reset old header 1219 // reset old header
1219 if(oldHeader != -1){ 1220 if(oldHeader != -1){
1220 hw->repaint(hw->sectionPos(oldHeader), 0, 1221 hw->repaint(hw->sectionPos(oldHeader), 0,
1221 hw->sectionSize(oldHeader), hw->height()); 1222 hw->sectionSize(oldHeader), hw->height());
1222 } 1223 }
1223 if(headerHoverID != -1){ 1224 if(headerHoverID != -1){
1224 hw->repaint(hw->sectionPos(headerHoverID), 0, 1225 hw->repaint(hw->sectionPos(headerHoverID), 0,
1225 hw->sectionSize(headerHoverID), hw->height()); 1226 hw->sectionSize(headerHoverID), hw->height());
1226 } 1227 }
1227 } 1228 }
1228 } 1229 }
1229 } 1230 }
1230 return(false); 1231 return(false);
1231} 1232}
1232 1233
1233void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, 1234void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h,
1234 const QColorGroup &g, bool sunken, 1235 const QColorGroup &g, bool sunken,
1235 const QBrush *) 1236 const QBrush *)
1236{ 1237{
1237 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), 1238 drawRoundButton(p, sunken ? g.background() : g.button(), g.background(),
1238 x, y, w, h); 1239 x, y, w, h);
1239} 1240}
1240 1241
1241void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, 1242void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h,
1242 const QColorGroup &g, bool sunken, 1243 const QColorGroup &g, bool sunken,
1243 const QBrush *) 1244 const QBrush *)
1244{ 1245{
1245 if(p->device()->devType() != QInternal::Widget){ 1246 if(p->device()->devType() != QInternal::Widget){
1246 // drawing into a temp pixmap, don't use mask 1247 // drawing into a temp pixmap, don't use mask
1247 QColor c = sunken ? g.button() : g.background(); 1248 QColor c = sunken ? g.button() : g.background();
1248 p->setPen(c.dark(130)); 1249 p->setPen(c.dark(130));
1249 p->drawRect(x, y, w, h); 1250 p->drawRect(x, y, w, h);
1250 p->setPen(c.light(105)); 1251 p->setPen(c.light(105));
1251 p->drawRect(x+1, y+1, w-2, h-2); 1252 p->drawRect(x+1, y+1, w-2, h-2);
1252 1253
1253 1254
1254 // fill 1255 // fill
1255 QPixmap *pix = bevelFillDict.find(c.rgb()); 1256 QPixmap *pix = bevelFillDict.find(c.rgb());
1256 if(!pix){ 1257 if(!pix){
1257 int h, s, v; 1258 int h, s, v;
1258 c.hsv(&h, &s, &v); 1259 c.hsv(&h, &s, &v);
1259 pix = new QPixmap(*bevelFillPix); 1260 pix = new QPixmap(*bevelFillPix);
1260 adjustHSV(*pix, h, s, v); 1261 adjustHSV(*pix, h, s, v);
1261 bevelFillDict.insert(c.rgb(), pix); 1262 bevelFillDict.insert(c.rgb(), pix);
1262 } 1263 }
1263 1264
1264 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1265 p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1265 } 1266 }
1266 else{ 1267 else{
1267 drawClearBevel(p, x, y, w, h, sunken ? g.button() : 1268 drawClearBevel(p, x, y, w, h, sunken ? g.button() :
1268 highlightWidget == p->device() ? g.button().light(110) : 1269 highlightWidget == p->device() ? g.button().light(110) :
1269 g.background(), g.background()); 1270 g.background(), g.background());
1270 } 1271 }
1271} 1272}
1272 1273
1273void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p) 1274void LiquidStyle::drawPushButton(QPushButton *btn, QPainter *p)
1274{ 1275{
1275 QRect r = btn->rect(); 1276 QRect r = btn->rect();
1276 bool sunken = btn->isOn() || btn->isDown(); 1277 bool sunken = btn->isOn() || btn->isDown();
1277 QColorGroup g = btn->colorGroup(); 1278 QColorGroup g = btn->colorGroup();
1278 1279
1279 1280
1280 //int dw = buttonDefaultIndicatorWidth(); 1281 //int dw = buttonDefaultIndicatorWidth();
1281 if(btn->hasFocus() || btn->isDefault()){ 1282 if(btn->hasFocus() || btn->isDefault()){
1282 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 1283 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
1283 QPixmap *pix = bevelFillDict.find(c.rgb()); 1284 QPixmap *pix = bevelFillDict.find(c.rgb());
1284 if(!pix){ 1285 if(!pix){
1285 int h, s, v; 1286 int h, s, v;
1286 c.hsv(&h, &s, &v); 1287 c.hsv(&h, &s, &v);
1287 pix = new QPixmap(*bevelFillPix); 1288 pix = new QPixmap(*bevelFillPix);
1288 adjustHSV(*pix, h, s, v); 1289 adjustHSV(*pix, h, s, v);
1289 bevelFillDict.insert(c.rgb(), pix); 1290 bevelFillDict.insert(c.rgb(), pix);
1290 } 1291 }
1291 p->setPen(c.dark(150)); 1292 p->setPen(c.dark(150));
1292 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y()); 1293 p->drawLine(r.x()+1, r.y(), r.right()-1, r.y());
1293 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); 1294 p->drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1);
1294 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); 1295 p->drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1);
1295 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); 1296 p->drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom());
1296 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1297 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1297 } 1298 }
1298 1299
1299 QColor newColor = btn == highlightWidget || sunken ? 1300 QColor newColor = btn == highlightWidget || sunken ?
1300 g.button().light(120) : g.button(); 1301 g.button().light(120) : g.button();
1301 1302
1302 drawRoundButton(p, newColor, g.background(), 1303 drawRoundButton(p, newColor, g.background(),
1303 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(), 1304 r.x(), r.y(), r.width(), r.height(), !btn->autoMask(),
1304 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(), 1305 sunken, btn->isDefault() || btn->autoDefault() || btn->hasFocus(),
1305 btn->autoMask()); 1306 btn->autoMask());
1306} 1307}
1307 1308
1308void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p) 1309void LiquidStyle::drawPushButtonLabel(QPushButton *btn, QPainter *p)
1309{ 1310{
1310 int x1, y1, x2, y2, w, h; 1311 int x1, y1, x2, y2, w, h;
1311 btn->rect().coords(&x1, &y1, &x2, &y2); 1312 btn->rect().coords(&x1, &y1, &x2, &y2);
1312 w = btn->width(); 1313 w = btn->width();
1313 h = btn->height(); 1314 h = btn->height();
1314 1315
1315 bool act = btn->isOn() || btn->isDown(); 1316 bool act = btn->isOn() || btn->isDown();
1316 if(act){ 1317 if(act){
1317 ++x1, ++y1; 1318 ++x1, ++y1;
1318 } 1319 }
1319 1320
1320 // Draw iconset first, if any 1321 // Draw iconset first, if any
1321 if ( btn->iconSet() && !btn->iconSet()->isNull() ) 1322 if ( btn->iconSet() && !btn->iconSet()->isNull() )
1322 { 1323 {
1323 QIconSet::Mode mode = btn->isEnabled() 1324 QIconSet::Mode mode = btn->isEnabled()
1324 ? QIconSet::Normal : QIconSet::Disabled; 1325 ? QIconSet::Normal : QIconSet::Disabled;
1325 if ( mode == QIconSet::Normal && btn->hasFocus() ) 1326 if ( mode == QIconSet::Normal && btn->hasFocus() )
1326 mode = QIconSet::Active; 1327 mode = QIconSet::Active;
1327 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode ); 1328 QPixmap pixmap = btn->iconSet()->pixmap( QIconSet::Small, mode );
1328 int pixw = pixmap.width(); 1329 int pixw = pixmap.width();
1329 int pixh = pixmap.height(); 1330 int pixh = pixmap.height();
1330 1331
1331 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap ); 1332 p->drawPixmap( x1+6, y1+h/2-pixh/2, pixmap );
1332 x1 += pixw + 8; 1333 x1 += pixw + 8;
1333 w -= pixw + 8; 1334 w -= pixw + 8;
1334 } 1335 }
1335 1336
1336 if(act){ 1337 if(act){
1337 QFont font = btn->font(); 1338 QFont font = btn->font();
1338 font.setBold(true); 1339 font.setBold(true);
1339 p->setFont(font); 1340 p->setFont(font);
1340 QColor shadow(btn->colorGroup().button().dark(130)); 1341 QColor shadow(btn->colorGroup().button().dark(130));
1341 drawItem( p, x1+1, y1+1, w, h, 1342 drawItem( p, x1+1, y1+1, w, h,
1342 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1343 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1343 btn->pixmap(), btn->text(), -1, 1344 btn->pixmap(), btn->text(), -1,
1344 &shadow); 1345 &shadow);
1345 1346
1346 drawItem( p, x1, y1, w, h, 1347 drawItem( p, x1, y1, w, h,
1347 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1348 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1348 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light()); 1349 btn->pixmap(), btn->text(), -1, &btn->colorGroup().light());
1349 } 1350 }
1350 else{ 1351 else{
1351 /* Too blurry 1352 /* Too blurry
1352 drawItem( p, x1+1, y1+1, w, h, 1353 drawItem( p, x1+1, y1+1, w, h,
1353 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), 1354 AlignCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(),
1354 btn->pixmap(), btn->text(), -1, 1355 btn->pixmap(), btn->text(), -1,
1355 &btn->colorGroup().button().dark(115)); 1356 &btn->colorGroup().button().dark(115));
1356 */ 1357 */
1357 drawItem( p, x1, y1, w, h, 1358 drawItem( p, x1, y1, w, h,
1358 AlignCenter | ShowPrefix, 1359 AlignCenter | ShowPrefix,
1359 btn->colorGroup(), btn->isEnabled(), 1360 btn->colorGroup(), btn->isEnabled(),
1360 btn->pixmap(), btn->text(), -1, 1361 btn->pixmap(), btn->text(), -1,
1361 &btn->colorGroup().buttonText()); 1362 &btn->colorGroup().buttonText());
1362 } 1363 }
1363} 1364}
1364 1365
1365void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h) 1366void LiquidStyle::drawButtonMask(QPainter *p, int x, int y, int w, int h)
1366{ 1367{
1367 int x2 = x+w-1; 1368 int x2 = x+w-1;
1368 int y2 = y+h-1; 1369 int y2 = y+h-1;
1369 1370
1370 p->setPen(Qt::color1); 1371 p->setPen(Qt::color1);
1371 p->fillRect(x, y, w, h, Qt::color0); 1372 p->fillRect(x, y, w, h, Qt::color0);
1372 if(w < 21 || h < 21){ 1373 if(w < 21 || h < 21){
1373 // outer rect 1374 // outer rect
1374 p->drawLine(x, y+2, x, y2-2); // l 1375 p->drawLine(x, y+2, x, y2-2); // l
1375 p->drawLine(x2, y+2, x2, y2-2); // r 1376 p->drawLine(x2, y+2, x2, y2-2); // r
1376 p->drawLine(x+2, y, x2-2, y); // t 1377 p->drawLine(x+2, y, x2-2, y); // t
1377 p->drawLine(x+2, y2, x2-2, y2); // b 1378 p->drawLine(x+2, y2, x2-2, y2); // b
1378 p->drawLine(x+1, y+1, x2-1, y+1); // top second line 1379 p->drawLine(x+1, y+1, x2-1, y+1); // top second line
1379 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line 1380 p->drawLine(x+1, y2-1, x2-1, y2-1); // bottom second line
1380 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1); 1381 p->fillRect(x+1, y+2, w-2, h-4, Qt::color1);
1381 } 1382 }
1382 else{ 1383 else{
1383 int x2 = x+w-1; 1384 int x2 = x+w-1;
1384 int y2 = y+h-1; 1385 int y2 = y+h-1;
1385 int bx2 = htmlBtnMaskBmp.width()-1; 1386 int bx2 = htmlBtnMaskBmp.width()-1;
1386 int by2 = htmlBtnMaskBmp.height()-1; 1387 int by2 = htmlBtnMaskBmp.height()-1;
1387 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl 1388 p->drawPixmap(0, 0, htmlBtnMaskBmp, 0, 0, 10, 10); // tl
1388 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr 1389 p->drawPixmap(x2-9, 0, htmlBtnMaskBmp, bx2-9, 0, 10, 10); // tr
1389 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl 1390 p->drawPixmap(0, y2-9, htmlBtnMaskBmp, 0, by2-9, 10, 10); // bl
1390 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br 1391 p->drawPixmap(x2-9, y2-9, htmlBtnMaskBmp, bx2-9, by2-9, 10, 10); // br
1391 // fills 1392 // fills
1392 p->fillRect(10, 0, w-20, 10, Qt::color1); // top 1393 p->fillRect(10, 0, w-20, 10, Qt::color1); // top
1393 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1394 p->fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1394 p->fillRect(0, 10, w, h-20, Qt::color1); // middle 1395 p->fillRect(0, 10, w, h-20, Qt::color1); // middle
1395 } 1396 }
1396} 1397}
1397 1398
1398void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, 1399void LiquidStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h,
1399 const QColorGroup &g, bool sunken, 1400 const QColorGroup &g, bool sunken,
1400 const QBrush */*fill*/) 1401 const QBrush */*fill*/)
1401{ 1402{
1402 if(currentHeader && p->device() == currentHeader){ 1403 if(currentHeader && p->device() == currentHeader){
1403 int id = currentHeader->sectionAt(x); 1404 int id = currentHeader->sectionAt(x);
1404 bool isHeaderHover = id != -1 && id == headerHoverID; 1405 bool isHeaderHover = id != -1 && id == headerHoverID;
1405 drawClearBevel(p, x, y, w, h, sunken ? 1406 drawClearBevel(p, x, y, w, h, sunken ?
1406 g.button() : isHeaderHover ? g.button().light(110) : 1407 g.button() : isHeaderHover ? g.button().light(110) :
1407 g.background(), g.background()); 1408 g.background(), g.background());
1408 } 1409 }
1409 else 1410 else
1410 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), 1411 drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(),
1411 g.background()); 1412 g.background());
1412} 1413}
1413 1414
1414QRect LiquidStyle::buttonRect(int x, int y, int w, int h) 1415QRect LiquidStyle::buttonRect(int x, int y, int w, int h)
1415{ 1416{
1416 return(QRect(x+5, y+5, w-10, h-10)); 1417 return(QRect(x+5, y+5, w-10, h-10));
1417} 1418}
1418 1419
1419void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h, 1420void LiquidStyle::drawComboButton(QPainter *painter, int x, int y, int w, int h,
1420 const QColorGroup &g, bool sunken, 1421 const QColorGroup &g, bool sunken,
1421 bool edit, bool, const QBrush *) 1422 bool edit, bool, const QBrush *)
1422{ 1423{
1423 bool isHover = highlightWidget == painter->device(); 1424 bool isHover = highlightWidget == painter->device();
1424 bool isMasked = false; 1425 bool isMasked = false;
1425 if(painter->device()->devType() == QInternal::Widget) 1426 if(painter->device()->devType() == QInternal::Widget)
1426 isMasked = ((QWidget*)painter->device())->autoMask(); 1427 isMasked = ((QWidget*)painter->device())->autoMask();
1427 // TODO: Do custom code, don't just call drawRoundButton into a pixmap 1428 // TODO: Do custom code, don't just call drawRoundButton into a pixmap
1428 QPixmap tmpPix(w, h); 1429 QPixmap tmpPix(w, h);
1429 QPainter p(&tmpPix); 1430 QPainter p(&tmpPix);
1430 1431
1431 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false, 1432 drawRoundButton(&p, g.button(), g.background(), 0, 0, w, h, false,
1432 sunken, false, isMasked); 1433 sunken, false, isMasked);
1433 if(!isHover){ 1434 if(!isHover){
1434 p.setClipRect(0, 0, w-17, h); 1435 p.setClipRect(0, 0, w-17, h);
1435 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false, 1436 drawRoundButton(&p, g.background(), g.background(), 0, 0, w, h, false,
1436 sunken, false, isMasked); 1437 sunken, false, isMasked);
1437 } 1438 }
1438 p.end(); 1439 p.end();
1439 int x2 = x+w-1; 1440 int x2 = x+w-1;
1440 int y2 = y+h-1; 1441 int y2 = y+h-1;
1441 int bx2 = btnMaskBmp.width()-1; 1442 int bx2 = btnMaskBmp.width()-1;
1442 int by2 = btnMaskBmp.height()-1; 1443 int by2 = btnMaskBmp.height()-1;
1443 QBitmap btnMask(w, h); 1444 QBitmap btnMask(w, h);
1444 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 1445 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
1445 p.begin(&btnMask); 1446 p.begin(&btnMask);
1446 p.fillRect(0, 0, w, h, Qt::color0); 1447 p.fillRect(0, 0, w, h, Qt::color0);
1447 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 1448 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
1448 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 1449 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr
1449 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl 1450 p.drawPixmap(0, y2-9, *mask, 0, by2-9, 10, 10); // bl
1450 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br 1451 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
1451 // fills 1452 // fills
1452 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 1453 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
1453 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 1454 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
1454 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 1455 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
1455 p.end(); 1456 p.end();
1456 tmpPix.setMask(btnMask); 1457 tmpPix.setMask(btnMask);
1457 1458
1458 painter->drawPixmap(x, y, tmpPix); 1459 painter->drawPixmap(x, y, tmpPix);
1459 1460
1460 painter->setPen(g.button().dark(120)); 1461 painter->setPen(g.button().dark(120));
1461 painter->drawLine(x2-16, y+1, x2-16, y2-1); 1462 painter->drawLine(x2-16, y+1, x2-16, y2-1);
1462 1463
1463 if(edit){ 1464 if(edit){
1464 painter->setPen(g.mid()); 1465 painter->setPen(g.mid());
1465 painter->drawRect(x+8, y+2, w-25, h-4); 1466 painter->drawRect(x+8, y+2, w-25, h-4);
1466 } 1467 }
1467 int arrow_h = h / 3; 1468 int arrow_h = h / 3;
1468 int arrow_w = arrow_h; 1469 int arrow_w = arrow_h;
1469 int arrow_x = w - arrow_w - 6; 1470 int arrow_x = w - arrow_w - 6;
1470 int arrow_y = (h - arrow_h) / 2; 1471 int arrow_y = (h - arrow_h) / 2;
1471 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true); 1472 drawArrow(painter, DownArrow, false, arrow_x, arrow_y, arrow_w, arrow_h, g, true);
1472} 1473}
1473 1474
1474void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h) 1475void LiquidStyle::drawComboButtonMask(QPainter *p, int x, int y, int w, int h)
1475{ 1476{
1476 drawButtonMask(p, x, y, w, h); 1477 drawButtonMask(p, x, y, w, h);
1477} 1478}
1478 1479
1479QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h) 1480QRect LiquidStyle::comboButtonRect(int x, int y, int w, int h)
1480{ 1481{
1481 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6)); 1482 //return(QRect(x+3, y+3, w - (h / 3) - 13, h-6));
1482 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6)); 1483 return(QRect(x+9, y+3, w - (h / 3) - 20, h-6));
1483} 1484}
1484 1485
1485QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h) 1486QRect LiquidStyle::comboButtonFocusRect(int x, int y, int w, int h)
1486{ 1487{
1487 return(QRect(x+5, y+3, w-(h/3)-13, h-5)); 1488 return(QRect(x+5, y+3, w-(h/3)-13, h-5));
1488} 1489}
1489 1490
1490void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb, 1491void LiquidStyle::drawScrollBarControls(QPainter *p, const QScrollBar *sb,
1491 int sliderStart, uint controls, 1492 int sliderStart, uint controls,
1492 uint activeControl) 1493 uint activeControl)
1493{ 1494{
1494 bool isHover = highlightWidget == p->device(); 1495 bool isHover = highlightWidget == p->device();
1495 int sliderMin, sliderMax, sliderLength, buttonDim; 1496 int sliderMin, sliderMax, sliderLength, buttonDim;
1496 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1497 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1497 1498
1498 if (sliderStart > sliderMax) 1499 if (sliderStart > sliderMax)
1499 sliderStart = sliderMax; 1500 sliderStart = sliderMax;
1500 1501
1501 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1502 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1502 QColorGroup g = sb->colorGroup(); 1503 QColorGroup g = sb->colorGroup();
1503 QRect addB, subHC, subB; 1504 QRect addB, subHC, subB;
1504 QRect addPageR, subPageR, sliderR; 1505 QRect addPageR, subPageR, sliderR;
1505 int addX, addY, subX, subY; 1506 int addX, addY, subX, subY;
1506 int len = horiz ? sb->width() : sb->height(); 1507 int len = horiz ? sb->width() : sb->height();
1507 int extent = horiz ? sb->height() : sb->width(); 1508 int extent = horiz ? sb->height() : sb->width();
1508 1509
1509 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar 1510 // a few apps (ie: KSpread), are broken and use a hardcoded scrollbar
1510 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now. 1511 // extent of 16. Luckily, most apps (ie: Kate), seem fixed by now.
1511 bool brokenApp; 1512 bool brokenApp;
1512 if(extent == 16) 1513 if(extent == 16)
1513 brokenApp = true; 1514 brokenApp = true;
1514 else 1515 else
1515 brokenApp = false; 1516 brokenApp = false;
1516 1517
1517 if (horiz) { 1518 if (horiz) {
1518 subY = addY = ( extent - buttonDim ) / 2; 1519 subY = addY = ( extent - buttonDim ) / 2;
1519 subX = 0; 1520 subX = 0;
1520 addX = len - buttonDim; 1521 addX = len - buttonDim;
1521 if(sbBuffer.size() != sb->size()) 1522 if(sbBuffer.size() != sb->size())
1522 sbBuffer.resize(sb->size()); 1523 sbBuffer.resize(sb->size());
1523 } 1524 }
1524 else { 1525 else {
1525 subX = addX = ( extent - buttonDim ) / 2; 1526 subX = addX = ( extent - buttonDim ) / 2;
1526 subY = 0; 1527 subY = 0;
1527 addY = len - buttonDim; 1528 addY = len - buttonDim;
1528 if(sbBuffer.size() != sb->size()) 1529 if(sbBuffer.size() != sb->size())
1529 sbBuffer.resize(sb->size()); 1530 sbBuffer.resize(sb->size());
1530 } 1531 }
1531 subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); 1532 subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
1532 addB.setRect( addX,addY,buttonDim,buttonDim ); 1533 addB.setRect( addX,addY,buttonDim,buttonDim );
1533 if(horiz) 1534 if(horiz)
1534 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); 1535 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
1535 else 1536 else
1536 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim ); 1537 subHC.setRect(addX,addY-buttonDim,buttonDim,buttonDim );
1537 1538
1538 int sliderEnd = sliderStart + sliderLength; 1539 int sliderEnd = sliderStart + sliderLength;
1539 int sliderW = extent; 1540 int sliderW = extent;
1540 1541
1541 if (horiz) { 1542 if (horiz) {
1542 subPageR.setRect( subB.right() + 1, 0, 1543 subPageR.setRect( subB.right() + 1, 0,
1543 sliderStart - subB.right() - 1 , sliderW ); 1544 sliderStart - subB.right() - 1 , sliderW );
1544 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW ); 1545 addPageR.setRect( sliderEnd, 0, addX - sliderEnd - buttonDim, sliderW );
1545 sliderR .setRect( sliderStart, 0, sliderLength, sliderW ); 1546 sliderR .setRect( sliderStart, 0, sliderLength, sliderW );
1546 } 1547 }
1547 else { 1548 else {
1548 subPageR.setRect( 0, subB.bottom() + 1, sliderW, 1549 subPageR.setRect( 0, subB.bottom() + 1, sliderW,
1549 sliderStart - subB.bottom() - 1 ); 1550 sliderStart - subB.bottom() - 1 );
1550 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd); 1551 addPageR.setRect( 0, sliderEnd, sliderW, addY - buttonDim - sliderEnd);
1551 sliderR .setRect( 0, sliderStart, sliderW, sliderLength ); 1552 sliderR .setRect( 0, sliderStart, sliderW, sliderLength );
1552 } 1553 }
1553 1554
1554 bool maxed = sb->maxValue() == sb->minValue(); 1555 bool maxed = sb->maxValue() == sb->minValue();
1555 1556
1556 QPainter painter; 1557 QPainter painter;
1557 if(!horiz){ 1558 if(!horiz){
1558 painter.begin(&sbBuffer); 1559 painter.begin(&sbBuffer);
1559 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); 1560 QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
1560 if(sliderR.height() >= 8){ 1561 if(sliderR.height() >= 8){
1561 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, 1562 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
1562 13, 8); 1563 13, 8);
1563 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg)); 1564 painter.drawPixmap(bgR.x()+1, bgR.y(), *getPixmap(VSBSliderTopBg));
1564 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13, 1565 painter.drawTiledPixmap(bgR.x()+1, bgR.y()+8, 13,
1565 bgR.height()-16, *getPixmap(VSBSliderMidBg)); 1566 bgR.height()-16, *getPixmap(VSBSliderMidBg));
1566 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix, 1567 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *vsbSliderFillPix,
1567 0, 0, 13, 8); 1568 0, 0, 13, 8);
1568 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg)); 1569 painter.drawPixmap(bgR.x()+1, bgR.bottom()-8, *getPixmap(VSBSliderBtmBg));
1569 } 1570 }
1570 else{ 1571 else{
1571 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(), 1572 painter.drawTiledPixmap(bgR.x()+1, bgR.y(), 13, bgR.height(),
1572 *getPixmap(VSBSliderMidBg)); 1573 *getPixmap(VSBSliderMidBg));
1573 painter.setPen(g.background().dark(210)); 1574 painter.setPen(g.background().dark(210));
1574 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1); 1575 painter.drawRect(bgR.x()+1, bgR.y(), 13, bgR.height()-1);
1575 painter.setPen(g.mid()); 1576 painter.setPen(g.mid());
1576 painter.drawPoint(bgR.x()+1, bgR.y()); 1577 painter.drawPoint(bgR.x()+1, bgR.y());
1577 painter.drawPoint(bgR.x()+13, bgR.y()); 1578 painter.drawPoint(bgR.x()+13, bgR.y());
1578 painter.drawPoint(bgR.x()+1, bgR.bottom()-1); 1579 painter.drawPoint(bgR.x()+1, bgR.bottom()-1);
1579 painter.drawPoint(bgR.x()+13, bgR.bottom()-1); 1580 painter.drawPoint(bgR.x()+13, bgR.bottom()-1);
1580 } 1581 }
1581 if(controls & Slider){ 1582 if(controls & Slider){
1582 if(sliderR.height() >= 16){ 1583 if(sliderR.height() >= 16){
1583 painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1584 painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1584 isHover ? *getPixmap(VSBSliderTopHover): 1585 isHover ? *getPixmap(VSBSliderTopHover):
1585 *getPixmap(VSBSliderTop)); 1586 *getPixmap(VSBSliderTop));
1586 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13, 1587 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+8, 13,
1587 sliderR.height()-16, isHover ? 1588 sliderR.height()-16, isHover ?
1588 *getPixmap(VSBSliderMidHover) : 1589 *getPixmap(VSBSliderMidHover) :
1589 *getPixmap(VSBSliderMid)); 1590 *getPixmap(VSBSliderMid));
1590 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8, 1591 painter.drawPixmap(sliderR.x()+1, sliderR.bottom()-8,
1591 isHover ? *getPixmap(VSBSliderBtmHover) : 1592 isHover ? *getPixmap(VSBSliderBtmHover) :
1592 *getPixmap(VSBSliderBtm)); 1593 *getPixmap(VSBSliderBtm));
1593 } 1594 }
1594 else if(sliderR.height() >= 8){ 1595 else if(sliderR.height() >= 8){
1595 int m = sliderR.height()/2; 1596 int m = sliderR.height()/2;
1596 painter.drawPixmap(sliderR.x()+1, sliderR.y(), 1597 painter.drawPixmap(sliderR.x()+1, sliderR.y(),
1597 isHover ? *getPixmap(VSBSliderTopHover): 1598 isHover ? *getPixmap(VSBSliderTopHover):
1598 *getPixmap(VSBSliderTop), 0, 0, 13, m); 1599 *getPixmap(VSBSliderTop), 0, 0, 13, m);
1599 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m, 1600 painter.drawPixmap(sliderR.x()+1, sliderR.y()+m,
1600 isHover ? *getPixmap(VSBSliderBtmHover): 1601 isHover ? *getPixmap(VSBSliderBtmHover):
1601 *getPixmap(VSBSliderBtm), 0, 8-m, 13, m); 1602 *getPixmap(VSBSliderBtm), 0, 8-m, 13, m);
1602 } 1603 }
1603 else{ 1604 else{
1604 painter.setPen(g.button().dark(210)); 1605 painter.setPen(g.button().dark(210));
1605 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(), 1606 drawRoundRect(&painter, sliderR.x()+1, sliderR.y(),
1606 13, sliderR.height()); 1607 13, sliderR.height());
1607 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1, 1608 painter.drawTiledPixmap(sliderR.x()+2, sliderR.y()+1,
1608 11, sliderR.height()-2, 1609 11, sliderR.height()-2,
1609 isHover ? *getPixmap(VSBSliderMidHover) : 1610 isHover ? *getPixmap(VSBSliderMidHover) :
1610 *getPixmap(VSBSliderMid), 1, 0); 1611 *getPixmap(VSBSliderMid), 1, 0);
1611 } 1612 }
1612 } 1613 }
1613 painter.setPen(g.mid()); 1614 painter.setPen(g.mid());
1614 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom()); 1615 painter.drawLine(bgR.x(), bgR.y(), bgR.x(), bgR.bottom());
1615 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom()); 1616 painter.drawLine(bgR.right(), bgR.y(), bgR.right(), bgR.bottom());
1616 if(brokenApp && (controls & Slider)){ 1617 if(brokenApp && (controls & Slider)){
1617 painter.setPen(g.background()); 1618 painter.setPen(g.background());
1618 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1, 1619 painter.drawLine(bgR.right()-1, bgR.y(), bgR.right()-1,
1619 bgR.bottom()); 1620 bgR.bottom());
1620 } 1621 }
1621 painter.end(); 1622 painter.end();
1622 } 1623 }
1623 else{ 1624 else{
1624 painter.begin(&sbBuffer); 1625 painter.begin(&sbBuffer);
1625 QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); 1626 QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
1626 if(sliderR.width() >= 8){ 1627 if(sliderR.width() >= 8){
1627 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, 1628 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
1628 8, 13); 1629 8, 13);
1629 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg)); 1630 painter.drawPixmap(bgR.x(), bgR.y()+1, *getPixmap(HSBSliderTopBg));
1630 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16, 1631 painter.drawTiledPixmap(bgR.x()+8, bgR.y()+1, bgR.width()-16,
1631 13, *getPixmap(HSBSliderMidBg)); 1632 13, *getPixmap(HSBSliderMidBg));
1632 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix, 1633 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *vsbSliderFillPix,
1633 0, 0, 8, 13); 1634 0, 0, 8, 13);
1634 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg)); 1635 painter.drawPixmap(bgR.right()-8, bgR.y()+1, *getPixmap(HSBSliderBtmBg));
1635 } 1636 }
1636 else{ 1637 else{
1637 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13, 1638 painter.drawTiledPixmap(bgR.x(), bgR.y()+1, bgR.width(), 13,
1638 *getPixmap(HSBSliderMidBg)); 1639 *getPixmap(HSBSliderMidBg));
1639 painter.setPen(g.background().dark(210)); 1640 painter.setPen(g.background().dark(210));
1640 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13); 1641 painter.drawRect(bgR.x(), bgR.y()+1, bgR.width()-1, 13);
1641 painter.setPen(g.mid()); 1642 painter.setPen(g.mid());
1642 painter.drawPoint(bgR.x(), bgR.y()+1); 1643 painter.drawPoint(bgR.x(), bgR.y()+1);
1643 painter.drawPoint(bgR.x(), bgR.bottom()-1); 1644 painter.drawPoint(bgR.x(), bgR.bottom()-1);
1644 painter.drawPoint(bgR.right()-1, bgR.y()+1); 1645 painter.drawPoint(bgR.right()-1, bgR.y()+1);
1645 painter.drawPoint(bgR.right()-1, bgR.bottom()-1); 1646 painter.drawPoint(bgR.right()-1, bgR.bottom()-1);
1646 } 1647 }
1647 if(controls & Slider){ 1648 if(controls & Slider){
1648 if(sliderR.width() >= 16){ 1649 if(sliderR.width() >= 16){
1649 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1650 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1650 isHover ? *getPixmap(HSBSliderTopHover) : 1651 isHover ? *getPixmap(HSBSliderTopHover) :
1651 *getPixmap(HSBSliderTop)); 1652 *getPixmap(HSBSliderTop));
1652 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16, 1653 painter.drawTiledPixmap(sliderR.x()+8, sliderR.y()+1, sliderR.width()-16,
1653 13, isHover ? *getPixmap(HSBSliderMidHover) : 1654 13, isHover ? *getPixmap(HSBSliderMidHover) :
1654 *getPixmap(HSBSliderMid)); 1655 *getPixmap(HSBSliderMid));
1655 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1656 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1656 *getPixmap(HSBSliderBtmHover) : 1657 *getPixmap(HSBSliderBtmHover) :
1657 *getPixmap(HSBSliderBtm)); 1658 *getPixmap(HSBSliderBtm));
1658 } 1659 }
1659 else if(sliderR.width() >= 8){ 1660 else if(sliderR.width() >= 8){
1660 int m = sliderR.width()/2; 1661 int m = sliderR.width()/2;
1661 painter.drawPixmap(sliderR.x(), sliderR.y()+1, 1662 painter.drawPixmap(sliderR.x(), sliderR.y()+1,
1662 isHover ? *getPixmap(HSBSliderTopHover) : 1663 isHover ? *getPixmap(HSBSliderTopHover) :
1663 *getPixmap(HSBSliderTop), 0, 0, m, 13); 1664 *getPixmap(HSBSliderTop), 0, 0, m, 13);
1664 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ? 1665 painter.drawPixmap(sliderR.right()-8, sliderR.y()+1, isHover ?
1665 *getPixmap(HSBSliderBtmHover) : 1666 *getPixmap(HSBSliderBtmHover) :
1666 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13); 1667 *getPixmap(HSBSliderBtm), 8-m, 0, m, 13);
1667 } 1668 }
1668 else{ 1669 else{
1669 painter.setPen(g.button().dark(210)); 1670 painter.setPen(g.button().dark(210));
1670 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1, 1671 drawRoundRect(&painter, sliderR.x(), sliderR.y()+1,
1671 sliderR.width(), 13); 1672 sliderR.width(), 13);
1672 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2, 1673 painter.drawTiledPixmap(sliderR.x()+1, sliderR.y()+2,
1673 sliderR.width()-2, 11, isHover ? 1674 sliderR.width()-2, 11, isHover ?
1674 *getPixmap(HSBSliderMidHover) : 1675 *getPixmap(HSBSliderMidHover) :
1675 *getPixmap(HSBSliderMid), 0, 1); 1676 *getPixmap(HSBSliderMid), 0, 1);
1676 } 1677 }
1677 } 1678 }
1678 painter.setPen(g.mid()); 1679 painter.setPen(g.mid());
1679 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y()); 1680 painter.drawLine(bgR.x(), bgR.y(), bgR.right(), bgR.y());
1680 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom()); 1681 painter.drawLine(bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom());
1681 if(brokenApp && (controls & Slider)){ 1682 if(brokenApp && (controls & Slider)){
1682 painter.setPen(g.background()); 1683 painter.setPen(g.background());
1683 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(), 1684 painter.drawLine(bgR.x(), bgR.bottom()-1, bgR.right(),
1684 bgR.bottom()-1); 1685 bgR.bottom()-1);
1685 } 1686 }
1686 painter.end(); 1687 painter.end();
1687 } 1688 }
1688 1689
1689 if ( controls & AddLine ) { 1690 if ( controls & AddLine ) {
1690 drawSBButton(p, addB, g, activeControl == AddLine); 1691 drawSBButton(p, addB, g, activeControl == AddLine);
1691 drawArrow( p, horiz ? RightArrow : DownArrow, 1692 drawArrow( p, horiz ? RightArrow : DownArrow,
1692 false, addB.x()+4, addB.y()+4, 1693 false, addB.x()+4, addB.y()+4,
1693 addB.width()-8, addB.height()-8, g, !maxed); 1694 addB.width()-8, addB.height()-8, g, !maxed);
1694 } 1695 }
1695 if ( controls & SubLine ) { 1696 if ( controls & SubLine ) {
1696 // drawSBButton(p, subB, g, activeControl == SubLine); 1697 // drawSBButton(p, subB, g, activeControl == SubLine);
1697 // drawArrow( p, horiz ? LeftArrow : UpArrow, 1698 // drawArrow( p, horiz ? LeftArrow : UpArrow,
1698 // false, subB.x()+4, subB.y()+4, 1699 // false, subB.x()+4, subB.y()+4,
1699 // subB.width()-8, subB.height()-8, g, !maxed); 1700 // subB.width()-8, subB.height()-8, g, !maxed);
1700 drawSBButton(p, subHC, g, activeControl == SubLine); 1701 drawSBButton(p, subHC, g, activeControl == SubLine);
1701 drawArrow( p, horiz ? LeftArrow : UpArrow, 1702 drawArrow( p, horiz ? LeftArrow : UpArrow,
1702 false, subHC.x()+4, subHC.y()+4, 1703 false, subHC.x()+4, subHC.y()+4,
1703 subHC.width()-8, subHC.height()-8, g, !maxed); 1704 subHC.width()-8, subHC.height()-8, g, !maxed);
1704 } 1705 }
1705 1706
1706 if(controls & AddPage){ 1707 if(controls & AddPage){
1707 if(addPageR.width()){ 1708 if(addPageR.width()){
1708 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer, 1709 p->drawPixmap(addPageR.x(), addPageR.y(), sbBuffer,
1709 addPageR.x(), addPageR.y(), addPageR.width(), 1710 addPageR.x(), addPageR.y(), addPageR.width(),
1710 addPageR.height()); 1711 addPageR.height());
1711 } 1712 }
1712 } 1713 }
1713 if(controls & SubPage){ 1714 if(controls & SubPage){
1714 if(subPageR.height()){ 1715 if(subPageR.height()){
1715 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer, 1716 p->drawPixmap(subPageR.x(), subPageR.y(), sbBuffer,
1716 subPageR.x(), subPageR.y(), subPageR.width(), 1717 subPageR.x(), subPageR.y(), subPageR.width(),
1717 subPageR.height()); 1718 subPageR.height());
1718 } 1719 }
1719 } 1720 }
1720 if ( controls & Slider ) { 1721 if ( controls & Slider ) {
1721 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer, 1722 p->drawPixmap(sliderR.x(), sliderR.y(), sbBuffer,
1722 sliderR.x(), sliderR.y(), sliderR.width(), 1723 sliderR.x(), sliderR.y(), sliderR.width(),
1723 sliderR.height()); 1724 sliderR.height());
1724 } 1725 }
1725} 1726}
1726 1727
1727void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, 1728void LiquidStyle::drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
1728 bool down, bool /*fast*/) 1729 bool down, bool /*fast*/)
1729{ 1730{
1730 p->setPen(g.mid()); 1731 p->setPen(g.mid());
1731 p->drawRect(r); 1732 p->drawRect(r);
1732 QColor c(down ? g.button() : g.background()); 1733 QColor c(down ? g.button() : g.background());
1733 QPixmap *pix = bevelFillDict.find(c.rgb()); 1734 QPixmap *pix = bevelFillDict.find(c.rgb());
1734 if(!pix){ 1735 if(!pix){
1735 int h, s, v; 1736 int h, s, v;
1736 c.hsv(&h, &s, &v); 1737 c.hsv(&h, &s, &v);
1737 pix = new QPixmap(*bevelFillPix); 1738 pix = new QPixmap(*bevelFillPix);
1738 adjustHSV(*pix, h, s, v); 1739 adjustHSV(*pix, h, s, v);
1739 bevelFillDict.insert(c.rgb(), pix); 1740 bevelFillDict.insert(c.rgb(), pix);
1740 } 1741 }
1741 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix); 1742 p->drawTiledPixmap(r.x()+1, r.y()+1, r.width()-2, r.height()-2, *pix);
1742 1743
1743} 1744}
1744 1745
1745void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, 1746void LiquidStyle::drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g,
1746 bool horiz) 1747 bool horiz)
1747{ 1748{
1748 if(horiz){ 1749 if(horiz){
1749 if(r.width() >= 15){ 1750 if(r.width() >= 15){
1750 int y = r.y()+3; 1751 int y = r.y()+3;
1751 int x = r.x() + (r.width()-7)/2; 1752 int x = r.x() + (r.width()-7)/2;
1752 int y2 = r.bottom()-3; 1753 int y2 = r.bottom()-3;
1753 p->setPen(g.light()); 1754 p->setPen(g.light());
1754 p->drawLine(x, y, x, y2); 1755 p->drawLine(x, y, x, y2);
1755 p->drawLine(x+3, y, x+3, y2); 1756 p->drawLine(x+3, y, x+3, y2);
1756 p->drawLine(x+6, y, x+6, y2); 1757 p->drawLine(x+6, y, x+6, y2);
1757 1758
1758 p->setPen(g.mid()); 1759 p->setPen(g.mid());
1759 p->drawLine(x+1, y, x+1, y2); 1760 p->drawLine(x+1, y, x+1, y2);
1760 p->drawLine(x+4, y, x+4, y2); 1761 p->drawLine(x+4, y, x+4, y2);
1761 p->drawLine(x+7, y, x+7, y2); 1762 p->drawLine(x+7, y, x+7, y2);
1762 } 1763 }
1763 } 1764 }
1764 else{ 1765 else{
1765 if(r.height() >= 15){ 1766 if(r.height() >= 15){
1766 int x = r.x()+3; 1767 int x = r.x()+3;
1767 int y = r.y() + (r.height()-7)/2; 1768 int y = r.y() + (r.height()-7)/2;
1768 int x2 = r.right()-3; 1769 int x2 = r.right()-3;
1769 p->setPen(g.light()); 1770 p->setPen(g.light());
1770 p->drawLine(x, y, x2, y); 1771 p->drawLine(x, y, x2, y);
1771 p->drawLine(x, y+3, x2, y+3); 1772 p->drawLine(x, y+3, x2, y+3);
1772 p->drawLine(x, y+6, x2, y+6); 1773 p->drawLine(x, y+6, x2, y+6);
1773 1774
1774 p->setPen(g.mid()); 1775 p->setPen(g.mid());
1775 p->drawLine(x, y+1, x2, y+1); 1776 p->drawLine(x, y+1, x2, y+1);
1776 p->drawLine(x, y+4, x2, y+4); 1777 p->drawLine(x, y+4, x2, y+4);
1777 p->drawLine(x, y+7, x2, y+7); 1778 p->drawLine(x, y+7, x2, y+7);
1778 } 1779 }
1779 } 1780 }
1780 1781
1781} 1782}
1782 1783
1783 1784
1784void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin, 1785void LiquidStyle::scrollBarMetrics(const QScrollBar *sb, int &sliderMin,
1785 int &sliderMax, int &sliderLength, 1786 int &sliderMax, int &sliderLength,
1786 int &buttonDim) 1787 int &buttonDim)
1787{ 1788{
1788 1789
1789 int maxLength; 1790 int maxLength;
1790 int b = 0; 1791 int b = 0;
1791 bool horiz = sb->orientation() == QScrollBar::Horizontal; 1792 bool horiz = sb->orientation() == QScrollBar::Horizontal;
1792 int length = horiz ? sb->width() : sb->height(); 1793 int length = horiz ? sb->width() : sb->height();
1793 int extent = horiz ? sb->height() : sb->width(); 1794 int extent = horiz ? sb->height() : sb->width();
1794 1795
1795 if ( length > ( extent - b*2 - 1 )*2 + b*2 ) 1796 if ( length > ( extent - b*2 - 1 )*2 + b*2 )
1796 buttonDim = extent - b*2; 1797 buttonDim = extent - b*2;
1797 else 1798 else
1798 buttonDim = ( length - b*2 )/2 - 1; 1799 buttonDim = ( length - b*2 )/2 - 1;
1799 1800
1800 sliderMin = b + 0; // buttonDim; 1801 sliderMin = b + 0; // buttonDim;
1801 maxLength = length - b*2 - buttonDim*2; // 3; 1802 maxLength = length - b*2 - buttonDim*2; // 3;
1802 1803
1803 if ( sb->maxValue() == sb->minValue() ) { 1804 if ( sb->maxValue() == sb->minValue() ) {
1804 sliderLength = maxLength; 1805 sliderLength = maxLength;
1805 } else { 1806 } else {
1806 sliderLength = (sb->pageStep()*maxLength)/ 1807 sliderLength = (sb->pageStep()*maxLength)/
1807 (sb->maxValue()-sb->minValue()+sb->pageStep()); 1808 (sb->maxValue()-sb->minValue()+sb->pageStep());
1808 uint range = sb->maxValue()-sb->minValue(); 1809 uint range = sb->maxValue()-sb->minValue();
1809 if ( sliderLength < 9 || range > INT_MAX/2 ) 1810 if ( sliderLength < 9 || range > INT_MAX/2 )
1810 sliderLength = 9; 1811 sliderLength = 9;
1811 if ( sliderLength > maxLength ) 1812 if ( sliderLength > maxLength )
1812 sliderLength = maxLength; 1813 sliderLength = maxLength;
1813 } 1814 }
1814 sliderMax = sliderMin + maxLength - sliderLength; 1815 sliderMax = sliderMin + maxLength - sliderLength;
1815 1816
1816} 1817}
1817 1818
1818QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb, 1819QStyle::ScrollControl LiquidStyle::scrollBarPointOver(const QScrollBar *sb,
1819 int sliderStart, 1820 int sliderStart,
1820 const QPoint &p) 1821 const QPoint &p)
1821{ 1822{
1822 if ( !sb->rect().contains( p ) ) 1823 if ( !sb->rect().contains( p ) )
1823 return NoScroll; 1824 return NoScroll;
1824 int sliderMin, sliderMax, sliderLength, buttonDim, pos; 1825 int sliderMin, sliderMax, sliderLength, buttonDim, pos;
1825 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 1826 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
1826 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y(); 1827 pos = (sb->orientation() == QScrollBar::Horizontal)? p.x() : p.y();
1827 if ( pos < sliderMin ) 1828 if ( pos < sliderMin )
1828 return SubLine; 1829 return SubLine;
1829 if ( pos < sliderStart ) 1830 if ( pos < sliderStart )
1830 return SubPage; 1831 return SubPage;
1831 if ( pos < sliderStart + sliderLength ) 1832 if ( pos < sliderStart + sliderLength )
1832 return Slider; 1833 return Slider;
1833 if ( pos < sliderMax + sliderLength) 1834 if ( pos < sliderMax + sliderLength)
1834 return AddPage; 1835 return AddPage;
1835 if(pos > sliderMax + sliderLength + 16) 1836 if(pos > sliderMax + sliderLength + 16)
1836 return AddLine; 1837 return AddLine;
1837 1838
1838 return SubLine; 1839 return SubLine;
1839} 1840}
1840 1841
1841#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1842#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1842 1843
1843 1844
1844QSize LiquidStyle::exclusiveIndicatorSize() const 1845QSize LiquidStyle::exclusiveIndicatorSize() const
1845{ 1846{
1846 return(QSize(16, 16)); 1847 return(QSize(16, 16));
1847} 1848}
1848 1849
1849void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, 1850void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
1850 int /*h*/, const QColorGroup &/*g*/, bool on, 1851 int /*h*/, const QColorGroup &/*g*/, bool on,
1851 bool down, bool) 1852 bool down, bool)
1852{ 1853{
1853 bool isHover = highlightWidget == p->device(); 1854 bool isHover = highlightWidget == p->device();
1854 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1855 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1855 && ((QWidget*)p->device())->autoMask(); 1856 && ((QWidget*)p->device())->autoMask();
1856 1857
1857 if(isMasked){ 1858 if(isMasked){
1858 if(on || down){ 1859 if(on || down){
1859 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : 1860 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) :
1860 *getPixmap(HTMLRadioDown)); 1861 *getPixmap(HTMLRadioDown));
1861 } 1862 }
1862 else 1863 else
1863 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : 1864 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) :
1864 *getPixmap(HTMLRadio)); 1865 *getPixmap(HTMLRadio));
1865 1866
1866 } 1867 }
1867 else{ 1868 else{
1868 if(on || down){ 1869 if(on || down){
1869 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : 1870 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) :
1870 *getPixmap(RadioOn)); 1871 *getPixmap(RadioOn));
1871 } 1872 }
1872 else 1873 else
1873 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : 1874 p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) :
1874 *getPixmap(RadioOff)); 1875 *getPixmap(RadioOff));
1875 } 1876 }
1876} 1877}
1877 1878
1878void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, 1879void LiquidStyle::drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w,
1879 int h, bool) 1880 int h, bool)
1880{ 1881{
1881 p->fillRect(x, y, w, h, Qt::color0); 1882 p->fillRect(x, y, w, h, Qt::color0);
1882 p->setPen(Qt::color1); 1883 p->setPen(Qt::color1);
1883 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask()); 1884 p->drawPixmap(x, y, *getPixmap(RadioOn)->mask());
1884} 1885}
1885 1886
1886 1887
1887QSize LiquidStyle::indicatorSize() const 1888QSize LiquidStyle::indicatorSize() const
1888{ 1889{
1889 return(QSize(20, 22)); 1890 return(QSize(20, 22));
1890} 1891}
1891 1892
1892void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1893void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1893 const QColorGroup &/*g*/, int state, bool /*down*/, bool) 1894 const QColorGroup &/*g*/, int state, bool /*down*/, bool)
1894{ 1895{
1895 bool isHover = highlightWidget == p->device(); 1896 bool isHover = highlightWidget == p->device();
1896 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 1897 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
1897 && ((QWidget*)p->device())->autoMask(); 1898 && ((QWidget*)p->device())->autoMask();
1898 if(isMasked){ 1899 if(isMasked){
1899 if(state != QButton::Off){ 1900 if(state != QButton::Off){
1900 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : 1901 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) :
1901 *getPixmap(HTMLCBDown)); 1902 *getPixmap(HTMLCBDown));
1902 } 1903 }
1903 else 1904 else
1904 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : 1905 p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) :
1905 *getPixmap(HTMLCB)); 1906 *getPixmap(HTMLCB));
1906 1907
1907 } 1908 }
1908 else{ 1909 else{
1909 if(state != QButton::Off){ 1910 if(state != QButton::Off){
1910 p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : 1911 p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) :
1911 *getPixmap(CBDown)); 1912 *getPixmap(CBDown));
1912 /* Todo - tristate 1913 /* Todo - tristate
1913 if(state == QButton::On){ 1914 if(state == QButton::On){
1914 p->setPen(Qt::black); 1915 p->setPen(Qt::black);
1915 p->drawPixmap(3, 3, xBmp); 1916 p->drawPixmap(3, 3, xBmp);
1916 } 1917 }
1917 else{ 1918 else{
1918 p->setPen(g.dark()); 1919 p->setPen(g.dark());
1919 p->drawRect(x+2, y+2, w-4, h-4); 1920 p->drawRect(x+2, y+2, w-4, h-4);
1920 p->setPen(Qt::black); 1921 p->setPen(Qt::black);
1921 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); 1922 p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2);
1922 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); 1923 p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2);
1923 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); 1924 p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2);
1924 }*/ 1925 }*/
1925 } 1926 }
1926 else 1927 else
1927 p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); 1928 p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB));
1928 } 1929 }
1929} 1930}
1930 1931
1931void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1932void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1932 int /*state*/) 1933 int /*state*/)
1933{ 1934{
1934 // needed for some reason by KHtml, even tho it's all filled ;P 1935 // needed for some reason by KHtml, even tho it's all filled ;P
1935 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 1936 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
1936 1937
1937} 1938}
1938 1939
1939void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 1940void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
1940 const QColorGroup &/*g*/, Orientation orient, 1941 const QColorGroup &/*g*/, Orientation orient,
1941 bool, bool) 1942 bool, bool)
1942{ 1943{
1943 QWidget *parent = (QWidget *)p->device(); 1944 QWidget *parent = (QWidget *)p->device();
1944 p->setBrushOrigin(parent->pos()); 1945 p->setBrushOrigin(parent->pos());
1945 parent->erase(x, y, w, h); 1946 parent->erase(x, y, w, h);
1946 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 1947 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
1947 *getPixmap(VSlider)); 1948 *getPixmap(VSlider));
1948} 1949}
1949 1950
1950void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 1951void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
1951 Orientation orient, bool, bool) 1952 Orientation orient, bool, bool)
1952{ 1953{
1953 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 1954 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
1954 *getPixmap(VSlider)->mask()); 1955 *getPixmap(VSlider)->mask());
1955} 1956}
1956 1957
1957int LiquidStyle::sliderLength() const 1958int LiquidStyle::sliderLength() const
1958{ 1959{
1959 return(10); 1960 return(10);
1960} 1961}
1961 1962
1962#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) 1963#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
1963 1964
1964void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, 1965void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x,
1965 int y, int w, int h, const QColorGroup &g, 1966 int y, int w, int h, const QColorGroup &g,
1966 bool enabled, const QBrush *) 1967 bool enabled, const QBrush *)
1967{ 1968{
1968 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}; 1969 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};
1969 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}; 1970 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};
1970 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}; 1971 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};
1971 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}; 1972 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};
1972 1973
1973 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); 1974 p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid());
1974 if(w > 8){ 1975 if(w > 8){
1975 x = x + (w-8)/2; 1976 x = x + (w-8)/2;
1976 y = y + (h-8)/2; 1977 y = y + (h-8)/2;
1977 } 1978 }
1978 1979
1979 QPointArray a; 1980 QPointArray a;
1980 switch(type){ 1981 switch(type){
1981 case Qt::UpArrow: 1982 case Qt::UpArrow:
1982 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); 1983 a.setPoints(QCOORDARRLEN(u_arrow), u_arrow);
1983 break; 1984 break;
1984 case Qt::DownArrow: 1985 case Qt::DownArrow:
1985 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); 1986 a.setPoints(QCOORDARRLEN(d_arrow), d_arrow);
1986 break; 1987 break;
1987 case Qt::LeftArrow: 1988 case Qt::LeftArrow:
1988 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); 1989 a.setPoints(QCOORDARRLEN(l_arrow), l_arrow);
1989 break; 1990 break;
1990 default: 1991 default:
1991 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); 1992 a.setPoints(QCOORDARRLEN(r_arrow), r_arrow);
1992 break; 1993 break;
1993 } 1994 }
1994 1995
1995 a.translate(x, y); 1996 a.translate(x, y);
1996 p->drawLineSegments(a); 1997 p->drawLineSegments(a);
1997} 1998}
1998 1999
1999 2000
2000void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 2001void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
2001 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 2002 QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
2002 { 2003 {
2003 if(active){ 2004 if(active){
2004 x -= 2; // Bug in Qt/E 2005 x -= 2; // Bug in Qt/E
2005 y -= 2; 2006 y -= 2;
2006 w += 2; 2007 w += 2;
2007 h += 2; 2008 h += 2;
2008 } 2009 }
2009 2010
2010 QWidget *parent = (QWidget *)p->device(); 2011 QWidget *parent = (QWidget *)p->device();
2011 p->setBrushOrigin(parent->pos()); 2012 p->setBrushOrigin(parent->pos());
2012 parent->erase(x, y, w, h); 2013 parent->erase(x, y, w, h);
2013 2014
2014 if(menuHandler->useShadowText()){ 2015 if(menuHandler->useShadowText()){
2015 QColor shadow; 2016 QColor shadow;
2016 if(p->device() && p->device()->devType() == QInternal::Widget && 2017 if(p->device() && p->device()->devType() == QInternal::Widget &&
2017 ((QWidget *)p->device())->inherits("QMenuBar")){ 2018 ((QWidget *)p->device())->inherits("QMenuBar")){
2018 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 2019 shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
2019 g.background().dark(130); 2020 g.background().dark(130);
2020 } 2021 }
2021 else 2022 else
2022 shadow = g.background().dark(130); 2023 shadow = g.background().dark(130);
2023 2024
2024 if(active){ 2025 if(active){
2025 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); 2026 drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background());
2026 QApplication::style().drawItem(p, x+1, y+1, w, h, 2027 QApplication::style().drawItem(p, x+1, y+1, w, h,
2027 AlignCenter|ShowPrefix|DontClip|SingleLine, 2028 AlignCenter|ShowPrefix|DontClip|SingleLine,
2028 g, mi->isEnabled(), NULL, mi->text(), 2029 g, mi->isEnabled(), NULL, mi->text(),
2029 -1, &shadow); 2030 -1, &shadow);
2030 QApplication::style().drawItem(p, x, y, w, h, 2031 QApplication::style().drawItem(p, x, y, w, h,
2031 AlignCenter|ShowPrefix|DontClip|SingleLine, 2032 AlignCenter|ShowPrefix|DontClip|SingleLine,
2032 g, mi->isEnabled(), NULL, mi->text(), 2033 g, mi->isEnabled(), NULL, mi->text(),
2033 -1, &g.text()); 2034 -1, &g.text());
2034 } 2035 }
2035 else{ 2036 else{
2036 QApplication::style().drawItem(p, x+1, y+1, w, h, 2037 QApplication::style().drawItem(p, x+1, y+1, w, h,
2037 AlignCenter|ShowPrefix|DontClip|SingleLine, 2038 AlignCenter|ShowPrefix|DontClip|SingleLine,
2038 g, mi->isEnabled(), NULL, mi->text(), 2039 g, mi->isEnabled(), NULL, mi->text(),
2039 -1, &shadow); 2040 -1, &shadow);
2040 QApplication::style().drawItem(p, x, y, w, h, 2041 QApplication::style().drawItem(p, x, y, w, h,
2041 AlignCenter|ShowPrefix|DontClip|SingleLine, 2042 AlignCenter|ShowPrefix|DontClip|SingleLine,
2042 g, mi->isEnabled(), NULL, mi->text(), 2043 g, mi->isEnabled(), NULL, mi->text(),
2043 -1, &g.text()); 2044 -1, &g.text());
2044 } 2045 }
2045 } 2046 }
2046 else{ 2047 else{
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff
index 7dfd868..90ece90 100644
--- a/noncore/styles/liquid/opie-liquid.diff
+++ b/noncore/styles/liquid/opie-liquid.diff
@@ -1,1413 +1,1435 @@
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 --- -Mon Jul 15 02:34:13 2002 6 --- -Sat Sep 21 05:31:47 2002
7 +++ liquid.hMon Jul 15 01:51:12 2002 7 +++ liquid.hMon Jul 15 02:52:50 2002
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@@ -204,6 +177,7 @@ 105@@ -204,6 +177,7 @@
106 QPixmap* getPixmap(BitmapData item); 106 QPixmap* getPixmap(BitmapData item);
107 QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); 107 QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false);
108 private: 108 private:
109 +bool flatTBButtons; 109 +bool flatTBButtons;
110 bool highcolor; 110 bool highcolor;
111 QColorGroup radioOnGrp; 111 QColorGroup radioOnGrp;
112 QWidget *highlightWidget; 112 QWidget *highlightWidget;
113 --- -Mon Jul 15 02:34:13 2002 113 --- -Sat Sep 21 05:31:48 2002
114 +++ liquid.cppMon Jul 15 02:31:59 2002 114 +++ liquid.cppSat Sep 21 05:18:54 2002
115@@ -10,12 +10,10 @@ 115@@ -10,12 +10,10 @@
116 116
117 #include <qmenudata.h> 117 #include <qmenudata.h>
118 #include "liquid.h" 118 #include "liquid.h"
119-#include <kapp.h> 119-#include <kapp.h>
120-#include <kglobal.h> 120-#include <kglobal.h>
121-#include <kconfig.h> 121-#include <kconfig.h>
122-#include <kdrawutil.h> 122-#include <kdrawutil.h>
123-#include <kglobalsettings.h> 123-#include <kglobalsettings.h>
124-#include <kpixmapeffect.h> 124-#include <kpixmapeffect.h>
125+#include "liquiddeco.h" 125+#include "liquiddeco.h"
126+#include <qapplication.h> 126+#include <qapplication.h>
127+#include <qpe/config.h> 127+#include <qpe/config.h>
128+#include "effects.h" 128+#include "effects.h"
129 #include <qpalette.h> 129 #include <qpalette.h>
130 #include <qbitmap.h> 130 #include <qbitmap.h>
131 #include <qtabbar.h> 131 #include <qtabbar.h>
132@@ -25,28 +23,29 @@ 132@@ -25,28 +23,29 @@
133 #include <qtimer.h> 133 #include <qtimer.h>
134 #include <qpixmapcache.h> 134 #include <qpixmapcache.h>
135 #include <qradiobutton.h> 135 #include <qradiobutton.h>
136-#include <kimageeffect.h> 136-#include <kimageeffect.h>
137-#include <ktoolbar.h> 137-#include <ktoolbar.h>
138+#include <qcombobox.h> 138+#include <qcombobox.h>
139 #include <qdrawutil.h> 139 #include <qdrawutil.h>
140 #include <qwidgetlist.h> 140 #include <qwidgetlist.h>
141 #include <qtoolbutton.h> 141 #include <qtoolbutton.h>
142 #include <qheader.h> 142 #include <qheader.h>
143 #include <unistd.h> 143 #include <unistd.h>
144-#include <klocale.h> 144-#include <klocale.h>
145-#include <kiconloader.h> 145-#include <kiconloader.h>
146-#include <kmenubar.h> 146-#include <kmenubar.h>
147-#include <kipc.h> 147-#include <kipc.h>
148+#include <qmenubar.h> 148+#include <qmenubar.h>
149 149
150-#include <X11/X.h> 150-#include <X11/X.h>
151-#include <X11/Xlib.h> 151-#include <X11/Xlib.h>
152+ 152+
153+#include <stdio.h> 153+#include <stdio.h>
154 154
155 #include "htmlmasks.h" 155 #include "htmlmasks.h"
156 #include "embeddata.h" 156 #include "embeddata.h"
157 157
158-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) 158-void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color)
159+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 159+typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
160+ QColorGroup &, bool, bool); 160+ QColorGroup &, bool, bool);
161+ 161+
162+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 162+QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
163+ 163+
164+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) 164+void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
165 { 165 {
166 QImage img(pix.convertToImage()); 166 QImage img(pix.convertToImage());
167- KImageEffect::fade(img, 0.9, color); 167- KImageEffect::fade(img, 0.9, color);
168+ QImageEffect::fade(img, 0.9, color); 168+ QImageEffect::fade(img, 0.9, color);
169 int x, y; 169 int x, y;
170 int r, g, b; 170 int r, g, b;
171 for(y=0; y < img.height(); y+=3){ 171 for(y=0; y < img.height(); y+=3){
172@@ -71,35 +70,37 @@ 172@@ -71,35 +70,37 @@
173 : QObject(parent) 173 : QObject(parent)
174 { 174 {
175 pixDict.setAutoDelete(true); 175 pixDict.setAutoDelete(true);
176- connect(kapp, SIGNAL(kipcMessage(int, int)), this, 176- connect(kapp, SIGNAL(kipcMessage(int, int)), this,
177- SLOT(slotKIPCMessage(int, int))); 177- SLOT(slotKIPCMessage(int, int)));
178 reloadSettings(); 178 reloadSettings();
179 } 179 }
180 180
181 void TransMenuHandler::reloadSettings() 181 void TransMenuHandler::reloadSettings()
182 { 182 {
183 pixDict.clear(); 183 pixDict.clear();
184- KConfig *config = KGlobal::config(); 184- KConfig *config = KGlobal::config();
185- config->setGroup("MosfetMenus"); 185- config->setGroup("MosfetMenus");
186 186
187- type = config->readNumEntry("Type", TransStippleBg); 187- type = config->readNumEntry("Type", TransStippleBg);
188- color = config->readColorEntry("Color", 188- color = config->readColorEntry("Color",
189- &QApplication::palette().active().button()); 189- &QApplication::palette().active().button());
190- fgColor = config->readColorEntry("TextColor", 190- fgColor = config->readColorEntry("TextColor",
191- &QApplication::palette().active().text()); 191- &QApplication::palette().active().text());
192- opacity = config->readNumEntry("Opacity", 10); 192- opacity = config->readNumEntry("Opacity", 10);
193- shadowText = config->readBoolEntry("ShadowText", true); 193- shadowText = config->readBoolEntry("ShadowText", true);
194+ Config config ( "qpe" ); 194+ Config config ( "qpe" );
195+ config. setGroup ( "Liquid-Style" ); 195+ config. setGroup ( "Liquid-Style" );
196+ 196+
197+ type = config. readNumEntry("Type", TransStippleBg); 197+ type = config. readNumEntry("Type", TransStippleBg);
198+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 198+ color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
199+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 199+ fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
200+ opacity = config. readNumEntry("Opacity", 10); 200+ opacity = config. readNumEntry("Opacity", 10);
201+ if ( opacity < -20 ) 201+ if ( opacity < -20 )
202 + opacity = 20; 202 + opacity = 20;
203+ else if ( opacity > 20 ) 203+ else if ( opacity > 20 )
204 + opacity = 20; 204 + opacity = 20;
205+ 205+
206+ shadowText = config. readBoolEntry("ShadowText", true); 206+ shadowText = config. readBoolEntry("ShadowText", true);
207 } 207 }
208 208
209 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 209 bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
210 { 210 {
211- QPopupMenu *p = (QPopupMenu *)obj; 211- QPopupMenu *p = (QPopupMenu *)obj;
212+ QWidget *p = (QWidget *)obj; 212+ QWidget *p = (QWidget *)obj;
213 213
214 if(ev->type() == QEvent::Show){ 214 if(ev->type() == QEvent::Show){
215 if(type == TransStippleBg || type == TransStippleBtn || 215 if(type == TransStippleBg || type == TransStippleBtn ||
216 type == Custom){ 216 type == Custom){
217 QApplication::syncX(); 217 QApplication::syncX();
218- KPixmap *pix = new KPixmap; 218- KPixmap *pix = new KPixmap;
219+ QPixmap *pix = new QPixmap; 219+ QPixmap *pix = new QPixmap;
220 if(p->testWFlags(Qt::WType_Popup)){ 220 if(p->testWFlags(Qt::WType_Popup)){
221 QRect r(p->x(), p->y(), p->width(), p->height()); 221 QRect r(p->x(), p->y(), p->width(), p->height());
222 QRect deskR = QApplication::desktop()->rect(); 222 QRect deskR = QApplication::desktop()->rect();
223@@ -107,7 +108,7 @@ 223@@ -107,7 +108,7 @@
224 r.setBottom(deskR.bottom()); 224 r.setBottom(deskR.bottom());
225 r.setRight(deskR.right()); 225 r.setRight(deskR.right());
226 } 226 }
227- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), 227- *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(),
228+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), 228+ *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(),
229 r.width(), r.height()); 229 r.width(), r.height());
230 } 230 }
231 else{ // tear off menu 231 else{ // tear off menu
232@@ -121,82 +122,55 @@ 232@@ -121,82 +122,55 @@
233 stripePixmap(*pix, p->colorGroup().button()); 233 stripePixmap(*pix, p->colorGroup().button());
234 } 234 }
235 else{ 235 else{
236- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 236- KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
237+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 237+ QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
238 } 238 }
239+ 239+
240 pixDict.insert(p->winId(), pix); 240 pixDict.insert(p->winId(), pix);
241+ 241+
242+ if (!p->inherits("QPopupMenu")) { 242+ if (!p->inherits("QPopupMenu")) {
243 + p->setBackgroundPixmap(*pix); 243 + p->setBackgroundPixmap(*pix);
244 + 244 +
245 + QObjectList *ol = p-> queryList("QWidget"); 245 + QObjectList *ol = p-> queryList("QWidget");
246 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 246 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
247 + QWidget *wid = (QWidget *) it.current ( ); 247 + QWidget *wid = (QWidget *) it.current ( );
248 + 248 +
249 + wid-> setBackgroundPixmap(*pix); 249 + wid-> setBackgroundPixmap(*pix);
250 + wid-> setBackgroundOrigin(QWidget::ParentOrigin); 250 + wid-> setBackgroundOrigin(QWidget::ParentOrigin);
251+ } 251+ }
252 + delete ol; 252 + delete ol;
253 + } 253 + }
254 } 254 }
255 } 255 }
256 else if(ev->type() == QEvent::Hide){ 256 else if(ev->type() == QEvent::Hide){
257 if(type == TransStippleBg || type == TransStippleBtn || 257 if(type == TransStippleBg || type == TransStippleBtn ||
258 type == Custom){ 258 type == Custom){
259- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 259- qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
260- pixDict.remove(p->winId()); 260- pixDict.remove(p->winId());
261- } 261- }
262- } 262- }
263- return(false); 263- return(false);
264-} 264-}
265- 265-
266-void TransMenuHandler::slotKIPCMessage(int id, int) 266-void TransMenuHandler::slotKIPCMessage(int id, int)
267-{ 267-{
268- if(id == LIQUID_MENU_CHANGE){ 268- if(id == LIQUID_MENU_CHANGE){
269- bool oldShadow = shadowText; 269- bool oldShadow = shadowText;
270+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 270+// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
271 271
272- KConfig *config = KGlobal::config(); 272- KConfig *config = KGlobal::config();
273- config->reparseConfiguration(); // in case KControl changed values 273- config->reparseConfiguration(); // in case KControl changed values
274- 274-
275- // Make sure no popupmenus are shown. There shouldn't be any because 275- // Make sure no popupmenus are shown. There shouldn't be any because
276- // the user just clicked "Apply", but there can be tear offs ;-) 276- // the user just clicked "Apply", but there can be tear offs ;-)
277- // We just close them so the pixmaps are deleted and regenerated. 277- // We just close them so the pixmaps are deleted and regenerated.
278- QWidgetList *list = QApplication::topLevelWidgets(); 278- QWidgetList *list = QApplication::topLevelWidgets();
279- QWidgetListIt it( *list ); 279- QWidgetListIt it( *list );
280- QWidget *w; 280- QWidget *w;
281- while ((w=it.current()) != 0 ){ 281- while ((w=it.current()) != 0 ){
282- ++it; 282- ++it;
283- if(w->inherits("QPopupMenu")){ 283- if(w->inherits("QPopupMenu")){
284- w->close(); 284- w->close();
285- } 285- }
286- } 286- }
287+ pixDict.remove(p->winId()); 287+ pixDict.remove(p->winId());
288+ if (!p->inherits("QPopupMenu")) { 288+ if (!p->inherits("QPopupMenu")) {
289+ p->setBackgroundMode(QWidget::PaletteBackground); 289+ p->setBackgroundMode(QWidget::PaletteBackground);
290 290
291- reloadSettings(); 291- reloadSettings();
292 + QObjectList *ol = p-> queryList("QWidget"); 292 + QObjectList *ol = p-> queryList("QWidget");
293 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 293 + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
294 + QWidget *wid = (QWidget *) it.current ( ); 294 + QWidget *wid = (QWidget *) it.current ( );
295 295
296- // Now repaint menubar if needed 296- // Now repaint menubar if needed
297- if(shadowText != oldShadow){ 297- if(shadowText != oldShadow){
298- it.toFirst(); 298- it.toFirst();
299- while ((w=it.current()) != 0 ){ 299- while ((w=it.current()) != 0 ){
300- ++it; 300- ++it;
301- if(w->inherits("QMenuBar")){ 301- if(w->inherits("QMenuBar")){
302- w->repaint(); 302- w->repaint();
303- } 303- }
304- } 304- }
305 + wid-> setBackgroundMode( QWidget::PaletteBackground ); 305 + wid-> setBackgroundMode( QWidget::PaletteBackground );
306 } 306 }
307- } 307- }
308- else if(id == MOSFET_BUTTON_CHANGE){ 308- else if(id == MOSFET_BUTTON_CHANGE){
309- qWarning("In mosfet button change"); 309- qWarning("In mosfet button change");
310- // really, this should be in LiquidStyle, but what the hell? ;-) 310- // really, this should be in LiquidStyle, but what the hell? ;-)
311- QWidgetList *list = QApplication::allWidgets(); 311- QWidgetList *list = QApplication::allWidgets();
312- QWidgetListIt it( *list ); 312- QWidgetListIt it( *list );
313- QWidget *w; 313- QWidget *w;
314- while ((w=it.current()) != 0 ){ 314- while ((w=it.current()) != 0 ){
315- ++it; 315- ++it;
316- if(w->inherits("QPushButton")){ 316- if(w->inherits("QPushButton")){
317- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); 317- ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w);
318- } 318- }
319- } 319- }
320- ((LiquidStyle*)parent())->loadCustomButtons(); 320- ((LiquidStyle*)parent())->loadCustomButtons();
321- it.toFirst(); 321- it.toFirst();
322- while ((w=it.current()) != 0 ){ 322- while ((w=it.current()) != 0 ){
323- ++it; 323- ++it;
324- if(w->inherits("QPushButton")){ 324- if(w->inherits("QPushButton")){
325- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); 325- ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w);
326 + delete ol; 326 + delete ol;
327 } 327 }
328 } 328 }
329- 329-
330 } 330 }
331+ return(false); 331+ return(false);
332 } 332 }
333 333
334+ 334+
335 LiquidStyle::LiquidStyle() 335 LiquidStyle::LiquidStyle()
336- :KStyle() 336- :KStyle()
337+ :QWindowsStyle() 337+ :QWindowsStyle()
338 { 338 {
339+ setName ( "LiquidStyle" ); 339+ setName ( "LiquidStyle" );
340+ 340+
341 +flatTBButtons = false; 341 +flatTBButtons = false;
342+ 342+
343 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 343 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
344 btnMaskBmp.setMask(btnMaskBmp); 344 btnMaskBmp.setMask(btnMaskBmp);
345 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 345 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
346@@ -730,20 +704,26 @@ 346@@ -711,7 +685,6 @@
347
348 void LiquidStyle::polish(QPalette &appPal)
349 {
350-
351 int i;
352 for(i=0; i < BITMAP_ITEMS; ++i){
353 if(pixmaps[i]){
354@@ -730,20 +703,29 @@
347 } 355 }
348 356
349 loadCustomButtons(); 357 loadCustomButtons();
350- lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; 358- lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10;
351+ lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 359+ lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
352 btnDict.clear(); 360 btnDict.clear();
353 btnBorderDict.clear(); 361 btnBorderDict.clear();
354 bevelFillDict.clear(); 362 bevelFillDict.clear();
355 smallBevelFillDict.clear(); 363 smallBevelFillDict.clear();
356 364
357- KConfig *config = KGlobal::config(); 365- KConfig *config = KGlobal::config();
358- QString oldGrp = config->group(); 366- QString oldGrp = config->group();
367- QPalette pal = QApplication::palette();
359+ Config config ( "qpe" ); 368+ Config config ( "qpe" );
360+ config. setGroup ( "Liquid-Style" ); 369+ config. setGroup ( "Liquid-Style" );
361 +int contrast = config. readNumEntry ( "StippleContrast", 5 ); 370 +int contrast = config. readNumEntry ( "StippleContrast", 5 );
362 +if ( contrast < 0 ) 371 +if ( contrast < 0 )
363 + contrast = 0; 372 + contrast = 0;
364 +else if ( contrast > 10 ) 373 +else if ( contrast > 10 )
365 + contrast = 10; 374 + contrast = 10;
366+ 375+
367 QPalette pal = QApplication::palette(); 376+// QPalette pal = QApplication::palette();
368 377
369 // button color stuff 378 // button color stuff
370- config->setGroup("General"); 379- config->setGroup("General");
371- QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); 380- QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray);
372- if(c == config->readColorEntry("background", &Qt::lightGray)){ 381- if(c == config->readColorEntry("background", &Qt::lightGray)){
373+ config. setGroup ( "Appearance" ); 382+ config. setGroup ( "Appearance" );
374 + QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 383+ QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
375+ if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { 384+ appPal. color ( QPalette::Active, QColorGroup::Button );
385+ if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )
386+ //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
387+ ) {
376 // force button color to be different from background 388 // force button color to be different from background
377 QBrush btnBrush(QColor(200, 202, 228)); 389 QBrush btnBrush(QColor(200, 202, 228));
378 appPal.setBrush(QColorGroup::Button, btnBrush); 390 appPal.setBrush(QColorGroup::Button, btnBrush);
379@@ -794,15 +774,7 @@ 391@@ -794,15 +776,7 @@
380 pagerBrush.setPixmap(*pix); 392 pagerBrush.setPixmap(*pix);
381 393
382 // background color stuff 394 // background color stuff
383- c = config->readColorEntry("background", &Qt::lightGray); 395- c = config->readColorEntry("background", &Qt::lightGray);
384- if(qstrcmp(kapp->argv()[0], "kicker") == 0){ 396- if(qstrcmp(kapp->argv()[0], "kicker") == 0){
385- appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); 397- appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110));
386- appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); 398- appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130));
387- appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); 399- appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110));
388- appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); 400- appPal.setColor(QColorGroup::Light, menuBrush.color().light(115));
389- menuBrush.setColor(c); // hack - used for kicker applets 401- menuBrush.setColor(c); // hack - used for kicker applets
390- appPal.setBrush(QColorGroup::Background, menuBrush); 402- appPal.setBrush(QColorGroup::Background, menuBrush);
391- } 403- }
392+ c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); 404+ c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background );
393 c.hsv(&bH, &bS, &bV); 405 c.hsv(&bH, &bS, &bV);
394 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 406 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
395 407
396@@ -817,21 +789,18 @@ 408@@ -817,21 +791,18 @@
397 wallPaper.fill(c.rgb()); 409 wallPaper.fill(c.rgb());
398 painter.begin(&wallPaper); 410 painter.begin(&wallPaper);
399 for(i=0; i < 32; i+=4){ 411 for(i=0; i < 32; i+=4){
400- painter.setPen(c.dark(105)); 412- painter.setPen(c.dark(105));
401+ painter.setPen(c.dark(100 + contrast)); 413+ painter.setPen(c.dark(100 + contrast));
402 painter.drawLine(0, i, 32, i); 414 painter.drawLine(0, i, 32, i);
403- painter.setPen(c.dark(103)); 415- painter.setPen(c.dark(103));
404+ painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 416+ painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
405 painter.drawLine(0, i+1, 32, i+1); 417 painter.drawLine(0, i+1, 32, i+1);
406 }; 418 };
407 painter.end(); 419 painter.end();
408 bgBrush.setColor(c); 420 bgBrush.setColor(c);
409 bgBrush.setPixmap(wallPaper); 421 bgBrush.setPixmap(wallPaper);
410- if(qstrcmp(kapp->argv()[0], "kicker") != 0 && 422- if(qstrcmp(kapp->argv()[0], "kicker") != 0 &&
411- qstrcmp(kapp->argv()[0], "ksplash") != 0){ 423- qstrcmp(kapp->argv()[0], "ksplash") != 0){
412 appPal.setBrush(QColorGroup::Background, bgBrush); 424 appPal.setBrush(QColorGroup::Background, bgBrush);
413- } 425- }
414 426
415 // lineedits 427 // lineedits
416- c = config->readColorEntry("windowBackground", &Qt::white); 428- c = config->readColorEntry("windowBackground", &Qt::white);
417+ c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); 429+ c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base );
418 QPixmap basePix; 430 QPixmap basePix;
419 basePix.resize(32, 32); 431 basePix.resize(32, 32);
420 basePix.fill(c.rgb()); 432 basePix.fill(c.rgb());
421@@ -857,51 +826,39 @@ 433@@ -856,52 +827,39 @@
434 applyCustomAttributes((QPushButton *)w);
422 } 435 }
423 } 436 }
424 437-
425- config->setGroup(oldGrp); 438- config->setGroup(oldGrp);
426 } 439 }
427 440
428 void LiquidStyle::polish(QWidget *w) 441 void LiquidStyle::polish(QWidget *w)
429 { 442 {
430 if(w->inherits("QMenuBar")){ 443 if(w->inherits("QMenuBar")){
431- ((QFrame*)w)->setLineWidth(0); 444- ((QFrame*)w)->setLineWidth(0);
432- w->setBackgroundMode(QWidget::NoBackground); 445- w->setBackgroundMode(QWidget::NoBackground);
433+ //((QFrame*)w)->setLineWidth(0); 446+ //((QFrame*)w)->setLineWidth(0);
434+ w->setBackgroundMode(QWidget::PaletteBackground); 447+ w->setBackgroundMode(QWidget::PaletteBackground);
435+ w->setBackgroundOrigin(QWidget::ParentOrigin); 448+ w->setBackgroundOrigin(QWidget::ParentOrigin);
436+ return; 449+ return;
437+ } 450+ }
438+ if(w->inherits("QToolBar")){ 451+ if(w->inherits("QToolBar")){
439+ w->installEventFilter(this); 452+ w->installEventFilter(this);
440+ w->setBackgroundMode(QWidget::PaletteBackground); 453+ w->setBackgroundMode(QWidget::PaletteBackground);
441+ w->setBackgroundOrigin(QWidget::WidgetOrigin); 454+ w->setBackgroundOrigin(QWidget::WidgetOrigin);
442 return; 455 return;
443 } 456 }
444 if(w->inherits("QPopupMenu")) 457 if(w->inherits("QPopupMenu"))
445 w->setBackgroundMode(QWidget::NoBackground); 458 w->setBackgroundMode(QWidget::NoBackground);
446+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 459+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
447 + w->installEventFilter(menuHandler); 460 + w->installEventFilter(menuHandler);
448+ } 461+ }
449 462
450 if(w->isTopLevel()){ 463 if(w->isTopLevel()){
451- if(!w->inherits("QPopupMenu") && 464- if(!w->inherits("QPopupMenu") &&
452- qstrcmp(kapp->argv()[0], "kicker") == 0){ 465- qstrcmp(kapp->argv()[0], "kicker") == 0){
453- qWarning("Got panel toplevel %s", w->className()); 466- qWarning("Got panel toplevel %s", w->className());
454- // force extensions and child panels to use proper palette. 467- // force extensions and child panels to use proper palette.
455- if(w->inherits("Panel")){ 468- if(w->inherits("Panel")){
456- qWarning("Setting panel palette"); 469- qWarning("Setting panel palette");
457- w->setPalette(kapp->palette()); 470- w->setPalette(kapp->palette());
458- } 471- }
459- else{ 472- else{
460- // reset palette for everything else 473- // reset palette for everything else
461- QPalette pal = kapp->palette(); 474- QPalette pal = kapp->palette();
462- pal.setBrush(QColorGroup::Background, bgBrush); 475- pal.setBrush(QColorGroup::Background, bgBrush);
463- pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); 476- pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130));
464- pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); 477- pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150));
465- pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); 478- pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110));
466- pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); 479- pal.setColor(QColorGroup::Light, bgBrush.color().light(120));
467- w->setPalette(pal); 480- w->setPalette(pal);
468- } 481- }
469- } 482- }
470 return; 483 return;
471 } 484 }
472- if(qstrcmp(kapp->argv()[0], "kicker") == 0 && 485- if(qstrcmp(kapp->argv()[0], "kicker") == 0 &&
473- w->inherits("KPanelExtension")){ // FIXME - doesn't work 486- w->inherits("KPanelExtension")){ // FIXME - doesn't work
474- w->setPalette(kapp->palette()); 487- w->setPalette(kapp->palette());
475- } 488- }
476+ 489+
477+ 490+
478+ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 491+ if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
479 + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 492 + w-> setBackgroundOrigin ( QWidget::ParentOrigin );
480 493
481 if(w->inherits("QComboBox") || 494 if(w->inherits("QComboBox") ||
482 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 495 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
483- w->inherits("QCheckBox") || w->inherits("QScrollBar") || 496- w->inherits("QCheckBox") || w->inherits("QScrollBar") ||
484- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || 497- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") ||
485- w->inherits("TaskContainer")){ 498- w->inherits("TaskContainer")){
486+ w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 499+ w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
487 w->installEventFilter(this); 500 w->installEventFilter(this);
488 } 501 }
489 if(w->inherits("QLineEdit")){ 502 if(w->inherits("QLineEdit")){
490@@ -913,6 +870,9 @@ 503@@ -913,6 +871,9 @@
491 applyCustomAttributes((QPushButton *)w); 504 applyCustomAttributes((QPushButton *)w);
492 w->installEventFilter(this); 505 w->installEventFilter(this);
493 } 506 }
494+ if(w->inherits("QButton") || w-> inherits("QComboBox")){ 507+ if(w->inherits("QButton") || w-> inherits("QComboBox")){
495 + w-> setBackgroundMode ( QWidget::PaletteBackground ); 508 + w-> setBackgroundMode ( QWidget::PaletteBackground );
496+ } 509+ }
497 510
498 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 511 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
499 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 512 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
500@@ -942,11 +902,14 @@ 513@@ -942,11 +903,14 @@
501 w->setMouseTracking(true); 514 w->setMouseTracking(true);
502 w->installEventFilter(this); 515 w->installEventFilter(this);
503 } 516 }
504+ if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { 517+ if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) {
505 + ((QToolButton*)w)->setAutoRaise (flatTBButtons); 518 + ((QToolButton*)w)->setAutoRaise (flatTBButtons);
506 + if ( flatTBButtons ) 519 + if ( flatTBButtons )
507 + w->setBackgroundOrigin(QWidget::ParentOrigin); 520 + w->setBackgroundOrigin(QWidget::ParentOrigin);
508+ } 521+ }
509 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 522 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
510 return; 523 return;
511 } 524 }
512- if(w->inherits("PanelButtonBase")) 525- if(w->inherits("PanelButtonBase"))
513- return; 526- return;
514 527
515 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 528 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
516 palette().active().brush(QColorGroup::Background).pixmap()){ 529 palette().active().brush(QColorGroup::Background).pixmap()){
517@@ -954,17 +917,13 @@ 530@@ -954,17 +918,13 @@
518 return; 531 return;
519 } 532 }
520 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 533 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
521- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ 534- !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){
522 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 535 + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
523 if(w->backgroundMode() == QWidget::PaletteBackground || 536 if(w->backgroundMode() == QWidget::PaletteBackground ||
524 w->backgroundMode() == QWidget::PaletteButton){ 537 w->backgroundMode() == QWidget::PaletteButton){
525 w->setBackgroundMode(QWidget::X11ParentRelative); 538 w->setBackgroundMode(QWidget::X11ParentRelative);
526 } 539 }
527 } 540 }
528- if(w->inherits("KToolBar")){ 541- if(w->inherits("KToolBar")){
529- w->installEventFilter(this); 542- w->installEventFilter(this);
530- //w->setBackgroundMode(QWidget::NoBackground); 543- //w->setBackgroundMode(QWidget::NoBackground);
531- return; 544- return;
532- } 545- }
533+ 546+
534 } 547 }
535 548
536 void LiquidStyle::unPolish(QWidget *w) 549 void LiquidStyle::unPolish(QWidget *w)
537@@ -977,6 +936,9 @@ 550@@ -977,6 +937,9 @@
538 551
539 if(w->inherits("QPopupMenu")) 552 if(w->inherits("QPopupMenu"))
540 w->setBackgroundMode(QWidget::PaletteButton); 553 w->setBackgroundMode(QWidget::PaletteButton);
541+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 554+ else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
542 + w->removeEventFilter(menuHandler); 555 + w->removeEventFilter(menuHandler);
543+ } 556+ }
544 557
545 if(w->isTopLevel()) 558 if(w->isTopLevel())
546 return; 559 return;
547@@ -1001,12 +963,14 @@ 560@@ -986,7 +949,7 @@
561 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
562 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
563
564- w->setPalette(QApplication::palette());
565+ w->unsetPalette();
566 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
567 if(w->inherits("QPushButton"))
568 w->setBackgroundMode(QWidget::PaletteButton);
569@@ -1001,12 +964,14 @@
548 unapplyCustomAttributes((QPushButton *)w); 570 unapplyCustomAttributes((QPushButton *)w);
549 w->removeEventFilter(this); 571 w->removeEventFilter(this);
550 } 572 }
551- 573-
552+/* 574+/*
553+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 575+ if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
554 + w-> setBackgroundMode ( PaletteBackground ); 576 + w-> setBackgroundMode ( PaletteBackground );
555+ } 577+ }
556+*/ 578+*/
557 if(w->inherits("QComboBox") || 579 if(w->inherits("QComboBox") ||
558 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 580 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
559- w->inherits("QCheckBox") || w->inherits("QScrollBar") || 581- w->inherits("QCheckBox") || w->inherits("QScrollBar") ||
560- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || 582- w->isA("AppletHandle") || w->inherits("KMiniPagerButton") ||
561- w->inherits("TaskContainer")){ 583- w->inherits("TaskContainer")){
562+ w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 584+ w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
563 w->removeEventFilter(this); 585 w->removeEventFilter(this);
564 } 586 }
565 if(w->inherits("QButton") || w->inherits("QComboBox")){ 587 if(w->inherits("QButton") || w->inherits("QComboBox")){
566@@ -1014,9 +978,9 @@ 588@@ -1014,9 +979,9 @@
567 w->setAutoMask(false); 589 w->setAutoMask(false);
568 } 590 }
569 } 591 }
570- if(w->inherits("KToolBar")){ 592- if(w->inherits("KToolBar")){
571+ if(w->inherits("QToolBar")){ 593+ if(w->inherits("QToolBar")){
572 w->removeEventFilter(this); 594 w->removeEventFilter(this);
573- //w->setBackgroundMode(QWidget::PaletteBackground); 595- //w->setBackgroundMode(QWidget::PaletteBackground);
574+ w->setBackgroundMode(QWidget::PaletteBackground); 596+ w->setBackgroundMode(QWidget::PaletteBackground);
575 return; 597 return;
576 } 598 }
577 if(w->inherits("QHeader")){ 599 if(w->inherits("QHeader")){
578@@ -1028,20 +992,34 @@ 600@@ -1028,20 +993,34 @@
579 void LiquidStyle::polish(QApplication *app) 601 void LiquidStyle::polish(QApplication *app)
580 { 602 {
581 603
582- KStyle::polish(app); 604- KStyle::polish(app);
583+ QWindowsStyle::polish(app); 605+ QWindowsStyle::polish(app);
584 menuAni = app->isEffectEnabled(UI_AnimateMenu); 606 menuAni = app->isEffectEnabled(UI_AnimateMenu);
585 menuFade = app->isEffectEnabled(UI_FadeMenu); 607 menuFade = app->isEffectEnabled(UI_FadeMenu);
586 if(menuAni) 608 if(menuAni)
587 app->setEffectEnabled(UI_AnimateMenu, false); 609 app->setEffectEnabled(UI_AnimateMenu, false);
588 if(menuFade) 610 if(menuFade)
589 app->setEffectEnabled(UI_FadeMenu, false); 611 app->setEffectEnabled(UI_FadeMenu, false);
590 + 612 +
591+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 613+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
592+ 614+
593+ Config config ( "qpe" ); 615+ Config config ( "qpe" );
594+ config. setGroup ( "Liquid-Style" ); 616+ config. setGroup ( "Liquid-Style" );
595+ 617+
596 + if ( config. readBoolEntry ( "WinDecoration", true )) 618 +// if ( config. readBoolEntry ( "WinDecoration", true ))
597 + QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 619 +// QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
598 + 620 +
599 +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 621 +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
600 } 622 }
601 623
602 void LiquidStyle::unPolish(QApplication *app) 624 void LiquidStyle::unPolish(QApplication *app)
603 { 625 {
604- KStyle::unPolish(app); 626- KStyle::unPolish(app);
605+ QWindowsStyle::unPolish(app); 627+ QWindowsStyle::unPolish(app);
606 app->setEffectEnabled(UI_AnimateMenu, menuAni); 628 app->setEffectEnabled(UI_AnimateMenu, menuAni);
607 app->setEffectEnabled(UI_FadeMenu, menuFade); 629 app->setEffectEnabled(UI_FadeMenu, menuFade);
608+ 630+
609+ qt_set_draw_menu_bar_impl ( 0 ); 631+ qt_set_draw_menu_bar_impl ( 0 );
610+ 632+
611+ QApplication::qwsSetDecoration ( new QPEDecoration ( )); 633+// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
612 } 634 }
613 635
614 /* 636 /*
615@@ -1063,7 +1041,7 @@ 637@@ -1063,7 +1042,7 @@
616 */ 638 */
617 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 639 bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
618 { 640 {
619- if(obj->inherits("KToolBar")){ 641- if(obj->inherits("KToolBar")){
620+ if(obj->inherits("QToolBar")){ 642+ if(obj->inherits("QToolBar")){
621 if(ev->type() == QEvent::Resize){ 643 if(ev->type() == QEvent::Resize){
622 const QObjectList *tbChildList = obj->children(); 644 const QObjectList *tbChildList = obj->children();
623 QObjectListIt it(*tbChildList); 645 QObjectListIt it(*tbChildList);
624@@ -1076,35 +1054,7 @@ 646@@ -1076,35 +1055,7 @@
625 647
626 } 648 }
627 } 649 }
628- else if(obj->inherits("KMiniPagerButton")){ 650- else if(obj->inherits("KMiniPagerButton")){
629- QButton *btn = (QButton *)obj; 651- QButton *btn = (QButton *)obj;
630- if(ev->type() == QEvent::Paint){ 652- if(ev->type() == QEvent::Paint){
631- if(!(btn->isOn() || btn->isDown())){ 653- if(!(btn->isOn() || btn->isDown())){
632- QPalette pal = btn->palette(); 654- QPalette pal = btn->palette();
633- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? 655- pal.setBrush(QColorGroup::Dark, btn == highlightWidget ?
634- pagerHoverBrush : pagerBrush); 656- pagerHoverBrush : pagerBrush);
635- btn->setPalette(pal); 657- btn->setPalette(pal);
636- } 658- }
637- else{ 659- else{
638- QPalette pal = btn->palette(); 660- QPalette pal = btn->palette();
639- pal.setBrush(QColorGroup::Dark, 661- pal.setBrush(QColorGroup::Dark,
640- QApplication::palette().active().brush(QColorGroup::Dark)); 662- QApplication::palette().active().brush(QColorGroup::Dark));
641- btn->setPalette(pal); 663- btn->setPalette(pal);
642- 664-
643- } 665- }
644- } 666- }
645- else if(ev->type() == QEvent::Enter){ 667- else if(ev->type() == QEvent::Enter){
646- highlightWidget = btn; 668- highlightWidget = btn;
647- btn->repaint(false); 669- btn->repaint(false);
648- } 670- }
649- else if(ev->type() == QEvent::Leave){ 671- else if(ev->type() == QEvent::Leave){
650- highlightWidget = NULL; 672- highlightWidget = NULL;
651- btn->repaint(false); 673- btn->repaint(false);
652- } 674- }
653- 675-
654- } 676- }
655- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || 677- else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") ||
656- obj->isA("AppletHandle")){ 678- obj->isA("AppletHandle")){
657+ else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ 679+ else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){
658 QWidget *btn = (QWidget *)obj; 680 QWidget *btn = (QWidget *)obj;
659 if(ev->type() == QEvent::Enter){ 681 if(ev->type() == QEvent::Enter){
660 if(btn->isEnabled()){ 682 if(btn->isEnabled()){
661@@ -1119,20 +1069,7 @@ 683@@ -1119,20 +1070,7 @@
662 } 684 }
663 } 685 }
664 } 686 }
665- else if(obj->inherits("TaskContainer")){ 687- else if(obj->inherits("TaskContainer")){
666- QButton *btn = (QButton *)obj; 688- QButton *btn = (QButton *)obj;
667- QPalette pal = btn->palette(); 689- QPalette pal = btn->palette();
668- if(ev->type() == QEvent::Enter){ 690- if(ev->type() == QEvent::Enter){
669- pal.setColor(QColorGroup::Background, pal.active().button().light(110)); 691- pal.setColor(QColorGroup::Background, pal.active().button().light(110));
670- btn->setPalette(pal); 692- btn->setPalette(pal);
671- } 693- }
672- else if(ev->type() == QEvent::Leave){ 694- else if(ev->type() == QEvent::Leave){
673- pal.setColor(QColorGroup::Background, 695- pal.setColor(QColorGroup::Background,
674- QApplication::palette().active().background()); 696- QApplication::palette().active().background());
675- btn->setPalette(pal); 697- btn->setPalette(pal);
676- } 698- }
677- } 699- }
678- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ 700- else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){
679+ else if(obj->inherits("QToolButton")){ 701+ else if(obj->inherits("QToolButton")){
680 QToolButton *btn = (QToolButton *)btn; 702 QToolButton *btn = (QToolButton *)btn;
681 if(!btn->autoRaise()){ 703 if(!btn->autoRaise()){
682 if(btn->isEnabled()){ 704 if(btn->isEnabled()){
683@@ -1340,11 +1277,6 @@ 705@@ -1340,11 +1278,6 @@
684 QColorGroup g = btn->colorGroup(); 706 QColorGroup g = btn->colorGroup();
685 707
686 708
687- QColor testColor; 709- QColor testColor;
688- if(btn->parent() && btn->parent()->isWidgetType()){ 710- if(btn->parent() && btn->parent()->isWidgetType()){
689- testColor = p->backgroundColor(); // remove me 711- testColor = p->backgroundColor(); // remove me
690- } 712- }
691- 713-
692 //int dw = buttonDefaultIndicatorWidth(); 714 //int dw = buttonDefaultIndicatorWidth();
693 if(btn->hasFocus() || btn->isDefault()){ 715 if(btn->hasFocus() || btn->isDefault()){
694 QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); 716 QColor c = btn->hasFocus() ? g.button().light(110) : g.background();
695@@ -1596,7 +1528,7 @@ 717@@ -1596,7 +1529,7 @@
696 if(sbBuffer.size() != sb->size()) 718 if(sbBuffer.size() != sb->size())
697 sbBuffer.resize(sb->size()); 719 sbBuffer.resize(sb->size());
698 } 720 }
699- subB.setRect( subX,subY,buttonDim,buttonDim ); 721- subB.setRect( subX,subY,buttonDim,buttonDim );
700+ subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); 722+ subB.setRect( subX,subY,0,0); // buttonDim,buttonDim );
701 addB.setRect( addX,addY,buttonDim,buttonDim ); 723 addB.setRect( addX,addY,buttonDim,buttonDim );
702 if(horiz) 724 if(horiz)
703 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); 725 subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim );
704@@ -1624,7 +1556,7 @@ 726@@ -1624,7 +1557,7 @@
705 QPainter painter; 727 QPainter painter;
706 if(!horiz){ 728 if(!horiz){
707 painter.begin(&sbBuffer); 729 painter.begin(&sbBuffer);
708- QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); 730- QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1);
709+ QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); 731+ QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1);
710 if(sliderR.height() >= 8){ 732 if(sliderR.height() >= 8){
711 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, 733 painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0,
712 13, 8); 734 13, 8);
713@@ -1690,7 +1622,7 @@ 735@@ -1690,7 +1623,7 @@
714 } 736 }
715 else{ 737 else{
716 painter.begin(&sbBuffer); 738 painter.begin(&sbBuffer);
717- QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); 739- QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height());
718+ QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); 740+ QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height());
719 if(sliderR.width() >= 8){ 741 if(sliderR.width() >= 8){
720 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, 742 painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0,
721 8, 13); 743 8, 13);
722@@ -1761,10 +1693,10 @@ 744@@ -1761,10 +1694,10 @@
723 addB.width()-8, addB.height()-8, g, !maxed); 745 addB.width()-8, addB.height()-8, g, !maxed);
724 } 746 }
725 if ( controls & SubLine ) { 747 if ( controls & SubLine ) {
726- drawSBButton(p, subB, g, activeControl == SubLine); 748- drawSBButton(p, subB, g, activeControl == SubLine);
727- drawArrow( p, horiz ? LeftArrow : UpArrow, 749- drawArrow( p, horiz ? LeftArrow : UpArrow,
728- false, subB.x()+4, subB.y()+4, 750- false, subB.x()+4, subB.y()+4,
729- subB.width()-8, subB.height()-8, g, !maxed); 751- subB.width()-8, subB.height()-8, g, !maxed);
730+ // drawSBButton(p, subB, g, activeControl == SubLine); 752+ // drawSBButton(p, subB, g, activeControl == SubLine);
731+ // drawArrow( p, horiz ? LeftArrow : UpArrow, 753+ // drawArrow( p, horiz ? LeftArrow : UpArrow,
732+ // false, subB.x()+4, subB.y()+4, 754+ // false, subB.x()+4, subB.y()+4,
733+ // subB.width()-8, subB.height()-8, g, !maxed); 755+ // subB.width()-8, subB.height()-8, g, !maxed);
734 drawSBButton(p, subHC, g, activeControl == SubLine); 756 drawSBButton(p, subHC, g, activeControl == SubLine);
735 drawArrow( p, horiz ? LeftArrow : UpArrow, 757 drawArrow( p, horiz ? LeftArrow : UpArrow,
736 false, subHC.x()+4, subHC.y()+4, 758 false, subHC.x()+4, subHC.y()+4,
737@@ -1865,8 +1797,8 @@ 759@@ -1865,8 +1798,8 @@
738 else 760 else
739 buttonDim = ( length - b*2 )/2 - 1; 761 buttonDim = ( length - b*2 )/2 - 1;
740 762
741- sliderMin = b + buttonDim; 763- sliderMin = b + buttonDim;
742- maxLength = length - b*2 - buttonDim*3; 764- maxLength = length - b*2 - buttonDim*3;
743+ sliderMin = b + 0; // buttonDim; 765+ sliderMin = b + 0; // buttonDim;
744+ maxLength = length - b*2 - buttonDim*2; // 3; 766+ maxLength = length - b*2 - buttonDim*2; // 3;
745 767
746 if ( sb->maxValue() == sb->minValue() ) { 768 if ( sb->maxValue() == sb->minValue() ) {
747 sliderLength = maxLength; 769 sliderLength = maxLength;
748@@ -1914,8 +1846,8 @@ 770@@ -1914,8 +1847,8 @@
749 return(QSize(16, 16)); 771 return(QSize(16, 16));
750 } 772 }
751 773
752-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, 774-void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w,
753- int h, const QColorGroup &g, bool on, 775- int h, const QColorGroup &g, bool on,
754+void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, 776+void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/,
755+ int /*h*/, const QColorGroup &/*g*/, bool on, 777+ int /*h*/, const QColorGroup &/*g*/, bool on,
756 bool down, bool) 778 bool down, bool)
757 { 779 {
758 bool isHover = highlightWidget == p->device(); 780 bool isHover = highlightWidget == p->device();
759@@ -1957,8 +1889,8 @@ 781@@ -1957,8 +1890,8 @@
760 return(QSize(20, 22)); 782 return(QSize(20, 22));
761 } 783 }
762 784
763-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, 785-void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h,
764- const QColorGroup &g, int state, bool down, bool) 786- const QColorGroup &g, int state, bool down, bool)
765+void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, 787+void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/,
766+ const QColorGroup &/*g*/, int state, bool /*down*/, bool) 788+ const QColorGroup &/*g*/, int state, bool /*down*/, bool)
767 { 789 {
768 bool isHover = highlightWidget == p->device(); 790 bool isHover = highlightWidget == p->device();
769 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget 791 bool isMasked = p->device() && p->device()->devType() == QInternal::Widget
770@@ -1996,8 +1928,8 @@ 792@@ -1996,8 +1929,8 @@
771 } 793 }
772 } 794 }
773 795
774-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, 796-void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h,
775- int state) 797- int state)
776+void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 798+void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
777+ int /*state*/) 799+ int /*state*/)
778 { 800 {
779 // needed for some reason by KHtml, even tho it's all filled ;P 801 // needed for some reason by KHtml, even tho it's all filled ;P
780 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); 802 p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask());
781@@ -2005,18 +1937,17 @@ 803@@ -2005,18 +1938,17 @@
782 } 804 }
783 805
784 void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, 806 void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h,
785- const QColorGroup &g, Orientation orient, 807- const QColorGroup &g, Orientation orient,
786+ const QColorGroup &/*g*/, Orientation orient, 808+ const QColorGroup &/*g*/, Orientation orient,
787 bool, bool) 809 bool, bool)
788 { 810 {
789 QWidget *parent = (QWidget *)p->device(); 811 QWidget *parent = (QWidget *)p->device();
790 p->setBrushOrigin(parent->pos()); 812 p->setBrushOrigin(parent->pos());
791- p->fillRect(x, y, w, h, 813- p->fillRect(x, y, w, h,
792- QApplication::palette().active().brush(QColorGroup::Background)); 814- QApplication::palette().active().brush(QColorGroup::Background));
793+ parent->erase(x, y, w, h); 815+ parent->erase(x, y, w, h);
794 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : 816 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) :
795 *getPixmap(VSlider)); 817 *getPixmap(VSlider));
796 } 818 }
797 819
798-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, 820-void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h,
799+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, 821+void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/,
800 Orientation orient, bool, bool) 822 Orientation orient, bool, bool)
801 { 823 {
802 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : 824 p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() :
803@@ -2065,203 +1996,26 @@ 825@@ -2065,203 +1997,26 @@
804 p->drawLineSegments(a); 826 p->drawLineSegments(a);
805 } 827 }
806 828
807-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, 829-void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h,
808- const QColorGroup &g, KToolBarPos, 830- const QColorGroup &g, KToolBarPos,
809- QBrush *) 831- QBrush *)
810-{ 832-{
811- p->setPen(g.button().dark(120)); 833- p->setPen(g.button().dark(120));
812- int x2 = x+w-1; 834- int x2 = x+w-1;
813- int y2 = y+h-1; 835- int y2 = y+h-1;
814- p->drawLine(x+1, y, x2-1, y); 836- p->drawLine(x+1, y, x2-1, y);
815- p->drawLine(x+1, y2, x2-1, y2); 837- p->drawLine(x+1, y2, x2-1, y2);
816- p->drawLine(x, y+1, x, y2-1); 838- p->drawLine(x, y+1, x, y2-1);
817- p->drawLine(x2, y+1, x2, y2-1); 839- p->drawLine(x2, y+1, x2, y2-1);
818- 840-
819- p->setPen(g.background()); 841- p->setPen(g.background());
820- p->drawPoint(x, y); 842- p->drawPoint(x, y);
821- p->drawPoint(x2, y); 843- p->drawPoint(x2, y);
822- p->drawPoint(x, y2); 844- p->drawPoint(x, y2);
823- p->drawPoint(x2, y2); 845- p->drawPoint(x2, y2);
824- 846-
825- 847-
826- 848-
827- // p->drawRect(x, y, w, h); 849- // p->drawRect(x, y, w, h);
828- QPixmap *pix = bevelFillDict.find(g.button().rgb()); 850- QPixmap *pix = bevelFillDict.find(g.button().rgb());
829- if(!pix){ 851- if(!pix){
830- int h, s, v; 852- int h, s, v;
831- g.button().hsv(&h, &s, &v); 853- g.button().hsv(&h, &s, &v);
832- pix = new QPixmap(*bevelFillPix); 854- pix = new QPixmap(*bevelFillPix);
833- adjustHSV(*pix, h, s, v); 855- adjustHSV(*pix, h, s, v);
834- bevelFillDict.insert(g.button().rgb(), pix); 856- bevelFillDict.insert(g.button().rgb(), pix);
835- } 857- }
836- 858-
837- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); 859- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix);
838-} 860-}
839- 861-
840-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, 862-void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h,
841- const QColorGroup &g, bool mac, QBrush *) 863- const QColorGroup &g, bool mac, QBrush *)
842-{ 864-{
843- if(p->device() && p->device()->devType() == QInternal::Widget && 865- if(p->device() && p->device()->devType() == QInternal::Widget &&
844- ((KMenuBar *)p->device())->isTopLevelMenu()){ 866- ((KMenuBar *)p->device())->isTopLevelMenu()){
845- p->setPen(Qt::black); 867- p->setPen(Qt::black);
846- p->drawRect(x, y, w, h); 868- p->drawRect(x, y, w, h);
847- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); 869- p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix);
848- // left 870- // left
849- p->drawLine(x+1, y+1, x+1, y+5); 871- p->drawLine(x+1, y+1, x+1, y+5);
850- p->drawLine(x+2, y+1, x+2, y+3); 872- p->drawLine(x+2, y+1, x+2, y+3);
851- p->drawLine(x+3, y+1, x+3, y+2); 873- p->drawLine(x+3, y+1, x+3, y+2);
852- p->drawLine(x+4, y+1, x+6, y+1); 874- p->drawLine(x+4, y+1, x+6, y+1);
853- // right 875- // right
854- int x2 = x+w-1; 876- int x2 = x+w-1;
855- p->drawLine(x2-1, y+1, x2-1, y+5); 877- p->drawLine(x2-1, y+1, x2-1, y+5);
856- p->drawLine(x2-2, y+1, x2-2, y+3); 878- p->drawLine(x2-2, y+1, x2-2, y+3);
857- p->drawLine(x2-3, y+1, x2-3, y+2); 879- p->drawLine(x2-3, y+1, x2-3, y+2);
858- p->drawLine(x2-4, y+1, x2-6, y+1); 880- p->drawLine(x2-4, y+1, x2-6, y+1);
859- } 881- }
860- else{ 882- else{
861- qDrawShadePanel(p, x, y, w, h, g, false, 1, 883- qDrawShadePanel(p, x, y, w, h, g, false, 1,
862- &g.brush(QColorGroup::Background)); 884- &g.brush(QColorGroup::Background));
863- } 885- }
864- 886-
865-} 887-}
866 888
867-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, 889-void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h,
868- const QColorGroup &g, KToolBarPos, QBrush *) 890- const QColorGroup &g, KToolBarPos, QBrush *)
869+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, 891+void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
870+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) 892+ QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active )
871 { 893 {
872- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 894- //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
873-} 895-}
874- 896-
875-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, 897-void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h,
876- const QColorGroup &g, bool sunken, 898- const QColorGroup &g, bool sunken,
877- bool raised, bool enabled, bool popup, 899- bool raised, bool enabled, bool popup,
878- KToolButtonType icontext, 900- KToolButtonType icontext,
879- const QString& btext, const QPixmap *pixmap, 901- const QString& btext, const QPixmap *pixmap,
880- QFont *font, QWidget *btn) 902- QFont *font, QWidget *btn)
881-{ 903-{
882- int dx, dy; 904- int dx, dy;
883- 905-
884- QFontMetrics fm(*font); 906- QFontMetrics fm(*font);
885- 907-
886- QToolBar* toolbar = 0; 908- QToolBar* toolbar = 0;
887- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) 909- if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar"))
888- toolbar = static_cast<QToolBar*>(btn->parent()); 910- toolbar = static_cast<QToolBar*>(btn->parent());
889- 911-
890- --w, --h; 912- --w, --h;
891- if(sunken) 913- if(sunken)
892- ++x, ++y; 914- ++x, ++y;
893- 915-
894- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : 916- QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) :
895- g.background()); 917- g.background());
896- drawClearBevel(p, x, y, w, h, btnColor, g.background()); 918- drawClearBevel(p, x, y, w, h, btnColor, g.background());
897- 919-
898- p->setPen(g.text()); 920- p->setPen(g.text());
899- 921-
900- if (icontext == Icon){ // icon only 922- if (icontext == Icon){ // icon only
901- if (pixmap){ 923- if (pixmap){
902- dx = ( w - pixmap->width() ) / 2; 924- dx = ( w - pixmap->width() ) / 2;
903- dy = ( h - pixmap->height() ) / 2; 925- dy = ( h - pixmap->height() ) / 2;
904- if ( sunken ) 926- if ( sunken )
905- { 927- {
906- ++dx; 928- ++dx;
907- ++dy; 929- ++dy;
908- } 930- }
909- p->drawPixmap( x+dx, y+dy, *pixmap ); 931- p->drawPixmap( x+dx, y+dy, *pixmap );
910- } 932- }
911- } 933- }
912- else if (icontext == IconTextRight){ // icon and text (if any) 934- else if (icontext == IconTextRight){ // icon and text (if any)
913- if (pixmap){ 935- if (pixmap){
914- dx = 4; 936- dx = 4;
915- dy = ( h - pixmap->height() ) / 2; 937- dy = ( h - pixmap->height() ) / 2;
916- if ( sunken ){ 938- if ( sunken ){
917- ++dx; 939- ++dx;
918- ++dy; 940- ++dy;
919- } 941- }
920- p->drawPixmap( x+dx, y+dy, *pixmap ); 942- p->drawPixmap( x+dx, y+dy, *pixmap );
921- } 943- }
922- if (!btext.isNull()){ 944- if (!btext.isNull()){
923- int tf = AlignVCenter|AlignLeft; 945- int tf = AlignVCenter|AlignLeft;
924- if (pixmap) 946- if (pixmap)
925- dx= 4 + pixmap->width() + 2; 947- dx= 4 + pixmap->width() + 2;
926- else 948- else
927- dx= 4; 949- dx= 4;
928- dy = 0; 950- dy = 0;
929- if ( sunken ){ 951- if ( sunken ){
930- ++dx; 952- ++dx;
931- ++dy; 953- ++dy;
932- } 954- }
933- if (font) 955- if (font)
934- p->setFont(*font); 956- p->setFont(*font);
935- if(raised) 957- if(raised)
936- p->setPen(KGlobalSettings::toolBarHighlightColor()); 958- p->setPen(KGlobalSettings::toolBarHighlightColor());
937- p->drawText(x+dx, y+dy, w-dx, h, tf, btext); 959- p->drawText(x+dx, y+dy, w-dx, h, tf, btext);
938- } 960- }
939- } 961- }
940- else if (icontext == Text){ // only text, even if there is a icon 962- else if (icontext == Text){ // only text, even if there is a icon
941- if (!btext.isNull()){ 963- if (!btext.isNull()){
942- int tf = AlignVCenter|AlignLeft; 964- int tf = AlignVCenter|AlignLeft;
943- if (!enabled) 965- if (!enabled)
944- p->setPen(g.dark()); 966- p->setPen(g.dark());
945- dx= (w - fm.width(btext)) / 2; 967- dx= (w - fm.width(btext)) / 2;
946- dy= (h - fm.lineSpacing()) / 2; 968- dy= (h - fm.lineSpacing()) / 2;
947- if ( sunken ){ 969- if ( sunken ){
948- ++dx; 970- ++dx;
949- ++dy; 971- ++dy;
950- } 972- }
951- if (font) 973- if (font)
952- p->setFont(*font); 974- p->setFont(*font);
953- if(raised) 975- if(raised)
954- p->setPen(KGlobalSettings::toolBarHighlightColor()); 976- p->setPen(KGlobalSettings::toolBarHighlightColor());
955- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); 977- p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext);
956- } 978- }
957- } 979- }
958- else if (icontext == IconTextBottom){ 980- else if (icontext == IconTextBottom){
959- if (pixmap){ 981- if (pixmap){
960- dx = (w - pixmap->width()) / 2; 982- dx = (w - pixmap->width()) / 2;
961- dy = (h - fm.lineSpacing() - pixmap->height()) / 2; 983- dy = (h - fm.lineSpacing() - pixmap->height()) / 2;
962- if ( sunken ){ 984- if ( sunken ){
963- ++dx; 985- ++dx;
964- ++dy; 986- ++dy;
965- } 987- }
966- p->drawPixmap( x+dx, y+dy, *pixmap ); 988- p->drawPixmap( x+dx, y+dy, *pixmap );
967- } 989- }
968- if (!btext.isNull()){ 990- if (!btext.isNull()){
969- int tf = AlignBottom|AlignHCenter; 991- int tf = AlignBottom|AlignHCenter;
970- dy= pixmap->height(); 992- dy= pixmap->height();
971- dx = 2; 993- dx = 2;
972- if ( sunken ){ 994- if ( sunken ){
973- ++dx; 995- ++dx;
974- ++dy; 996- ++dy;
975- } 997- }
976- if (font) 998- if (font)
977- p->setFont(*font); 999- p->setFont(*font);
978- if(raised) 1000- if(raised)
979- p->setPen(KGlobalSettings::toolBarHighlightColor()); 1001- p->setPen(KGlobalSettings::toolBarHighlightColor());
980- p->drawText(x, y, w, h-3, tf, btext); 1002- p->drawText(x, y, w, h-3, tf, btext);
981- } 1003- }
982- } 1004- }
983- if (popup){ 1005- if (popup){
984- if (enabled) 1006- if (enabled)
985- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, 1007- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0,
986- g, true); 1008- g, true);
987- else 1009- else
988- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 1010- qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5,
989- 0, 0, g, false); 1011- 0, 0, g, false);
990+ if(active){ 1012+ if(active){
991+ x -= 2; // Bug in Qt/E 1013+ x -= 2; // Bug in Qt/E
992+ y -= 2; 1014+ y -= 2;
993+ w += 2; 1015+ w += 2;
994+ h += 2; 1016+ h += 2;
995 } 1017 }
996-} 1018-}
997-
998 1019
1020-
999-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, 1021-void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h,
1000- const QColorGroup &g, bool active, QMenuItem *mi, 1022- const QColorGroup &g, bool active, QMenuItem *mi,
1001- QBrush *) 1023- QBrush *)
1002-{ 1024-{
1003- if ( p->font() == KGlobalSettings::generalFont() ) 1025- if ( p->font() == KGlobalSettings::generalFont() )
1004- p->setFont( KGlobalSettings::menuFont() ); 1026- p->setFont( KGlobalSettings::menuFont() );
1005+ QWidget *parent = (QWidget *)p->device(); 1027+ QWidget *parent = (QWidget *)p->device();
1006+ p->setBrushOrigin(parent->pos()); 1028+ p->setBrushOrigin(parent->pos());
1007+ parent->erase(x, y, w, h); 1029+ parent->erase(x, y, w, h);
1008 1030
1009 if(menuHandler->useShadowText()){ 1031 if(menuHandler->useShadowText()){
1010 QColor shadow; 1032 QColor shadow;
1011 if(p->device() && p->device()->devType() == QInternal::Widget && 1033 if(p->device() && p->device()->devType() == QInternal::Widget &&
1012- ((QWidget *)p->device())->inherits("KMenuBar")){ 1034- ((QWidget *)p->device())->inherits("KMenuBar")){
1013- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1035- shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1014+ ((QWidget *)p->device())->inherits("QMenuBar")){ 1036+ ((QWidget *)p->device())->inherits("QMenuBar")){
1015+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : 1037+ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) :
1016 g.background().dark(130); 1038 g.background().dark(130);
1017 } 1039 }
1018 else 1040 else
1019@@ -2300,8 +2054,8 @@ 1041@@ -2300,8 +2055,8 @@
1020 } 1042 }
1021 1043
1022 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, 1044 void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h,
1023- const QColorGroup &g, int lineWidth, 1045- const QColorGroup &g, int lineWidth,
1024- const QBrush * fill) 1046- const QBrush * fill)
1025+ const QColorGroup &g, int /*lineWidth*/, 1047+ const QColorGroup &g, int /*lineWidth*/,
1026+ const QBrush * /*fill*/) 1048+ const QBrush * /*fill*/)
1027 { 1049 {
1028 QColor c; 1050 QColor c;
1029 switch(menuHandler->transType()){ 1051 switch(menuHandler->transType()){
1030@@ -2336,8 +2090,6 @@ 1052@@ -2336,8 +2091,6 @@
1031 1053
1032 maxpmw = QMAX( maxpmw, 20 ); 1054 maxpmw = QMAX( maxpmw, 20 );
1033 1055
1034- if ( p->font() == KGlobalSettings::generalFont() ) 1056- if ( p->font() == KGlobalSettings::generalFont() )
1035- p->setFont( KGlobalSettings::menuFont() ); 1057- p->setFont( KGlobalSettings::menuFont() );
1036 1058
1037 bool dis = !enabled; 1059 bool dis = !enabled;
1038 QColorGroup itemg = dis ? pal.disabled() : pal.active(); 1060 QColorGroup itemg = dis ? pal.disabled() : pal.active();
1039@@ -2363,7 +2115,7 @@ 1061@@ -2363,7 +2116,7 @@
1040 p->fillRect(x, y, w, h, menuBrush); 1062 p->fillRect(x, y, w, h, menuBrush);
1041 } 1063 }
1042 else{ 1064 else{
1043- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1065- KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1044+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); 1066+ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId());
1045 if(pix) 1067 if(pix)
1046 p->drawPixmap(x, y, *pix, x, y, w, h); 1068 p->drawPixmap(x, y, *pix, x, y, w, h);
1047 } 1069 }
1048@@ -2508,25 +2260,6 @@ 1070@@ -2508,25 +2261,6 @@
1049 return h; 1071 return h;
1050 } 1072 }
1051 1073
1052-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, 1074-void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h,
1053- const QColorGroup &g, QBrush *fill) 1075- const QColorGroup &g, QBrush *fill)
1054-{ 1076-{
1055- p->setPen(g.button().dark(130)); 1077- p->setPen(g.button().dark(130));
1056- p->drawRect(x, y, w, h); 1078- p->drawRect(x, y, w, h);
1057- p->setPen(g.button().light(120)); 1079- p->setPen(g.button().light(120));
1058- p->drawRect(x+1, y+1, w-2, h-2); 1080- p->drawRect(x+1, y+1, w-2, h-2);
1059- if(w >= 4 && h >= 4){ 1081- if(w >= 4 && h >= 4){
1060- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); 1082- QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb());
1061- if(!pix){ 1083- if(!pix){
1062- int h, s, v; 1084- int h, s, v;
1063- g.button().dark(120).hsv(&h, &s, &v); 1085- g.button().dark(120).hsv(&h, &s, &v);
1064- pix = new QPixmap(*bevelFillPix); 1086- pix = new QPixmap(*bevelFillPix);
1065- adjustHSV(*pix, h, s, v); 1087- adjustHSV(*pix, h, s, v);
1066- bevelFillDict.insert(g.button().dark(120).rgb(), pix); 1088- bevelFillDict.insert(g.button().dark(120).rgb(), pix);
1067- } 1089- }
1068- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); 1090- p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix);
1069- } 1091- }
1070-} 1092-}
1071 1093
1072 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, 1094 void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r,
1073 const QColorGroup &g, const QColor *c, 1095 const QColorGroup &g, const QColor *c,
1074@@ -2540,25 +2273,25 @@ 1096@@ -2540,25 +2274,25 @@
1075 return; 1097 return;
1076 } 1098 }
1077 else{ 1099 else{
1078- KStyle::drawFocusRect(p, r, g, c, atBorder); 1100- KStyle::drawFocusRect(p, r, g, c, atBorder);
1079+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 1101+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
1080 } 1102 }
1081 } 1103 }
1082 else 1104 else
1083- KStyle::drawFocusRect(p, r, g, c, atBorder); 1105- KStyle::drawFocusRect(p, r, g, c, atBorder);
1084+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); 1106+ QWindowsStyle::drawFocusRect(p, r, g, c, atBorder);
1085 1107
1086 } 1108 }
1087 1109
1088 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) 1110 void LiquidStyle::polishPopupMenu(QPopupMenu *mnu)
1089 { 1111 {
1090 mnu->installEventFilter(menuHandler); 1112 mnu->installEventFilter(menuHandler);
1091- KStyle::polishPopupMenu(mnu); 1113- KStyle::polishPopupMenu(mnu);
1092+ QWindowsStyle::polishPopupMenu(mnu); 1114+ QWindowsStyle::polishPopupMenu(mnu);
1093 } 1115 }
1094 1116
1095 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, 1117 void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
1096 bool selected) 1118 bool selected)
1097 { 1119 {
1098 if(tabBar->shape() != QTabBar::RoundedAbove){ 1120 if(tabBar->shape() != QTabBar::RoundedAbove){
1099- KStyle::drawTab(p, tabBar, tab, selected); 1121- KStyle::drawTab(p, tabBar, tab, selected);
1100+ QWindowsStyle::drawTab(p, tabBar, tab, selected); 1122+ QWindowsStyle::drawTab(p, tabBar, tab, selected);
1101 return; 1123 return;
1102 } 1124 }
1103 QPixmap tilePix; 1125 QPixmap tilePix;
1104@@ -2671,7 +2404,7 @@ 1126@@ -2671,7 +2405,7 @@
1105 vFrame = 8; // was 10 1127 vFrame = 8; // was 10
1106 } 1128 }
1107 else 1129 else
1108- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1130- KStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1109+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); 1131+ QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap);
1110 } 1132 }
1111 1133
1112 1134
1113@@ -2699,7 +2432,7 @@ 1135@@ -2699,7 +2433,7 @@
1114 p->drawLine(x+1, y+1, x+1, y2-1); 1136 p->drawLine(x+1, y+1, x+1, y2-1);
1115 } 1137 }
1116 else if(lineWidth != 2 || !sunken) 1138 else if(lineWidth != 2 || !sunken)
1117- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1139- KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1118+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); 1140+ QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill);
1119 else{ 1141 else{
1120 QPen oldPen = p->pen(); 1142 QPen oldPen = p->pen();
1121 int x2 = x+w-1; 1143 int x2 = x+w-1;
1122@@ -2726,105 +2459,6 @@ 1144@@ -2726,105 +2460,6 @@
1123 } 1145 }
1124 } 1146 }
1125 1147
1126-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, 1148-void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h,
1127- const QColorGroup &g, QBrush *) 1149- const QColorGroup &g, QBrush *)
1128-{ 1150-{
1129- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); 1151- p->fillRect(x, y, w, h, g.brush(QColorGroup::Background));
1130- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? 1152- drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ?
1131- g.button().light(120) : g.button(), g.button()); 1153- g.button().light(120) : g.button(), g.button());
1132- /* 1154- /*
1133- if(h > w){ 1155- if(h > w){
1134- int y2 = y+h-1; 1156- int y2 = y+h-1;
1135- 1157-
1136- p->setPen(g.light()); 1158- p->setPen(g.light());
1137- 1159-
1138- p->drawLine(x+1, y+2, x+1, y2-2); 1160- p->drawLine(x+1, y+2, x+1, y2-2);
1139- p->drawLine(x+4, y+2, x+4, y2-2); 1161- p->drawLine(x+4, y+2, x+4, y2-2);
1140- 1162-
1141- p->setPen(g.dark()); 1163- p->setPen(g.dark());
1142- p->drawLine(x+2, y+2, x+2, y2-2); 1164- p->drawLine(x+2, y+2, x+2, y2-2);
1143- p->drawLine(x+5, y+2, x+5, y2-2); 1165- p->drawLine(x+5, y+2, x+5, y2-2);
1144- 1166-
1145- } 1167- }
1146- else{ 1168- else{
1147- int x2 = x+w-1; 1169- int x2 = x+w-1;
1148- 1170-
1149- p->setPen(g.light()); 1171- p->setPen(g.light());
1150- 1172-
1151- p->drawLine(x+2, y+1, x2-2, y+1); 1173- p->drawLine(x+2, y+1, x2-2, y+1);
1152- p->drawLine(x+2, y+4, x2-2, y+4); 1174- p->drawLine(x+2, y+4, x2-2, y+4);
1153- 1175-
1154- p->setPen(g.dark()); 1176- p->setPen(g.dark());
1155- p->drawLine(x+2, y+2, x2-2, y+2); 1177- p->drawLine(x+2, y+2, x2-2, y+2);
1156- p->drawLine(x+2, y+5, x2-2, y+5); 1178- p->drawLine(x+2, y+5, x2-2, y+5);
1157- }*/ 1179- }*/
1158- 1180-
1159-} 1181-}
1160- 1182-
1161-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, 1183-void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h,
1162- const QColorGroup &g, 1184- const QColorGroup &g,
1163- const QString &text, bool sunken, 1185- const QString &text, bool sunken,
1164- QPixmap *pixmap, QBrush *) 1186- QPixmap *pixmap, QBrush *)
1165-{ 1187-{
1166- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); 1188- p->fillRect(x, y, w, h, g.brush(QColorGroup::Button));
1167- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); 1189- drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button());
1168- p->setPen(g.buttonText()); // Kicker doesn't set this ;-) 1190- p->setPen(g.buttonText()); // Kicker doesn't set this ;-)
1169- 1191-
1170- if(text.isNull() && !pixmap) 1192- if(text.isNull() && !pixmap)
1171- return; 1193- return;
1172- 1194-
1173- const int pxWidth = 20; 1195- const int pxWidth = 20;
1174- int textPos = pxWidth; 1196- int textPos = pxWidth;
1175- QRect br(buttonRect(x, y, w, h)); 1197- QRect br(buttonRect(x, y, w, h));
1176- 1198-
1177- if (sunken) 1199- if (sunken)
1178- p->translate(1,1); 1200- p->translate(1,1);
1179- 1201-
1180- if ( pixmap && !pixmap->isNull() ) { 1202- if ( pixmap && !pixmap->isNull() ) {
1181- int dx = ( pxWidth - pixmap->width() ) / 2; 1203- int dx = ( pxWidth - pixmap->width() ) / 2;
1182- int dy = ( h - pixmap->height() ) / 2; 1204- int dy = ( h - pixmap->height() ) / 2;
1183- p->drawPixmap( br.x()+dx, dy, *pixmap ); 1205- p->drawPixmap( br.x()+dx, dy, *pixmap );
1184- } 1206- }
1185- 1207-
1186- QString s = text; 1208- QString s = text;
1187- static const QString &modStr = KGlobal::staticQString( 1209- static const QString &modStr = KGlobal::staticQString(
1188- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); 1210- QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]"));
1189- 1211-
1190- int modStrPos = s.find(modStr); 1212- int modStrPos = s.find(modStr);
1191- 1213-
1192- if (-1 != modStrPos) { 1214- if (-1 != modStrPos) {
1193- 1215-
1194- // +1 because we include a space after the closing brace. 1216- // +1 because we include a space after the closing brace.
1195- s.remove(modStrPos, modStr.length()+1); 1217- s.remove(modStrPos, modStr.length()+1);
1196- 1218-
1197- QPixmap modPixmap = SmallIcon("modified"); 1219- QPixmap modPixmap = SmallIcon("modified");
1198- 1220-
1199- int dx = (pxWidth - modPixmap.width()) / 2; 1221- int dx = (pxWidth - modPixmap.width()) / 2;
1200- int dy = (h - modPixmap.height()) / 2; 1222- int dy = (h - modPixmap.height()) / 2;
1201- 1223-
1202- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); 1224- p->drawPixmap(br.x() + textPos + dx, dy, modPixmap);
1203- 1225-
1204- textPos += pxWidth; 1226- textPos += pxWidth;
1205- } 1227- }
1206- 1228-
1207- if (!s.isEmpty()){ 1229- if (!s.isEmpty()){
1208- if (p->fontMetrics().width(s) > br.width() - textPos) { 1230- if (p->fontMetrics().width(s) > br.width() - textPos) {
1209- 1231-
1210- int maxLen = br.width() - textPos - p->fontMetrics().width("..."); 1232- int maxLen = br.width() - textPos - p->fontMetrics().width("...");
1211- 1233-
1212- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) 1234- while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen))
1213- s.truncate(s.length() - 1); 1235- s.truncate(s.length() - 1);
1214- 1236-
1215- s.append("..."); 1237- s.append("...");
1216- } 1238- }
1217- 1239-
1218- p->setPen(g.buttonText()); 1240- p->setPen(g.buttonText());
1219- 1241-
1220- p->drawText(br.x()+ textPos, -1, w-textPos, h, 1242- p->drawText(br.x()+ textPos, -1, w-textPos, h,
1221- AlignLeft|AlignVCenter, s); 1243- AlignLeft|AlignVCenter, s);
1222- } 1244- }
1223- 1245-
1224-} 1246-}
1225 1247
1226 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) 1248 void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v)
1227 { 1249 {
1228@@ -2998,22 +2632,22 @@ 1250@@ -2998,22 +2633,22 @@
1229 customBtnIconList.clear(); 1251 customBtnIconList.clear();
1230 customBtnLabelList.clear(); 1252 customBtnLabelList.clear();
1231 1253
1232- KConfig *config = KGlobal::config(); 1254- KConfig *config = KGlobal::config();
1233- QString oldGrp = config->group(); 1255- QString oldGrp = config->group();
1234- config->setGroup("MosfetButtons"); 1256- config->setGroup("MosfetButtons");
1235+// KConfig *config = KGlobal::config(); 1257+// KConfig *config = KGlobal::config();
1236+// QString oldGrp = config->group(); 1258+// QString oldGrp = config->group();
1237+// config->setGroup("MosfetButtons"); 1259+// config->setGroup("MosfetButtons");
1238 1260
1239 QStrList iconList, colorList; //temp, we store QPixmaps and QColors 1261 QStrList iconList, colorList; //temp, we store QPixmaps and QColors
1240 iconList.setAutoDelete(true); 1262 iconList.setAutoDelete(true);
1241 colorList.setAutoDelete(true); 1263 colorList.setAutoDelete(true);
1242- config->readListEntry("Labels", customBtnLabelList); 1264- config->readListEntry("Labels", customBtnLabelList);
1243- config->readListEntry("Icons", iconList); 1265- config->readListEntry("Icons", iconList);
1244- config->readListEntry("Colors", colorList); 1266- config->readListEntry("Colors", colorList);
1245+// config->readListEntry("Labels", customBtnLabelList); 1267+// config->readListEntry("Labels", customBtnLabelList);
1246+// config->readListEntry("Icons", iconList); 1268+// config->readListEntry("Icons", iconList);
1247+// config->readListEntry("Colors", colorList); 1269+// config->readListEntry("Colors", colorList);
1248 1270
1249 const char *labelStr = customBtnLabelList.first(); 1271 const char *labelStr = customBtnLabelList.first();
1250 const char *colorStr = colorList.first(); 1272 const char *colorStr = colorList.first();
1251 const char *iconStr = iconList.first(); 1273 const char *iconStr = iconList.first();
1252 1274
1253- KIconLoader *ldr = KGlobal::iconLoader(); 1275- KIconLoader *ldr = KGlobal::iconLoader();
1254+// KIconLoader *ldr = KGlobal::iconLoader(); 1276+// KIconLoader *ldr = KGlobal::iconLoader();
1255 while(labelStr != NULL){ 1277 while(labelStr != NULL){
1256 QColor *c = new QColor; 1278 QColor *c = new QColor;
1257 c->setNamedColor(QString(colorStr)); 1279 c->setNamedColor(QString(colorStr));
1258@@ -3022,7 +2656,7 @@ 1280@@ -3022,7 +2657,7 @@
1259 QString tmpStr(iconStr); 1281 QString tmpStr(iconStr);
1260 if(!tmpStr.isEmpty()){ 1282 if(!tmpStr.isEmpty()){
1261 QPixmap *pixmap = 1283 QPixmap *pixmap =
1262- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); 1284- new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small));
1263+ new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); 1285+ new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small));
1264 if(pixmap->isNull()){ 1286 if(pixmap->isNull()){
1265 delete pixmap; 1287 delete pixmap;
1266 customBtnIconList.append(NULL); 1288 customBtnIconList.append(NULL);
1267@@ -3037,7 +2671,6 @@ 1289@@ -3037,7 +2672,6 @@
1268 colorStr = colorList.next(); 1290 colorStr = colorList.next();
1269 iconStr = iconList.next(); 1291 iconStr = iconList.next();
1270 } 1292 }
1271- config->setGroup(oldGrp); 1293- config->setGroup(oldGrp);
1272 } 1294 }
1273 1295
1274 void LiquidStyle::applyCustomAttributes(QPushButton *btn) 1296 void LiquidStyle::applyCustomAttributes(QPushButton *btn)
1275@@ -3087,7 +2720,7 @@ 1297@@ -3087,7 +2721,7 @@
1276 } 1298 }
1277 } 1299 }
1278 1300
1279-#include "liquid.moc" 1301-#include "liquid.moc"
1280+// #include "liquid.moc" 1302+// #include "liquid.moc"
1281 1303
1282 1304
1283 1305
1284 --- -Mon Jul 15 02:34:13 2002 1306 --- -Sat Sep 21 05:31:48 2002
1285 +++ plugin.cppFri Jul 12 00:41:40 2002 1307 +++ plugin.cppMon Jul 8 02:42:56 2002
1286@@ -1,29 +1,113 @@ 1308@@ -1,29 +1,113 @@
1287 #include "liquid.h" 1309 #include "liquid.h"
1288-#include <klocale.h> 1310-#include <klocale.h>
1289+#include "liquidset.h" 1311+#include "liquidset.h"
1290+#include "plugin.h" 1312+#include "plugin.h"
1291 1313
1292-extern "C" { 1314-extern "C" {
1293- KStyle* allocate(); 1315- KStyle* allocate();
1294- int minor_version(); 1316- int minor_version();
1295- int major_version(); 1317- int major_version();
1296- const char *description(); 1318- const char *description();
1297+ 1319+
1298+ 1320+
1299+LiquidInterface::LiquidInterface ( ) : ref ( 0 ) 1321+LiquidInterface::LiquidInterface ( ) : ref ( 0 )
1300+{ 1322+{
1301+} 1323+}
1302+ 1324+
1303+LiquidInterface::~LiquidInterface ( ) 1325+LiquidInterface::~LiquidInterface ( )
1304+{ 1326+{
1305+} 1327+}
1306+ 1328+
1307+QStyle *LiquidInterface::create ( ) 1329+QStyle *LiquidInterface::create ( )
1308+{ 1330+{
1309 +return new LiquidStyle ( ); 1331 +return new LiquidStyle ( );
1310+} 1332+}
1311+ 1333+
1312+QString LiquidInterface::name ( ) 1334+QString LiquidInterface::name ( )
1313+{ 1335+{
1314 +return QObject::tr( "Liquid", "name" ); 1336 +return QObject::tr( "Liquid", "name" );
1315 } 1337 }
1316 1338
1317-KStyle* allocate() 1339-KStyle* allocate()
1318+QString LiquidInterface::description ( ) 1340+QString LiquidInterface::description ( )
1319 { 1341 {
1320- return(new LiquidStyle); 1342- return(new LiquidStyle);
1321 +return QObject::tr( "High Performance Liquid style by Mosfet", "description" ); 1343 +return QObject::tr( "High Performance Liquid style by Mosfet", "description" );
1322 } 1344 }
1323 1345
1324-int minor_version() 1346-int minor_version()
1325+QCString LiquidInterface::key ( ) 1347+QCString LiquidInterface::key ( )
1326 { 1348 {
1327- return(0); 1349- return(0);
1328 +return QCString ( "liquid" ); 1350 +return QCString ( "liquid" );
1329 } 1351 }
1330 1352
1331-int major_version() 1353-int major_version()
1332+unsigned int LiquidInterface::version ( ) 1354+unsigned int LiquidInterface::version ( )
1333 { 1355 {
1334- return(1); 1356- return(1);
1335 +return 100; // 1.0.0 (\d+.\d.\d) 1357 +return 100; // 1.0.0 (\d+.\d.\d)
1336 } 1358 }
1337 1359
1338-const char *description() 1360-const char *description()
1339+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 1361+QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
1340+{ 1362+{
1341 +static LiquidSettingsInterface *setiface = 0; 1363 +static LiquidSettingsInterface *setiface = 0;
1342+ 1364+
1343 +*iface = 0; 1365 +*iface = 0;
1344 + 1366 +
1345 +if ( uuid == IID_QUnknown ) 1367 +if ( uuid == IID_QUnknown )
1346 + *iface = this; 1368 + *iface = this;
1347 +else if ( uuid == IID_Style ) 1369 +else if ( uuid == IID_Style )
1348 + *iface = this; 1370 + *iface = this;
1349 +else if ( uuid == IID_StyleSettings ) { 1371 +else if ( uuid == IID_StyleSettings ) {
1350 + if ( !setiface ) 1372 + if ( !setiface )
1351 + setiface = new LiquidSettingsInterface ( ); 1373 + setiface = new LiquidSettingsInterface ( );
1352 + *iface = setiface; 1374 + *iface = setiface;
1353 +} 1375 +}
1354 + 1376 +
1355 +if ( *iface ) 1377 +if ( *iface )
1356 + (*iface)-> addRef ( ); 1378 + (*iface)-> addRef ( );
1357 + 1379 +
1358 +return QS_OK; 1380 +return QS_OK;
1359+} 1381+}
1360+ 1382+
1361+Q_EXPORT_INTERFACE() 1383+Q_EXPORT_INTERFACE()
1362+{ 1384+{
1363 +Q_CREATE_INSTANCE( LiquidInterface ) 1385 +Q_CREATE_INSTANCE( LiquidInterface )
1364+} 1386+}
1365+ 1387+
1366+ 1388+
1367+LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) 1389+LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 )
1368 { 1390 {
1369- return(i18n("High performance liquid plugin").utf8()); 1391- return(i18n("High performance liquid plugin").utf8());
1370 +m_widget = 0; 1392 +m_widget = 0;
1371 } 1393 }
1372+ 1394+
1373+LiquidSettingsInterface::~LiquidSettingsInterface ( ) 1395+LiquidSettingsInterface::~LiquidSettingsInterface ( )
1374+{ 1396+{
1375+} 1397+}
1376+ 1398+
1377+QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) 1399+QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name )
1378+{ 1400+{
1379 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); 1401 +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" );
1380 + 1402 +
1381 +return m_widget; 1403 +return m_widget;
1382+} 1404+}
1383+ 1405+
1384+bool LiquidSettingsInterface::accept ( ) 1406+bool LiquidSettingsInterface::accept ( )
1385+{ 1407+{
1386 +if ( !m_widget ) 1408 +if ( !m_widget )
1387 + return false; 1409 + return false;
1388+ 1410+
1389 +return m_widget-> writeConfig ( ); 1411 +return m_widget-> writeConfig ( );
1390+} 1412+}
1391+ 1413+
1392+void LiquidSettingsInterface::reject ( ) 1414+void LiquidSettingsInterface::reject ( )
1393+{ 1415+{
1394+} 1416+}
1395+ 1417+
1396+QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 1418+QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
1397+{ 1419+{
1398 +*iface = 0; 1420 +*iface = 0;
1399 + 1421 +
1400 + 1422 +
1401 +if ( uuid == IID_QUnknown ) 1423 +if ( uuid == IID_QUnknown )
1402 + *iface = this; 1424 + *iface = this;
1403 +else if ( uuid == IID_StyleSettings ) 1425 +else if ( uuid == IID_StyleSettings )
1404 + *iface = this; 1426 + *iface = this;
1405 + 1427 +
1406 +if ( *iface ) 1428 +if ( *iface )
1407 + (*iface)-> addRef ( ); 1429 + (*iface)-> addRef ( );
1408 + 1430 +
1409 +return QS_OK; 1431 +return QS_OK;
1410+} 1432+}
1411+ 1433+
1412+// Hack for Retail Z experiments 1434+// Hack for Retail Z experiments
1413+extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } 1435+extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } }