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