summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 4013981..eb1ec6e 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,1184 +1,1182 @@
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#include <qprogressbar.h> 33#include <qprogressbar.h>
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 }
142 } 141 }
143 } 142 }
144 else if(ev->type() == QEvent::Hide){ 143 else if(ev->type() == QEvent::Hide){
145 if(type == TransStippleBg || type == TransStippleBtn || 144 if(type == TransStippleBg || type == TransStippleBtn ||
146 type == Custom){ 145 type == Custom){
147// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 146// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
148 147
149 pixDict.remove(p->winId()); 148 pixDict.remove(p->winId());
150 if (!p->inherits("QPopupMenu")) { 149 if ( !p->inherits("QPopupMenu"))
151 p->setBackgroundMode(QWidget::PaletteBackground); 150 p->setBackgroundMode(QWidget::PaletteBackground);
152 151
153 QObjectList *ol = p-> queryList("QWidget"); 152 QObjectList *ol = p-> queryList("QWidget");
154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 153 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
155 QWidget *wid = (QWidget *) it.current ( ); 154 QWidget *wid = (QWidget *) it.current ( );
156 155
157 wid-> setBackgroundMode( QWidget::PaletteBackground ); 156 wid-> setBackgroundMode( QWidget::PaletteBackground );
158 }
159 delete ol;
160 } 157 }
158 delete ol;
161 } 159 }
162 } 160 }
163 return(false); 161 return(false);
164} 162}
165 163
166 164
167LiquidStyle::LiquidStyle() 165LiquidStyle::LiquidStyle()
168 :QWindowsStyle() 166 :QWindowsStyle()
169{ 167{
170 setName ( "LiquidStyle" ); 168 setName ( "LiquidStyle" );
171 169
172 flatTBButtons = false; 170 flatTBButtons = false;
173 171
174 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 172 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
175 btnMaskBmp.setMask(btnMaskBmp); 173 btnMaskBmp.setMask(btnMaskBmp);
176 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 174 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
177 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 175 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
178 headerHoverID = -1; 176 headerHoverID = -1;
179 highlightWidget = NULL; 177 highlightWidget = NULL;
180 setButtonDefaultIndicatorWidth(0); 178 setButtonDefaultIndicatorWidth(0);
181 btnDict.setAutoDelete(true); 179 btnDict.setAutoDelete(true);
182 bevelFillDict.setAutoDelete(true); 180 bevelFillDict.setAutoDelete(true);
183 smallBevelFillDict.setAutoDelete(true); 181 smallBevelFillDict.setAutoDelete(true);
184 customBtnColorList.setAutoDelete(true); 182 customBtnColorList.setAutoDelete(true);
185 customBtnIconList.setAutoDelete(true); 183 customBtnIconList.setAutoDelete(true);
186 customBtnLabelList.setAutoDelete(true); 184 customBtnLabelList.setAutoDelete(true);
187 185
188 rMatrix.rotate(270.0); 186 rMatrix.rotate(270.0);
189 highcolor = QPixmap::defaultDepth() > 8; 187 highcolor = QPixmap::defaultDepth() > 8;
190 btnBorderPix = new QPixmap; 188 btnBorderPix = new QPixmap;
191 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 189 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
192 btnBlendPix = new QPixmap; 190 btnBlendPix = new QPixmap;
193 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 191 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
194 bevelFillPix = new QPixmap; 192 bevelFillPix = new QPixmap;
195 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 193 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
196 smallBevelFillPix = new QPixmap; 194 smallBevelFillPix = new QPixmap;
197 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 195 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
198 // new stuff 196 // new stuff
199 vsbSliderFillPix = menuPix = NULL; 197 vsbSliderFillPix = menuPix = NULL;
200 menuHandler = new TransMenuHandler(this); 198 menuHandler = new TransMenuHandler(this);
201 setScrollBarExtent(15, 15); 199 setScrollBarExtent(15, 15);
202 int i; 200 int i;
203 for(i=0; i < BITMAP_ITEMS; ++i){ 201 for(i=0; i < BITMAP_ITEMS; ++i){
204 pixmaps[i] = NULL; 202 pixmaps[i] = NULL;
205 } 203 }
206 oldSliderThickness = sliderThickness(); 204 oldSliderThickness = sliderThickness();
207 setSliderThickness(11); 205 setSliderThickness(11);
208} 206}
209 207
210LiquidStyle::~LiquidStyle() 208LiquidStyle::~LiquidStyle()
211{ 209{
212 if(btnBorderPix) 210 if(btnBorderPix)
213 delete btnBorderPix; 211 delete btnBorderPix;
214 if(btnBlendPix) 212 if(btnBlendPix)
215 delete btnBlendPix; 213 delete btnBlendPix;
216 if(bevelFillPix) 214 if(bevelFillPix)
217 delete bevelFillPix; 215 delete bevelFillPix;
218 if(smallBevelFillPix) 216 if(smallBevelFillPix)
219 delete smallBevelFillPix; 217 delete smallBevelFillPix;
220 if(vsbSliderFillPix) 218 if(vsbSliderFillPix)
221 delete vsbSliderFillPix; 219 delete vsbSliderFillPix;
222 if(menuPix) 220 if(menuPix)
223 delete menuPix; 221 delete menuPix;
224 222
225 setScrollBarExtent(16, 16); 223 setScrollBarExtent(16, 16);
226 setSliderThickness(oldSliderThickness); 224 setSliderThickness(oldSliderThickness);
227 int i; 225 int i;
228 for(i=0; i < BITMAP_ITEMS; ++i){ 226 for(i=0; i < BITMAP_ITEMS; ++i){
229 if(pixmaps[i]) 227 if(pixmaps[i])
230 delete pixmaps[i]; 228 delete pixmaps[i];
231 } 229 }
232} 230}
233 231
234void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, 232void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h,
235 const QColor &c, const QColor &bg) 233 const QColor &c, const QColor &bg)
236{ 234{
237 235
238 QPen oldPen = p->pen(); // headers need this 236 QPen oldPen = p->pen(); // headers need this
239 int x2 = x+w-1; 237 int x2 = x+w-1;
240 int y2 = y+h-1; 238 int y2 = y+h-1;
241 // outer dark rect 239 // outer dark rect
242 p->setPen(c.dark(130)); 240 p->setPen(c.dark(130));
243 p->drawLine(x, y+2, x, y2-2); // l 241 p->drawLine(x, y+2, x, y2-2); // l
244 p->drawLine(x2, y+2, x2, y2-2); // r 242 p->drawLine(x2, y+2, x2, y2-2); // r
245 p->drawLine(x+2, y, x2-2, y); // t 243 p->drawLine(x+2, y, x2-2, y); // t
246 p->drawLine(x+2, y2, x2-2, y2); // b 244 p->drawLine(x+2, y2, x2-2, y2); // b
247 p->drawPoint(x+1, y+1); // tl 245 p->drawPoint(x+1, y+1); // tl
248 p->drawPoint(x2-1, y+1); // tr 246 p->drawPoint(x2-1, y+1); // tr
249 p->drawPoint(x+1, y2-1); // bl 247 p->drawPoint(x+1, y2-1); // bl
250 p->drawPoint(x2-1, y2-1); // br 248 p->drawPoint(x2-1, y2-1); // br
251 249
252 // inner top light lines 250 // inner top light lines
253 p->setPen(c.light(105)); 251 p->setPen(c.light(105));
254 p->drawLine(x+2, y+1, x2-2, y+1); 252 p->drawLine(x+2, y+1, x2-2, y+1);
255 p->drawLine(x+1, y+2, x2-1, y+2); 253 p->drawLine(x+1, y+2, x2-1, y+2);
256 p->drawLine(x+1, y+3, x+2, y+3); 254 p->drawLine(x+1, y+3, x+2, y+3);
257 p->drawLine(x2-2, y+3, x2-1, y+3); 255 p->drawLine(x2-2, y+3, x2-1, y+3);
258 p->drawPoint(x+1, y+4); 256 p->drawPoint(x+1, y+4);
259 p->drawPoint(x2-1, y+4); 257 p->drawPoint(x2-1, y+4);
260 258
261 // inner bottom light lines 259 // inner bottom light lines
262 p->setPen(c.light(110)); 260 p->setPen(c.light(110));
263 p->drawLine(x+2, y2-1, x2-2, y2-1); 261 p->drawLine(x+2, y2-1, x2-2, y2-1);
264 p->drawLine(x+1, y2-2, x2-1, y2-2); 262 p->drawLine(x+1, y2-2, x2-1, y2-2);
265 p->drawLine(x+1, y2-3, x+2, y2-3); 263 p->drawLine(x+1, y2-3, x+2, y2-3);
266 p->drawLine(x2-2, y2-3, x2-1, y2-3); 264 p->drawLine(x2-2, y2-3, x2-1, y2-3);
267 p->drawPoint(x+1, y2-4); 265 p->drawPoint(x+1, y2-4);
268 p->drawPoint(x2-1, y2-4); 266 p->drawPoint(x2-1, y2-4);
269 267
270 // inner left mid lines 268 // inner left mid lines
271 //p->setPen(c.light(105)); 269 //p->setPen(c.light(105));
272 p->setPen(c); 270 p->setPen(c);
273 p->drawLine(x+1, y+5, x+1, y2-5); 271 p->drawLine(x+1, y+5, x+1, y2-5);
274 p->drawLine(x+2, y+4, x+2, y2-4); 272 p->drawLine(x+2, y+4, x+2, y2-4);
275 273
276 // inner right mid lines 274 // inner right mid lines
277 p->drawLine(x2-1, y+5, x2-1, y2-5); 275 p->drawLine(x2-1, y+5, x2-1, y2-5);
278 p->drawLine(x2-2, y+4, x2-2, y2-4); 276 p->drawLine(x2-2, y+4, x2-2, y2-4);
279 277
280 // fill 278 // fill
281 QPixmap *pix; 279 QPixmap *pix;
282 if(h >= 32){ 280 if(h >= 32){
283 pix = bevelFillDict.find(c.rgb()); 281 pix = bevelFillDict.find(c.rgb());
284 if(!pix){ 282 if(!pix){
285 int h, s, v; 283 int h, s, v;
286 c.hsv(&h, &s, &v); 284 c.hsv(&h, &s, &v);
287 pix = new QPixmap(*bevelFillPix); 285 pix = new QPixmap(*bevelFillPix);
288 adjustHSV(*pix, h, s, v); 286 adjustHSV(*pix, h, s, v);
289 bevelFillDict.insert(c.rgb(), pix); 287 bevelFillDict.insert(c.rgb(), pix);
290 } 288 }
291 } 289 }
292 else{ 290 else{
293 pix = smallBevelFillDict.find(c.rgb()); 291 pix = smallBevelFillDict.find(c.rgb());
294 if(!pix){ 292 if(!pix){
295 int h, s, v; 293 int h, s, v;
296 c.hsv(&h, &s, &v); 294 c.hsv(&h, &s, &v);
297 pix = new QPixmap(*smallBevelFillPix); 295 pix = new QPixmap(*smallBevelFillPix);
298 adjustHSV(*pix, h, s, v); 296 adjustHSV(*pix, h, s, v);
299 smallBevelFillDict.insert(c.rgb(), pix); 297 smallBevelFillDict.insert(c.rgb(), pix);
300 } 298 }
301 } 299 }
302 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix); 300 p->drawTiledPixmap(x+3, y+3, w-6, h-6, *pix);
303 // blend 301 // blend
304 int red, green, blue; 302 int red, green, blue;
305 QColor btnColor(c.dark(130)); 303 QColor btnColor(c.dark(130));
306 red = (btnColor.red() >> 1) + (bg.red() >> 1); 304 red = (btnColor.red() >> 1) + (bg.red() >> 1);
307 green = (btnColor.green() >> 1) + (bg.green() >> 1); 305 green = (btnColor.green() >> 1) + (bg.green() >> 1);
308 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1); 306 blue = (btnColor.blue() >> 1) + (bg.blue() >> 1);
309 btnColor.setRgb(red, green, blue); 307 btnColor.setRgb(red, green, blue);
310 308
311 p->setPen(btnColor); 309 p->setPen(btnColor);
312 p->drawPoint(x+1, y); 310 p->drawPoint(x+1, y);
313 p->drawPoint(x, y+1); 311 p->drawPoint(x, y+1);
314 p->drawPoint(x+1, y2); 312 p->drawPoint(x+1, y2);
315 p->drawPoint(x, y2-1); 313 p->drawPoint(x, y2-1);
316 314
317 p->drawPoint(x2-1, y); 315 p->drawPoint(x2-1, y);
318 p->drawPoint(x2, y+1); 316 p->drawPoint(x2, y+1);
319 p->drawPoint(x2-1, y2); 317 p->drawPoint(x2-1, y2);
320 p->drawPoint(x2, y2-1); 318 p->drawPoint(x2, y2-1);
321 319
322 p->setPen(oldPen); 320 p->setPen(oldPen);
323 321
324} 322}
325 323
326void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, 324void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
327 const QColor &back, int x, int y, int w, int h, 325 const QColor &back, int x, int y, int w, int h,
328 bool supportPushDown, bool pushedDown, 326 bool supportPushDown, bool pushedDown,
329 bool autoDefault, bool isMasked) 327 bool autoDefault, bool isMasked)
330{ 328{
331 if(w < 21 || h < 21){ 329 if(w < 21 || h < 21){
332 drawClearBevel(painter, x, y, w, h, c, back); 330 drawClearBevel(painter, x, y, w, h, c, back);
333 return; 331 return;
334 } 332 }
335 if(supportPushDown){ 333 if(supportPushDown){
336 --w, --h; 334 --w, --h;
337 } 335 }
338 /* We don't make the round buttons smaller, since they don't look as good 336 /* We don't make the round buttons smaller, since they don't look as good
339 if(autoDefault){ 337 if(autoDefault){
340 w = w-buttonDefaultIndicatorWidth()*2; 338 w = w-buttonDefaultIndicatorWidth()*2;
341 h = h-buttonDefaultIndicatorWidth()*2; 339 h = h-buttonDefaultIndicatorWidth()*2;
342 }*/ 340 }*/
343 341
344 342
345 QPixmap *pix = btnDict.find(c.rgb()); 343 QPixmap *pix = btnDict.find(c.rgb());
346 if(!pix){ 344 if(!pix){
347 int h, s, v; 345 int h, s, v;
348 c.hsv(&h, &s, &v); 346 c.hsv(&h, &s, &v);
349 pix = new QPixmap(*btnBorderPix); 347 pix = new QPixmap(*btnBorderPix);
350 adjustHSV(*pix, h, s, v); 348 adjustHSV(*pix, h, s, v);
351 btnDict.insert(c.rgb(), pix); 349 btnDict.insert(c.rgb(), pix);
352 } 350 }
353 int x2 = x+w-1; 351 int x2 = x+w-1;
354 int y2 = y+h-1; 352 int y2 = y+h-1;
355 int bx2 = pix->width()-1; 353 int bx2 = pix->width()-1;
356 int by2 = pix->height()-1; 354 int by2 = pix->height()-1;
357 355
358 QPixmap tmpPix(w, h); 356 QPixmap tmpPix(w, h);
359 QPixmap tilePix; 357 QPixmap tilePix;
360 QPainter p; 358 QPainter p;
361 p.begin(&tmpPix); 359 p.begin(&tmpPix);
362 360
363 // do the fill 361 // do the fill
364 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 362 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
365 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 363 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 364 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 365 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
368 366
369 // edges 367 // edges
370 tilePix.resize(pix->width()-20, 10); 368 tilePix.resize(pix->width()-20, 10);
371 // top 369 // top
372 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 370 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
373 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 371 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
374 // bottom 372 // bottom
375 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 373 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20);
376 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 374 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
377 // left 375 // left
378 tilePix.resize(10, pix->height()-20); 376 tilePix.resize(10, pix->height()-20);
379 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 377 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
380 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 378 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
381 // right 379 // right
382 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 380 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20);
383 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 381 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
384 382
385 // middle 383 // middle
386 tilePix.resize(pix->width()-20, pix->height()-20); 384 tilePix.resize(pix->width()-20, pix->height()-20);
387 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20); 385 bitBlt(&tilePix, 0, 0, pix, 10, 10, pix->width()-20, pix->height()-20);
388 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix); 386 p.drawTiledPixmap(10, 10, w-20, h-20, tilePix);
389 387
390 388
391 // do the blend 389 // do the blend
392 QBitmap blendMask; 390 QBitmap blendMask;
393 if(!isMasked){ 391 if(!isMasked){
394 //QRgb bgRgb = back.rgb(); 392 //QRgb bgRgb = back.rgb();
395 //QRgb fgRgb = c.rgb(); 393 //QRgb fgRgb = c.rgb();
396 //int r, g, b; 394 //int r, g, b;
397 395
398 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25); 396 //r = (int)(qRed(bgRgb)*0.75 + qRed(fgRgb)*0.25);
399 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25); 397 //g = (int)(qGreen(bgRgb)*0.75 + qGreen(fgRgb)*0.25);
400 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25); 398 //b = (int)(qBlue(bgRgb)*0.75 + qBlue(fgRgb)*0.25);
401 //QColor blendColor(r, g, b); 399 //QColor blendColor(r, g, b);
402 int hue, sat, v1, v2; 400 int hue, sat, v1, v2;
403 QColor blendColor(autoDefault ? c : back); 401 QColor blendColor(autoDefault ? c : back);
404 back.hsv(&hue, &sat, &v1); 402 back.hsv(&hue, &sat, &v1);
405 blendColor.hsv(&hue, &sat, &v2); 403 blendColor.hsv(&hue, &sat, &v2);
406 if(v2 > v1) 404 if(v2 > v1)
407 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25)); 405 blendColor.setHsv(hue, sat, (int)(v1*0.75 + v2*0.25));
408 406
409 pix = btnBorderDict.find(blendColor.rgb()); 407 pix = btnBorderDict.find(blendColor.rgb());
410 if(!pix){ 408 if(!pix){
411 int h, s, v; 409 int h, s, v;
412 blendColor.hsv(&h, &s, &v); 410 blendColor.hsv(&h, &s, &v);
413 pix = new QPixmap(*btnBlendPix); 411 pix = new QPixmap(*btnBlendPix);
414 adjustHSV(*pix, h, s, v); 412 adjustHSV(*pix, h, s, v);
415 btnBorderDict.insert(blendColor.rgb(), pix); 413 btnBorderDict.insert(blendColor.rgb(), pix);
416 } 414 }
417 } 415 }
418 else{ 416 else{
419 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) : 417 pix = pushedDown ? getPixmap(HTMLBtnBorderDown) :
420 getPixmap(HTMLBtnBorder); 418 getPixmap(HTMLBtnBorder);
421 } 419 }
422 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl 420 p.drawPixmap(0, 0, *pix, 0, 0, 10, 10); // tl
423 p.drawPixmap(x2-9, 0, *pix, bx2-9, 0, 10, 10); // tr 421 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 422 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 423 p.drawPixmap(x2-9, y2-9, *pix, bx2-9, by2-9, 10, 10); // br
426 424
427 // edges 425 // edges
428 tilePix.resize(pix->width()-20, 10); 426 tilePix.resize(pix->width()-20, 10);
429 blendMask.resize(pix->width()-20, 10); 427 blendMask.resize(pix->width()-20, 10);
430 // top 428 // top
431 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10); 429 bitBlt(&tilePix, 0, 0, pix, 10, 0, pix->width()-20, 10);
432 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10); 430 bitBlt(&blendMask, 0, 0, pix->mask(), 10, 0, pix->width()-20, 10);
433 tilePix.setMask(blendMask); 431 tilePix.setMask(blendMask);
434 p.drawTiledPixmap(10, 0, w-20, 10, tilePix); 432 p.drawTiledPixmap(10, 0, w-20, 10, tilePix);
435 // bottom 433 // bottom
436 bitBlt(&tilePix, 0, 0, pix, 10, by2-9, pix->width()-20, 20); 434 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); 435 bitBlt(&blendMask, 0, 0, pix->mask(), 10, by2-9, pix->width()-20, 20);
438 tilePix.setMask(blendMask); 436 tilePix.setMask(blendMask);
439 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix); 437 p.drawTiledPixmap(10, y2-9, w-20, 10, tilePix);
440 // left 438 // left
441 tilePix.resize(10, pix->height()-20); 439 tilePix.resize(10, pix->height()-20);
442 blendMask.resize(10, pix->height()-20); 440 blendMask.resize(10, pix->height()-20);
443 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20); 441 bitBlt(&tilePix, 0, 0, pix, 0, 10, 10, pix->height()-20);
444 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20); 442 bitBlt(&blendMask, 0, 0, pix->mask(), 0, 10, 10, pix->height()-20);
445 tilePix.setMask(blendMask); 443 tilePix.setMask(blendMask);
446 p.drawTiledPixmap(0, 10, 10, h-20, tilePix); 444 p.drawTiledPixmap(0, 10, 10, h-20, tilePix);
447 // right 445 // right
448 bitBlt(&tilePix, 0, 0, pix, bx2-9, 10, 10, pix->height()-20); 446 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); 447 bitBlt(&blendMask, 0, 0, pix->mask(), bx2-9, 10, 10, pix->height()-20);
450 tilePix.setMask(blendMask); 448 tilePix.setMask(blendMask);
451 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix); 449 p.drawTiledPixmap(x2-9, 10, 10, h-20, tilePix);
452 450
453 p.end(); 451 p.end();
454 452
455 // do the button mask - we don't automask buttons 453 // do the button mask - we don't automask buttons
456 QBitmap btnMask(w, h); 454 QBitmap btnMask(w, h);
457 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp; 455 QBitmap *mask = isMasked ? &htmlBtnMaskBmp : &btnMaskBmp;
458 p.begin(&btnMask); 456 p.begin(&btnMask);
459 p.fillRect(0, 0, w, h, Qt::color0); 457 p.fillRect(0, 0, w, h, Qt::color0);
460 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl 458 p.drawPixmap(0, 0, *mask, 0, 0, 10, 10); // tl
461 p.drawPixmap(x2-9, 0, *mask, bx2-9, 0, 10, 10); // tr 459 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 460 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 461 p.drawPixmap(x2-9, y2-9, *mask, bx2-9, by2-9, 10, 10); // br
464 // fills 462 // fills
465 p.fillRect(10, 0, w-20, 10, Qt::color1); // top 463 p.fillRect(10, 0, w-20, 10, Qt::color1); // top
466 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom 464 p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom
467 p.fillRect(0, 10, w, h-20, Qt::color1); // middle 465 p.fillRect(0, 10, w, h-20, Qt::color1); // middle
468 p.end(); 466 p.end();
469 tmpPix.setMask(btnMask); 467 tmpPix.setMask(btnMask);
470 /*if(autoDefault){ 468 /*if(autoDefault){
471 if(supportPushDown && pushedDown){ 469 if(supportPushDown && pushedDown){
472 painter->drawPixmap(x+3, y+3, tmpPix); 470 painter->drawPixmap(x+3, y+3, tmpPix);
473 } 471 }
474 else{ 472 else{
475 painter->drawPixmap(x+2, y+2, tmpPix); 473 painter->drawPixmap(x+2, y+2, tmpPix);
476 } 474 }
477 } 475 }
478 else */if(supportPushDown && pushedDown) 476 else */if(supportPushDown && pushedDown)
479 painter->drawPixmap(x+1, y+1, tmpPix); 477 painter->drawPixmap(x+1, y+1, tmpPix);
480 else 478 else
481 painter->drawPixmap(x, y, tmpPix); 479 painter->drawPixmap(x, y, tmpPix);
482 480
483 481
484 482
485} 483}
486 484
487 485
488QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, 486QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
489 bool blend) 487 bool blend)
490{ 488{
491 QImage img(qembed_findImage(label)); 489 QImage img(qembed_findImage(label));
492 img.detach(); 490 img.detach();
493 if(img.isNull()){ // shouldn't happen, been tested 491 if(img.isNull()){ // shouldn't happen, been tested
494 qWarning("Invalid embedded label %s", label); 492 qWarning("Invalid embedded label %s", label);
495 return(NULL); 493 return(NULL);
496 } 494 }
497 if(img.depth() != 32) 495 if(img.depth() != 32)
498 img = img.convertDepth(32); 496 img = img.convertDepth(32);
499 unsigned int *data = (unsigned int *)img.bits(); 497 unsigned int *data = (unsigned int *)img.bits();
500 int total = img.width()*img.height(); 498 int total = img.width()*img.height();
501 int current; 499 int current;
502 QColor c; 500 QColor c;
503 int oldH, oldS, oldV; 501 int oldH, oldS, oldV;
504 int alpha; 502 int alpha;
505 if(v < 235) 503 if(v < 235)
506 v += 20; 504 v += 20;
507 else 505 else
508 v = 255; 506 v = 255;
509 float intensity = v/255.0; 507 float intensity = v/255.0;
510 508
511 for(current=0; current<total; ++current){ 509 for(current=0; current<total; ++current){
512 alpha = qAlpha(data[current]); 510 alpha = qAlpha(data[current]);
513 c.setRgb(data[current]); 511 c.setRgb(data[current]);
514 c.hsv(&oldH, &oldS, &oldV); 512 c.hsv(&oldH, &oldS, &oldV);
515 oldV = (int)(oldV*intensity); 513 oldV = (int)(oldV*intensity);
516 c.setHsv(h, s, oldV); 514 c.setHsv(h, s, oldV);
517 if(blend && alpha != 255 && alpha != 0){ 515 if(blend && alpha != 255 && alpha != 0){
518 float srcPercent = ((float)alpha)/255.0; 516 float srcPercent = ((float)alpha)/255.0;
519 float destPercent = 1.0-srcPercent; 517 float destPercent = 1.0-srcPercent;
520 oldH = (int)((srcPercent*h) + (destPercent*bH)); 518 oldH = (int)((srcPercent*h) + (destPercent*bH));
521 oldS = (int)((srcPercent*s) + (destPercent*bS)); 519 oldS = (int)((srcPercent*s) + (destPercent*bS));
522 oldV = (int)((srcPercent*oldV) + (destPercent*bV)); 520 oldV = (int)((srcPercent*oldV) + (destPercent*bV));
523 c.setHsv(oldH, oldS, oldV); 521 c.setHsv(oldH, oldS, oldV);
524 alpha = 255; 522 alpha = 255;
525 } 523 }
526 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); 524 data[current] = qRgba(c.red(), c.green(), c.blue(), alpha);
527 } 525 }
528 QPixmap *pix = new QPixmap; 526 QPixmap *pix = new QPixmap;
529 pix->convertFromImage(img); 527 pix->convertFromImage(img);
530 return(pix); 528 return(pix);
531} 529}
532 530
533 531
534 532
535 533
536QPixmap* LiquidStyle::getPixmap(BitmapData item) 534QPixmap* LiquidStyle::getPixmap(BitmapData item)
537{ 535{
538 536
539 if(pixmaps[item]) 537 if(pixmaps[item])
540 return(pixmaps[item]); 538 return(pixmaps[item]);
541 539
542 switch(item){ 540 switch(item){
543 case HTMLBtnBorder: 541 case HTMLBtnBorder:
544 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); 542 pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV);
545 break; 543 break;
546 case HTMLBtnBorderDown: 544 case HTMLBtnBorderDown:
547 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); 545 pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV);
548 break; 546 break;
549 case HTMLCB: 547 case HTMLCB:
550 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); 548 pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV);
551 break; 549 break;
552 case HTMLCBDown: 550 case HTMLCBDown:
553 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); 551 pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV);
554 break; 552 break;
555 case HTMLCBHover: 553 case HTMLCBHover:
556 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); 554 pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV);
557 break; 555 break;
558 case HTMLCBDownHover: 556 case HTMLCBDownHover:
559 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", 557 pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown",
560 btnHoverH, btnHoverS, 558 btnHoverH, btnHoverS,
561 btnHoverV); 559 btnHoverV);
562 break; 560 break;
563 case HTMLRadio: 561 case HTMLRadio:
564 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); 562 pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV);
565 case HTMLRadioDown: 563 case HTMLRadioDown:
566 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); 564 pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV);
567 case HTMLRadioHover: 565 case HTMLRadioHover:
568 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); 566 pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV);
569 case HTMLRadioDownHover: 567 case HTMLRadioDownHover:
570 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", 568 pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown",
571 btnHoverH, btnHoverS, 569 btnHoverH, btnHoverS,
572 btnHoverV); 570 btnHoverV);
573 case RadioOn: 571 case RadioOn:
574 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); 572 pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true);
575 break; 573 break;
576 case RadioOnHover: 574 case RadioOnHover:
577 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, 575 pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS,
578 btnHoverV, true); 576 btnHoverV, true);
579 break; 577 break;
580 case RadioOffHover: 578 case RadioOffHover:
581 pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); 579 pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true);
582 break; 580 break;
583 case TabDown: 581 case TabDown:
584 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); 582 pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true);
585 break; 583 break;
586 case TabFocus: 584 case TabFocus:
587 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, 585 pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS,
588 btnHoverS, true); 586 btnHoverS, true);
589 break; 587 break;
590 case CBDown: 588 case CBDown:
591 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); 589 pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true);
592 break; 590 break;
593 case CBDownHover: 591 case CBDownHover:
594 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, 592 pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH,
595 btnHoverS, btnHoverV, true); 593 btnHoverS, btnHoverV, true);
596 break; 594 break;
597 case CBHover: 595 case CBHover:
598 pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); 596 pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true);
599 break; 597 break;
600 case HSlider: 598 case HSlider:
601 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 599 pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
602 break; 600 break;
603 case VSlider: 601 case VSlider:
604 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); 602 pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true);
605 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); 603 *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix);
606 break; 604 break;
607 case RadioOff: 605 case RadioOff:
608 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); 606 pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true);
609 break; 607 break;
610 case Tab: 608 case Tab:
611 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); 609 pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true);
612 break; 610 break;
613 case CB: 611 case CB:
614 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); 612 pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true);
615 break; 613 break;
616 case VSBSliderTop: 614 case VSBSliderTop:
617 pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 615 pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
618 break; 616 break;
619 case VSBSliderBtm: 617 case VSBSliderBtm:
620 pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 618 pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
621 break; 619 break;
622 case VSBSliderMid: 620 case VSBSliderMid:
623 pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 621 pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
624 break; 622 break;
625 case VSBSliderTopHover: 623 case VSBSliderTopHover:
626 pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 624 pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
627 break; 625 break;
628 case VSBSliderBtmHover: 626 case VSBSliderBtmHover:
629 pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 627 pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
630 break; 628 break;
631 case VSBSliderMidHover: 629 case VSBSliderMidHover:
632 pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 630 pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
633 break; 631 break;
634 632
635 case HSBSliderTop: 633 case HSBSliderTop:
636 pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); 634 pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true);
637 *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); 635 *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix);
638 break; 636 break;
639 case HSBSliderBtm: 637 case HSBSliderBtm:
640 pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); 638 pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true);
641 *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); 639 *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix);
642 break; 640 break;
643 case HSBSliderMid: 641 case HSBSliderMid:
644 pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); 642 pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV);
645 *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); 643 *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix);
646 break; 644 break;
647 case HSBSliderTopHover: 645 case HSBSliderTopHover:
648 pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); 646 pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true);
649 *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); 647 *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix);
650 break; 648 break;
651 case HSBSliderBtmHover: 649 case HSBSliderBtmHover:
652 pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); 650 pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true);
653 *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); 651 *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix);
654 break; 652 break;
655 case HSBSliderMidHover: 653 case HSBSliderMidHover:
656 pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); 654 pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV);
657 *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); 655 *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix);
658 break; 656 break;
659 case VSBSliderTopBg: 657 case VSBSliderTopBg:
660 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 658 pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
661 break; 659 break;
662 case VSBSliderBtmBg: 660 case VSBSliderBtmBg:
663 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 661 pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
664 break; 662 break;
665 case VSBSliderMidBg: 663 case VSBSliderMidBg:
666 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 664 pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
667 break; 665 break;
668 case HSBSliderTopBg: 666 case HSBSliderTopBg:
669 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); 667 pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true);
670 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); 668 *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix);
671 break; 669 break;
672 case HSBSliderBtmBg: 670 case HSBSliderBtmBg:
673 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); 671 pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true);
674 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); 672 *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix);
675 break; 673 break;
676 case HSBSliderMidBg: 674 case HSBSliderMidBg:
677 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); 675 pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV);
678 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); 676 *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix);
679 break; 677 break;
680 default: 678 default:
681 break; 679 break;
682 } 680 }
683 return(pixmaps[item]); 681 return(pixmaps[item]);
684} 682}
685 683
686void LiquidStyle::polish(QPalette &appPal) 684void LiquidStyle::polish(QPalette &appPal)
687{ 685{
688 int i; 686 int i;
689 for(i=0; i < BITMAP_ITEMS; ++i){ 687 for(i=0; i < BITMAP_ITEMS; ++i){
690 if(pixmaps[i]){ 688 if(pixmaps[i]){
691 delete pixmaps[i]; 689 delete pixmaps[i];
692 pixmaps[i] = NULL; 690 pixmaps[i] = NULL;
693 } 691 }
694 } 692 }
695 QWidgetList *list = QApplication::allWidgets(); 693 QWidgetList *list = QApplication::allWidgets();
696 QWidgetListIt it( *list ); 694 QWidgetListIt it( *list );
697 QWidget *w; 695 QWidget *w;
698 while ((w=it.current()) != 0 ){ 696 while ((w=it.current()) != 0 ){
699 ++it; 697 ++it;
700 if(w->inherits("QPushButton")){ 698 if(w->inherits("QPushButton")){
701 unapplyCustomAttributes((QPushButton *)w); 699 unapplyCustomAttributes((QPushButton *)w);
702 } 700 }
703 } 701 }
704 702
705 loadCustomButtons(); 703 loadCustomButtons();
706 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 704 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
707 btnDict.clear(); 705 btnDict.clear();
708 btnBorderDict.clear(); 706 btnBorderDict.clear();
709 bevelFillDict.clear(); 707 bevelFillDict.clear();
710 smallBevelFillDict.clear(); 708 smallBevelFillDict.clear();
711 709
712 Config config ( "qpe" ); 710 Config config ( "qpe" );
713 config. setGroup ( "Liquid-Style" ); 711 config. setGroup ( "Liquid-Style" );
714 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 712 int contrast = config. readNumEntry ( "StippleContrast", 5 );
715 if ( contrast < 0 ) 713 if ( contrast < 0 )
716 contrast = 0; 714 contrast = 0;
717 else if ( contrast > 10 ) 715 else if ( contrast > 10 )
718 contrast = 10; 716 contrast = 10;
719 717
720// QPalette pal = QApplication::palette(); 718// QPalette pal = QApplication::palette();
721 719
722 // button color stuff 720 // button color stuff
723 config. setGroup ( "Appearance" ); 721 config. setGroup ( "Appearance" );
724 QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); 722 QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( )));
725 appPal. color ( QPalette::Active, QColorGroup::Button ); 723 appPal. color ( QPalette::Active, QColorGroup::Button );
726 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) 724 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )
727 //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) 725 //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
728 ) { 726 ) {
729 // force button color to be different from background 727 // force button color to be different from background
730 QBrush btnBrush(QColor(200, 202, 228)); 728 QBrush btnBrush(QColor(200, 202, 228));
731 appPal.setBrush(QColorGroup::Button, btnBrush); 729 appPal.setBrush(QColorGroup::Button, btnBrush);
732 } 730 }
733 c.hsv(&btnH, &btnS, &btnV); 731 c.hsv(&btnH, &btnS, &btnV);
734 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 732 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
735 733
736 // menu pixmap 734 // menu pixmap
737 if(!menuPix){ 735 if(!menuPix){
738 menuPix = new QPixmap; 736 menuPix = new QPixmap;
739 menuPix->resize(64, 64); 737 menuPix->resize(64, 64);
740 } 738 }
741 QPainter painter; 739 QPainter painter;
742 menuPix->fill(c.rgb()); 740 menuPix->fill(c.rgb());
743 painter.begin(menuPix); 741 painter.begin(menuPix);
744 painter.setPen(c.dark(105)); 742 painter.setPen(c.dark(105));
745 for(i=0; i < 63; i+=4){ 743 for(i=0; i < 63; i+=4){
746 painter.drawLine(0, i, 63, i); 744 painter.drawLine(0, i, 63, i);
747 painter.drawLine(0, i+1, 63, i+1); 745 painter.drawLine(0, i+1, 63, i+1);
748 }; 746 };
749 painter.end(); 747 painter.end();
750 menuBrush.setColor(c); 748 menuBrush.setColor(c);
751 menuBrush.setPixmap(*menuPix); 749 menuBrush.setPixmap(*menuPix);
752 750
753 // pager brush 751 // pager brush
754 c = c.dark(120); 752 c = c.dark(120);
755 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 753 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
756 if(!pix){ 754 if(!pix){
757 int h, s, v; 755 int h, s, v;
758 c.hsv(&h, &s, &v); 756 c.hsv(&h, &s, &v);
759 pix = new QPixmap(*smallBevelFillPix); 757 pix = new QPixmap(*smallBevelFillPix);
760 adjustHSV(*pix, h, s, v); 758 adjustHSV(*pix, h, s, v);
761 smallBevelFillDict.insert(c.rgb(), pix); 759 smallBevelFillDict.insert(c.rgb(), pix);
762 } 760 }
763 pagerHoverBrush.setColor(c); 761 pagerHoverBrush.setColor(c);
764 pagerHoverBrush.setPixmap(*pix); 762 pagerHoverBrush.setPixmap(*pix);
765 763
766 c = c.dark(120); 764 c = c.dark(120);
767 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 765 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
768 if(!pix){ 766 if(!pix){
769 int h, s, v; 767 int h, s, v;
770 c.hsv(&h, &s, &v); 768 c.hsv(&h, &s, &v);
771 pix = new QPixmap(*smallBevelFillPix); 769 pix = new QPixmap(*smallBevelFillPix);
772 adjustHSV(*pix, h, s, v); 770 adjustHSV(*pix, h, s, v);
773 smallBevelFillDict.insert(c.rgb(), pix); 771 smallBevelFillDict.insert(c.rgb(), pix);
774 } 772 }
775 pagerBrush.setColor(c); 773 pagerBrush.setColor(c);
776 pagerBrush.setPixmap(*pix); 774 pagerBrush.setPixmap(*pix);
777 775
778 // background color stuff 776 // background color stuff
779 c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); 777 c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background );
780 c.hsv(&bH, &bS, &bV); 778 c.hsv(&bH, &bS, &bV);
781 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 779 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
782 780
783 // FIXME? 781 // FIXME?
784 if(vsbSliderFillPix) 782 if(vsbSliderFillPix)
785 delete vsbSliderFillPix; 783 delete vsbSliderFillPix;
786 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 784 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
787 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 785 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
788 786
789 // background brush 787 // background brush
790 QPixmap wallPaper(32, 32); 788 QPixmap wallPaper(32, 32);
791 wallPaper.fill(c.rgb()); 789 wallPaper.fill(c.rgb());
792 painter.begin(&wallPaper); 790 painter.begin(&wallPaper);
793 for(i=0; i < 32; i+=4){ 791 for(i=0; i < 32; i+=4){
794 painter.setPen(c.dark(100 + contrast)); 792 painter.setPen(c.dark(100 + contrast));
795 painter.drawLine(0, i, 32, i); 793 painter.drawLine(0, i, 32, i);
796 painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 794 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
797 painter.drawLine(0, i+1, 32, i+1); 795 painter.drawLine(0, i+1, 32, i+1);
798 }; 796 };
799 painter.end(); 797 painter.end();
800 bgBrush.setColor(c); 798 bgBrush.setColor(c);
801 bgBrush.setPixmap(wallPaper); 799 bgBrush.setPixmap(wallPaper);
802 appPal.setBrush(QColorGroup::Background, bgBrush); 800 appPal.setBrush(QColorGroup::Background, bgBrush);
803 801
804 // lineedits 802 // lineedits
805 c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); 803 c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base );
806 QPixmap basePix; 804 QPixmap basePix;
807 basePix.resize(32, 32); 805 basePix.resize(32, 32);
808 basePix.fill(c.rgb()); 806 basePix.fill(c.rgb());
809 painter.begin(&basePix); 807 painter.begin(&basePix);
810 painter.setPen(c.dark(105)); 808 painter.setPen(c.dark(105));
811 for(i=0; i < 32; i+=4){ 809 for(i=0; i < 32; i+=4){
812 painter.drawLine(0, i, 32, i); 810 painter.drawLine(0, i, 32, i);
813 painter.drawLine(0, i+1, 32, i+1); 811 painter.drawLine(0, i+1, 32, i+1);
814 }; 812 };
815 painter.end(); 813 painter.end();
816 baseBrush.setColor(c); 814 baseBrush.setColor(c);
817 baseBrush.setPixmap(basePix); 815 baseBrush.setPixmap(basePix);
818 it.toFirst(); 816 it.toFirst();
819 while ((w=it.current()) != 0 ){ 817 while ((w=it.current()) != 0 ){
820 ++it; 818 ++it;
821 if(w->inherits("QLineEdit")){ 819 if(w->inherits("QLineEdit")){
822 QPalette pal = w->palette(); 820 QPalette pal = w->palette();
823 pal.setBrush(QColorGroup::Base, baseBrush); 821 pal.setBrush(QColorGroup::Base, baseBrush);
824 w->setPalette(pal); 822 w->setPalette(pal);
825 } 823 }
826 else if(w->inherits("QPushButton")){ 824 else if(w->inherits("QPushButton")){
827 applyCustomAttributes((QPushButton *)w); 825 applyCustomAttributes((QPushButton *)w);
828 } 826 }
829 } 827 }
830} 828}
831 829
832void LiquidStyle::polish(QWidget *w) 830void LiquidStyle::polish(QWidget *w)
833{ 831{
834 if(w->inherits("QMenuBar")){ 832 if(w->inherits("QMenuBar")){
835 //((QFrame*)w)->setLineWidth(0); 833 //((QFrame*)w)->setLineWidth(0);
836 w->setBackgroundMode(QWidget::PaletteBackground); 834 w->setBackgroundMode(QWidget::PaletteBackground);
837 w->setBackgroundOrigin(QWidget::ParentOrigin); 835 w->setBackgroundOrigin(QWidget::ParentOrigin);
838 return; 836 return;
839 } 837 }
840 if(w->inherits("QToolBar")){ 838 if(w->inherits("QToolBar")){
841 w->installEventFilter(this); 839 w->installEventFilter(this);
842 w->setBackgroundMode(QWidget::PaletteBackground); 840 w->setBackgroundMode(QWidget::PaletteBackground);
843 w->setBackgroundOrigin(QWidget::WidgetOrigin); 841 w->setBackgroundOrigin(QWidget::WidgetOrigin);
844 return; 842 return;
845 } 843 }
846 if(w->inherits("QPopupMenu")) 844 if(w->inherits("QPopupMenu"))
847 w->setBackgroundMode(QWidget::NoBackground); 845 w->setBackgroundMode(QWidget::NoBackground);
848 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 846 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
849 w->installEventFilter(menuHandler); 847 w->installEventFilter(menuHandler);
850 } 848 }
851 849
852 if(w->isTopLevel()){ 850 if(w->isTopLevel()){
853 return; 851 return;
854 } 852 }
855 853
856 if(w->inherits("QComboBox") || w->inherits("QProgressBar") || 854 if(w->inherits("QComboBox") || w->inherits("QProgressBar") ||
857 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 855 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
858 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 856 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
859 w->installEventFilter(this); 857 w->installEventFilter(this);
860 } 858 }
861 if(w->inherits("QLineEdit")){ 859 if(w->inherits("QLineEdit")){
862 QPalette pal = w->palette(); 860 QPalette pal = w->palette();
863 pal.setBrush(QColorGroup::Base, baseBrush); 861 pal.setBrush(QColorGroup::Base, baseBrush);
864 w->setPalette(pal); 862 w->setPalette(pal);
865 } 863 }
866 if(w->inherits("QPushButton")){ 864 if(w->inherits("QPushButton")){
867 applyCustomAttributes((QPushButton *)w); 865 applyCustomAttributes((QPushButton *)w);
868 w->installEventFilter(this); 866 w->installEventFilter(this);
869 } 867 }
870 if(w->inherits("QButton") || w-> inherits("QComboBox")){ 868 if(w->inherits("QButton") || w-> inherits("QComboBox")){
871 w-> setBackgroundMode ( QWidget::PaletteBackground ); 869 w-> setBackgroundMode ( QWidget::PaletteBackground );
872 w->setBackgroundOrigin ( QWidget::ParentOrigin); 870 w->setBackgroundOrigin ( QWidget::ParentOrigin);
873 } 871 }
874 872
875 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || 873 bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 ||
876 qstrcmp(w->name(), "qt_clipped_viewport") == 0; 874 qstrcmp(w->name(), "qt_clipped_viewport") == 0;
877 bool isViewportChild = w->parent() && 875 bool isViewportChild = w->parent() &&
878 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 876 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
879 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 877 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
880 878
881 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ 879 if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){
882 w->setBackgroundMode(QWidget::X11ParentRelative); 880 w->setBackgroundMode(QWidget::X11ParentRelative);
883 return; 881 return;
884 } 882 }
885 if(isViewportChild){ 883 if(isViewportChild){
886 if(w->inherits("QButton") || w->inherits("QComboBox")){ 884 if(w->inherits("QButton") || w->inherits("QComboBox")){
887 if(w->parent()){ // heh, only way to test for KHTML children ;-) 885 if(w->parent()){ // heh, only way to test for KHTML children ;-)
888 if(w->parent()->parent()){ 886 if(w->parent()->parent()){
889 if(w->parent()->parent()->parent() && 887 if(w->parent()->parent()->parent() &&
890 w->parent()->parent()->parent()->inherits("KHTMLView")){ 888 w->parent()->parent()->parent()->inherits("KHTMLView")){
891 w->setAutoMask(true); 889 w->setAutoMask(true);
892 w->setBackgroundMode(QWidget::NoBackground); 890 w->setBackgroundMode(QWidget::NoBackground);
893 } 891 }
894 } 892 }
895 } 893 }
896 return; 894 return;
897 } 895 }
898 } 896 }
899 if(w->inherits("QHeader")){ 897 if(w->inherits("QHeader")){
900 w->setMouseTracking(true); 898 w->setMouseTracking(true);
901 w->installEventFilter(this); 899 w->installEventFilter(this);
902 } 900 }
903 if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { 901 if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) {
904 ((QToolButton*)w)->setAutoRaise (flatTBButtons); 902 ((QToolButton*)w)->setAutoRaise (flatTBButtons);
905 if ( flatTBButtons ) 903 if ( flatTBButtons )
906 w->setBackgroundOrigin(QWidget::ParentOrigin); 904 w->setBackgroundOrigin(QWidget::ParentOrigin);
907 } 905 }
908 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { 906 if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
909 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); 907 ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
910 } 908 }
911 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ 909 if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
912 return; 910 return;
913 } 911 }
914 912
915 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> 913 if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
916 palette().active().brush(QColorGroup::Background).pixmap()){ 914 palette().active().brush(QColorGroup::Background).pixmap()){
917 qWarning("No parent pixmap for child widget %s", w->className()); 915 qWarning("No parent pixmap for child widget %s", w->className());
918 return; 916 return;
919 } 917 }
920 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && 918 if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
921 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { 919 !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
922 if(w->backgroundMode() == QWidget::PaletteBackground || 920 if(w->backgroundMode() == QWidget::PaletteBackground ||
923 w->backgroundMode() == QWidget::PaletteButton){ 921 w->backgroundMode() == QWidget::PaletteButton){
924 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); 922 w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
925 w->setBackgroundOrigin(QWidget::ParentOrigin); 923 w->setBackgroundOrigin(QWidget::ParentOrigin);
926 // w->setBackgroundMode(QWidget::NoBackground); 924 // w->setBackgroundMode(QWidget::NoBackground);
927 } 925 }
928 } 926 }
929 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) 927 if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
930 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 928 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
931 else if ( w-> inherits("QFrame") ) 929 else if ( w-> inherits("QFrame") )
932 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 930 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
933 931
934 if ( w->parentWidget()->inherits ( "QWidgetStack" )) { 932 if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
935 w->setBackgroundOrigin ( QWidget::WidgetOrigin ); 933 w->setBackgroundOrigin ( QWidget::WidgetOrigin );
936 } 934 }
937} 935}
938 936
939void LiquidStyle::unPolish(QWidget *w) 937void LiquidStyle::unPolish(QWidget *w)
940{ 938{
941 if(w->inherits("QMenuBar")){ 939 if(w->inherits("QMenuBar")){
942 ((QFrame *)w)->setLineWidth(1); 940 ((QFrame *)w)->setLineWidth(1);
943 w->setBackgroundMode(QWidget::PaletteBackground); 941 w->setBackgroundMode(QWidget::PaletteBackground);
944 return; 942 return;
945 } 943 }
946 944
947 if(w->inherits("QPopupMenu")) 945 if(w->inherits("QPopupMenu"))
948 w->setBackgroundMode(QWidget::PaletteButton); 946 w->setBackgroundMode(QWidget::PaletteButton);
949 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { 947 else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) {
950 w->removeEventFilter(menuHandler); 948 w->removeEventFilter(menuHandler);
951 } 949 }
952 950
953 if(w->isTopLevel()) 951 if(w->isTopLevel())
954 return; 952 return;
955 953
956 // for viewport children, don't just check for NoBackground.... 954 // for viewport children, don't just check for NoBackground....
957 bool isViewportChild = w->parent() && 955 bool isViewportChild = w->parent() &&
958 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || 956 ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) ||
959 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); 957 (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0));
960 958
961 w->unsetPalette(); 959 w->unsetPalette();
962 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ 960 if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){
963 if(w->inherits("QPushButton")) 961 if(w->inherits("QPushButton"))
964 w->setBackgroundMode(QWidget::PaletteButton); 962 w->setBackgroundMode(QWidget::PaletteButton);
965 else 963 else
966 w->setBackgroundMode(QWidget::PaletteBackground); 964 w->setBackgroundMode(QWidget::PaletteBackground);
967 } 965 }
968 966
969 if(isViewportChild) 967 if(isViewportChild)
970 w->setAutoMask(false); 968 w->setAutoMask(false);
971 969
972 if(w->inherits("QPushButton")){ 970 if(w->inherits("QPushButton")){
973 unapplyCustomAttributes((QPushButton *)w); 971 unapplyCustomAttributes((QPushButton *)w);
974 w->removeEventFilter(this); 972 w->removeEventFilter(this);
975 } 973 }
976/* 974/*
977 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ 975 if(w->inherits("QPushButton") || w-> inherits("QComboBox")){
978 w-> setBackgroundMode ( PaletteBackground ); 976 w-> setBackgroundMode ( PaletteBackground );
979 } 977 }
980*/ 978*/
981 if(w->inherits("QComboBox") || 979 if(w->inherits("QComboBox") ||
982 w->inherits("QLineEdit") || w->inherits("QRadioButton") || 980 w->inherits("QLineEdit") || w->inherits("QRadioButton") ||
983 w->inherits("QCheckBox") || w->inherits("QScrollBar")) { 981 w->inherits("QCheckBox") || w->inherits("QScrollBar")) {
984 w->removeEventFilter(this); 982 w->removeEventFilter(this);
985 } 983 }
986 if(w->inherits("QButton") || w->inherits("QComboBox")){ 984 if(w->inherits("QButton") || w->inherits("QComboBox")){
987 if(w->parent() && w->parent()->inherits("KHTMLPart")){ 985 if(w->parent() && w->parent()->inherits("KHTMLPart")){
988 w->setAutoMask(false); 986 w->setAutoMask(false);
989 } 987 }
990 } 988 }
991 if(w->inherits("QToolBar")){ 989 if(w->inherits("QToolBar")){
992 w->removeEventFilter(this); 990 w->removeEventFilter(this);
993 w->setBackgroundMode(QWidget::PaletteBackground); 991 w->setBackgroundMode(QWidget::PaletteBackground);
994 return; 992 return;
995 } 993 }
996 if(w->inherits("QHeader")){ 994 if(w->inherits("QHeader")){
997 w->setMouseTracking(false); 995 w->setMouseTracking(false);
998 w->removeEventFilter(this); 996 w->removeEventFilter(this);
999 } 997 }
1000} 998}
1001 999
1002void LiquidStyle::polish(QApplication *app) 1000void LiquidStyle::polish(QApplication *app)
1003{ 1001{
1004 1002
1005 QWindowsStyle::polish(app); 1003 QWindowsStyle::polish(app);
1006 menuAni = app->isEffectEnabled(UI_AnimateMenu); 1004 menuAni = app->isEffectEnabled(UI_AnimateMenu);
1007 menuFade = app->isEffectEnabled(UI_FadeMenu); 1005 menuFade = app->isEffectEnabled(UI_FadeMenu);
1008 if(menuAni) 1006 if(menuAni)
1009 app->setEffectEnabled(UI_AnimateMenu, false); 1007 app->setEffectEnabled(UI_AnimateMenu, false);
1010 if(menuFade) 1008 if(menuFade)
1011 app->setEffectEnabled(UI_FadeMenu, false); 1009 app->setEffectEnabled(UI_FadeMenu, false);
1012 1010
1013 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 1011 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
1014 1012
1015 Config config ( "qpe" ); 1013 Config config ( "qpe" );
1016 config. setGroup ( "Liquid-Style" ); 1014 config. setGroup ( "Liquid-Style" );
1017 1015
1018 // if ( config. readBoolEntry ( "WinDecoration", true )) 1016 // if ( config. readBoolEntry ( "WinDecoration", true ))
1019 // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); 1017 // QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
1020 1018
1021 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); 1019 flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false );
1022} 1020}
1023 1021
1024void LiquidStyle::unPolish(QApplication *app) 1022void LiquidStyle::unPolish(QApplication *app)
1025{ 1023{
1026 QWindowsStyle::unPolish(app); 1024 QWindowsStyle::unPolish(app);
1027 app->setEffectEnabled(UI_AnimateMenu, menuAni); 1025 app->setEffectEnabled(UI_AnimateMenu, menuAni);
1028 app->setEffectEnabled(UI_FadeMenu, menuFade); 1026 app->setEffectEnabled(UI_FadeMenu, menuFade);
1029 1027
1030 qt_set_draw_menu_bar_impl ( 0 ); 1028 qt_set_draw_menu_bar_impl ( 0 );
1031 1029
1032// QApplication::qwsSetDecoration ( new QPEDecoration ( )); 1030// QApplication::qwsSetDecoration ( new QPEDecoration ( ));
1033} 1031}
1034 1032
1035 1033
1036/* !! HACK !! Beware 1034/* !! HACK !! Beware
1037 * 1035 *
1038 * TT forgot to make the QProgressBar widget styleable in Qt 2.x 1036 * TT forgot to make the QProgressBar widget styleable in Qt 2.x
1039 * So the only way to customize the drawing, is to intercept the 1037 * So the only way to customize the drawing, is to intercept the
1040 * paint event - since we have to use protected functions, we need 1038 * paint event - since we have to use protected functions, we need
1041 * to derive a "hack" class from QProgressBar and do the painting 1039 * to derive a "hack" class from QProgressBar and do the painting
1042 * in there. 1040 * in there.
1043 * 1041 *
1044 * - sandman 1042 * - sandman
1045 */ 1043 */
1046 1044
1047class HackProgressBar : public QProgressBar { 1045class HackProgressBar : public QProgressBar {
1048public: 1046public:
1049 HackProgressBar ( ); 1047 HackProgressBar ( );
1050 1048
1051 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) 1049 void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix )
1052 { 1050 {
1053 QPainter p( this ); 1051 QPainter p( this );
1054 1052
1055 if ( !contentsRect().contains( event->rect() ) ) { 1053 if ( !contentsRect().contains( event->rect() ) ) {
1056 p.save(); 1054 p.save();
1057 p.setClipRegion( event->region().intersect(frameRect()) ); 1055 p.setClipRegion( event->region().intersect(frameRect()) );
1058 drawFrame( &p); 1056 drawFrame( &p);
1059 p.restore(); 1057 p.restore();
1060 } 1058 }
1061 if ( event->rect().intersects( contentsRect() )) { 1059 if ( event->rect().intersects( contentsRect() )) {
1062 p.setClipRegion( event->region().intersect( contentsRect() ) ); 1060 p.setClipRegion( event->region().intersect( contentsRect() ) );
1063 1061
1064 int x, y, w, h; 1062 int x, y, w, h;
1065 contentsRect ( ). rect ( &x, &y, &w, &h ); 1063 contentsRect ( ). rect ( &x, &y, &w, &h );
1066 1064
1067 int prog = progress ( ); 1065 int prog = progress ( );
1068 int total = totalSteps ( ); 1066 int total = totalSteps ( );
1069 if ( prog < 0 ) 1067 if ( prog < 0 )
1070 prog = 0; 1068 prog = 0;
1071 if ( total <= 0 ) 1069 if ( total <= 0 )
1072 total = 1; 1070 total = 1;
1073 int bw = w * prog / total; 1071 int bw = w * prog / total;
1074 if ( bw > w ) 1072 if ( bw > w )
1075 bw = w; 1073 bw = w;
1076 1074
1077 p.setPen(g.button().dark(130)); 1075 p.setPen(g.button().dark(130));
1078 p.drawRect(x, y, bw, h); 1076 p.drawRect(x, y, bw, h);
1079 p.setPen(g.button().light(120)); 1077 p.setPen(g.button().light(120));
1080 p.drawRect(x+1, y+1, bw-2, h-2); 1078 p.drawRect(x+1, y+1, bw-2, h-2);
1081 1079
1082 if(bw >= 4 && h >= 4 && pix) 1080 if(bw >= 4 && h >= 4 && pix)
1083 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); 1081 p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix);
1084 1082
1085 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { 1083 if ( progress ( )>= 0 && totalSteps ( ) > 0 ) {
1086 QString pstr; 1084 QString pstr;
1087 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); 1085 pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ());
1088 p. setPen ( g.text());//g.highlightedText ( )); 1086 p. setPen ( g.text());//g.highlightedText ( ));
1089 p. drawText (x,y,w-1,h-1,AlignCenter,pstr); 1087 p. drawText (x,y,w-1,h-1,AlignCenter,pstr);
1090 } 1088 }
1091 } 1089 }
1092 } 1090 }
1093}; 1091};
1094 1092
1095 1093
1096 1094
1097/* 1095/*
1098 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1096 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1099 * force everything to erase and repaint on resize. This is going away, I'm 1097 * force everything to erase and repaint on resize. This is going away, I'm
1100 * trying to get shaped widgets to work right without masking. QPushButton, 1098 * trying to get shaped widgets to work right without masking. QPushButton,
1101 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1099 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1102 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1100 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1103 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1101 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1104 * caches them in QPixmapCache, which is bad for doing things like hover 1102 * caches them in QPixmapCache, which is bad for doing things like hover
1105 * because the style methods aren't called in paintEvents if everything 1103 * because the style methods aren't called in paintEvents if everything
1106 * is cached. We use our own Paint event handler instead. Taskbuttons and 1104 * is cached. We use our own Paint event handler instead. Taskbuttons and
1107 * pager buttons draw into a pixmap buffer, so we handle those with palette 1105 * pager buttons draw into a pixmap buffer, so we handle those with palette
1108 * modifications. For QHeader, different header items are actually one widget 1106 * modifications. For QHeader, different header items are actually one widget
1109 * that draws multiple items, so we need to check which ID is hightlighted 1107 * that draws multiple items, so we need to check which ID is hightlighted
1110 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1108 * and draw it. Finally, we also check enter and leave events for QLineEdit,
1111 * since if it's inside a combobox we want to highlight the combobox during 1109 * since if it's inside a combobox we want to highlight the combobox during
1112 * hovering in the edit. 1110 * hovering in the edit.
1113 */ 1111 */
1114bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1112bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1115{ 1113{
1116 if(obj->inherits("QToolBar")){ 1114 if(obj->inherits("QToolBar")){
1117 if(ev->type() == QEvent::Resize){ 1115 if(ev->type() == QEvent::Resize){
1118 const QObjectList *tbChildList = obj->children(); 1116 const QObjectList *tbChildList = obj->children();
1119 QObjectListIt it(*tbChildList); 1117 QObjectListIt it(*tbChildList);
1120 QObject *child; 1118 QObject *child;
1121 while((child = it.current()) != NULL){ 1119 while((child = it.current()) != NULL){
1122 ++it; 1120 ++it;
1123 if(child->isWidgetType()) 1121 if(child->isWidgetType())
1124 ((QWidget *)child)->repaint(true); 1122 ((QWidget *)child)->repaint(true);
1125 } 1123 }
1126 1124
1127 } 1125 }
1128 } 1126 }
1129 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ 1127 else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){
1130 QWidget *btn = (QWidget *)obj; 1128 QWidget *btn = (QWidget *)obj;
1131 if(ev->type() == QEvent::Enter){ 1129 if(ev->type() == QEvent::Enter){
1132 if(btn->isEnabled()){ 1130 if(btn->isEnabled()){
1133 highlightWidget = btn; 1131 highlightWidget = btn;
1134 btn->repaint(false); 1132 btn->repaint(false);
1135 } 1133 }
1136 } 1134 }
1137 else if(ev->type() == QEvent::Leave){ 1135 else if(ev->type() == QEvent::Leave){
1138 if(btn == highlightWidget){ 1136 if(btn == highlightWidget){
1139 highlightWidget = NULL; 1137 highlightWidget = NULL;
1140 btn->repaint(false); 1138 btn->repaint(false);
1141 } 1139 }
1142 } 1140 }
1143 } 1141 }
1144 else if(obj->inherits("QToolButton")){ 1142 else if(obj->inherits("QToolButton")){
1145 QToolButton *btn = (QToolButton *)btn; 1143 QToolButton *btn = (QToolButton *)btn;
1146 if(!btn->autoRaise()){ 1144 if(!btn->autoRaise()){
1147 if(btn->isEnabled()){ 1145 if(btn->isEnabled()){
1148 highlightWidget = btn; 1146 highlightWidget = btn;
1149 btn->repaint(false); 1147 btn->repaint(false);
1150 } 1148 }
1151 } 1149 }
1152 else if(ev->type() == QEvent::Leave){ 1150 else if(ev->type() == QEvent::Leave){
1153 QWidget *btn = (QWidget *)obj; 1151 QWidget *btn = (QWidget *)obj;
1154 if(btn == highlightWidget){ 1152 if(btn == highlightWidget){
1155 highlightWidget = NULL; 1153 highlightWidget = NULL;
1156 btn->repaint(false); 1154 btn->repaint(false);
1157 } 1155 }
1158 } 1156 }
1159 else 1157 else
1160 highlightWidget = NULL; 1158 highlightWidget = NULL;
1161 } 1159 }
1162 else if(obj->inherits("QScrollBar")){ 1160 else if(obj->inherits("QScrollBar")){
1163 QScrollBar *sb = (QScrollBar *)obj; 1161 QScrollBar *sb = (QScrollBar *)obj;
1164 if(ev->type() == QEvent::Enter){ 1162 if(ev->type() == QEvent::Enter){
1165 if(sb->isEnabled()){ 1163 if(sb->isEnabled()){
1166 highlightWidget = sb; 1164 highlightWidget = sb;
1167 sb->repaint(false); 1165 sb->repaint(false);
1168 } 1166 }
1169 } 1167 }
1170 else if(ev->type() == QEvent::Leave){ 1168 else if(ev->type() == QEvent::Leave){
1171 if(sb == highlightWidget && !sb->draggingSlider()){ 1169 if(sb == highlightWidget && !sb->draggingSlider()){
1172 highlightWidget = NULL; 1170 highlightWidget = NULL;
1173 sb->repaint(false); 1171 sb->repaint(false);
1174 } 1172 }
1175 } 1173 }
1176 else if(ev->type() == QEvent::MouseButtonRelease){ 1174 else if(ev->type() == QEvent::MouseButtonRelease){
1177 QMouseEvent *me = (QMouseEvent *)ev; 1175 QMouseEvent *me = (QMouseEvent *)ev;
1178 if(sb == highlightWidget && !sb->rect().contains(me->pos())){ 1176 if(sb == highlightWidget && !sb->rect().contains(me->pos())){
1179 highlightWidget = NULL; 1177 highlightWidget = NULL;
1180 sb->repaint(false); 1178 sb->repaint(false);
1181 } 1179 }
1182 } 1180 }
1183 } 1181 }
1184 else if(obj->inherits("QLineEdit")){ 1182 else if(obj->inherits("QLineEdit")){