1 | /** $Id: $ */
|
---|
2 | /** @file
|
---|
3 | * Qt GUI - VBox Variation on the QAquaStyle.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | #ifndef ___VBoxAquaStyle_h___
|
---|
20 | #define ___VBoxAquaStyle_h___
|
---|
21 |
|
---|
22 | #include <qstyle.h>
|
---|
23 | //Added by qt3to4:
|
---|
24 | #include <QPixmap>
|
---|
25 | #include <Q3PopupMenu>
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The Virtual Box QAquaStyle overrider.
|
---|
29 | *
|
---|
30 | * The purpose of this class is to make some small adjustments to
|
---|
31 | * the QAquaStyle so it looks and works better.
|
---|
32 | *
|
---|
33 | * Since the QAquaStyle class isn't exported we have to do all the
|
---|
34 | * virtual method work our selves. This also means we doesn't have
|
---|
35 | * access to any protected or QAquaStyle methods, too bad.
|
---|
36 | */
|
---|
37 | class VBoxAquaStyle : public QStyle //QAquaStyle - not exported, sigh.
|
---|
38 | {
|
---|
39 | public:
|
---|
40 | VBoxAquaStyle(QStyle *parent);
|
---|
41 | VBoxAquaStyle(QStyle &parent);
|
---|
42 | virtual ~VBoxAquaStyle();
|
---|
43 | static VBoxAquaStyle &instance();
|
---|
44 |
|
---|
45 | // The QStyle implementation.
|
---|
46 | virtual void polish( QWidget *w );
|
---|
47 | virtual void unPolish( QWidget *w );
|
---|
48 | virtual void polish( QApplication *app );
|
---|
49 | virtual void unPolish( QApplication *app );
|
---|
50 | virtual void polish( QPalette &p );
|
---|
51 | virtual void polishPopupMenu( Q3PopupMenu *m );
|
---|
52 | virtual QRect itemRect( QPainter *p, const QRect &r, int flags, bool enabled, const QPixmap *pixmap,
|
---|
53 | const QString &text, int len = -1 ) const;
|
---|
54 | virtual void drawItem( QPainter *p, const QRect &r, int flags, const QColorGroup &g, bool enabled,
|
---|
55 | const QPixmap *pixmap, const QString &text, int len = -1, const QColor *penColor = 0 ) const;
|
---|
56 | virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg,
|
---|
57 | SFlags flags = Style_Default, const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
58 | virtual void drawControl( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg,
|
---|
59 | SFlags how = Style_Default, const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
60 | virtual void drawControlMask( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r,
|
---|
61 | const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
62 | virtual QRect subRect( SubRect r, const QWidget *widget ) const;
|
---|
63 | virtual int pixelMetric( PixelMetric metric, const QWidget *widget = 0 ) const;
|
---|
64 | virtual QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize,
|
---|
65 | const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
66 | virtual int styleHint( StyleHint stylehint, const QWidget *widget = 0, const QStyleOption &foo = QStyleOption::Default,
|
---|
67 | QStyleHintReturn* returnData = 0 ) const;
|
---|
68 | virtual QPixmap stylePixmap( StylePixmap stylepixmap, const QWidget *widget = 0, const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
69 | virtual void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r,
|
---|
70 | const QColorGroup &cg, SFlags how = Style_Default, SCFlags sub = (uint)SC_All,
|
---|
71 | SCFlags subActive = SC_None, const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
72 | virtual void drawComplexControlMask( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r,
|
---|
73 | const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
74 | virtual QRect querySubControlMetrics( ComplexControl control, const QWidget *widget, SubControl sc,
|
---|
75 | const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
76 | virtual SubControl querySubControl( ComplexControl control, const QWidget *widget, const QPoint &pos,
|
---|
77 | const QStyleOption &foo = QStyleOption::Default ) const;
|
---|
78 |
|
---|
79 | protected:
|
---|
80 | /** The style we're overloading. */
|
---|
81 | QStyle *mparent;
|
---|
82 |
|
---|
83 | /** The global instance. */
|
---|
84 | static VBoxAquaStyle *sInstance;
|
---|
85 | };
|
---|
86 |
|
---|
87 | #endif
|
---|
88 |
|
---|