~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kstyles/light/lightstyle-v2.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (c) 2000-2001 Trolltech AS (info@trolltech.com)
 
3
 
 
4
  Permission is hereby granted, free of charge, to any person obtaining a
 
5
  copy of this software and associated documentation files (the "Software"),
 
6
  to deal in the Software without restriction, including without limitation
 
7
  the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
8
  and/or sell copies of the Software, and to permit persons to whom the
 
9
  Software is furnished to do so, subject to the following conditions:
 
10
 
 
11
  The above copyright notice and this permission notice shall be included in
 
12
  all copies or substantial portions of the Software.
 
13
 
 
14
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
15
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
16
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
17
  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
18
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
19
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
20
  DEALINGS IN THE SOFTWARE.
 
21
*/
 
22
 
 
23
#include "lightstyle-v2.h"
 
24
 
 
25
#include "QtGui/QMenuBar"
 
26
#include "QtGui/QApplication"
 
27
#include "QtGui/QPainter"
 
28
#include "QtGui/QPalette"
 
29
#include "QtGui/QPushButton"
 
30
#include "QtGui/qdrawutil.h"
 
31
#include "QtGui/QProgressBar"
 
32
#include "QtGui/QScrollBar"
 
33
#include "QtGui/QTabBar"
 
34
#include "QtCore/QPointer"
 
35
#include "QtGui/QLayout"
 
36
#include "QtGui/QLineEdit"
 
37
#include "QtGui/QImage"
 
38
#include "QtGui/QComboBox"
 
39
#include "QtGui/QSlider"
 
40
#include "QtGui/QStyleFactory"
 
41
#include <Qt3Support/Q3PointArray>
 
42
 
 
43
 
 
44
class LightStyleV2Private
 
45
{
 
46
public:
 
47
    LightStyleV2Private()
 
48
        : ref(1)
 
49
    {
 
50
        basestyle = QStyleFactory::create( "Windows" );
 
51
        if ( ! basestyle )
 
52
            basestyle = QStyleFactory::create( QStyleFactory::keys().first() );
 
53
        if ( ! basestyle )
 
54
            qFatal( "LightStyle: could not find a basestyle!" );
 
55
    }
 
56
 
 
57
    ~LightStyleV2Private()
 
58
    {
 
59
        delete basestyle;
 
60
    }
 
61
 
 
62
    QStyle *basestyle;
 
63
    int ref;
 
64
};
 
65
 
 
66
static LightStyleV2Private *singleton = 0;
 
67
 
 
68
 
 
69
LightStyleV2::LightStyleV2()
 
70
    : KStyle(AllowMenuTransparency)
 
71
{
 
72
    if (! singleton)
 
73
        singleton = new LightStyleV2Private;
 
74
    else
 
75
        singleton->ref++;
 
76
}
 
77
 
 
78
LightStyleV2::~LightStyleV2()
 
79
{
 
80
    if (singleton && --singleton->ref <= 0) {
 
81
        delete singleton;
 
82
        singleton = 0;
 
83
    }
 
84
}
 
85
 
 
86
void LightStyleV2::polishPopupMenu( QMenu * menu )
 
87
{
 
88
    KStyle::polishPopupMenu(menu);
 
89
}
 
90
 
 
91
static void drawLightBevel(QPainter *p, const QRect &r, const QPalette &cg,
 
92
                           QStyle::State flags, const QBrush *fill = 0)
 
93
{
 
94
    QRect br = r;
 
95
    bool sunken = (flags & (QStyle::State_Down | QStyle::State_On |
 
96
                            QStyle::State_Sunken));
 
97
 
 
98
    p->setPen(cg.dark());
 
99
    p->drawRect(r);
 
100
 
 
101
    if (flags & (QStyle::State_Down | QStyle::State_On |
 
102
                 QStyle::State_Sunken | QStyle::State_Raised)) {
 
103
        // button bevel
 
104
        if (sunken)
 
105
            p->setPen(cg.mid());
 
106
        else
 
107
            p->setPen(cg.light());
 
108
 
 
109
        p->drawLine(r.x() + 1, r.y() + 2,
 
110
                    r.x() + 1, r.y() + r.height() - 3); // left
 
111
        p->drawLine(r.x() + 1, r.y() + 1,
 
112
                    r.x() + r.width() - 2, r.y() + 1); // top
 
113
 
 
114
        if (sunken)
 
115
            p->setPen(cg.light());
 
116
        else
 
117
            p->setPen(cg.mid());
 
118
 
 
119
        p->drawLine(r.x() + r.width() - 2, r.y() + 2,
 
120
                    r.x() + r.width() - 2, r.y() + r.height() - 3); // right
 
121
        p->drawLine(r.x() + 1, r.y() + r.height() - 2,
 
122
                    r.x() + r.width() - 2, r.y() + r.height() - 2); // bottom
 
123
 
 
124
        br.adjust(2, 2, -2, -2);
 
125
    } else
 
126
        br.adjust(1, 1, -1, -1);
 
127
 
 
128
    // fill
 
129
    if (fill) p->fillRect(br, *fill);
 
130
}
 
131
 
 
132
void LightStyleV2::drawPrimitive( PrimitiveElement pe,
 
133
                                const QStyleOption *option,
 
134
                                QPainter *p,
 
135
                                const QWidget *widget ) const
 
136
{
 
137
    QRect r = option->rect();
 
138
    switch (pe) {
 
139
    case PE_HeaderSection:
 
140
        {
 
141
            flags = ((flags | Style_Sunken) ^ Style_Sunken) | Style_Raised; 
 
142
                //Don't show pressed too often (as in light 3)
 
143
            QBrush fill(cg.background());
 
144
            if (flags & QStyle::State_Enabled)
 
145
                fill.setColor(cg.button());
 
146
            
 
147
            drawLightBevel(p, r, cg, flags, &fill);
 
148
            p->setPen( cg.buttonText() );
 
149
            break;
 
150
        }
 
151
        
 
152
    case PE_ButtonCommand:
 
153
    case PE_ButtonBevel:
 
154
    case PE_ButtonTool:
 
155
        {
 
156
            const QBrush *fill;
 
157
            if (flags & QStyle::State_Enabled) {
 
158
                if (flags & (QStyle::State_Down |
 
159
                             QStyle::State_On |
 
160
                             QStyle::State_Sunken))
 
161
                    fill = &cg.brush(QPalette::Midlight);
 
162
                else
 
163
                    fill = &cg.brush(QPalette::Button);
 
164
            } else
 
165
                fill = &cg.brush(QPalette::Background);
 
166
            drawLightBevel(p, r, cg, flags, fill);
 
167
            break;
 
168
        }
 
169
 
 
170
    case PE_ButtonDropDown:
 
171
        {
 
172
            QBrush thefill;
 
173
            bool sunken =
 
174
                (flags & (QStyle::State_Down | QStyle::State_On | QStyle::State_Sunken));
 
175
 
 
176
            if (flags & QStyle::State_Enabled) {
 
177
                if (sunken)
 
178
                    thefill = cg.brush(QPalette::Midlight);
 
179
                else
 
180
                    thefill = cg.brush(QPalette::Button);
 
181
            } else
 
182
                thefill = cg.brush(QPalette::Background);
 
183
 
 
184
            p->setPen(cg.dark());
 
185
            p->drawLine(r.topLeft(),     r.topRight());
 
186
            p->drawLine(r.topRight(),    r.bottomRight());
 
187
            p->drawLine(r.bottomRight(), r.bottomLeft());
 
188
 
 
189
            if (flags & (QStyle::State_Down | QStyle::State_On |
 
190
                         QStyle::State_Sunken | QStyle::State_Raised)) {
 
191
                // button bevel
 
192
                if (sunken)
 
193
                    p->setPen(cg.mid());
 
194
                else
 
195
                    p->setPen(cg.light());
 
196
 
 
197
                p->drawLine(r.x(), r.y() + 2,
 
198
                            r.x(), r.y() + r.height() - 3); // left
 
199
                p->drawLine(r.x(), r.y() + 1,
 
200
                            r.x() + r.width() - 2, r.y() + 1); // top
 
201
 
 
202
                if (sunken)
 
203
                    p->setPen(cg.light());
 
204
                else
 
205
                    p->setPen(cg.mid());
 
206
 
 
207
                p->drawLine(r.x() + r.width() - 2, r.y() + 2,
 
208
                            r.x() + r.width() - 2, r.y() + r.height() - 3); // right
 
209
                p->drawLine(r.x() + 1, r.y() + r.height() - 2,
 
210
                            r.x() + r.width() - 2, r.y() + r.height() - 2); // bottom
 
211
            }
 
212
 
 
213
            p->fillRect(r.x() + 1, r.y() + 2, r.width() - 3, r.height() - 4, thefill);
 
214
            break;
 
215
        }
 
216
 
 
217
    case PE_ButtonDefault:
 
218
        p->setPen(cg.dark());
 
219
        p->setBrush(cg.light());
 
220
        p->drawRect(r);
 
221
        break;
 
222
 
 
223
    case PE_Indicator:
 
224
        const QBrush *fill;
 
225
        if (! (flags & Style_Enabled))
 
226
            fill = &cg.brush(QPalette::Background);
 
227
        else if (flags & Style_Down)
 
228
            fill = &cg.brush(QPalette::Mid);
 
229
        else
 
230
            fill = &cg.brush(QPalette::Base);
 
231
        drawLightBevel(p, r, cg, flags | Style_Sunken, fill);
 
232
 
 
233
        p->setPen(cg.text());
 
234
        if (flags & Style_NoChange) {
 
235
            p->drawLine(r.x() + 3, r.y() + r.height() / 2,
 
236
                        r.x() + r.width() - 4, r.y() + r.height() / 2);
 
237
            p->drawLine(r.x() + 3, r.y() + 1 + r.height() / 2,
 
238
                        r.x() + r.width() - 4, r.y() + 1 + r.height() / 2);
 
239
            p->drawLine(r.x() + 3, r.y() - 1 + r.height() / 2,
 
240
                        r.x() + r.width() - 4, r.y() - 1 + r.height() / 2);
 
241
        } else if (flags & Style_On) {
 
242
            p->drawLine(r.x() + 4, r.y() + 3,
 
243
                        r.x() + r.width() - 4, r.y() + r.height() - 5);
 
244
            p->drawLine(r.x() + 3, r.y() + 3,
 
245
                        r.x() + r.width() - 4, r.y() + r.height() - 4);
 
246
            p->drawLine(r.x() + 3, r.y() + 4,
 
247
                        r.x() + r.width() - 5, r.y() + r.height() - 4);
 
248
            p->drawLine(r.x() + 3, r.y() + r.height() - 5,
 
249
                        r.x() + r.width() - 5, r.y() + 3);
 
250
            p->drawLine(r.x() + 3, r.y() + r.height() - 4,
 
251
                        r.x() + r.width() - 4, r.y() + 3);
 
252
            p->drawLine(r.x() + 4, r.y() + r.height() - 4,
 
253
                        r.x() + r.width() - 4, r.y() + 4);
 
254
        }
 
255
 
 
256
        break;
 
257
 
 
258
    case PE_ExclusiveIndicator:
 
259
        {
 
260
            QRect br = r, // bevel rect
 
261
                  cr = r, // contents rect
 
262
                  ir = r; // indicator rect
 
263
            br.adjust(1, 1, -1, -1);
 
264
            cr.adjust(2, 2, -2, -2);
 
265
            ir.adjust(3, 3, -3, -3);
 
266
 
 
267
            p->fillRect(r, cg.brush(QPalette::Background));
 
268
 
 
269
            p->setPen(cg.dark());
 
270
            p->drawArc(r, 0, 16*360);
 
271
            p->setPen(cg.mid());
 
272
            p->drawArc(br, 45*16, 180*16);
 
273
            p->setPen(cg.light());
 
274
            p->drawArc(br, 235*16, 180*16);
 
275
 
 
276
            p->setPen(flags & Style_Down ? cg.mid() :
 
277
                      (flags & Style_Enabled ? cg.base() : cg.background()));
 
278
            p->setBrush(flags & Style_Down ? cg.mid() :
 
279
                        (flags & Style_Enabled ? cg.base() : cg.background()));
 
280
            p->drawEllipse(cr);
 
281
 
 
282
            if (flags & Style_On) {
 
283
                p->setBrush(cg.text());
 
284
                p->drawEllipse(ir);
 
285
            }
 
286
 
 
287
            break;
 
288
        }
 
289
 
 
290
    case PE_DockWindowHandle:
 
291
        {
 
292
            QString title;
 
293
            bool drawTitle = false;
 
294
            if ( p && p->device()->devType() == QInternal::Widget ) {
 
295
                QWidget *w = (QWidget *) p->device();
 
296
                QWidget *p = w->parentWidget();
 
297
                if (p->inherits("QDockWindow") && ! p->inherits("QToolBar")) {
 
298
                    drawTitle = true;
 
299
                    title = p->caption();
 
300
                }
 
301
            }
 
302
 
 
303
            flags |= Style_Raised;
 
304
            if (flags & Style_Horizontal) {
 
305
                if (drawTitle) {
 
306
                    QPixmap pm(r.height(), r.width());
 
307
                    QPainter p2(&pm);
 
308
                    p2.fillRect(0, 0, pm.width(), pm.height(),
 
309
                                cg.brush(QPalette::Highlight));
 
310
                    p2.setPen(cg.highlightedText());
 
311
                    p2.drawText(0, 0, pm.width(), pm.height(), Qt::AlignCenter, title);
 
312
                    p2.end();
 
313
 
 
314
                    QMatrix m;
 
315
                    m.rotate(270.0);
 
316
                    pm = pm.xForm(m);
 
317
                    p->drawPixmap(r.x(), r.y(), pm);
 
318
                } else {
 
319
                    p->fillRect(r, cg.background());
 
320
                    p->setPen(cg.mid().dark());
 
321
                    p->drawLine(r.right() - 6, r.top() + 2,
 
322
                                r.right() - 6, r.bottom() - 2);
 
323
                    p->drawLine(r.right() - 3, r.top() + 2,
 
324
                                r.right() - 3, r.bottom() - 2);
 
325
                    p->setPen(cg.light());
 
326
                    p->drawLine(r.right() - 5, r.top() + 2,
 
327
                                r.right() - 5, r.bottom() - 2);
 
328
                    p->drawLine(r.right() - 2, r.top() + 2,
 
329
                                r.right() - 2, r.bottom() - 2);
 
330
                }
 
331
            } else {
 
332
                if (drawTitle) {
 
333
                    p->fillRect(r, cg.brush(QPalette::Highlight));
 
334
                    p->setPen(cg.highlightedText());
 
335
                    p->drawText(r, Qt::AlignCenter, title);
 
336
                } else {
 
337
                    p->fillRect(r, cg.background());
 
338
                    p->setPen(cg.mid().dark());
 
339
                    p->drawLine(r.left() + 2,  r.bottom() - 6,
 
340
                                r.right() - 2, r.bottom() - 6);
 
341
                    p->drawLine(r.left() + 2,  r.bottom() - 3,
 
342
                                r.right() - 2, r.bottom() - 3);
 
343
                    p->setPen(cg.light());
 
344
                    p->drawLine(r.left() + 2,  r.bottom() - 5,
 
345
                                r.right() - 2, r.bottom() - 5);
 
346
                    p->drawLine(r.left() + 2,  r.bottom() - 2,
 
347
                                r.right() - 2, r.bottom() - 2);
 
348
                }
 
349
            }
 
350
            break;
 
351
        }
 
352
 
 
353
    case PE_DockWindowSeparator:
 
354
        {
 
355
            if (r.width() > 20 || r.height() > 20) {
 
356
                if (flags & Style_Horizontal) {
 
357
                    p->setPen(cg.mid().dark(120));
 
358
                    p->drawLine(r.left() + 1, r.top() + 6, r.left() + 1, r.bottom() - 6);
 
359
                    p->setPen(cg.light());
 
360
                    p->drawLine(r.left() + 2, r.top() + 6, r.left() + 2, r.bottom() - 6);
 
361
                } else {
 
362
                    p->setPen(cg.mid().dark(120));
 
363
                    p->drawLine(r.left() + 6, r.top() + 1, r.right() - 6, r.top() + 1);
 
364
                    p->setPen(cg.light());
 
365
                    p->drawLine(r.left() + 6, r.top() + 2, r.right() - 6, r.top() + 2);
 
366
                }
 
367
            } else
 
368
                QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data);
 
369
            break;
 
370
        }
 
371
 
 
372
    case PE_Splitter:
 
373
        if (flags & Style_Horizontal)
 
374
            flags &= ~Style_Horizontal;
 
375
        else
 
376
            flags |= Style_Horizontal;
 
377
        // fall through intended
 
378
 
 
379
    case PE_DockWindowResizeHandle:
 
380
        {
 
381
            p->fillRect(r, cg.background());
 
382
            if (flags & Style_Horizontal) {
 
383
                p->setPen(cg.highlight().light());
 
384
                p->drawLine(r.left() + 1, r.top() + 1, r.right() - 1, r.top() + 1);
 
385
                p->setPen(cg.highlight());
 
386
                p->drawLine(r.left() + 1, r.top() + 2, r.right() - 1, r.top() + 2);
 
387
                p->setPen(cg.highlight().dark());
 
388
                p->drawLine(r.left() + 1, r.top() + 3, r.right() - 1, r.top() + 3);
 
389
            } else {
 
390
                p->setPen(cg.highlight().light());
 
391
                p->drawLine(r.left() + 1, r.top() + 1, r.left() + 1, r.bottom() - 1);
 
392
                p->setPen(cg.highlight());
 
393
                p->drawLine(r.left() + 2, r.top() + 1, r.left() + 2, r.bottom() - 1);
 
394
                p->setPen(cg.highlight().dark());
 
395
                p->drawLine(r.left() + 3, r.top() + 1, r.left() + 3, r.bottom() - 1);
 
396
            }
 
397
            break;
 
398
        }
 
399
 
 
400
    case PE_Panel:
 
401
    case PE_PanelPopup:
 
402
    case PE_PanelLineEdit:
 
403
    case PE_PanelTabWidget:
 
404
    case PE_WindowFrame:
 
405
        {
 
406
            int lw = data.isDefault() ?
 
407
                     pixelMetric(PM_DefaultFrameWidth) : data.lineWidth();
 
408
 
 
409
            if ( ! ( flags & Style_Sunken ) )
 
410
                flags |= Style_Raised;
 
411
            if (lw == 2)
 
412
                drawLightBevel(p, r, cg, flags);
 
413
            else
 
414
                QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data);
 
415
            break;
 
416
        }
 
417
 
 
418
    case PE_PanelDockWindow:
 
419
        {
 
420
            int lw = data.isDefault() ?
 
421
                     pixelMetric(PM_DockWindowFrameWidth) : data.lineWidth();
 
422
 
 
423
            if (lw == 2)
 
424
                drawLightBevel(p, r, cg, flags | Style_Raised,
 
425
                               &cg.brush(QPalette::Button));
 
426
            else
 
427
                QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data);
 
428
            break;
 
429
        }
 
430
 
 
431
    case PE_PanelMenuBar:
 
432
        {
 
433
            int lw = data.isDefault() ?
 
434
                     pixelMetric(PM_MenuBarFrameWidth) : data.lineWidth();
 
435
 
 
436
            if (lw == 2)
 
437
                drawLightBevel(p, r, cg, flags, &cg.brush(QPalette::Button));
 
438
            else
 
439
                QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data);
 
440
            break;
 
441
        }
 
442
 
 
443
    case PE_ScrollBarSubLine:
 
444
        {
 
445
            QRect fr = r, ar = r;
 
446
            PrimitiveElement pe;
 
447
 
 
448
            p->setPen(cg.dark());
 
449
            if (flags & Style_Horizontal) {
 
450
                p->drawLine(r.topLeft(), r.topRight());
 
451
                fr.adjust(0, 1, 0, 0);
 
452
                ar.adjust(0, 1, 0, 0);
 
453
                pe = PE_ArrowLeft;
 
454
            } else {
 
455
                p->drawLine(r.topLeft(), r.bottomLeft());
 
456
                fr.adjust(1, 0, 0, 0);
 
457
                ar.adjust(2, 0, 0, 0);
 
458
                pe = PE_ArrowUp;
 
459
            }
 
460
 
 
461
            p->fillRect(fr, cg.brush((flags & Style_Down) ?
 
462
                                     QPalette::Midlight :
 
463
                                     QPalette::Background));
 
464
            drawPrimitive(pe, p, ar, cg, flags);
 
465
            break;
 
466
        }
 
467
 
 
468
    case PE_ScrollBarAddLine:
 
469
        {
 
470
            QRect fr = r, ar = r;
 
471
            PrimitiveElement pe;
 
472
 
 
473
            p->setPen(cg.dark());
 
474
            if (flags & Style_Horizontal) {
 
475
                p->drawLine(r.topLeft(), r.topRight());
 
476
                fr.adjust(0, 1, 0, 0);
 
477
                ar.adjust(0, 1, 0, 0);
 
478
                pe = PE_ArrowRight;
 
479
            } else {
 
480
                p->drawLine(r.topLeft(), r.bottomLeft());
 
481
                fr.adjust(1, 0, 0, 0);
 
482
                ar.adjust(2, 0, 0, 0);
 
483
                pe = PE_ArrowDown;
 
484
            }
 
485
 
 
486
            p->fillRect(fr, cg.brush((flags & Style_Down) ?
 
487
                                     QPalette::Midlight :
 
488
                                     QPalette::Background));
 
489
            drawPrimitive(pe, p, ar, cg, flags);
 
490
            break;
 
491
        }
 
492
 
 
493
    case PE_ScrollBarSubPage:
 
494
    case PE_ScrollBarAddPage:
 
495
        {
 
496
            QRect fr = r;
 
497
 
 
498
            p->setPen(cg.dark());
 
499
            if (flags & Style_Horizontal) {
 
500
                p->drawLine(r.topLeft(), r.topRight());
 
501
                p->setPen(cg.background());
 
502
                p->drawLine(r.left(), r.top() + 1, r.right(), r.top() + 1);
 
503
                fr.adjust(0, 2, 0, 0);
 
504
            } else {
 
505
                p->drawLine(r.topLeft(), r.bottomLeft());
 
506
                p->setPen(cg.background());
 
507
                p->drawLine(r.left() + 1, r.top(), r.left() + 1, r.bottom());
 
508
                fr.adjust(2, 0, 0, 0);
 
509
            }
 
510
 
 
511
            p->fillRect(fr, cg.brush((flags & Style_Down) ?
 
512
                                     QPalette::Midlight :
 
513
                                     QPalette::Mid));
 
514
            break;
 
515
        }
 
516
 
 
517
    case PE_ScrollBarSlider:
 
518
        {
 
519
            QRect fr = r;
 
520
 
 
521
            p->setPen(cg.dark());
 
522
            if (flags & Style_Horizontal) {
 
523
                p->drawLine(r.topLeft(), r.topRight());
 
524
                p->setPen(cg.background());
 
525
                p->drawLine(r.left(), r.top() + 1, r.right(), r.top() + 1);
 
526
                fr.adjust(0, 2, 0, -1);
 
527
            } else {
 
528
                p->drawLine(r.topLeft(), r.bottomLeft());
 
529
                p->setPen(cg.background());
 
530
                p->drawLine(r.left() + 1, r.top(), r.left() + 1, r.bottom());
 
531
                fr.adjust(2, 0, -1, 0);
 
532
            }
 
533
 
 
534
            drawLightBevel(p, fr, cg, ((flags | Style_Down) ^ Style_Down) |
 
535
                           ((flags & Style_Enabled) ? Style_Raised : Style_Default),
 
536
                           &cg.brush(QPalette::Button));
 
537
            break;
 
538
        }
 
539
 
 
540
    case PE_FocusRect:
 
541
        {
 
542
            p->setBrush(Qt::NoBrush);
 
543
            if (flags & Style_FocusAtBorder)
 
544
                p->setPen(cg.shadow());
 
545
            else
 
546
                p->setPen(cg.dark());
 
547
            p->drawRect(r);
 
548
            break;
 
549
        }
 
550
 
 
551
    case PE_ProgressBarChunk:
 
552
        p->fillRect(r.x(), r.y() + 2, r.width(), r.height() - 4, cg.highlight());
 
553
        break;
 
554
 
 
555
    default:
 
556
        if (pe == PE_HeaderArrow) {
 
557
            if (flags & Style_Down)
 
558
                pe = PE_ArrowDown;
 
559
            else
 
560
                pe = PE_ArrowUp;
 
561
        }
 
562
        
 
563
 
 
564
        if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
 
565
            Q3PointArray a;
 
566
 
 
567
            switch ( pe ) {
 
568
            case PE_ArrowUp:
 
569
                a.setPoints( 7, -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2 );
 
570
                break;
 
571
 
 
572
            case PE_ArrowDown:
 
573
                a.setPoints( 7, -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1 );
 
574
                break;
 
575
 
 
576
            case PE_ArrowRight:
 
577
                a.setPoints( 7, -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0 );
 
578
                break;
 
579
 
 
580
            case PE_ArrowLeft:
 
581
                a.setPoints( 7, 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0 );
 
582
                break;
 
583
 
 
584
            default:
 
585
                break;
 
586
            }
 
587
 
 
588
            if (a.isNull())
 
589
                return;
 
590
 
 
591
            p->save();
 
592
            if ( flags & Style_Enabled ) {
 
593
                a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
 
594
                p->setPen( cg.buttonText() );
 
595
                p->drawLineSegments( a, 0, 3 );         // draw arrow
 
596
                p->drawPoint( a[6] );
 
597
            } else {
 
598
                a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 );
 
599
                p->setPen( cg.light() );
 
600
                p->drawLineSegments( a, 0, 3 );         // draw arrow
 
601
                p->drawPoint( a[6] );
 
602
                a.translate( -1, -1 );
 
603
                p->setPen( cg.mid() );
 
604
                p->drawLineSegments( a, 0, 3 );         // draw arrow
 
605
                p->drawPoint( a[6] );
 
606
            }
 
607
            p->restore();
 
608
        } else
 
609
            QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data);
 
610
        break;
 
611
    }
 
612
}
 
613
 
 
614
void LightStyleV2::drawControl( ControlElement control,
 
615
                              const QStyleOption *option,
 
616
                              QPainter *p,
 
617
                              const QWidget *widget ) const
 
618
{
 
619
    QRect r = option->rect();
 
620
    switch (control) {
 
621
    case CE_TabBarTab:
 
622
        {
 
623
            const QTabBar* tb = static_cast<const QTabBar*>(widget);
 
624
            bool below = false;
 
625
            QRect tr(r);
 
626
            QRect fr(r);
 
627
 
 
628
            tr.adjust(0, 0,  0, -1);
 
629
            fr.adjust(2, 2, -2, -2);
 
630
            
 
631
            if ( tb->shape() == QTabBar:: RoundedSouth || tb->shape() == QTabBar:: TriangularSouth) {
 
632
                tr = r; tr.adjust(0, 1, 0, 0);
 
633
                fr = r; fr.adjust(2, 2,-2, -4);
 
634
                below = true;
 
635
            }
 
636
                
 
637
            if (! (flags & Style_Selected)) {
 
638
                if (below) {
 
639
                    tr.adjust(0, 0, 0, -1);
 
640
                    tr.adjust(0, 0, 0, -1);
 
641
                } else {
 
642
                    tr.adjust(0, 1, 0, 0);
 
643
                    fr.adjust(0, 1, 0, 0);
 
644
                }
 
645
 
 
646
                p->setPen(cg.dark());
 
647
                p->drawRect(tr);
 
648
 
 
649
                if (tr.left() == 0)
 
650
                    if (below) 
 
651
                        p->drawPoint(tr.left(), tr.top() - 1);
 
652
                    else
 
653
                        p->drawPoint(tr.left(), tr.bottom() + 1);
 
654
 
 
655
                p->setPen(cg.light());
 
656
                if (below) {
 
657
                    p->drawLine(tr.left() + 1, tr.top() + 1,
 
658
                            tr.left() + 1, tr.bottom() - 2);
 
659
                    p->drawLine(tr.left() + 1, tr.bottom() - 1,
 
660
                            tr.right() - 1, tr.bottom() - 1);
 
661
                } else {
 
662
                    p->drawLine(tr.left() + 1, tr.bottom() - 1,
 
663
                            tr.left() + 1, tr.top() + 2);
 
664
                    p->drawLine(tr.left() + 1, tr.top() + 1,
 
665
                            tr.right() - 1, tr.top() + 1);
 
666
                }
 
667
                
 
668
                if (below) {
 
669
                    if (tr.left() == 0)
 
670
                        p->drawLine(tr.left() + 1, tr.top() - 1,
 
671
                                    tr.right(), tr.top() - 1);
 
672
                    else
 
673
                    {
 
674
                        p->setPen(cg.mid()); //To match lower border of the frame
 
675
                        p->drawLine(tr.left(), tr.top() - 1,
 
676
                                    tr.right(), tr.top() - 1);
 
677
                    }
 
678
                } else {
 
679
                    if (tr.left() == 0)
 
680
                        p->drawLine(tr.left() + 1, tr.bottom() + 1,
 
681
                                    tr.right(), tr.bottom() + 1);
 
682
                    else
 
683
                        p->drawLine(tr.left(), tr.bottom() + 1,
 
684
                                    tr.right(), tr.bottom() + 1);
 
685
                }
 
686
                
 
687
                p->setPen(cg.mid());
 
688
                
 
689
                if (below) {
 
690
                    p->drawLine(tr.right() - 1, tr.bottom() - 2,
 
691
                                tr.right() - 1, tr.top() + 1);
 
692
                } else {
 
693
                    p->drawLine(tr.right() - 1, tr.top() + 2,
 
694
                                tr.right() - 1, tr.bottom() - 1);
 
695
                }
 
696
            } else {
 
697
                p->setPen(cg.dark());
 
698
                if (tr.left() == 0)
 
699
                    if (below)
 
700
                        p->drawLine(tr.left(), tr.top() - 1,
 
701
                                    tr.left(), tr.bottom() - 1);
 
702
                    else
 
703
                        p->drawLine(tr.left(), tr.bottom() + 1,
 
704
                                    tr.left(), tr.top() + 1);
 
705
                else
 
706
                    if (below)
 
707
                        p->drawLine(tr.left(), tr.bottom(),
 
708
                                    tr.left(), tr.top() + 1);
 
709
                    else
 
710
                        p->drawLine(tr.left(), tr.bottom(),
 
711
                                    tr.left(), tr.top() + 1);
 
712
                                    
 
713
                if (below) {
 
714
                    p->drawLine(tr.left(), tr.bottom(),
 
715
                                tr.right(), tr.bottom());
 
716
                    p->drawLine(tr.right(), tr.bottom() - 1,
 
717
                                tr.right(), tr.top());
 
718
 
 
719
                } else {
 
720
                    p->drawLine(tr.left(), tr.top(),
 
721
                                tr.right(), tr.top());
 
722
                    p->drawLine(tr.right(), tr.top() + 1,
 
723
                                tr.right(), tr.bottom());
 
724
                }
 
725
 
 
726
                p->setPen(cg.light());
 
727
                if (tr.left() == 0)
 
728
                    if (below)
 
729
                        p->drawLine(tr.left() + 1, tr.top() - 2,
 
730
                                    tr.left() + 1, tr.bottom() - 2);
 
731
                    else
 
732
                        p->drawLine(tr.left() + 1, tr.bottom() + 2,
 
733
                                    tr.left() + 1, tr.top() + 2);
 
734
                else {
 
735
                    if (below) {
 
736
                        p->drawLine(tr.left() + 1, tr.top(),
 
737
                                    tr.left() + 1, tr.bottom() - 2);
 
738
                        p->drawPoint(tr.left(), tr.top() - 1);
 
739
 
 
740
                    } else {
 
741
                        p->drawLine(tr.left() + 1, tr.bottom(),
 
742
                                    tr.left() + 1, tr.top() + 2);
 
743
                        p->drawPoint(tr.left(), tr.bottom() + 1);
 
744
                    }
 
745
                }
 
746
                
 
747
                if (below) {
 
748
                    p->drawLine(tr.left() + 1, tr.bottom() - 1,
 
749
                                tr.right() - 1, tr.bottom() - 1);
 
750
                    p->drawPoint(tr.right(), tr.top() - 1);
 
751
 
 
752
                    p->setPen(cg.mid());
 
753
                    p->drawLine(tr.right() - 1, tr.bottom() - 2,
 
754
                                tr.right() - 1, tr.top());
 
755
                } else {
 
756
                    p->drawLine(tr.left() + 1, tr.top() + 1,
 
757
                                tr.right() - 1, tr.top() + 1);
 
758
                    p->drawPoint(tr.right(), tr.bottom() + 1);
 
759
 
 
760
                    p->setPen(cg.mid());
 
761
                    p->drawLine(tr.right() - 1, tr.top() + 2,
 
762
                                tr.right() - 1, tr.bottom());
 
763
                }
 
764
            }
 
765
 
 
766
            p->fillRect(fr, ((flags & Style_Selected) ?
 
767
                             cg.background() : cg.mid()));
 
768
            break;
 
769
        }
 
770
 
 
771
    case CE_PopupMenuItem:
 
772
        {
 
773
            if (! widget || data.isDefault())
 
774
                break;
 
775
 
 
776
            const QMenu *popupmenu = (const QMenu *) widget;
 
777
            QMenuItem *mi = data.menuItem();
 
778
            int tab = data.tabWidth();
 
779
            int maxpmw = data.maxIconWidth();
 
780
 
 
781
            if ( mi && mi->isSeparator() ) {
 
782
                // draw separator (bg first, though)      
 
783
                if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() )
 
784
                    p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r );
 
785
                else
 
786
                    p->fillRect(r, cg.brush(QPalette::Button));
 
787
            
 
788
                p->setPen(cg.mid().dark(120));
 
789
                p->drawLine(r.left() + 12,  r.top() + 1,
 
790
                            r.right() - 12, r.top() + 1);
 
791
                p->setPen(cg.light());
 
792
                p->drawLine(r.left() + 12,  r.top() + 2,
 
793
                            r.right() - 12, r.top() + 2);
 
794
                break;
 
795
            }
 
796
 
 
797
            if (flags & Style_Active)
 
798
                qDrawShadePanel(p, r, cg, true, 1,
 
799
                                &cg.brush(QPalette::Midlight));
 
800
            else if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() )
 
801
                p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r );
 
802
            else 
 
803
                p->fillRect(r, cg.brush(QPalette::Button));
 
804
 
 
805
            if ( !mi )
 
806
                break;
 
807
 
 
808
            maxpmw = qMax(maxpmw, 16);
 
809
 
 
810
            QRect cr, ir, tr, sr;
 
811
            // check column
 
812
            cr.setRect(r.left(), r.top(), maxpmw, r.height());
 
813
            // submenu indicator column
 
814
            sr.setCoords(r.right() - maxpmw, r.top(), r.right(), r.bottom());
 
815
            // tab/accelerator column
 
816
            tr.setCoords(sr.left() - tab - 4, r.top(), sr.left(), r.bottom());
 
817
            // item column
 
818
            ir.setCoords(cr.right() + 4, r.top(), tr.right() - 4, r.bottom());
 
819
 
 
820
            bool reverse = QApplication::isRightToLeft();
 
821
            if ( reverse ) {
 
822
                cr = visualRect( cr, r );
 
823
                sr = visualRect( sr, r );
 
824
                tr = visualRect( tr, r );
 
825
                ir = visualRect( ir, r );
 
826
            }
 
827
 
 
828
            if (mi->isChecked() &&
 
829
                ! (flags & Style_Active) &
 
830
                (flags & Style_Enabled))
 
831
                qDrawShadePanel(p, cr, cg, true, 1, &cg.brush(QPalette::Midlight));
 
832
 
 
833
            if (mi->iconSet()) {
 
834
                QIcon::Mode mode =
 
835
                    (flags & Style_Enabled) ? QIcon::Normal : QIcon::Disabled;
 
836
                if ((flags & Style_Active) && (flags & Style_Enabled))
 
837
                    mode = QIcon::Active;
 
838
                QPixmap pixmap;
 
839
                if (popupmenu->isCheckable() && mi->isChecked())
 
840
                    pixmap =
 
841
                        mi->iconSet()->pixmap( QIcon::Small, mode, QIcon::On );
 
842
                else
 
843
                    pixmap =
 
844
                        mi->iconSet()->pixmap( QIcon::Small, mode );
 
845
                QRect pmr(QPoint(0, 0), pixmap.size());
 
846
                pmr.moveCenter(cr.center());
 
847
                p->setPen(cg.text());
 
848
                p->drawPixmap(pmr.topLeft(), pixmap);
 
849
            } else if (popupmenu->isCheckable() && mi->isChecked())
 
850
                drawPrimitive(PE_CheckMark, p, cr, cg,
 
851
                              (flags & Style_Enabled) | Style_On);
 
852
 
 
853
            QColor textcolor;
 
854
            QColor embosscolor;
 
855
            if (flags & Style_Active) {
 
856
                if (! (flags & Style_Enabled))
 
857
                    textcolor = cg.midlight().dark();
 
858
                else
 
859
                    textcolor = cg.buttonText();
 
860
                embosscolor = cg.midlight().light();
 
861
            } else if (! (flags & Style_Enabled)) {
 
862
                textcolor = cg.text();
 
863
                embosscolor = cg.light();
 
864
            } else
 
865
                textcolor = embosscolor = cg.buttonText();
 
866
            p->setPen(textcolor);
 
867
 
 
868
            if (mi->custom()) {
 
869
                p->save();
 
870
                if (! (flags & Style_Enabled)) {
 
871
                    p->setPen(cg.light());
 
872
                    mi->custom()->paint(p, cg, flags & Style_Active,
 
873
                                        flags & Style_Enabled,
 
874
                                        ir.x() + 1, ir.y() + 1,
 
875
                                        ir.width() - 1, ir.height() - 1);
 
876
                    p->setPen(textcolor);
 
877
                }
 
878
                mi->custom()->paint(p, cg, flags & Style_Active,
 
879
                                    flags & Style_Enabled,
 
880
                                    ir.x(), ir.y(),
 
881
                                    ir.width(), ir.height());
 
882
                p->restore();
 
883
            }
 
884
 
 
885
            QString text = mi->text();
 
886
            if (! text.isNull()) {
 
887
                int t = text.find('\t');
 
888
 
 
889
                // draw accelerator/tab-text
 
890
                if (t >= 0) {
 
891
                    int alignFlag = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
 
892
                    alignFlag |= ( reverse ? Qt::AlignLeft : Qt::AlignRight );
 
893
                    if (! (flags & Style_Enabled)) {
 
894
                        p->setPen(embosscolor);
 
895
                        tr.translate(1, 1);
 
896
                        p->drawText(tr, alignFlag, text.mid(t + 1));
 
897
                        tr.translate(-1, -1);
 
898
                        p->setPen(textcolor);
 
899
                    }
 
900
 
 
901
                    p->drawText(tr, alignFlag, text.mid(t + 1));
 
902
                }
 
903
 
 
904
                int alignFlag = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
 
905
                alignFlag |= ( reverse ? Qt::AlignRight : Qt::AlignLeft );
 
906
 
 
907
                if (! (flags & Style_Enabled)) {
 
908
                    p->setPen(embosscolor);
 
909
                    ir.translate(1, 1);
 
910
                    p->drawText(ir, alignFlag, text, t);
 
911
                    ir.translate(-1, -1);
 
912
                    p->setPen(textcolor);
 
913
                }
 
914
 
 
915
                p->drawText(ir, alignFlag, text, t);
 
916
            } else if (mi->pixmap()) {
 
917
                QPixmap pixmap = *mi->pixmap();
 
918
                if (pixmap.depth() == 1)
 
919
                    p->setBackgroundMode(Qt::OpaqueMode);
 
920
                p->drawPixmap(ir.x(), ir.y() + (ir.height() - pixmap.height()) / 2, pixmap);
 
921
                if (pixmap.depth() == 1)
 
922
                    p->setBackgroundMode(Qt::TransparentMode);
 
923
            }
 
924
 
 
925
            if (mi->popup())
 
926
                drawPrimitive( (reverse ? PE_ArrowLeft : PE_ArrowRight), p, sr, cg, flags);
 
927
            break;
 
928
        }
 
929
        
 
930
    case CE_MenuBarEmptyArea:
 
931
        {
 
932
            p->fillRect(r, cg.brush(QPalette::Button));
 
933
            break;
 
934
        }
 
935
        
 
936
    case CE_DockWindowEmptyArea:
 
937
        {
 
938
            p->fillRect(r, cg.brush(QPalette::Button));
 
939
            break;
 
940
        }
 
941
 
 
942
 
 
943
    case CE_MenuBarItem:
 
944
        {
 
945
            if (flags & Style_Active)
 
946
                qDrawShadePanel(p, r, cg, true, 1, &cg.brush(QPalette::Midlight));
 
947
            else
 
948
                p->fillRect(r, cg.brush(QPalette::Button));
 
949
 
 
950
            if (data.isDefault())
 
951
                break;
 
952
 
 
953
            QMenuItem *mi = data.menuItem();
 
954
            drawItem(p, r, Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine, cg,
 
955
                     flags & Style_Enabled, mi->pixmap(), mi->text(), -1,
 
956
                     &cg.buttonText());
 
957
            break;
 
958
        }
 
959
 
 
960
    case CE_ProgressBarGroove:
 
961
        drawLightBevel(p, r, cg, Style_Sunken, &cg.brush(QPalette::Background));
 
962
        break;
 
963
 
 
964
    default:
 
965
        QCommonStyle::drawControl(control, p, widget, r, cg, flags, data);
 
966
        break;
 
967
    }
 
968
}
 
969
 
 
970
void LightStyleV2::drawControlMask( ControlElement control,
 
971
                                  QPainter *p,
 
972
                                  const QWidget *widget,
 
973
                                  const QRect &r,
 
974
                                  const QStyleOption &data ) const
 
975
{
 
976
    switch (control) {
 
977
    case CE_PushButton:
 
978
        p->fillRect(r, Qt::color1);
 
979
        break;
 
980
 
 
981
    default:
 
982
        QCommonStyle::drawControlMask(control, p, widget, r, data);
 
983
        break;
 
984
    }
 
985
}
 
986
 
 
987
QRect LightStyleV2::subElementRect(SubElement subelement, const QWidget *widget) const
 
988
{
 
989
    QRect rect, wrect(widget->rect());
 
990
 
 
991
    switch (subelement) {
 
992
    case SR_PushButtonFocusRect:
 
993
        {
 
994
            const QPushButton *button = (const QPushButton *) widget;
 
995
            int dbw1 = 0, dbw2 = 0;
 
996
            if (button->isDefault() || button->autoDefault()) {
 
997
                dbw1 = pixelMetric(PM_ButtonDefaultIndicator, widget);
 
998
                dbw2 = dbw1 * 2;
 
999
            }
 
1000
 
 
1001
            rect.setRect(wrect.x()      + 3 + dbw1,
 
1002
                         wrect.y()      + 3 + dbw1,
 
1003
                         wrect.width()  - 6 - dbw2,
 
1004
                         wrect.height() - 6 - dbw2);
 
1005
            break;
 
1006
        }
 
1007
 
 
1008
    default:
 
1009
        rect = QCommonStyle::subElementRect(subelement, widget);
 
1010
    }
 
1011
 
 
1012
    return rect;
 
1013
}
 
1014
 
 
1015
void LightStyleV2::drawComplexControl( ComplexControl control,
 
1016
                                     QPainter* p,
 
1017
                                     const QWidget* widget,
 
1018
                                     SCFlags controls,
 
1019
                                     SCFlags active,
 
1020
                                     const QStyleOption &data ) const
 
1021
{
 
1022
    switch (control) {
 
1023
    case CC_ComboBox:
 
1024
        {
 
1025
            const QComboBox *combobox = (const QComboBox *) widget;
 
1026
            QRect frame, arrow, field;
 
1027
            frame =
 
1028
                QStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget,
 
1029
                                                          SC_ComboBoxFrame, data),
 
1030
                                   widget);
 
1031
            arrow =
 
1032
                QStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget,
 
1033
                                                          SC_ComboBoxArrow, data),
 
1034
                                   widget);
 
1035
            field =
 
1036
                QStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget,
 
1037
                                                          SC_ComboBoxEditField, data),
 
1038
                                   widget);
 
1039
 
 
1040
            if ((controls & SC_ComboBoxFrame) && frame.isValid())
 
1041
                drawLightBevel(p, frame, cg, flags | Style_Raised,
 
1042
                               &cg.brush(QPalette::Button));
 
1043
 
 
1044
            if ((controls & SC_ComboBoxArrow) && arrow.isValid()) {
 
1045
                if (active == SC_ComboBoxArrow)
 
1046
                    p->fillRect(arrow, cg.brush(QPalette::Mid));
 
1047
                arrow.adjust(4, 2, -2, -2);
 
1048
                drawPrimitive(PE_ArrowDown, p, arrow, cg, flags);
 
1049
            }
 
1050
 
 
1051
            if ((controls & SC_ComboBoxEditField) && field.isValid()) {
 
1052
                p->setPen(cg.dark());
 
1053
                if (combobox->editable()) {
 
1054
                    field.adjust(-1, -1, 1, 1);
 
1055
                    p->drawRect(field);
 
1056
                } else
 
1057
                    p->drawLine(field.right() + 1, field.top(),
 
1058
                                field.right() + 1, field.bottom());
 
1059
 
 
1060
                if (flags & Style_HasFocus) {
 
1061
                    if (! combobox->editable()) {
 
1062
                        p->fillRect( field, cg.brush( QPalette::Highlight ) );
 
1063
                        QRect fr =
 
1064
                            QStyle::visualRect( subRect( SR_ComboBoxFocusRect, widget ),
 
1065
                                                widget );
 
1066
                        drawPrimitive( PE_FocusRect, p, fr, cg,
 
1067
                                       flags | Style_FocusAtBorder,
 
1068
                                       QStyleOption(cg.highlight()));
 
1069
                    }
 
1070
 
 
1071
                    p->setPen(cg.highlightedText());
 
1072
                } else
 
1073
                    p->setPen(cg.buttonText());
 
1074
            }
 
1075
 
 
1076
            break;
 
1077
        }
 
1078
 
 
1079
    case CC_SpinWidget:
 
1080
        {
 
1081
            const Q3SpinWidget *spinwidget = (const Q3SpinWidget *) widget;
 
1082
            QRect frame, up, down;
 
1083
 
 
1084
            frame = querySubControlMetrics(CC_SpinWidget, widget,
 
1085
                                           SC_SpinWidgetFrame, data);
 
1086
            up = spinwidget->upRect();
 
1087
            down = spinwidget->downRect();
 
1088
 
 
1089
            if ((controls & SC_SpinWidgetFrame) && frame.isValid())
 
1090
                drawLightBevel(p, frame, cg, flags | Style_Sunken,
 
1091
                               &cg.brush(QPalette::Base));
 
1092
 
 
1093
            if ((controls & SC_SpinWidgetUp) && up.isValid()) {
 
1094
                PrimitiveElement pe = PE_SpinWidgetUp;
 
1095
                if ( spinwidget->buttonSymbols() == Q3SpinWidget::PlusMinus )
 
1096
                    pe = PE_SpinWidgetPlus;
 
1097
 
 
1098
                p->setPen(cg.dark());
 
1099
                p->drawLine(up.topLeft(), up.bottomLeft());
 
1100
 
 
1101
                up.adjust(1, 0, 0, 0);
 
1102
                p->fillRect(up, cg.brush(QPalette::Button));
 
1103
                if (active == SC_SpinWidgetUp)
 
1104
                    p->setPen(cg.mid());
 
1105
                else
 
1106
                    p->setPen(cg.light());
 
1107
                p->drawLine(up.left(), up.top(),
 
1108
                            up.right() - 1, up.top());
 
1109
                p->drawLine(up.left(), up.top() + 1,
 
1110
                            up.left(), up.bottom() - 1);
 
1111
                if (active == SC_SpinWidgetUp)
 
1112
                    p->setPen(cg.light());
 
1113
                else
 
1114
                    p->setPen(cg.mid());
 
1115
                p->drawLine(up.right(), up.top(),
 
1116
                            up.right(), up.bottom());
 
1117
                p->drawLine(up.left(), up.bottom(),
 
1118
                            up.right() - 1, up.bottom());
 
1119
 
 
1120
                up.adjust(1, 0, 0, 0);
 
1121
                drawPrimitive(pe, p, up, cg, flags |
 
1122
                              ((active == SC_SpinWidgetUp) ?
 
1123
                               Style_On | Style_Sunken : Style_Raised));
 
1124
            }
 
1125
 
 
1126
            if ((controls & SC_SpinWidgetDown) && down.isValid()) {
 
1127
                PrimitiveElement pe = PE_SpinWidgetDown;
 
1128
                if ( spinwidget->buttonSymbols() == Q3SpinWidget::PlusMinus )
 
1129
                    pe = PE_SpinWidgetMinus;
 
1130
 
 
1131
                p->setPen(cg.dark());
 
1132
                p->drawLine(down.topLeft(), down.bottomLeft());
 
1133
 
 
1134
                down.adjust(1, 0, 0, 0);
 
1135
                p->fillRect(down, cg.brush(QPalette::Button));
 
1136
                if (active == SC_SpinWidgetDown)
 
1137
                    p->setPen(cg.mid());
 
1138
                else
 
1139
                    p->setPen(cg.light());
 
1140
                p->drawLine(down.left(), down.top(),
 
1141
                            down.right() - 1, down.top());
 
1142
                p->drawLine(down.left(), down.top() + 1,
 
1143
                            down.left(), down.bottom() - 1);
 
1144
                if (active == SC_SpinWidgetDown)
 
1145
                    p->setPen(cg.light());
 
1146
                else
 
1147
                    p->setPen(cg.mid());
 
1148
                p->drawLine(down.right(), down.top(),
 
1149
                            down.right(), down.bottom());
 
1150
                p->drawLine(down.left(), down.bottom(),
 
1151
                            down.right() - 1, down.bottom());
 
1152
 
 
1153
                down.adjust(1, 0, 0, 0);
 
1154
                drawPrimitive(pe, p, down, cg, flags |
 
1155
                              ((active == SC_SpinWidgetDown) ?
 
1156
                               Style_On | Style_Sunken : Style_Raised));
 
1157
            }
 
1158
 
 
1159
            break;
 
1160
        }
 
1161
 
 
1162
    case CC_ScrollBar:
 
1163
        {
 
1164
            const QScrollBar *scrollbar = (const QScrollBar *) widget;
 
1165
            QRect addline, subline, subline2, addpage, subpage, slider, first, last;
 
1166
            bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue());
 
1167
 
 
1168
            subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, data);
 
1169
            addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, data);
 
1170
            subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, data);
 
1171
            addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, data);
 
1172
            slider  = querySubControlMetrics(control, widget, SC_ScrollBarSlider,  data);
 
1173
            first   = querySubControlMetrics(control, widget, SC_ScrollBarFirst,   data);
 
1174
            last    = querySubControlMetrics(control, widget, SC_ScrollBarLast,    data);
 
1175
 
 
1176
            subline2 = addline;
 
1177
            if (scrollbar->orientation() == Qt::Horizontal)
 
1178
                subline2.translate(-addline.width(), 0);
 
1179
            else
 
1180
                subline2.translate(0, -addline.height());
 
1181
 
 
1182
            if ((controls & SC_ScrollBarSubLine) && subline.isValid()) {
 
1183
                drawPrimitive(PE_ScrollBarSubLine, p, subline, cg,
 
1184
                              Style_Enabled | ((active == SC_ScrollBarSubLine) ?
 
1185
                                               Style_Down : Style_Default) |
 
1186
                              ((scrollbar->orientation() == Qt::Horizontal) ?
 
1187
                               Style_Horizontal : 0));
 
1188
 
 
1189
                if (subline2.isValid())
 
1190
                    drawPrimitive(PE_ScrollBarSubLine, p, subline2, cg,
 
1191
                                  Style_Enabled | ((active == SC_ScrollBarSubLine) ?
 
1192
                                                   Style_Down : Style_Default) |
 
1193
                                  ((scrollbar->orientation() == Qt::Horizontal) ?
 
1194
                                   Style_Horizontal : 0));
 
1195
            }
 
1196
            if ((controls & SC_ScrollBarAddLine) && addline.isValid())
 
1197
                drawPrimitive(PE_ScrollBarAddLine, p, addline, cg,
 
1198
                              Style_Enabled | ((active == SC_ScrollBarAddLine) ?
 
1199
                                               Style_Down : Style_Default) |
 
1200
                              ((scrollbar->orientation() == Qt::Horizontal) ?
 
1201
                               Style_Horizontal : 0));
 
1202
            if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
 
1203
                drawPrimitive(PE_ScrollBarSubPage, p, subpage, cg,
 
1204
                              Style_Enabled | ((active == SC_ScrollBarSubPage) ?
 
1205
                                               Style_Down : Style_Default) |
 
1206
                              ((scrollbar->orientation() == Qt::Horizontal) ?
 
1207
                               Style_Horizontal : 0));
 
1208
            if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
 
1209
                drawPrimitive(PE_ScrollBarAddPage, p, addpage, cg,
 
1210
                              ((maxedOut) ? Style_Default : Style_Enabled) |
 
1211
                              ((active == SC_ScrollBarAddPage) ?
 
1212
                               Style_Down : Style_Default) |
 
1213
                              ((scrollbar->orientation() == Qt::Horizontal) ?
 
1214
                               Style_Horizontal : 0));
 
1215
            if ((controls & SC_ScrollBarFirst) && first.isValid())
 
1216
                drawPrimitive(PE_ScrollBarFirst, p, first, cg,
 
1217
                              Style_Enabled | ((active == SC_ScrollBarFirst) ?
 
1218
                                               Style_Down : Style_Default) |
 
1219
                              ((scrollbar->orientation() == Qt::Horizontal) ?
 
1220
                               Style_Horizontal : 0));
 
1221
            if ((controls & SC_ScrollBarLast) && last.isValid())
 
1222
                drawPrimitive(PE_ScrollBarLast, p, last, cg,
 
1223
                              Style_Enabled | ((active == SC_ScrollBarLast) ?
 
1224
                                               Style_Down : Style_Default) |
 
1225
                              ((scrollbar->orientation() == Qt::Horizontal) ?
 
1226
                               Style_Horizontal : 0));
 
1227
            if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
 
1228
                drawPrimitive(PE_ScrollBarSlider, p, slider, cg,
 
1229
                              Style_Enabled | ((active == SC_ScrollBarSlider) ?
 
1230
                                               Style_Down : Style_Default) |
 
1231
                              ((scrollbar->orientation() == Qt::Horizontal) ?
 
1232
                               Style_Horizontal : 0));
 
1233
 
 
1234
                // ### perhaps this should not be able to accept focus if maxedOut?
 
1235
                if (scrollbar->hasFocus()) {
 
1236
                    QRect fr(slider.x() + 2, slider.y() + 2,
 
1237
                             slider.width() - 5, slider.height() - 5);
 
1238
                    drawPrimitive(PE_FocusRect, p, fr, cg, Style_Default);
 
1239
                }
 
1240
            }
 
1241
 
 
1242
            break;
 
1243
        }
 
1244
 
 
1245
    case CC_Slider:
 
1246
        {
 
1247
            const QSlider *slider = (const QSlider *) widget;
 
1248
            QRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove,
 
1249
                                                  data),
 
1250
                  handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle,
 
1251
                                                  data);
 
1252
 
 
1253
            if ((controls & SC_SliderGroove) && groove.isValid()) {
 
1254
                if (flags & Style_HasFocus)
 
1255
                    drawPrimitive( PE_FocusRect, p, groove, cg );
 
1256
 
 
1257
                if (slider->orientation() == Qt::Horizontal) {
 
1258
                    int dh = (groove.height() - 5) / 2;
 
1259
                    groove.adjust(0, dh, 0, -dh);
 
1260
                } else {
 
1261
                    int dw = (groove.width() - 5) / 2;
 
1262
                    groove.adjust(dw, 0, -dw, 0);
 
1263
                }
 
1264
 
 
1265
                drawLightBevel(p, groove, cg, ((flags | Style_Raised) ^ Style_Raised) |
 
1266
                               ((flags & Style_Enabled) ? Style_Sunken : Style_Default),
 
1267
                               &cg.brush(QPalette::Midlight));
 
1268
            }
 
1269
 
 
1270
            if ((controls & SC_SliderHandle) && handle.isValid()) {
 
1271
                drawLightBevel(p, handle, cg, ((flags | Style_Down) ^ Style_Down) |
 
1272
                               ((flags & Style_Enabled) ? Style_Raised : Style_Default),
 
1273
                               &cg.brush(QPalette::Button));
 
1274
 
 
1275
            }
 
1276
 
 
1277
            if (controls & SC_SliderTickmarks)
 
1278
                QCommonStyle::drawComplexControl(control, p, widget, r, cg, flags,
 
1279
                                                 SC_SliderTickmarks, active, data );
 
1280
            break;
 
1281
        }
 
1282
 
 
1283
    case CC_ListView:
 
1284
        // use the base style for CC_ListView
 
1285
        singleton->basestyle->drawComplexControl(control, p, widget, r, cg, flags,
 
1286
                                                 controls, active, data);
 
1287
        break;
 
1288
 
 
1289
    default:
 
1290
        QCommonStyle::drawComplexControl(control, p, widget, r, cg, flags,
 
1291
                                         controls, active, data);
 
1292
        break;
 
1293
    }
 
1294
}
 
1295
 
 
1296
QRect LightStyleV2::querySubControlMetrics( ComplexControl control,
 
1297
                                          const QWidget *widget,
 
1298
                                          SubControl sc,
 
1299
                                          const QStyleOption &data ) const
 
1300
{
 
1301
    QRect ret;
 
1302
 
 
1303
    switch (control) {
 
1304
    case CC_ScrollBar:
 
1305
        {
 
1306
            const QScrollBar *scrollbar = (const QScrollBar *) widget;
 
1307
            int sliderstart = scrollbar->sliderStart();
 
1308
            int sbextent = pixelMetric(PM_ScrollBarExtent, widget);
 
1309
            int maxlen = ((scrollbar->orientation() == Qt::Horizontal) ?
 
1310
                          scrollbar->width() : scrollbar->height()) - (sbextent * 3);
 
1311
            int sliderlen;
 
1312
 
 
1313
            // calculate slider length
 
1314
            if (scrollbar->maxValue() != scrollbar->minValue()) {
 
1315
                uint range = scrollbar->maxValue() - scrollbar->minValue();
 
1316
                sliderlen = (scrollbar->pageStep() * maxlen) /
 
1317
                            (range + scrollbar->pageStep());
 
1318
 
 
1319
                int slidermin = pixelMetric( PM_ScrollBarSliderMin, widget );
 
1320
                if ( sliderlen < slidermin || range > INT_MAX / 2 )
 
1321
                    sliderlen = slidermin;
 
1322
                if ( sliderlen > maxlen )
 
1323
                    sliderlen = maxlen;
 
1324
            } else
 
1325
                sliderlen = maxlen;
 
1326
 
 
1327
            switch (sc) {
 
1328
            case SC_ScrollBarSubLine:
 
1329
                // top/left button
 
1330
                ret.setRect(0, 0, sbextent, sbextent);
 
1331
                break;
 
1332
 
 
1333
            case SC_ScrollBarAddLine:
 
1334
                // bottom/right button
 
1335
                if (scrollbar->orientation() == Qt::Horizontal)
 
1336
                    ret.setRect(scrollbar->width() - sbextent, 0, sbextent, sbextent);
 
1337
                else
 
1338
                    ret.setRect(0, scrollbar->height() - sbextent, sbextent, sbextent);
 
1339
                break;
 
1340
 
 
1341
            case SC_ScrollBarSubPage:
 
1342
                // between top/left button and slider
 
1343
                if (scrollbar->orientation() == Qt::Horizontal)
 
1344
                    ret.setRect(sbextent, 0, sliderstart - sbextent, sbextent);
 
1345
                else
 
1346
                    ret.setRect(0, sbextent, sbextent, sliderstart - sbextent);
 
1347
                break;
 
1348
 
 
1349
            case SC_ScrollBarAddPage:
 
1350
                // between bottom/right button and slider
 
1351
                if (scrollbar->orientation() == Qt::Horizontal)
 
1352
                    ret.setRect(sliderstart + sliderlen, 0,
 
1353
                                maxlen - sliderstart - sliderlen + sbextent, sbextent);
 
1354
                else
 
1355
                    ret.setRect(0, sliderstart + sliderlen,
 
1356
                                sbextent, maxlen - sliderstart - sliderlen + sbextent);
 
1357
                break;
 
1358
 
 
1359
            case SC_ScrollBarGroove:
 
1360
                if (scrollbar->orientation() == Qt::Horizontal)
 
1361
                    ret.setRect(sbextent, 0, scrollbar->width() - sbextent * 3,
 
1362
                                scrollbar->height());
 
1363
                else
 
1364
                    ret.setRect(0, sbextent, scrollbar->width(),
 
1365
                                scrollbar->height() - sbextent * 3);
 
1366
                break;
 
1367
 
 
1368
            case SC_ScrollBarSlider:
 
1369
                if (scrollbar->orientation() == Qt::Horizontal)
 
1370
                    ret.setRect(sliderstart, 0, sliderlen, sbextent);
 
1371
                else
 
1372
                    ret.setRect(0, sliderstart, sbextent, sliderlen);
 
1373
                break;
 
1374
 
 
1375
            default:
 
1376
                break;
 
1377
            }
 
1378
 
 
1379
            break;
 
1380
        }
 
1381
 
 
1382
    default:
 
1383
        ret = QCommonStyle::querySubControlMetrics(control, widget, sc, data);
 
1384
        break;
 
1385
    }
 
1386
 
 
1387
    return ret;
 
1388
}
 
1389
 
 
1390
QStyle::SubControl LightStyleV2::querySubControl( ComplexControl control,
 
1391
                                                const QWidget *widget,
 
1392
                                                const QPoint &pos,
 
1393
                                                const QStyleOption &data ) const
 
1394
{
 
1395
    QStyle::SubControl ret = QCommonStyle::querySubControl(control, widget, pos, data);
 
1396
 
 
1397
    // this is an ugly hack, but i really don't care, it's the quickest way to
 
1398
    // enabled the third button
 
1399
    if (control == CC_ScrollBar &&
 
1400
        ret == SC_None)
 
1401
        ret = SC_ScrollBarSubLine;
 
1402
 
 
1403
    return ret;
 
1404
}
 
1405
 
 
1406
int LightStyleV2::pixelMetric( PixelMetric metric,
 
1407
                             const QWidget *widget ) const
 
1408
{
 
1409
    int ret;
 
1410
 
 
1411
    switch (metric) {
 
1412
    case PM_ButtonMargin:
 
1413
        ret = 4;
 
1414
        break;
 
1415
 
 
1416
    case PM_ButtonShiftHorizontal:
 
1417
    case PM_ButtonShiftVertical:
 
1418
        ret = 0;
 
1419
        break;
 
1420
 
 
1421
    case PM_ButtonDefaultIndicator:
 
1422
    case PM_DefaultFrameWidth:
 
1423
        ret = 2;
 
1424
        break;
 
1425
 
 
1426
    case PM_IndicatorWidth:
 
1427
    case PM_IndicatorHeight:
 
1428
    case PM_ExclusiveIndicatorWidth:
 
1429
    case PM_ExclusiveIndicatorHeight:
 
1430
        ret = 13;
 
1431
        break;
 
1432
 
 
1433
    case PM_TabBarTabOverlap:
 
1434
        ret = 0;
 
1435
        break;
 
1436
 
 
1437
    case PM_ScrollBarExtent:
 
1438
    case PM_ScrollBarSliderMin:
 
1439
        ret = 14;
 
1440
        break;
 
1441
 
 
1442
    case PM_MenuBarFrameWidth:
 
1443
        ret = 1;
 
1444
        break;
 
1445
 
 
1446
    case PM_ProgressBarChunkWidth:
 
1447
        ret = 1;
 
1448
        break;
 
1449
 
 
1450
    case PM_DockWindowSeparatorExtent:
 
1451
        ret = 4;
 
1452
        break;
 
1453
        
 
1454
    case PM_SplitterWidth:
 
1455
        ret = 6;
 
1456
        break;
 
1457
 
 
1458
 
 
1459
    case PM_SliderLength:
 
1460
    case PM_SliderControlThickness:
 
1461
        ret = singleton->basestyle->pixelMetric( metric, widget );
 
1462
        break;
 
1463
 
 
1464
    case PM_MaximumDragDistance:
 
1465
        ret = -1;
 
1466
        break;
 
1467
 
 
1468
    default:
 
1469
        ret = QCommonStyle::pixelMetric(metric, widget);
 
1470
        break;
 
1471
    }
 
1472
 
 
1473
    return ret;
 
1474
}
 
1475
 
 
1476
QSize LightStyleV2::sizeFromContents( ContentsType contents,
 
1477
                                    const QWidget *widget,
 
1478
                                    const QSize &contentsSize,
 
1479
                                    const QStyleOption &data ) const
 
1480
{
 
1481
    QSize ret;
 
1482
 
 
1483
    switch (contents) {
 
1484
    case CT_PushButton:
 
1485
        {
 
1486
            const QPushButton *button = (const QPushButton *) widget;
 
1487
            ret = QCommonStyle::sizeFromContents( contents, widget, contentsSize, data );
 
1488
            int w = ret.width(), h = ret.height();
 
1489
 
 
1490
            // only expand the button if we are displaying text...
 
1491
            if ( ! button->text().isEmpty() ) {
 
1492
                if ( button->isDefault() || button->autoDefault() ) {
 
1493
                    // default button minimum size
 
1494
                    if ( w < 80 )
 
1495
                        w = 80;
 
1496
                    if ( h < 25 )
 
1497
                        h = 25;
 
1498
                } else {
 
1499
                    // regular button minimum size
 
1500
                    if ( w < 76 )
 
1501
                        w = 76;
 
1502
                    if ( h < 21 )
 
1503
                        h = 21;
 
1504
                }
 
1505
            }
 
1506
 
 
1507
            ret = QSize( w, h );
 
1508
            break;
 
1509
        }
 
1510
 
 
1511
    case CT_PopupMenuItem:
 
1512
        {
 
1513
            if (! widget || data.isDefault())
 
1514
                break;
 
1515
 
 
1516
            QMenuItem *mi = data.menuItem();
 
1517
            const QMenu *popupmenu = (const QMenu *) widget;
 
1518
            int maxpmw = data.maxIconWidth();
 
1519
            int w = contentsSize.width(), h = contentsSize.height();
 
1520
 
 
1521
            if (mi->custom()) {
 
1522
                w = mi->custom()->sizeHint().width();
 
1523
                h = mi->custom()->sizeHint().height();
 
1524
                if (! mi->custom()->fullSpan() && h < 22)
 
1525
                    h = 22;
 
1526
            } else if(mi->widget()) {
 
1527
            } else if (mi->isSeparator()) {
 
1528
                w = 10;
 
1529
                h = 4;
 
1530
            } else {
 
1531
                // check is at least 16x16
 
1532
                if (h < 16)
 
1533
                    h = 16;
 
1534
                if (mi->pixmap())
 
1535
                    h = qMax(h, mi->pixmap()->height());
 
1536
                else if (! mi->text().isNull())
 
1537
                    h = qMax(h, popupmenu->fontMetrics().height() + 2);
 
1538
                if (mi->iconSet() != 0)
 
1539
                    h = qMax(h, mi->iconSet()->pixmap(QIcon::Small,
 
1540
                                                      QIcon::Normal).height());
 
1541
                h += 2;
 
1542
            }
 
1543
 
 
1544
            // check | 4 pixels | item | 8 pixels | accel | 4 pixels | check
 
1545
 
 
1546
            // check is at least 16x16
 
1547
            maxpmw = qMax(maxpmw, 16);
 
1548
            w += (maxpmw * 2) + 8;
 
1549
 
 
1550
            if (! mi->text().isNull() && mi->text().find('\t') >= 0)
 
1551
                w += 8;
 
1552
 
 
1553
            ret = QSize(w, h);
 
1554
            break;
 
1555
        }
 
1556
    case CT_ProgressBar:
 
1557
        {
 
1558
            const QProgressBar* pb = static_cast<const QProgressBar*>(widget);
 
1559
            
 
1560
            //If we have to display the indicator, and we do it on RHS, give some more room
 
1561
            //for it. This tries to match the logic and the spacing in SR_ProgressBarGroove/Contents
 
1562
            //sizing in QCommonStyle.
 
1563
            if (pb->percentageVisible() && 
 
1564
                (pb->indicatorFollowsStyle() || ! pb->centerIndicator()))
 
1565
            {
 
1566
                int addw = pb->fontMetrics().width("100%") + 6;
 
1567
                return QSize(contentsSize.width() + addw, contentsSize.height());
 
1568
            }
 
1569
            else
 
1570
                return contentsSize; //Otherwise leave unchanged
 
1571
            
 
1572
            break;
 
1573
        }    
 
1574
 
 
1575
    default:
 
1576
        ret = QCommonStyle::sizeFromContents(contents, widget, contentsSize, data);
 
1577
        break;
 
1578
    }
 
1579
 
 
1580
    return ret;
 
1581
}
 
1582
 
 
1583
int LightStyleV2::styleHint( StyleHint stylehint,
 
1584
                           const QWidget *widget,
 
1585
                           const QStyleOption &option,
 
1586
                           QStyleHintReturn* returnData ) const
 
1587
{
 
1588
    int ret;
 
1589
 
 
1590
    switch (stylehint) {
 
1591
    case SH_EtchDisabledText:
 
1592
    case SH_Slider_SnapToValue:
 
1593
    case SH_PrintDialog_RightAlignButtons:
 
1594
    case SH_FontDialog_SelectAssociatedText:
 
1595
    case SH_MenuBar_AltKeyNavigation:
 
1596
    case SH_MenuBar_MouseTracking:
 
1597
    case SH_PopupMenu_MouseTracking:
 
1598
    case SH_ComboBox_ListMouseTracking:
 
1599
    case SH_ScrollBar_MiddleClickAbsolutePosition:
 
1600
        ret = 1;
 
1601
        break;
 
1602
 
 
1603
    case SH_MainWindow_SpaceBelowMenuBar:
 
1604
        ret = 0;
 
1605
        break;
 
1606
 
 
1607
    default:
 
1608
        ret = QCommonStyle::styleHint(stylehint, widget, option, returnData);
 
1609
        break;
 
1610
    }
 
1611
 
 
1612
    return ret;
 
1613
}
 
1614
 
 
1615
QPixmap LightStyleV2::standardPixmap( StylePixmap standardpixmap,
 
1616
                                   const QWidget *widget,
 
1617
                                   const QStyleOption &data ) const
 
1618
{
 
1619
    return singleton->basestyle->standardPixmap( stylepixmap, widget, data );
 
1620
}
 
1621
#include "lightstyle-v2.moc"