Qt3to4
[kdeartwork.git] / styles / phase / phasestyle.h
blob1c55eb1463cbba15adb690157c66c224faccc905
1 //////////////////////////////////////////////////////////////////////////////
2 // phasestyle.h
3 // -------------------
4 // Qt/KDE widget style
5 // -------------------
6 // Copyright (c) 2004 David Johnson <david@usermode.org>
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 //////////////////////////////////////////////////////////////////////////////
27 #ifndef PHASESTYLE_H
28 #define PHASESTYLE_H
30 #include <kstyle.h>
31 #include <qcolor.h>
32 //Added by qt3to4:
33 #include <QEvent>
35 class KPixmap;
37 class PhaseStyle : public KStyle
39 Q_OBJECT
40 public:
41 PhaseStyle();
42 virtual ~PhaseStyle();
44 void polish(QApplication* app);
45 void polish(QWidget *widget);
46 void polish(QPalette &pal);
47 void unPolish(QWidget *widget);
49 void drawPrimitive(PrimitiveElement element,
50 QPainter *painter,
51 const QRect &rect,
52 const QColorGroup &group,
53 SFlags flags = Style_Default,
54 const QStyleOption &option = QStyleOption::Default) const;
56 void drawKStylePrimitive(KStylePrimitive element,
57 QPainter *painter,
58 const QWidget *widget,
59 const QRect &rect,
60 const QColorGroup &group,
61 SFlags flags = Style_Default,
62 const QStyleOption &option = QStyleOption::Default) const;
64 void drawControl(ControlElement element,
65 QPainter *painter,
66 const QWidget *widget,
67 const QRect &rect,
68 const QColorGroup &group,
69 SFlags flags = Style_Default,
70 const QStyleOption &option = QStyleOption::Default) const;
72 void drawControlMask(ControlElement element,
73 QPainter *painter,
74 const QWidget *widget,
75 const QRect &rect,
76 const QStyleOption &option = QStyleOption::Default) const;
78 void drawComplexControl(ComplexControl control,
79 QPainter *painter,
80 const QWidget *widget,
81 const QRect &rect,
82 const QColorGroup &group,
83 SFlags flags = Style_Default,
84 SCFlags controls = SC_All,
85 SCFlags active = SC_None,
86 const QStyleOption &option = QStyleOption::Default) const;
88 void drawComplexControlMask(ComplexControl control,
89 QPainter *painter,
90 const QWidget *widget,
91 const QRect &rect,
92 const QStyleOption &option = QStyleOption::Default) const;
94 int pixelMetric(PixelMetric metric,
95 const QWidget *widget = 0) const;
97 QRect querySubControlMetrics(ComplexControl control,
98 const QWidget *widget,
99 SubControl subcontrol,
100 const QStyleOption &option = QStyleOption::Default) const;
102 QSize sizeFromContents(ContentsType contents,
103 const QWidget *widget,
104 const QSize &contentsize,
105 const QStyleOption& option = QStyleOption::Default) const;
107 private:
108 PhaseStyle(const PhaseStyle &);
109 PhaseStyle& operator=(const PhaseStyle &);
111 void drawPhaseBevel(QPainter *painter,
112 int x, int y, int w, int h,
113 const QColorGroup &group,
114 const QColor &fill,
115 bool sunken=false,
116 bool horizontal=true,
117 bool reverse=false) const;
119 void drawPhaseButton(QPainter *painter,
120 int x, int y, int w, int h,
121 const QColorGroup &group,
122 const QColor &fill,
123 bool sunken=false) const;
125 void drawPhasePanel(QPainter *painter,
126 int x, int y, int w, int h,
127 const QColorGroup &group,
128 bool sunken=false,
129 const QBrush *fill=NULL) const;
131 void drawPhaseTab(QPainter *painter,
132 int x, int y, int w, int h,
133 const QColorGroup &group,
134 const QTabBar *bar,
135 const QStyleOption &option,
136 const SFlags flags) const;
138 void drawPhaseGradient(QPainter *painter,
139 const QRect &rect,
140 QColor color,
141 bool horizontal,
142 int px=0, int py=0,
143 int pw=-1, int ph=-1,
144 bool reverse=false) const;
146 bool flatToolbar(const Q3ToolBar *toolbar) const;
148 bool eventFilter(QObject *object, QEvent *event);
150 private:
151 QWidget *hover_;
152 QTab *hovertab_;
153 bool gradients_;
154 bool highlights_;
155 bool reverse_;
156 bool kicker_;
159 class GradientSet
161 public:
162 enum GradientType {
163 Horizontal,
164 Vertical,
165 HorizontalReverse,
166 VerticalReverse,
167 GradientTypeCount
170 GradientSet(const QColor &color, int size);
171 ~GradientSet();
173 KPixmap* gradient(bool horizontal, bool reverse);
175 private:
176 KPixmap *set[GradientTypeCount];
177 QColor color_;
178 int size_;
181 #endif // PHASESTYLE_H