summaryrefslogtreecommitdiff
authorleseb <leseb>2002-07-02 21:23:40 (UTC)
committer leseb <leseb>2002-07-02 21:23:40 (UTC)
commitd83f58a1a4a314a3ef8b25dd78432488922a9e31 (patch) (unidiff)
tree353b815ff13bb34594fa8db4d15233ed6b8c27e4
parent2481ac4013794f95c53580f99b4b761142e4ee8f (diff)
downloadopie-d83f58a1a4a314a3ef8b25dd78432488922a9e31.zip
opie-d83f58a1a4a314a3ef8b25dd78432488922a9e31.tar.gz
opie-d83f58a1a4a314a3ef8b25dd78432488922a9e31.tar.bz2
Fix QToolButton drawing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/othemestyle.cpp8
-rw-r--r--noncore/styles/theme/othemestyle.h6
2 files changed, 14 insertions, 0 deletions
diff --git a/noncore/styles/theme/othemestyle.cpp b/noncore/styles/theme/othemestyle.cpp
index 61127b8..d97b026 100644
--- a/noncore/styles/theme/othemestyle.cpp
+++ b/noncore/styles/theme/othemestyle.cpp
@@ -120,384 +120,392 @@ void OThemeStyle::polish( QWidget *w )
120 newPal.setNormal( *colorGroup( newPal.normal(), IndicatorOff ) ); 120 newPal.setNormal( *colorGroup( newPal.normal(), IndicatorOff ) );
121 newPal.setDisabled( *colorGroup( newPal.normal(), IndicatorOff ) ); 121 newPal.setDisabled( *colorGroup( newPal.normal(), IndicatorOff ) );
122 } 122 }
123 if ( isColor( IndicatorOn ) ) 123 if ( isColor( IndicatorOn ) )
124 newPal.setActive( *colorGroup( newPal.active(), IndicatorOn ) ); 124 newPal.setActive( *colorGroup( newPal.active(), IndicatorOn ) );
125 w->setPalette( newPal ); 125 w->setPalette( newPal );
126 } 126 }
127 } 127 }
128 if ( w->inherits( "QRadioButton" ) ) { 128 if ( w->inherits( "QRadioButton" ) ) {
129 if ( isColor( ExIndicatorOff ) || isColor( ExIndicatorOn ) ) { 129 if ( isColor( ExIndicatorOff ) || isColor( ExIndicatorOn ) ) {
130 QPalette newPal( w->palette() ); 130 QPalette newPal( w->palette() );
131 w->setPalettePropagation( QWidget::SamePalette ); 131 w->setPalettePropagation( QWidget::SamePalette );
132 if ( isColor( ExIndicatorOff ) ) { 132 if ( isColor( ExIndicatorOff ) ) {
133 newPal.setNormal( *colorGroup( newPal.normal(), ExIndicatorOff ) ); 133 newPal.setNormal( *colorGroup( newPal.normal(), ExIndicatorOff ) );
134 newPal.setDisabled( *colorGroup( newPal.normal(), 134 newPal.setDisabled( *colorGroup( newPal.normal(),
135 ExIndicatorOff ) ); 135 ExIndicatorOff ) );
136 } 136 }
137 if ( isColor( ExIndicatorOn ) ) 137 if ( isColor( ExIndicatorOn ) )
138 newPal.setActive( *colorGroup( newPal.active(), ExIndicatorOn ) ); 138 newPal.setActive( *colorGroup( newPal.active(), ExIndicatorOn ) );
139 w->setPalette( newPal ); 139 w->setPalette( newPal );
140 } 140 }
141 } 141 }
142} 142}
143 143
144void OThemeStyle::unPolish( QWidget* w ) 144void OThemeStyle::unPolish( QWidget* w )
145{ 145{
146 if ( !w->isTopLevel() ) { 146 if ( !w->isTopLevel() ) {
147 if ( w->inherits( "QGroupBox" ) 147 if ( w->inherits( "QGroupBox" )
148 || w->inherits( "QTabWidget" ) ) { 148 || w->inherits( "QTabWidget" ) ) {
149 w->setAutoMask( FALSE ); 149 w->setAutoMask( FALSE );
150 return ; 150 return ;
151 } 151 }
152 if ( w->inherits( "QLabel" ) 152 if ( w->inherits( "QLabel" )
153 || w->inherits( "QSlider" ) 153 || w->inherits( "QSlider" )
154 || w->inherits( "QButton" ) 154 || w->inherits( "QButton" )
155 || w->inherits( "QProgressBar" ) 155 || w->inherits( "QProgressBar" )
156 ) { 156 ) {
157 w->setBackgroundOrigin( QWidget::WidgetOrigin ); 157 w->setBackgroundOrigin( QWidget::WidgetOrigin );
158 } 158 }
159 } 159 }
160 if ( w->inherits( "QPopupMenu" ) ) 160 if ( w->inherits( "QPopupMenu" ) )
161 w->unsetPalette(); 161 w->unsetPalette();
162 if ( w->inherits( "QCheckBox" ) ) 162 if ( w->inherits( "QCheckBox" ) )
163 w->unsetPalette(); 163 w->unsetPalette();
164 if ( w->inherits( "QRadioButton" ) ) 164 if ( w->inherits( "QRadioButton" ) )
165 w->unsetPalette(); 165 w->unsetPalette();
166} 166}
167 167
168void OThemeStyle::drawBaseButton( QPainter *p, int x, int y, int w, int h, 168void OThemeStyle::drawBaseButton( QPainter *p, int x, int y, int w, int h,
169 const QColorGroup &g, bool sunken, bool 169 const QColorGroup &g, bool sunken, bool
170 rounded, WidgetType type, const QBrush * ) 170 rounded, WidgetType type, const QBrush * )
171{ 171{
172 int offset = borderPixmap( type ) ? 0 : decoWidth( type ); 172 int offset = borderPixmap( type ) ? 0 : decoWidth( type );
173 QPen oldPen = p->pen(); 173 QPen oldPen = p->pen();
174 174
175 // handle reverse bevel here since it uses decowidth differently 175 // handle reverse bevel here since it uses decowidth differently
176 if ( gradientHint( type ) == GrReverseBevel ) { 176 if ( gradientHint( type ) == GrReverseBevel ) {
177 int i; 177 int i;
178 bitBlt( p->device(), x, y, scalePixmap( w, h, type ), 0, 0, w, h, 178 bitBlt( p->device(), x, y, scalePixmap( w, h, type ), 0, 0, w, h,
179 Qt::CopyROP, true ); 179 Qt::CopyROP, true );
180 p->setPen( g.text() ); 180 p->setPen( g.text() );
181 for ( i = 0; i < borderWidth( type ); ++i, ++x, ++y, w -= 2, h -= 2 ) 181 for ( i = 0; i < borderWidth( type ); ++i, ++x, ++y, w -= 2, h -= 2 )
182 p->drawRect( x, y, w, h ); 182 p->drawRect( x, y, w, h );
183 } 183 }
184 // same with KDE style borders 184 // same with KDE style borders
185 else if ( !borderPixmap( type ) && shade() == KDE ) { 185 else if ( !borderPixmap( type ) && shade() == KDE ) {
186 qDrawWinButton( p, x, y, w, h, g, sunken ); 186 qDrawWinButton( p, x, y, w, h, g, sunken );
187 if ( isPixmap( type ) ) 187 if ( isPixmap( type ) )
188 p->drawTiledPixmap( x + 4, y + 4, w - 6, h - 6, 188 p->drawTiledPixmap( x + 4, y + 4, w - 6, h - 6,
189 *scalePixmap( w - 6, h - 6, 189 *scalePixmap( w - 6, h - 6,
190 type ) ); 190 type ) );
191 else 191 else
192 p->fillRect( x + 4, y + 4, w - 6, h - offset * 6, 192 p->fillRect( x + 4, y + 4, w - 6, h - offset * 6,
193 g.brush( QColorGroup::Button ) ); 193 g.brush( QColorGroup::Button ) );
194 194
195 } 195 }
196 else { 196 else {
197 if ( ( w - offset * 2 ) > 0 && ( h - offset * 2 ) > 0 ) { 197 if ( ( w - offset * 2 ) > 0 && ( h - offset * 2 ) > 0 ) {
198 if ( isPixmap( type ) ) 198 if ( isPixmap( type ) )
199 if ( rounded ) 199 if ( rounded )
200 p->drawTiledPixmap( x, y, w, h, *scalePixmap( w, h, type ) ); 200 p->drawTiledPixmap( x, y, w, h, *scalePixmap( w, h, type ) );
201 else 201 else
202 p->drawTiledPixmap( x + offset, y + offset, w - offset * 2, 202 p->drawTiledPixmap( x + offset, y + offset, w - offset * 2,
203 h - offset * 2, 203 h - offset * 2,
204 *scalePixmap( w - offset * 2, h - offset * 2, 204 *scalePixmap( w - offset * 2, h - offset * 2,
205 type ) ); 205 type ) );
206 else 206 else
207 p->fillRect( x + offset, y + offset, w - offset * 2, h - offset * 2, 207 p->fillRect( x + offset, y + offset, w - offset * 2, h - offset * 2,
208 g.brush( QColorGroup::Button ) ); 208 g.brush( QColorGroup::Button ) );
209 } 209 }
210 if ( borderPixmap( type ) ) 210 if ( borderPixmap( type ) )
211 bitBlt( p->device(), x, y, scaleBorder( w, h, type ), 0, 0, w, h, 211 bitBlt( p->device(), x, y, scaleBorder( w, h, type ), 0, 0, w, h,
212 Qt::CopyROP, false ); 212 Qt::CopyROP, false );
213 else 213 else
214 drawShade( p, x, y, w, h, g, sunken, rounded, 214 drawShade( p, x, y, w, h, g, sunken, rounded,
215 highlightWidth( type ), borderWidth( type ), shade() ); 215 highlightWidth( type ), borderWidth( type ), shade() );
216 } 216 }
217 p->setPen( oldPen ); 217 p->setPen( oldPen );
218} 218}
219 219
220void OThemeStyle::drawButton( QPainter *p, int x, int y, int w, int h, 220void OThemeStyle::drawButton( QPainter *p, int x, int y, int w, int h,
221 const QColorGroup &g, bool sunken, 221 const QColorGroup &g, bool sunken,
222 const QBrush *fill ) 222 const QBrush *fill )
223{ 223{
224 drawBaseButton( p, x, y, w, h, g, sunken, roundButton(), sunken ? 224 drawBaseButton( p, x, y, w, h, g, sunken, roundButton(), sunken ?
225 PushButtonDown : PushButton, fill ); 225 PushButtonDown : PushButton, fill );
226} 226}
227 227
228void OThemeStyle::drawPushButton( QPushButton* btn, QPainter *p ) 228void OThemeStyle::drawPushButton( QPushButton* btn, QPainter *p )
229{ 229{
230 bool sunken = btn->isOn() || btn->isDown(); 230 bool sunken = btn->isOn() || btn->isDown();
231 int diw = buttonDefaultIndicatorWidth(); 231 int diw = buttonDefaultIndicatorWidth();
232 drawBaseButton( p, diw, diw, btn->width() - 2 * diw, btn->height() - 2 * diw, 232 drawBaseButton( p, diw, diw, btn->width() - 2 * diw, btn->height() - 2 * diw,
233 *colorGroup( btn->colorGroup(), sunken ? PushButtonDown : 233 *colorGroup( btn->colorGroup(), sunken ? PushButtonDown :
234 PushButton ), sunken, roundButton(), 234 PushButton ), sunken, roundButton(),
235 sunken ? PushButtonDown : PushButton, NULL ); 235 sunken ? PushButtonDown : PushButton, NULL );
236 // TODO if diw, draw fancy default button indicator 236 // TODO if diw, draw fancy default button indicator
237} 237}
238 238
239void OThemeStyle::drawBaseMask( QPainter *p, int x, int y, int w, int h, 239void OThemeStyle::drawBaseMask( QPainter *p, int x, int y, int w, int h,
240 bool round ) 240 bool round )
241{ 241{
242 // round edge fills 242 // round edge fills
243 static const QCOORD btm_left_fill[] = { 243 static const QCOORD btm_left_fill[] = {
244 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 244 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1,
245 1, 2, 2, 2, 3, 2, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4 245 1, 2, 2, 2, 3, 2, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4
246 }; 246 };
247 247
248 static const QCOORD btm_right_fill[] = { 248 static const QCOORD btm_right_fill[] = {
249 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, 249 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4,
250 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4 250 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4
251 }; 251 };
252 252
253 static const QCOORD top_left_fill[] = { 253 static const QCOORD top_left_fill[] = {
254 3, 0, 4, 0, 2, 1, 3, 1, 4, 1, 1, 2, 2, 2, 3, 2, 4, 2, 0, 3, 254 3, 0, 4, 0, 2, 1, 3, 1, 4, 1, 1, 2, 2, 2, 3, 2, 4, 2, 0, 3,
255 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4 255 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4
256 }; 256 };
257 257
258 static const QCOORD top_right_fill[] = { 258 static const QCOORD top_right_fill[] = {
259 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 259 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 0, 2, 1, 2, 2, 2, 3, 2, 0,
260 3, 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4 260 3, 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4
261 }; 261 };
262 262
263 QBrush fillBrush( color1, SolidPattern ); 263 QBrush fillBrush( color1, SolidPattern );
264 p->setPen( color1 ); 264 p->setPen( color1 );
265 if ( round && w > 19 && h > 19 ) { 265 if ( round && w > 19 && h > 19 ) {
266 int x2 = x + w - 1; 266 int x2 = x + w - 1;
267 int y2 = y + h - 1; 267 int y2 = y + h - 1;
268 QPointArray a( QCOORDARRLEN( top_left_fill ), top_left_fill ); 268 QPointArray a( QCOORDARRLEN( top_left_fill ), top_left_fill );
269 a.translate( 1, 1 ); 269 a.translate( 1, 1 );
270 p->drawPoints( a ); 270 p->drawPoints( a );
271 a.setPoints( QCOORDARRLEN( btm_left_fill ), btm_left_fill ); 271 a.setPoints( QCOORDARRLEN( btm_left_fill ), btm_left_fill );
272 a.translate( 1, h - 6 ); 272 a.translate( 1, h - 6 );
273 p->drawPoints( a ); 273 p->drawPoints( a );
274 a.setPoints( QCOORDARRLEN( top_right_fill ), top_right_fill ); 274 a.setPoints( QCOORDARRLEN( top_right_fill ), top_right_fill );
275 a.translate( w - 6, 1 ); 275 a.translate( w - 6, 1 );
276 p->drawPoints( a ); 276 p->drawPoints( a );
277 a.setPoints( QCOORDARRLEN( btm_right_fill ), btm_right_fill ); 277 a.setPoints( QCOORDARRLEN( btm_right_fill ), btm_right_fill );
278 a.translate( w - 6, h - 6 ); 278 a.translate( w - 6, h - 6 );
279 p->drawPoints( a ); 279 p->drawPoints( a );
280 280
281 p->fillRect( x + 6, y, w - 12, h, fillBrush ); 281 p->fillRect( x + 6, y, w - 12, h, fillBrush );
282 p->fillRect( x, y + 6, x + 6, h - 12, fillBrush ); 282 p->fillRect( x, y + 6, x + 6, h - 12, fillBrush );
283 p->fillRect( x2 - 6, y + 6, x2, h - 12, fillBrush ); 283 p->fillRect( x2 - 6, y + 6, x2, h - 12, fillBrush );
284 p->drawLine( x + 6, y, x2 - 6, y ); 284 p->drawLine( x + 6, y, x2 - 6, y );
285 p->drawLine( x + 6, y2, x2 - 6, y2 ); 285 p->drawLine( x + 6, y2, x2 - 6, y2 );
286 p->drawLine( x, y + 6, x, y2 - 6 ); 286 p->drawLine( x, y + 6, x, y2 - 6 );
287 p->drawLine( x2, y + 6, x2, y2 - 6 ); 287 p->drawLine( x2, y + 6, x2, y2 - 6 );
288 288
289 } 289 }
290 else 290 else
291 p->fillRect( x, y, w, h, fillBrush ); 291 p->fillRect( x, y, w, h, fillBrush );
292} 292}
293 293
294void OThemeStyle::drawButtonMask( QPainter *p, int x, int y, int w, int h ) 294void OThemeStyle::drawButtonMask( QPainter *p, int x, int y, int w, int h )
295{ 295{
296 drawBaseMask( p, x, y, w, h, roundButton() ); 296 drawBaseMask( p, x, y, w, h, roundButton() );
297} 297}
298 298
299void OThemeStyle::drawComboButtonMask( QPainter *p, int x, int y, int w, int h ) 299void OThemeStyle::drawComboButtonMask( QPainter *p, int x, int y, int w, int h )
300{ 300{
301 drawBaseMask( p, x, y, w, h, roundComboBox() ); 301 drawBaseMask( p, x, y, w, h, roundComboBox() );
302} 302}
303 303
304void OThemeStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h, 304void OThemeStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h,
305 const QColorGroup &g, bool sunken, 305 const QColorGroup &g, bool sunken,
306 const QBrush * ) 306 const QBrush * )
307{ 307{
308 WidgetType type = sunken ? BevelDown : Bevel; 308 WidgetType type = sunken ? BevelDown : Bevel;
309 drawBaseButton( p, x, y, w, h, *colorGroup( g, type ), sunken, false, type ); 309 drawBaseButton( p, x, y, w, h, *colorGroup( g, type ), sunken, false, type );
310} 310}
311 311
312void OThemeStyle::drawToolButton( QPainter *p, int x, int y, int w, int h,
313 const QColorGroup &g, bool sunken,
314 const QBrush * )
315{
316 WidgetType type = sunken ? ToolButtonDown : ToolButton;
317 drawBaseButton( p, x, y, w, h, *colorGroup( g, type ), sunken, false, type );
318}
319
312#if 0 320#if 0
313void OThemeStyle::drawKToolBarButton( QPainter *p, int x, int y, int w, int h, 321void OThemeStyle::drawKToolBarButton( QPainter *p, int x, int y, int w, int h,
314 const QColorGroup &g, bool sunken, 322 const QColorGroup &g, bool sunken,
315 bool raised, bool enabled, bool popup, 323 bool raised, bool enabled, bool popup,
316 KToolButtonType type, const QString &btext, 324 KToolButtonType type, const QString &btext,
317 const QPixmap *pixmap, QFont *font, 325 const QPixmap *pixmap, QFont *font,
318 QWidget * ) 326 QWidget * )
319{ 327{
320 QFont tmp_font( QString::fromLatin1( "Helvetica" ), 10 ); 328 QFont tmp_font( QString::fromLatin1( "Helvetica" ), 10 );
321 if ( font ) 329 if ( font )
322 tmp_font = *font; 330 tmp_font = *font;
323 QFontMetrics fm( tmp_font ); 331 QFontMetrics fm( tmp_font );
324 WidgetType widget = sunken ? ToolButtonDown : ToolButton; 332 WidgetType widget = sunken ? ToolButtonDown : ToolButton;
325 333
326 drawBaseButton( p, x, y, w, h, *colorGroup( g, widget ), sunken, false, 334 drawBaseButton( p, x, y, w, h, *colorGroup( g, widget ), sunken, false,
327 widget ); 335 widget );
328 int dx, dy; 336 int dx, dy;
329 if ( type == Icon ) { // icon only 337 if ( type == Icon ) { // icon only
330 if ( pixmap ) { 338 if ( pixmap ) {
331 dx = ( w - pixmap->width() ) / 2; 339 dx = ( w - pixmap->width() ) / 2;
332 dy = ( h - pixmap->height() ) / 2; 340 dy = ( h - pixmap->height() ) / 2;
333 if ( sunken ) { 341 if ( sunken ) {
334 ++dx; 342 ++dx;
335 ++dy; 343 ++dy;
336 } 344 }
337 p->drawPixmap( x + dx, y + dy, *pixmap ); 345 p->drawPixmap( x + dx, y + dy, *pixmap );
338 } 346 }
339 } 347 }
340 else if ( type == IconTextRight ) { // icon and text (if any) 348 else if ( type == IconTextRight ) { // icon and text (if any)
341 if ( pixmap ) { 349 if ( pixmap ) {
342 dx = 4; 350 dx = 4;
343 dy = ( h - pixmap->height() ) / 2; 351 dy = ( h - pixmap->height() ) / 2;
344 if ( sunken ) { 352 if ( sunken ) {
345 ++dx; 353 ++dx;
346 ++dy; 354 ++dy;
347 } 355 }
348 p->drawPixmap( x + dx, y + dy, *pixmap ); 356 p->drawPixmap( x + dx, y + dy, *pixmap );
349 } 357 }
350 if ( !btext.isNull() ) { 358 if ( !btext.isNull() ) {
351 int tf = AlignVCenter | AlignLeft; 359 int tf = AlignVCenter | AlignLeft;
352 if ( pixmap ) 360 if ( pixmap )
353 dx = 4 + pixmap->width() + 2; 361 dx = 4 + pixmap->width() + 2;
354 else 362 else
355 dx = 4; 363 dx = 4;
356 dy = 0; 364 dy = 0;
357 if ( sunken ) { 365 if ( sunken ) {
358 ++dx; 366 ++dx;
359 ++dy; 367 ++dy;
360 } 368 }
361 if ( font ) 369 if ( font )
362 p->setFont( *font ); 370 p->setFont( *font );
363 if ( raised ) 371 if ( raised )
364 p->setPen( KGlobalSettings::toolBarHighlightColor() ); 372 p->setPen( KGlobalSettings::toolBarHighlightColor() );
365 p->drawText( x + dx, y + dy, w - dx, h, tf, btext ); 373 p->drawText( x + dx, y + dy, w - dx, h, tf, btext );
366 } 374 }
367 } 375 }
368 else if ( type == Text ) { // only text, even if there is a icon 376 else if ( type == Text ) { // only text, even if there is a icon
369 if ( !btext.isNull() ) { 377 if ( !btext.isNull() ) {
370 int tf = AlignTop | AlignLeft; 378 int tf = AlignTop | AlignLeft;
371 if ( !enabled ) 379 if ( !enabled )
372 p->setPen( g.dark() ); 380 p->setPen( g.dark() );
373 dx = ( w - fm.width( btext ) ) / 2; 381 dx = ( w - fm.width( btext ) ) / 2;
374 dy = ( h - fm.lineSpacing() ) / 2; 382 dy = ( h - fm.lineSpacing() ) / 2;
375 if ( sunken ) { 383 if ( sunken ) {
376 ++dx; 384 ++dx;
377 ++dy; 385 ++dy;
378 } 386 }
379 if ( font ) 387 if ( font )
380 p->setFont( *font ); 388 p->setFont( *font );
381 if ( raised ) 389 if ( raised )
382 p->setPen( KGlobalSettings::toolBarHighlightColor() ); 390 p->setPen( KGlobalSettings::toolBarHighlightColor() );
383 p->drawText( x + dx, y + dy, fm.width( btext ), fm.lineSpacing(), tf, btext ); 391 p->drawText( x + dx, y + dy, fm.width( btext ), fm.lineSpacing(), tf, btext );
384 } 392 }
385 } 393 }
386 else if ( type == IconTextBottom ) { 394 else if ( type == IconTextBottom ) {
387 if ( pixmap ) { 395 if ( pixmap ) {
388 dx = ( w - pixmap->width() ) / 2; 396 dx = ( w - pixmap->width() ) / 2;
389 dy = ( h - fm.lineSpacing() - pixmap->height() ) / 2; 397 dy = ( h - fm.lineSpacing() - pixmap->height() ) / 2;
390 if ( sunken ) { 398 if ( sunken ) {
391 ++dx; 399 ++dx;
392 ++dy; 400 ++dy;
393 } 401 }
394 p->drawPixmap( x + dx, y + dy, *pixmap ); 402 p->drawPixmap( x + dx, y + dy, *pixmap );
395 } 403 }
396 if ( !btext.isNull() ) { 404 if ( !btext.isNull() ) {
397 int tf = AlignBottom | AlignHCenter; 405 int tf = AlignBottom | AlignHCenter;
398 dx = ( w - fm.width( btext ) ) / 2; 406 dx = ( w - fm.width( btext ) ) / 2;
399 dy = h - fm.lineSpacing() - 4; 407 dy = h - fm.lineSpacing() - 4;
400 if ( sunken ) { 408 if ( sunken ) {
401 ++dx; 409 ++dx;
402 ++dy; 410 ++dy;
403 } 411 }
404 if ( font ) 412 if ( font )
405 p->setFont( *font ); 413 p->setFont( *font );
406 if ( raised ) 414 if ( raised )
407 p->setPen( KGlobalSettings::toolBarHighlightColor() ); 415 p->setPen( KGlobalSettings::toolBarHighlightColor() );
408 p->drawText( x + dx, y + dy, fm.width( btext ), fm.lineSpacing(), tf, btext ); 416 p->drawText( x + dx, y + dy, fm.width( btext ), fm.lineSpacing(), tf, btext );
409 } 417 }
410 } 418 }
411 if ( popup ) { 419 if ( popup ) {
412 if ( enabled ) 420 if ( enabled )
413 qDrawArrow ( p, DownArrow, WindowsStyle, false, w - 5, h - 5, 0, 0, 421 qDrawArrow ( p, DownArrow, WindowsStyle, false, w - 5, h - 5, 0, 0,
414 g, true ); 422 g, true );
415 else 423 else
416 qDrawArrow ( p, DownArrow, WindowsStyle, false, w - 5, h - 5, 424 qDrawArrow ( p, DownArrow, WindowsStyle, false, w - 5, h - 5,
417 0, 0, g, false ); 425 0, 0, g, false );
418 } 426 }
419} 427}
420 428
421void OThemeStyle::drawKBarHandle( QPainter *p, int x, int y, int w, int h, 429void OThemeStyle::drawKBarHandle( QPainter *p, int x, int y, int w, int h,
422 const QColorGroup &g, KToolBarPos, QBrush * ) 430 const QColorGroup &g, KToolBarPos, QBrush * )
423{ 431{
424 if ( w > h ) 432 if ( w > h )
425 drawBaseButton( p, x, y, w, h, *colorGroup( g, HBarHandle ), false, false, 433 drawBaseButton( p, x, y, w, h, *colorGroup( g, HBarHandle ), false, false,
426 HBarHandle ); 434 HBarHandle );
427 else 435 else
428 drawBaseButton( p, x, y, w, h, *colorGroup( g, VBarHandle ), false, false, 436 drawBaseButton( p, x, y, w, h, *colorGroup( g, VBarHandle ), false, false,
429 VBarHandle ); 437 VBarHandle );
430} 438}
431 439
432void OThemeStyle::drawKToolBar( QPainter *p, int x, int y, int w, int h, 440void OThemeStyle::drawKToolBar( QPainter *p, int x, int y, int w, int h,
433 const QColorGroup &g, KToolBarPos, QBrush * ) 441 const QColorGroup &g, KToolBarPos, QBrush * )
434{ 442{
435 drawBaseButton( p, x, y, w, h, *colorGroup( g, ToolBar ), false, false, 443 drawBaseButton( p, x, y, w, h, *colorGroup( g, ToolBar ), false, false,
436 ToolBar ); 444 ToolBar );
437} 445}
438#endif 446#endif
439 447
440QRect OThemeStyle::buttonRect( int x, int y, int w, int h ) 448QRect OThemeStyle::buttonRect( int x, int y, int w, int h )
441{ 449{
442 int spacing = decoWidth( PushButton ) > decoWidth( PushButtonDown ) ? 450 int spacing = decoWidth( PushButton ) > decoWidth( PushButtonDown ) ?
443 decoWidth( PushButton ) : decoWidth( PushButtonDown ); 451 decoWidth( PushButton ) : decoWidth( PushButtonDown );
444 return ( QRect( x + spacing, y + spacing, w - ( spacing * 2 ), h - ( spacing * 2 ) ) ); 452 return ( QRect( x + spacing, y + spacing, w - ( spacing * 2 ), h - ( spacing * 2 ) ) );
445} 453}
446 454
447void OThemeStyle::drawComboButton( QPainter *p, int x, int y, int w, int h, 455void OThemeStyle::drawComboButton( QPainter *p, int x, int y, int w, int h,
448 const QColorGroup &g, bool sunken, bool, 456 const QColorGroup &g, bool sunken, bool,
449 bool, const QBrush * ) 457 bool, const QBrush * )
450{ 458{
451 WidgetType widget = sunken ? ComboBoxDown : ComboBox; 459 WidgetType widget = sunken ? ComboBoxDown : ComboBox;
452 drawBaseButton( p, x, y, w, h, *colorGroup( g, widget ), sunken, 460 drawBaseButton( p, x, y, w, h, *colorGroup( g, widget ), sunken,
453 roundComboBox(), widget ); 461 roundComboBox(), widget );
454 if ( !sunken && isPixmap( ComboDeco ) ) 462 if ( !sunken && isPixmap( ComboDeco ) )
455 p->drawPixmap( w - uncached( ComboDeco ) ->width() - 463 p->drawPixmap( w - uncached( ComboDeco ) ->width() -
456 decoWidth( ComboBox ) - 2, 464 decoWidth( ComboBox ) - 2,
457 y + ( h - uncached( ComboDeco ) -> 465 y + ( h - uncached( ComboDeco ) ->
458 height() ) / 2, *uncached( ComboDeco ) ); 466 height() ) / 2, *uncached( ComboDeco ) );
459 else if ( sunken && isPixmap( ComboDecoDown ) ) 467 else if ( sunken && isPixmap( ComboDecoDown ) )
460 p->drawPixmap( w - uncached( ComboDecoDown ) ->width() - 468 p->drawPixmap( w - uncached( ComboDecoDown ) ->width() -
461 decoWidth( ComboBoxDown ) - 2, 469 decoWidth( ComboBoxDown ) - 2,
462 y + ( h - uncached( ComboDecoDown ) -> 470 y + ( h - uncached( ComboDecoDown ) ->
463 height() ) / 2, *uncached( ComboDecoDown ) ); 471 height() ) / 2, *uncached( ComboDecoDown ) );
464 else { 472 else {
465 qDrawArrow( p, Qt::DownArrow, Qt::MotifStyle, false, w - 15, y + 6, 10, 473 qDrawArrow( p, Qt::DownArrow, Qt::MotifStyle, false, w - 15, y + 6, 10,
466 h - 15, *colorGroup( g, widget ), true ); 474 h - 15, *colorGroup( g, widget ), true );
467 qDrawShadeRect( p, w - 14, y + 7 + ( h - 15 ), 10, 3, *colorGroup( g, widget ) ); 475 qDrawShadeRect( p, w - 14, y + 7 + ( h - 15 ), 10, 3, *colorGroup( g, widget ) );
468 } 476 }
469} 477}
470 478
471void OThemeStyle::drawScrollBarControls( QPainter *p, const QScrollBar *sb, 479void OThemeStyle::drawScrollBarControls( QPainter *p, const QScrollBar *sb,
472 int sliderStart, uint controls, 480 int sliderStart, uint controls,
473 uint activeControl ) 481 uint activeControl )
474{ 482{
475 int sliderMin, sliderMax, sliderLength, buttonDim; 483 int sliderMin, sliderMax, sliderLength, buttonDim;
476 QRect add 484 QRect add
477 , sub, addPage, subPage, slider; 485 , sub, addPage, subPage, slider;
478 int addX, addY, subX, subY; 486 int addX, addY, subX, subY;
479 bool horizontal = sb->orientation() == QScrollBar::Horizontal; 487 bool horizontal = sb->orientation() == QScrollBar::Horizontal;
480 int len = ( horizontal ) ? sb->width() : sb->height(); 488 int len = ( horizontal ) ? sb->width() : sb->height();
481 int extent = ( horizontal ) ? sb->height() : sb->width(); 489 int extent = ( horizontal ) ? sb->height() : sb->width();
482 int offset = decoWidth( horizontal ? HScrollGroove : VScrollGroove ); 490 int offset = decoWidth( horizontal ? HScrollGroove : VScrollGroove );
483 QColorGroup g = sb->colorGroup(); 491 QColorGroup g = sb->colorGroup();
484 492
485 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim ); 493 scrollBarMetrics( sb, sliderMin, sliderMax, sliderLength, buttonDim );
486 if ( sliderStart > sliderMax ) 494 if ( sliderStart > sliderMax )
487 sliderStart = sliderMax; 495 sliderStart = sliderMax;
488 496
489 int sliderEnd = sliderStart + sliderLength; 497 int sliderEnd = sliderStart + sliderLength;
490 int sliderWidth = extent - offset * 2; 498 int sliderWidth = extent - offset * 2;
491 499
492 // Scary button placement code >:-P Feel free to improve this if you 500 // Scary button placement code >:-P Feel free to improve this if you
493 // want. I get a headache just looking at it... (mosfet) 501 // want. I get a headache just looking at it... (mosfet)
494 if ( scrollBarLayout() == SBOpposite ) { 502 if ( scrollBarLayout() == SBOpposite ) {
495 if ( horizontal ) { 503 if ( horizontal ) {
496 subY = addY = ( extent - buttonDim ) / 2; 504 subY = addY = ( extent - buttonDim ) / 2;
497 subX = offset; 505 subX = offset;
498 addX = len - buttonDim - offset; 506 addX = len - buttonDim - offset;
499 } 507 }
500 else { 508 else {
501 subX = addX = ( extent - buttonDim ) / 2; 509 subX = addX = ( extent - buttonDim ) / 2;
502 subY = offset; 510 subY = offset;
503 addY = len - buttonDim - offset; 511 addY = len - buttonDim - offset;
diff --git a/noncore/styles/theme/othemestyle.h b/noncore/styles/theme/othemestyle.h
index 02bec78..52445c4 100644
--- a/noncore/styles/theme/othemestyle.h
+++ b/noncore/styles/theme/othemestyle.h
@@ -1,303 +1,309 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org> 2 Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation. 6 License version 2 as published by the Free Software Foundation.
7 7
8 This library is distributed in the hope that it will be useful, 8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details. 11 Library General Public License for more details.
12 12
13 You should have received a copy of the GNU Library General Public License 13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to 14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17*/ 17*/
18#ifndef __KTHEMESTYLE_H 18#ifndef __KTHEMESTYLE_H
19#define __KTHEMESTYLE_H 19#define __KTHEMESTYLE_H
20 20
21#include "othemebase.h" 21#include "othemebase.h"
22#include <qwindowdefs.h> 22#include <qwindowdefs.h>
23#include <qobject.h> 23#include <qobject.h>
24#include <qbutton.h> 24#include <qbutton.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#include <qscrollbar.h> 26#include <qscrollbar.h>
27#include <qstring.h> 27#include <qstring.h>
28 28
29 29
30/** 30/**
31 * KDE themed styles. 31 * KDE themed styles.
32 * 32 *
33 * It provides methods for 33 * It provides methods for
34 * drawing most widgets with user-specified borders, highlights, pixmaps, 34 * drawing most widgets with user-specified borders, highlights, pixmaps,
35 * etc. It also handles various other settings such as scrollbar types, 35 * etc. It also handles various other settings such as scrollbar types,
36 * rounded buttons, and shading types. For a full list of parameters this 36 * rounded buttons, and shading types. For a full list of parameters this
37 * class handles refer to the KDE theme configuration documentation. 37 * class handles refer to the KDE theme configuration documentation.
38 * 38 *
39 */ 39 */
40 40
41class OThemeStyle: public OThemeBase 41class OThemeStyle: public OThemeBase
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 /** 45 /**
46 * Construct a new @ref OThemeStyle object. 46 * Construct a new @ref OThemeStyle object.
47 * 47 *
48 * @param configFile A KConfig file to use as the theme configuration. 48 * @param configFile A KConfig file to use as the theme configuration.
49 * Defaults to ~/.kderc. 49 * Defaults to ~/.kderc.
50 */ 50 */
51 OThemeStyle( const QString &configFile = QString::null ); 51 OThemeStyle( const QString &configFile = QString::null );
52 ~OThemeStyle(); 52 ~OThemeStyle();
53 virtual void polish( QWidget* ); 53 virtual void polish( QWidget* );
54 virtual void unPolish( QWidget* ); 54 virtual void unPolish( QWidget* );
55 /** 55 /**
56 * By default this just sets the background brushes to the pixmapped 56 * By default this just sets the background brushes to the pixmapped
57 * background. 57 * background.
58 */ 58 */
59 virtual void polish( QApplication *app ); 59 virtual void polish( QApplication *app );
60 virtual void unPolish( QApplication* ); 60 virtual void unPolish( QApplication* );
61 61
62 /// @internal 62 /// @internal
63 // to make it possible for derived classes to overload this function 63 // to make it possible for derived classes to overload this function
64 virtual void polish( QPalette& pal ); 64 virtual void polish( QPalette& pal );
65 65
66 /** 66 /**
67 * This is a convenience method for drawing widgets with 67 * This is a convenience method for drawing widgets with
68 * borders, highlights, pixmaps, colors, etc... 68 * borders, highlights, pixmaps, colors, etc...
69 * You specify the widget type and it will draw it according to the 69 * You specify the widget type and it will draw it according to the
70 * config file settings. 70 * config file settings.
71 * 71 *
72 * @param p The QPainter to draw on. 72 * @param p The QPainter to draw on.
73 * @param g The color group to use. 73 * @param g The color group to use.
74 * @param rounded @p true if the widget is rounded, @p false if rectangular. 74 * @param rounded @p true if the widget is rounded, @p false if rectangular.
75 * @param type The widget type to paint. 75 * @param type The widget type to paint.
76 * @param fill An optional fill brush. Currently ignored (the config file 76 * @param fill An optional fill brush. Currently ignored (the config file
77 * is used instead). 77 * is used instead).
78 */ 78 */
79 virtual void drawBaseButton( QPainter *p, int x, int y, int w, int h, 79 virtual void drawBaseButton( QPainter *p, int x, int y, int w, int h,
80 const QColorGroup &g, bool sunken = FALSE, 80 const QColorGroup &g, bool sunken = FALSE,
81 bool rounded = FALSE, WidgetType type = Bevel, 81 bool rounded = FALSE, WidgetType type = Bevel,
82 const QBrush *fill = 0 ); 82 const QBrush *fill = 0 );
83 /** 83 /**
84 * Draw a mask with for widgets that may be rounded. 84 * Draw a mask with for widgets that may be rounded.
85 * 85 *
86 *Currently used 86 *Currently used
87 * by pushbuttons and comboboxes. 87 * by pushbuttons and comboboxes.
88 * 88 *
89 * @param p The QPainter to draw on. 89 * @param p The QPainter to draw on.
90 * @param rounded @p true if the widget is rounded, @p false if rectangular. 90 * @param rounded @p true if the widget is rounded, @p false if rectangular.
91 */ 91 */
92 virtual void drawBaseMask( QPainter *p, int x, int y, int w, int h, 92 virtual void drawBaseMask( QPainter *p, int x, int y, int w, int h,
93 bool rounded ); 93 bool rounded );
94 /** 94 /**
95 * Draw a pushbutton. 95 * Draw a pushbutton.
96 * 96 *
97 * This calls @ref drawBaseButton() with @p PushButton as the 97 * This calls @ref drawBaseButton() with @p PushButton as the
98 * widget type. 98 * widget type.
99 */ 99 */
100 virtual void drawButton( QPainter *p, int x, int y, int w, int h, 100 virtual void drawButton( QPainter *p, int x, int y, int w, int h,
101 const QColorGroup &g, bool sunken = FALSE, 101 const QColorGroup &g, bool sunken = FALSE,
102 const QBrush *fill = 0 ); 102 const QBrush *fill = 0 );
103 /** 103 /**
104 * Draw a bevel button. 104 * Draw a bevel button.
105 * 105 *
106 * This calls @ref drawBaseButton() with Bevel as the 106 * This calls @ref drawBaseButton() with Bevel as the
107 * widget type. 107 * widget type.
108 */ 108 */
109 virtual void drawBevelButton( QPainter *p, int x, int y, int w, int h, 109 virtual void drawBevelButton( QPainter *p, int x, int y, int w, int h,
110 const QColorGroup &g, bool sunken = FALSE, 110 const QColorGroup &g, bool sunken = FALSE,
111 const QBrush *fill = 0 ); 111 const QBrush *fill = 0 );
112 /**
113 * Draw a toolbar button.
114 */
115 virtual void drawToolButton ( QPainter *p, int x, int y, int w, int h,
116 const QColorGroup &g, bool sunken = FALSE,
117 const QBrush *fill = 0 );
112#if 0 118#if 0
113 /** 119 /**
114 * Draw a toolbar button. 120 * Draw a toolbar button.
115 */ 121 */
116 virtual void drawKToolBarButton( QPainter *p, int x, int y, int w, int h, 122 virtual void drawKToolBarButton( QPainter *p, int x, int y, int w, int h,
117 const QColorGroup &g, bool sunken = false, 123 const QColorGroup &g, bool sunken = false,
118 bool raised = true, bool enabled = true, 124 bool raised = true, bool enabled = true,
119 bool popup = false, KToolButtonType type = Icon, 125 bool popup = false, KToolButtonType type = Icon,
120 const QString &btext = QString::null, 126 const QString &btext = QString::null,
121 const QPixmap *icon = NULL, 127 const QPixmap *icon = NULL,
122 QFont *font = NULL, QWidget *btn = NULL ); 128 QFont *font = NULL, QWidget *btn = NULL );
123 /** 129 /**
124 * Draw the handle used in toolbars. 130 * Draw the handle used in toolbars.
125 */ 131 */
126 void drawKBarHandle( QPainter *p, int x, int y, int w, int h, 132 void drawKBarHandle( QPainter *p, int x, int y, int w, int h,
127 const QColorGroup &g, 133 const QColorGroup &g,
128 KToolBarPos type, QBrush *fill = NULL ); 134 KToolBarPos type, QBrush *fill = NULL );
129 135
130 /** 136 /**
131 * Draw a toolbar. 137 * Draw a toolbar.
132 */ 138 */
133 void drawKToolBar( QPainter *p, int x, int y, int w, int h, 139 void drawKToolBar( QPainter *p, int x, int y, int w, int h,
134 const QColorGroup &g, KToolBarPos type, 140 const QColorGroup &g, KToolBarPos type,
135 QBrush *fill = NULL ); 141 QBrush *fill = NULL );
136#endif 142#endif
137 /** 143 /**
138 * Return the space available in a pushbutton, taking configurable 144 * Return the space available in a pushbutton, taking configurable
139 * borders and highlights into account. 145 * borders and highlights into account.
140 */ 146 */
141 virtual QRect buttonRect( int x, int y, int w, int h ); 147 virtual QRect buttonRect( int x, int y, int w, int h );
142 /** 148 /**
143 * Draw an arrow in the style specified by the config file. 149 * Draw an arrow in the style specified by the config file.
144 */ 150 */
145 virtual void drawArrow( QPainter *p, Qt::ArrowType type, bool down, 151 virtual void drawArrow( QPainter *p, Qt::ArrowType type, bool down,
146 int x, int y, int w, int h, const QColorGroup &g, 152 int x, int y, int w, int h, const QColorGroup &g,
147 bool enabled = true, const QBrush *fill = 0 ); 153 bool enabled = true, const QBrush *fill = 0 );
148 /** 154 /**
149 * Return the size of the exclusive indicator pixmap if one is specified 155 * Return the size of the exclusive indicator pixmap if one is specified
150 * in the config file, otherwise it uses the base style's size. 156 * in the config file, otherwise it uses the base style's size.
151 */ 157 */
152 virtual QSize exclusiveIndicatorSize() const; 158 virtual QSize exclusiveIndicatorSize() const;
153 /** 159 /**
154 * Draw an exclusive indicator widget. 160 * Draw an exclusive indicator widget.
155 * 161 *
156 * If a pixmap is specified in the 162 * If a pixmap is specified in the
157 * config file that is used, otherwise the base style's widget is drawn. 163 * config file that is used, otherwise the base style's widget is drawn.
158 */ 164 */
159 virtual void drawExclusiveIndicator( QPainter* p, int x, int y, int w, 165 virtual void drawExclusiveIndicator( QPainter* p, int x, int y, int w,
160 int h, const QColorGroup &g, bool on, 166 int h, const QColorGroup &g, bool on,
161 bool down = FALSE, 167 bool down = FALSE,
162 bool enabled = TRUE ); 168 bool enabled = TRUE );
163 /** 169 /**
164 * Set the mask of an exclusive indicator widget. 170 * Set the mask of an exclusive indicator widget.
165 * 171 *
166 * If a pixmap is specified 172 * If a pixmap is specified
167 * it is masked according to it's transparent pixels, otherwise the 173 * it is masked according to it's transparent pixels, otherwise the
168 * base style's mask is used. 174 * base style's mask is used.
169 */ 175 */
170 virtual void drawExclusiveIndicatorMask( QPainter *p, int x, int y, int w, 176 virtual void drawExclusiveIndicatorMask( QPainter *p, int x, int y, int w,
171 int h, bool on ); 177 int h, bool on );
172 /** 178 /**
173 * Set the mask of an indicator widget. 179 * Set the mask of an indicator widget.
174 * 180 *
175 * If a pixmap is specified 181 * If a pixmap is specified
176 * it is masked according to it's transparent pixels, otherwise the 182 * it is masked according to it's transparent pixels, otherwise the
177 * base style's mask is used. 183 * base style's mask is used.
178 */ 184 */
179 virtual void drawIndicatorMask( QPainter *p, int x, int y, int w, int h, 185 virtual void drawIndicatorMask( QPainter *p, int x, int y, int w, int h,
180 int state ); 186 int state );
181 /** 187 /**
182 * Set the mask for pushbuttons. 188 * Set the mask for pushbuttons.
183 */ 189 */
184 virtual void drawButtonMask( QPainter *p, int x, int y, int w, int h ); 190 virtual void drawButtonMask( QPainter *p, int x, int y, int w, int h );
185 /** 191 /**
186 * Set the mask for combo boxes. 192 * Set the mask for combo boxes.
187 */ 193 */
188 virtual void drawComboButtonMask( QPainter *p, int x, int y, int w, int h ); 194 virtual void drawComboButtonMask( QPainter *p, int x, int y, int w, int h );
189 /** 195 /**
190 * Return the size of the indicator pixmap if one is specified 196 * Return the size of the indicator pixmap if one is specified
191 * in the config file, otherwise it uses the base style's size. 197 * in the config file, otherwise it uses the base style's size.
192 */ 198 */
193 virtual QSize indicatorSize() const; 199 virtual QSize indicatorSize() const;
194 /** 200 /**
195 * Draw an indicator widget. 201 * Draw an indicator widget.
196 * 202 *
197 * If a pixmap is specified in the 203 * If a pixmap is specified in the
198 * config file that is used, otherwise the base style's widget is drawn. 204 * config file that is used, otherwise the base style's widget is drawn.
199 */ 205 */
200 virtual void drawIndicator( QPainter* p, int x, int y, int w, int h, 206 virtual void drawIndicator( QPainter* p, int x, int y, int w, int h,
201 const QColorGroup &g, int state, 207 const QColorGroup &g, int state,
202 bool down = FALSE, bool enabled = TRUE ); 208 bool down = FALSE, bool enabled = TRUE );
203 /** 209 /**
204 * Draw a combobox. 210 * Draw a combobox.
205 */ 211 */
206 virtual void drawComboButton( QPainter *p, int x, int y, int w, int h, 212 virtual void drawComboButton( QPainter *p, int x, int y, int w, int h,
207 const QColorGroup &g, bool sunken = FALSE, 213 const QColorGroup &g, bool sunken = FALSE,
208 bool editable = FALSE, bool enabled = TRUE, 214 bool editable = FALSE, bool enabled = TRUE,
209 const QBrush *fill = 0 ); 215 const QBrush *fill = 0 );
210 /** 216 /**
211 * Draw a pushbutton. 217 * Draw a pushbutton.
212 */ 218 */
213 virtual void drawPushButton( QPushButton* btn, QPainter *p ); 219 virtual void drawPushButton( QPushButton* btn, QPainter *p );
214 /** 220 /**
215 * Return the amount of button content displacement specified by the 221 * Return the amount of button content displacement specified by the
216 * config file. 222 * config file.
217 */ 223 */
218 virtual void getButtonShift( int &x, int &y ); 224 virtual void getButtonShift( int &x, int &y );
219 /** 225 /**
220 * Return the frame width. 226 * Return the frame width.
221 */ 227 */
222 virtual int defaultFrameWidth() const; 228 virtual int defaultFrameWidth() const;
223 /** 229 /**
224 * Calculate the metrics of the scrollbar controls according to the 230 * Calculate the metrics of the scrollbar controls according to the
225 * layout specified by the config file. 231 * layout specified by the config file.
226 */ 232 */
227 virtual void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int& ); 233 virtual void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int& );
228 /** 234 /**
229 * Draw a themed scrollbar. 235 * Draw a themed scrollbar.
230 */ 236 */
231 virtual void drawScrollBarControls( QPainter*, const QScrollBar*, 237 virtual void drawScrollBarControls( QPainter*, const QScrollBar*,
232 int sliderStart, uint controls, 238 int sliderStart, uint controls,
233 uint activeControl ); 239 uint activeControl );
234 /** 240 /**
235 * Return the control that the given point is over according to the 241 * Return the control that the given point is over according to the
236 * layout in the config file. 242 * layout in the config file.
237 */ 243 */
238 virtual ScrollControl scrollBarPointOver( const QScrollBar*, 244 virtual ScrollControl scrollBarPointOver( const QScrollBar*,
239 int sliderStart, const QPoint& ); 245 int sliderStart, const QPoint& );
240 /** 246 /**
241 * Return the configurable default slider length. 247 * Return the configurable default slider length.
242 */ 248 */
243 virtual int sliderLength() const; 249 virtual int sliderLength() const;
244 /** 250 /**
245 * Draw a slider control. 251 * Draw a slider control.
246 */ 252 */
247 virtual void drawSlider( QPainter *p, int x, int y, int w, int h, 253 virtual void drawSlider( QPainter *p, int x, int y, int w, int h,
248 const QColorGroup &g, Orientation, bool tickAbove, 254 const QColorGroup &g, Orientation, bool tickAbove,
249 bool tickBelow ); 255 bool tickBelow );
250 /** 256 /**
251 * Draw a slider groove. 257 * Draw a slider groove.
252 */ 258 */
253 void drawSliderGroove( QPainter *p, int x, int y, int w, int h, 259 void drawSliderGroove( QPainter *p, int x, int y, int w, int h,
254 const QColorGroup& g, QCOORD c, 260 const QColorGroup& g, QCOORD c,
255 Orientation ); 261 Orientation );
256 /** 262 /**
257 * Draw the mask for a slider (both the control and groove. 263 * Draw the mask for a slider (both the control and groove.
258 */ 264 */
259 virtual void drawSliderMask( QPainter *p, int x, int y, int w, int h, 265 virtual void drawSliderMask( QPainter *p, int x, int y, int w, int h,
260 Orientation, bool tickAbove, bool tickBelow ); 266 Orientation, bool tickAbove, bool tickBelow );
261 // void drawSliderGrooveMask(QPainter *p,int x, int y, int w, int h, 267 // void drawSliderGrooveMask(QPainter *p,int x, int y, int w, int h,
262 // QCOORD c, Orientation ); 268 // QCOORD c, Orientation );
263 /** 269 /**
264 * Convience method for drawing themed scrollbar grooves. 270 * Convience method for drawing themed scrollbar grooves.
265 * 271 *
266 * Since the 272 * Since the
267 * grooves may be a scaled pixmap you cannot just bitblt the pixmap at 273 * grooves may be a scaled pixmap you cannot just bitblt the pixmap at
268 * any offset. This generates a cached pixmap at full size if needed and 274 * any offset. This generates a cached pixmap at full size if needed and
269 * then copies the requested area. 275 * then copies the requested area.
270 * 276 *
271 * @param p The painter to draw on. 277 * @param p The painter to draw on.
272 * @param sb The scrollbar (usually given by drawScrollBarControls). 278 * @param sb The scrollbar (usually given by drawScrollBarControls).
273 * @param horizontal Is the scrollBar horizontal? 279 * @param horizontal Is the scrollBar horizontal?
274 * @param r The rectangle to fill. 280 * @param r The rectangle to fill.
275 * @param g The color group to use. 281 * @param g The color group to use.
276 */ 282 */
277 virtual void drawScrollBarGroove( QPainter *p, const QScrollBar *sb, 283 virtual void drawScrollBarGroove( QPainter *p, const QScrollBar *sb,
278 bool horizontal, QRect r, QColorGroup g ); 284 bool horizontal, QRect r, QColorGroup g );
279 /** 285 /**
280 * Draw a shaded rectangle using the given style. 286 * Draw a shaded rectangle using the given style.
281 * 287 *
282 * @param p The painter to draw on. 288 * @param p The painter to draw on.
283 * @param g The color group to use. 289 * @param g The color group to use.
284 * @param rounded Draws a rounded shape if true. Requires bWidth to be 290 * @param rounded Draws a rounded shape if true. Requires bWidth to be
285 * at least 1. 291 * at least 1.
286 * @param hWidth The highlight width. 292 * @param hWidth The highlight width.
287 * @param bWidth The border width. 293 * @param bWidth The border width.
288 * @param style The shading style to use. 294 * @param style The shading style to use.
289 */ 295 */
290 virtual void drawShade( QPainter *p, int x, int y, int w, int h, 296 virtual void drawShade( QPainter *p, int x, int y, int w, int h,
291 const QColorGroup &g, bool sunken, bool rounded, 297 const QColorGroup &g, bool sunken, bool rounded,
292 int hWidth, int bWidth, ShadeStyle style ); 298 int hWidth, int bWidth, ShadeStyle style );
293 /** 299 /**
294 * Draw the text for a pushbutton. 300 * Draw the text for a pushbutton.
295 */ 301 */
296 virtual void drawPushButtonLabel( QPushButton *btn, QPainter *p ); 302 virtual void drawPushButtonLabel( QPushButton *btn, QPainter *p );
297 /** 303 /**
298 * Draw a menubar. 304 * Draw a menubar.
299 */ 305 */
300#if 0 306#if 0
301 307
302 void drawKMenuBar( QPainter *p, int x, int y, int w, int h, 308 void drawKMenuBar( QPainter *p, int x, int y, int w, int h,
303 const QColorGroup &g, bool macMode, 309 const QColorGroup &g, bool macMode,