summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-07 09:42:21 (UTC)
committer alwin <alwin>2005-03-07 09:42:21 (UTC)
commitd6fc7417f752867c14a0b6555c32f2d768736fe8 (patch) (unidiff)
tree29b1780ed157b799cbcf8133f846b74da248e8e5
parentf312f32d624c6198c63890e141e8658bc492cf37 (diff)
downloadopie-d6fc7417f752867c14a0b6555c32f2d768736fe8.zip
opie-d6fc7417f752867c14a0b6555c32f2d768736fe8.tar.gz
opie-d6fc7417f752867c14a0b6555c32f2d768736fe8.tar.bz2
applied patch from Paul Eggleton
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/phase/phasestyle.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/styles/phase/phasestyle.cpp b/noncore/styles/phase/phasestyle.cpp
index 906ccee..746354e 100644
--- a/noncore/styles/phase/phasestyle.cpp
+++ b/noncore/styles/phase/phasestyle.cpp
@@ -83,193 +83,193 @@ void kColorBitmaps(QPainter *p, const QColorGroup &g, int x, int y,
83/* 83/*
84 * drawMenuBarItem is not virtual 84 * drawMenuBarItem is not virtual
85 * this way we define our draw handler 85 * this way we define our draw handler
86 */ 86 */
87typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, 87typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
88 QColorGroup &, bool, bool); 88 QColorGroup &, bool, bool);
89 89
90extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); 90extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
91 91
92 92
93PhaseStyle::PhaseStyle() 93PhaseStyle::PhaseStyle()
94 : QWindowsStyle() 94 : QWindowsStyle()
95{ 95{
96 setName( "PhaseStyle" ); 96 setName( "PhaseStyle" );
97 97
98 /* small default sizes */ 98 /* small default sizes */
99 setButtonDefaultIndicatorWidth(1); 99 setButtonDefaultIndicatorWidth(1);
100 setScrollBarExtent(SCROLLBAR_EXTENT, SCROLLBAR_EXTENT); 100 setScrollBarExtent(SCROLLBAR_EXTENT, SCROLLBAR_EXTENT);
101 setSliderThickness(12); 101 setSliderThickness(12);
102 setButtonMargin( 1 ); 102 setButtonMargin( 1 );
103 103
104 // create bitmaps 104 // create bitmaps
105 uarrow = QBitmap(6, 6, uarrow_bits, true); 105 uarrow = QBitmap(6, 6, uarrow_bits, true);
106 uarrow.setMask(uarrow); 106 uarrow.setMask(uarrow);
107 darrow = QBitmap(6, 6, darrow_bits, true); 107 darrow = QBitmap(6, 6, darrow_bits, true);
108 darrow.setMask(darrow); 108 darrow.setMask(darrow);
109 larrow = QBitmap(6, 6, larrow_bits, true); 109 larrow = QBitmap(6, 6, larrow_bits, true);
110 larrow.setMask(larrow); 110 larrow.setMask(larrow);
111 rarrow = QBitmap(6, 6, rarrow_bits, true); 111 rarrow = QBitmap(6, 6, rarrow_bits, true);
112 rarrow.setMask(rarrow); 112 rarrow.setMask(rarrow);
113 bplus = QBitmap(6, 6, bplus_bits, true); 113 bplus = QBitmap(6, 6, bplus_bits, true);
114 bplus.setMask(bplus); 114 bplus.setMask(bplus);
115 bminus = QBitmap(6, 6, bminus_bits, true); 115 bminus = QBitmap(6, 6, bminus_bits, true);
116 bminus.setMask(bminus); 116 bminus.setMask(bminus);
117 bcheck = QBitmap(9, 9, bcheck_bits, true); 117 bcheck = QBitmap(9, 9, bcheck_bits, true);
118 bcheck.setMask(bcheck); 118 bcheck.setMask(bcheck);
119 dexpand = QBitmap(9, 9, dexpand_bits, true); 119 dexpand = QBitmap(9, 9, dexpand_bits, true);
120 dexpand.setMask(dexpand); 120 dexpand.setMask(dexpand);
121 rexpand = QBitmap(9, 9, rexpand_bits, true); 121 rexpand = QBitmap(9, 9, rexpand_bits, true);
122 rexpand.setMask(rexpand); 122 rexpand.setMask(rexpand);
123 doodad_mid = QBitmap(4, 4, doodad_mid_bits, true); 123 doodad_mid = QBitmap(4, 4, doodad_mid_bits, true);
124 doodad_light = QBitmap(4, 4, doodad_light_bits, true); 124 doodad_light = QBitmap(4, 4, doodad_light_bits, true);
125} 125}
126 126
127PhaseStyle::~PhaseStyle() { 127PhaseStyle::~PhaseStyle() {
128 /* deleted by Qt */ 128 /* deleted by Qt */
129} 129}
130 130
131void PhaseStyle::drawCheckMark ( QPainter * p, int x, int y, int w, 131void PhaseStyle::drawCheckMark ( QPainter * p, int x, int y, int w,
132 int h, const QColorGroup & g, 132 int h, const QColorGroup & g,
133 bool , bool) { 133 bool , bool) {
134 p->setPen(g.text()); 134 p->setPen(g.text());
135 p->drawPixmap(x+w/2-4, y+h/2-4, bcheck); 135 p->drawPixmap(x+w/2-4, y+h/2-4, bcheck);
136} 136}
137 137
138void PhaseStyle::drawArrow(QPainter *painter, Qt::ArrowType type, bool down, 138void PhaseStyle::drawArrow(QPainter *painter, Qt::ArrowType type, bool down,
139 int x, int y, int w, int h, const QColorGroup &group, 139 int x, int y, int w, int h, const QColorGroup &group,
140 bool enabled , const QBrush * ) { 140 bool enabled , const QBrush * ) {
141 switch( type ) { 141 switch( type ) {
142 case UpArrow: 142 case UpArrow:
143 if (enabled) 143 if (enabled)
144 painter->setPen(down ? group.midlight() : group.dark()); 144 painter->setPen(down ? group.midlight() : group.dark());
145 else painter->setPen(group.mid()); 145 else painter->setPen(group.mid());
146 painter->drawPixmap(x+w/2-3, y+h/2-3, uarrow); 146 painter->drawPixmap(x+w/2-3, y+h/2-3, uarrow);
147 break; 147 break;
148 case DownArrow: 148 case DownArrow:
149 if (enabled) painter->setPen(down ? group.midlight() : group.dark()); 149 if (enabled) painter->setPen(down ? group.midlight() : group.dark());
150 else painter->setPen(group.mid()); 150 else painter->setPen(group.mid());
151 painter->drawPixmap(x+w/2-3, y+h/2-3, darrow); 151 painter->drawPixmap(x+w/2-3, y+h/2-3, darrow);
152 break; 152 break;
153 case LeftArrow: 153 case LeftArrow:
154 if (enabled) painter->setPen(down ? group.midlight() : group.dark()); 154 if (enabled) painter->setPen(down ? group.midlight() : group.dark());
155 else painter->setPen(group.mid()); 155 else painter->setPen(group.mid());
156 painter->drawPixmap(x+w/2-3, y+h/2-3, larrow); 156 painter->drawPixmap(x+w/2-3, y+h/2-3, larrow);
157 break; 157 break;
158 case RightArrow: 158 case RightArrow:
159 if (enabled) painter->setPen(down ? group.midlight() : group.dark()); 159 if (enabled) painter->setPen(down ? group.midlight() : group.dark());
160 else painter->setPen(group.mid()); 160 else painter->setPen(group.mid());
161 painter->drawPixmap(x+w/2-3, y+h/2-3, rarrow); 161 painter->drawPixmap(x+w/2-3, y+h/2-3, rarrow);
162 break; 162 break;
163 } 163 }
164} 164}
165 165
166void PhaseStyle::drawPushButton(QPushButton *btn, QPainter *painter) { 166void PhaseStyle::drawPushButton(QPushButton *btn, QPainter *painter) {
167 QRect r = btn->rect(); 167 QRect r = btn->rect();
168 int x = r.x(); 168 int x = r.x();
169 int y = r.y(); 169 int y = r.y();
170 int h = r.height(); 170 int h = r.height();
171 int w = r.width(); 171 int w = r.width();
172 bool depress = btn->isOn() || btn->isDown(); 172 bool depress = btn->isOn() || btn->isDown();
173 QColorGroup group = btn->colorGroup(); 173 QColorGroup group = btn->colorGroup();
174 QBrush brush(group.button() ); 174 QBrush brush(group.button() );
175// int bd = pixelMetric(PM_ButtonDefaultIndicator, widget) + 1; 175// int bd = pixelMetric(PM_ButtonDefaultIndicator, widget) + 1;
176 static int bd = 2; 176 static int bd = 2;
177 177
178 if (btn->isDefault() && !depress) { 178 if (btn->isDefault() && !depress) {
179 drawPanel(painter, x, y, h, w, group, 179 drawPanel(painter, x, y, w, h, group,
180 &group.brush(QColorGroup::Mid), true); 180 &group.brush(QColorGroup::Mid), true);
181 drawBevelButton(painter, x+bd, y+bd, w-bd*2, h-bd*2, group, 181 drawBevelButton(painter, x+bd, y+bd, w-bd*2, h-bd*2, group,
182 false, &brush ); 182 false, &brush );
183 } else { 183 } else {
184 drawButton(painter, x, y, w, h, group, depress, 184 drawButton(painter, x, y, w, h, group, depress,
185 &brush ); 185 &brush );
186 } 186 }
187 187
188 if (btn->hasFocus() ) { // draw focus 188 if (btn->hasFocus() ) { // draw focus
189 QColor col; 189 QColor col;
190 drawFocusRect(painter, r, group, 190 drawFocusRect(painter, r, group,
191 &col, false ); 191 &col, false );
192 } 192 }
193} 193}
194 194
195 195
196void PhaseStyle::drawPanel(QPainter* painter, int x, int y, int w, int h, 196void PhaseStyle::drawPanel(QPainter* painter, int x, int y, int w, int h,
197 const QColorGroup& group, bool sunken, 197 const QColorGroup& group, bool sunken,
198 int , const QBrush* fill) { 198 int , const QBrush* fill) {
199 int x2 = x + w - 1; 199 int x2 = x + w - 1;
200 int y2 = y + h - 1; 200 int y2 = y + h - 1;
201 painter->save(); 201 painter->save();
202 202
203 if (sunken) { 203 if (sunken) {
204 painter->setPen(group.dark()); 204 painter->setPen(group.dark());
205 painter->drawRect(x+1, y+1, w-2, h-2); 205 painter->drawRect(x+1, y+1, w-2, h-2);
206 painter->setPen(group.midlight()); 206 painter->setPen(group.midlight());
207 painter->drawLine(x+1, y2, x2, y2); 207 painter->drawLine(x+1, y2, x2, y2);
208 painter->drawLine(x2, y+1, x2, y2-1); 208 painter->drawLine(x2, y+1, x2, y2-1);
209 painter->setPen(group.mid()); 209 painter->setPen(group.mid());
210 painter->drawLine(x, y, x, y2-1); 210 painter->drawLine(x, y, x, y2-1);
211 painter->drawLine(x+1, y, x2-1, y); 211 painter->drawLine(x+1, y, x2-1, y);
212 painter->setPen(group.background()); 212 painter->setPen(group.background());
213 painter->drawPoint(x, y2); 213 painter->drawPoint(x, y2);
214 painter->drawPoint(x2, y); 214 painter->drawPoint(x2, y);
215 } else { 215 } else {
216 painter->setPen(group.dark()); 216 painter->setPen(group.dark());
217 painter->drawRect(x, y, w, h); 217 painter->drawRect(x, y, w, h);
218 painter->setPen(group.midlight()); 218 painter->setPen(group.midlight());
219 painter->drawLine(x+1, y+1, x2-2, y+1); 219 painter->drawLine(x+1, y+1, x2-2, y+1);
220 painter->drawLine(x+1, y+2, x+1, y2-2); 220 painter->drawLine(x+1, y+2, x+1, y2-2);
221 painter->setPen(group.mid()); 221 painter->setPen(group.mid());
222 painter->drawLine(x+2, y2-1, x2-1, y2-1); 222 painter->drawLine(x+2, y2-1, x2-1, y2-1);
223 painter->drawLine(x2-1, y+2, x2-1, y2-2); 223 painter->drawLine(x2-1, y+2, x2-1, y2-2);
224 painter->setPen(group.background()); 224 painter->setPen(group.background());
225 painter->drawPoint(x+1, y2-1); 225 painter->drawPoint(x+1, y2-1);
226 painter->drawPoint(x2-1, y+1); 226 painter->drawPoint(x2-1, y+1);
227 } 227 }
228 228
229 if (fill) { 229 if (fill) {
230 painter->fillRect(x+2, y+2, w-4, h-4, *fill ); 230 painter->fillRect(x+2, y+2, w-4, h-4, *fill );
231 } 231 }
232 painter->restore(); 232 painter->restore();
233} 233}
234 234
235 235
236 236
237void PhaseStyle::drawButton(QPainter *p, int x, int y, int w, int h, 237void PhaseStyle::drawButton(QPainter *p, int x, int y, int w, int h,
238 const QColorGroup &group, bool sunken , 238 const QColorGroup &group, bool sunken ,
239 const QBrush *fill ) { 239 const QBrush *fill ) {
240 int x2 = x + w - 1; 240 int x2 = x + w - 1;
241 int y2 = y + h - 1; 241 int y2 = y + h - 1;
242 242
243 p->setPen(group.midlight()); 243 p->setPen(group.midlight());
244 p->drawLine(x+1, y2, x2, y2); 244 p->drawLine(x+1, y2, x2, y2);
245 p->drawLine(x2, y+1, x2, y2-1); 245 p->drawLine(x2, y+1, x2, y2-1);
246 246
247 p->setPen(group.mid()); 247 p->setPen(group.mid());
248 p->drawLine(x, y, x2-1, y); 248 p->drawLine(x, y, x2-1, y);
249 p->drawLine(x, y+1, x, y2-1); 249 p->drawLine(x, y+1, x, y2-1);
250 250
251 p->setPen(group.button()); 251 p->setPen(group.button());
252 p->drawPoint(x, y2); 252 p->drawPoint(x, y2);
253 p->drawPoint(x2, y); 253 p->drawPoint(x2, y);
254 254
255 drawBevelButton(p, x+1, y+1, w-2, h-2, group, sunken, 255 drawBevelButton(p, x+1, y+1, w-2, h-2, group, sunken,
256 fill); 256 fill);
257} 257}
258 258
259void PhaseStyle::drawButtonMask( QPainter* p, int x, int y, 259void PhaseStyle::drawButtonMask( QPainter* p, int x, int y,
260 int w, int h ) { 260 int w, int h ) {
261 QRect rect(x, y, w, h ); 261 QRect rect(x, y, w, h );
262 p->fillRect(rect, Qt::color1); 262 p->fillRect(rect, Qt::color1);
263 p->setPen(Qt::color0); 263 p->setPen(Qt::color0);
264} 264}
265 265
266 266
267void PhaseStyle::drawBevelButton(QPainter* p, int x, int y, 267void PhaseStyle::drawBevelButton(QPainter* p, int x, int y,
268 int w, int h, const QColorGroup& group, 268 int w, int h, const QColorGroup& group,
269 bool sunken, const QBrush* fill ) { 269 bool sunken, const QBrush* fill ) {
270 int x2 = x + w - 1; 270 int x2 = x + w - 1;
271 int y2 = y + h - 1; 271 int y2 = y + h - 1;
272 p->save(); 272 p->save();
273 273
274 p->setPen(group.dark()); 274 p->setPen(group.dark());
275 p->drawRect(x, y, w, h); 275 p->drawRect(x, y, w, h);