author | llornkcor <llornkcor> | 2003-05-26 04:07:44 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-05-26 04:07:44 (UTC) |
commit | f63dee18fe56ba54d9203836722a1f499e2539f3 (patch) (unidiff) | |
tree | 557b83bb4048094072d9163f687b54ea8a709c96 | |
parent | 4a9831b570a60075650863b571b0875e96ca8ad6 (diff) | |
download | opie-f63dee18fe56ba54d9203836722a1f499e2539f3.zip opie-f63dee18fe56ba54d9203836722a1f499e2539f3.tar.gz opie-f63dee18fe56ba54d9203836722a1f499e2539f3.tar.bz2 |
remove extra includes
-rw-r--r-- | noncore/styles/metal/metal.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/noncore/styles/metal/metal.cpp b/noncore/styles/metal/metal.cpp index 2380fed..5cb2d22 100644 --- a/noncore/styles/metal/metal.cpp +++ b/noncore/styles/metal/metal.cpp | |||
@@ -1,214 +1,205 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
5 | ** | 5 | ** |
6 | ** This file is part of an example program for Qt. This example | 6 | ** This file is part of an example program for Qt. This example |
7 | ** program may be used, distributed and modified without limitation. | 7 | ** program may be used, distributed and modified without limitation. |
8 | ** | 8 | ** |
9 | *****************************************************************************/ | 9 | *****************************************************************************/ |
10 | 10 | ||
11 | #include "metal.h" | 11 | #include "metal.h" |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | #include <qpainter.h> | ||
14 | #include <qdrawutil.h> // for now | ||
15 | #include <qpixmap.h> // for now | ||
16 | #include <qpalette.h> // for now | ||
17 | #include <qwidget.h> | ||
18 | #include <qlabel.h> | ||
19 | #include <qimage.h> | ||
20 | #include <qpushbutton.h> | 13 | #include <qpushbutton.h> |
21 | #include <qwidget.h> | ||
22 | #include <qrangecontrol.h> | ||
23 | #include <qscrollbar.h> | 14 | #include <qscrollbar.h> |
24 | #include <limits.h> | 15 | #include <limits.h> |
25 | 16 | ||
26 | 17 | ||
27 | ///////////////////////////////////////////////////////// | 18 | ///////////////////////////////////////////////////////// |
28 | #include "stonedark.xpm" | 19 | #include "stonedark.xpm" |
29 | #include "stone1.xpm" | 20 | #include "stone1.xpm" |
30 | #include "marble.xpm" | 21 | #include "marble.xpm" |
31 | /////////////////////////////////////////////////////// | 22 | /////////////////////////////////////////////////////// |
32 | 23 | ||
33 | 24 | ||
34 | 25 | ||
35 | MetalStyle::MetalStyle() : QWindowsStyle() { } | 26 | MetalStyle::MetalStyle() : QWindowsStyle() { } |
36 | 27 | ||
37 | /*! | 28 | /*! |
38 | Reimplementation from QStyle | 29 | Reimplementation from QStyle |
39 | */ | 30 | */ |
40 | void MetalStyle::polish( QApplication *app) | 31 | void MetalStyle::polish( QApplication *app) |
41 | { | 32 | { |
42 | oldPalette = app->palette(); | 33 | oldPalette = app->palette(); |
43 | 34 | ||
44 | // we simply create a nice QColorGroup with a couple of fancy | 35 | // we simply create a nice QColorGroup with a couple of fancy |
45 | // pixmaps here and apply to it all widgets | 36 | // pixmaps here and apply to it all widgets |
46 | 37 | ||
47 | QFont f("times", app->font().pointSize() ); | 38 | QFont f("times", app->font().pointSize() ); |
48 | f.setBold( TRUE ); | 39 | f.setBold( TRUE ); |
49 | f.setItalic( TRUE ); | 40 | f.setItalic( TRUE ); |
50 | app->setFont( f, TRUE, "QMenuBar"); | 41 | app->setFont( f, TRUE, "QMenuBar"); |
51 | app->setFont( f, TRUE, "QPopupMenu"); | 42 | app->setFont( f, TRUE, "QPopupMenu"); |
52 | 43 | ||
53 | 44 | ||
54 | //QPixmap button( stone1_xpm ); | 45 | //QPixmap button( stone1_xpm ); |
55 | QPixmap button( stonedark_xpm ); | 46 | QPixmap button( stonedark_xpm ); |
56 | QPixmap background(marble_xpm); | 47 | QPixmap background(marble_xpm); |
57 | #if 0 | 48 | #if 0 |
58 | 49 | ||
59 | int i; | 50 | int i; |
60 | for (i=0; i<img.numColors(); i++) { | 51 | for (i=0; i<img.numColors(); i++) { |
61 | QRgb rgb = img.color(i); | 52 | QRgb rgb = img.color(i); |
62 | QColor c(rgb); | 53 | QColor c(rgb); |
63 | rgb = c.dark().rgb(); | 54 | rgb = c.dark().rgb(); |
64 | img.setColor(i,rgb); | 55 | img.setColor(i,rgb); |
65 | } | 56 | } |
66 | QPixmap mid; | 57 | QPixmap mid; |
67 | mid.convertFromImage(img); | 58 | mid.convertFromImage(img); |
68 | 59 | ||
69 | img = orig; | 60 | img = orig; |
70 | for (i=0; i<img.numColors(); i++) { | 61 | for (i=0; i<img.numColors(); i++) { |
71 | QRgb rgb = img.color(i); | 62 | QRgb rgb = img.color(i); |
72 | QColor c(rgb); | 63 | QColor c(rgb); |
73 | rgb = c.light().rgb(); | 64 | rgb = c.light().rgb(); |
74 | img.setColor(i,rgb); | 65 | img.setColor(i,rgb); |
75 | } | 66 | } |
76 | QPixmap light; | 67 | QPixmap light; |
77 | light.convertFromImage(img); | 68 | light.convertFromImage(img); |
78 | 69 | ||
79 | img = orig; | 70 | img = orig; |
80 | for (i=0; i<img.numColors(); i++) { | 71 | for (i=0; i<img.numColors(); i++) { |
81 | QRgb rgb = img.color(i); | 72 | QRgb rgb = img.color(i); |
82 | QColor c(rgb); | 73 | QColor c(rgb); |
83 | rgb = c.dark().rgb(); | 74 | rgb = c.dark().rgb(); |
84 | img.setColor(i,rgb); | 75 | img.setColor(i,rgb); |
85 | } | 76 | } |
86 | QPixmap dark; | 77 | QPixmap dark; |
87 | dark.convertFromImage(img); | 78 | dark.convertFromImage(img); |
88 | #else | 79 | #else |
89 | QPixmap dark( 1, 1 ); dark.fill( red.dark() ); | 80 | QPixmap dark( 1, 1 ); dark.fill( red.dark() ); |
90 | QPixmap mid( stone1_xpm ); | 81 | QPixmap mid( stone1_xpm ); |
91 | QPixmap light( stone1_xpm );//1, 1 ); light.fill( green ); | 82 | QPixmap light( stone1_xpm );//1, 1 ); light.fill( green ); |
92 | #endif | 83 | #endif |
93 | QPalette op = app->palette(); | 84 | QPalette op = app->palette(); |
94 | 85 | ||
95 | QColor backCol( 227,227,227 ); | 86 | QColor backCol( 227,227,227 ); |
96 | 87 | ||
97 | // QPalette op(white); | 88 | // QPalette op(white); |
98 | QColorGroup active (op.normal().foreground(), | 89 | QColorGroup active (op.normal().foreground(), |
99 | QBrush(op.normal().button(),button), | 90 | QBrush(op.normal().button(),button), |
100 | QBrush(op.normal().light(), light), | 91 | QBrush(op.normal().light(), light), |
101 | QBrush(op.normal().dark(), dark), | 92 | QBrush(op.normal().dark(), dark), |
102 | QBrush(op.normal().mid(), mid), | 93 | QBrush(op.normal().mid(), mid), |
103 | op.normal().text(), | 94 | op.normal().text(), |
104 | Qt::white, | 95 | Qt::white, |
105 | op.normal().base(),// QColor(236,182,120), | 96 | op.normal().base(),// QColor(236,182,120), |
106 | QBrush(backCol, background) | 97 | QBrush(backCol, background) |
107 | ); | 98 | ); |
108 | active.setColor( QColorGroup::ButtonText, Qt::white ); | 99 | active.setColor( QColorGroup::ButtonText, Qt::white ); |
109 | active.setColor( QColorGroup::Shadow, Qt::black ); | 100 | active.setColor( QColorGroup::Shadow, Qt::black ); |
110 | QColorGroup disabled (op.disabled().foreground(), | 101 | QColorGroup disabled (op.disabled().foreground(), |
111 | QBrush(op.disabled().button(),button), | 102 | QBrush(op.disabled().button(),button), |
112 | QBrush(op.disabled().light(), light), | 103 | QBrush(op.disabled().light(), light), |
113 | op.disabled().dark(), | 104 | op.disabled().dark(), |
114 | QBrush(op.disabled().mid(), mid), | 105 | QBrush(op.disabled().mid(), mid), |
115 | op.disabled().text(), | 106 | op.disabled().text(), |
116 | Qt::white, | 107 | Qt::white, |
117 | op.disabled().base(),// QColor(236,182,120), | 108 | op.disabled().base(),// QColor(236,182,120), |
118 | QBrush(backCol, background) | 109 | QBrush(backCol, background) |
119 | ); | 110 | ); |
120 | 111 | ||
121 | QPalette newPalette( active, disabled, active ); | 112 | QPalette newPalette( active, disabled, active ); |
122 | app->setPalette( newPalette, TRUE ); | 113 | app->setPalette( newPalette, TRUE ); |
123 | } | 114 | } |
124 | 115 | ||
125 | /*! | 116 | /*! |
126 | Reimplementation from QStyle | 117 | Reimplementation from QStyle |
127 | */ | 118 | */ |
128 | void MetalStyle::unPolish( QApplication *app) | 119 | void MetalStyle::unPolish( QApplication *app) |
129 | { | 120 | { |
130 | app->setPalette(oldPalette, TRUE); | 121 | app->setPalette(oldPalette, TRUE); |
131 | app->setFont( app->font(), TRUE ); | 122 | app->setFont( app->font(), TRUE ); |
132 | } | 123 | } |
133 | 124 | ||
134 | /*! | 125 | /*! |
135 | Reimplementation from QStyle | 126 | Reimplementation from QStyle |
136 | */ | 127 | */ |
137 | void MetalStyle::polish( QWidget* w) | 128 | void MetalStyle::polish( QWidget* w) |
138 | { | 129 | { |
139 | 130 | ||
140 | // the polish function sets some widgets to transparent mode and | 131 | // the polish function sets some widgets to transparent mode and |
141 | // some to translate background mode in order to get the full | 132 | // some to translate background mode in order to get the full |
142 | // benefit from the nice pixmaps in the color group. | 133 | // benefit from the nice pixmaps in the color group. |
143 | 134 | ||
144 | if (w->inherits("QPushButton")){ | 135 | if (w->inherits("QPushButton")){ |
145 | w->setBackgroundMode( QWidget::NoBackground ); | 136 | w->setBackgroundMode( QWidget::NoBackground ); |
146 | return; | 137 | return; |
147 | } | 138 | } |
148 | 139 | ||
149 | if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){ | 140 | if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){ |
150 | return; | 141 | return; |
151 | } | 142 | } |
152 | 143 | ||
153 | if ( !w->isTopLevel() ) { | 144 | if ( !w->isTopLevel() ) { |
154 | if ( w->inherits("QGroupBox") | 145 | if ( w->inherits("QGroupBox") |
155 | || w->inherits("QTabWidget") ) { | 146 | || w->inherits("QTabWidget") ) { |
156 | w->setAutoMask( TRUE ); | 147 | w->setAutoMask( TRUE ); |
157 | return; | 148 | return; |
158 | } | 149 | } |
159 | if (w->inherits("QLabel") | 150 | if (w->inherits("QLabel") |
160 | || w->inherits("QSlider") | 151 | || w->inherits("QSlider") |
161 | || w->inherits("QButton") | 152 | || w->inherits("QButton") |
162 | || w->inherits("QProgressBar") | 153 | || w->inherits("QProgressBar") |
163 | ){ | 154 | ){ |
164 | w->setBackgroundOrigin( QWidget::ParentOrigin ); | 155 | w->setBackgroundOrigin( QWidget::ParentOrigin ); |
165 | } | 156 | } |
166 | } | 157 | } |
167 | } | 158 | } |
168 | 159 | ||
169 | void MetalStyle::unPolish( QWidget* w) | 160 | void MetalStyle::unPolish( QWidget* w) |
170 | { | 161 | { |
171 | 162 | ||
172 | // the polish function sets some widgets to transparent mode and | 163 | // the polish function sets some widgets to transparent mode and |
173 | // some to translate background mode in order to get the full | 164 | // some to translate background mode in order to get the full |
174 | // benefit from the nice pixmaps in the color group. | 165 | // benefit from the nice pixmaps in the color group. |
175 | 166 | ||
176 | if (w->inherits("QPushButton")){ | 167 | if (w->inherits("QPushButton")){ |
177 | w->setBackgroundMode( QWidget::PaletteButton ); | 168 | w->setBackgroundMode( QWidget::PaletteButton ); |
178 | return; | 169 | return; |
179 | } | 170 | } |
180 | 171 | ||
181 | if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){ | 172 | if (w->inherits("QTipLabel") || w->inherits("QLCDNumber") ){ |
182 | return; | 173 | return; |
183 | } | 174 | } |
184 | 175 | ||
185 | if ( !w->isTopLevel() ) { | 176 | if ( !w->isTopLevel() ) { |
186 | if ( w->inherits("QGroupBox") | 177 | if ( w->inherits("QGroupBox") |
187 | || w->inherits("QTabWidget") ) { | 178 | || w->inherits("QTabWidget") ) { |
188 | w->setAutoMask( FALSE ); | 179 | w->setAutoMask( FALSE ); |
189 | return; | 180 | return; |
190 | } | 181 | } |
191 | if (w->inherits("QLabel") | 182 | if (w->inherits("QLabel") |
192 | || w->inherits("QSlider") | 183 | || w->inherits("QSlider") |
193 | || w->inherits("QButton") | 184 | || w->inherits("QButton") |
194 | || w->inherits("QProgressBar") | 185 | || w->inherits("QProgressBar") |
195 | ){ | 186 | ){ |
196 | w->setBackgroundOrigin( QWidget::WidgetOrigin ); | 187 | w->setBackgroundOrigin( QWidget::WidgetOrigin ); |
197 | } | 188 | } |
198 | } | 189 | } |
199 | 190 | ||
200 | } | 191 | } |
201 | 192 | ||
202 | /*! | 193 | /*! |
203 | Draw a metallic button, sunken if \a sunken is TRUE, horizontal if | 194 | Draw a metallic button, sunken if \a sunken is TRUE, horizontal if |
204 | /a horz is TRUE. | 195 | /a horz is TRUE. |
205 | */ | 196 | */ |
206 | 197 | ||
207 | void MetalStyle::drawMetalButton( QPainter *p, int x, int y, int w, int h, | 198 | void MetalStyle::drawMetalButton( QPainter *p, int x, int y, int w, int h, |
208 | bool sunken, bool horz ) | 199 | bool sunken, bool horz ) |
209 | { | 200 | { |
210 | QColor top1("#878769691515"); | 201 | QColor top1("#878769691515"); |
211 | QColor top2("#C6C6B4B44949"); | 202 | QColor top2("#C6C6B4B44949"); |
212 | 203 | ||
213 | QColor bot2("#70705B5B1414"); | 204 | QColor bot2("#70705B5B1414"); |
214 | QColor bot1("56564A4A0E0E"); //first from the bottom | 205 | QColor bot1("56564A4A0E0E"); //first from the bottom |