355
352
#define DRAW_PIXMAP_AND_TEXT \
358
style().drawItem( p, x, 0, pixmap()->width(), height(), AlignCenter, colorGroup(), isEnabled(), pixmap(), QString::null );\
355
style().drawItem( p, QRect( x, 0, pixmap()->width(), height() ), AlignCenter, colorGroup(), isEnabled(), pixmap(), QString::null );\
359
356
if (d->m_iconMode==TK::IconAndText && !d->m_text.isEmpty()) {\
360
357
x += pixmap()->width() + 3;\
363
360
if ((d->m_iconMode==TK::IconAndText||d->m_iconMode==TK::TextOnly) && !d->m_text.isEmpty()) {\
364
QFontMetrics fm(ref_font);\
365
style().drawItem( p, x, 0, fm.width(d->m_text), height(), AlignCenter, colorGroup(), isEnabled(), 0, d->m_text );\
361
QFontMetrics fm(KGlobalSettings::toolBarFont());\
362
style().drawItem( p, QRect( x, 0, fm.width(d->m_text), height() ), AlignCenter, colorGroup(), isEnabled(), 0, d->m_text );\
368
365
const char* arrow[] = {
376
373
QPixmap arrow_pix(arrow);
378
KStyle::KToolButtonType iconType = d->m_iconMode != TK::IconOnly ? KStyle::IconTextRight : KStyle::Icon;
379
QFont ref_font(KGlobalSettings::toolBarFont());
380
374
bool f = d->m_isOn || isDown();
382
if (d->m_popup && !d->m_isToggle)
376
if (d->m_popup && !d->m_isToggle)
386
if (kapp->kstyle()) {
387
kapp->kstyle()->drawKToolBarButton(p, 0, 0, width()-12, height(),
388
isEnabled()? colorGroup() : palette().disabled(), f && !d->m_arrowPressed,
389
d->m_isRaised, isEnabled(), false, iconType, d->m_text,
390
pixmap(), &ref_font, this);
391
kapp->kstyle()->drawKToolBarButton(p, width()-13, 0, 13, height(),
392
isEnabled()? colorGroup() : palette().disabled(), f && d->m_arrowPressed,
393
d->m_isRaised, isEnabled(), false, KStyle::Icon, "",
394
&arrow_pix, &ref_font, this);
396
style().drawToolButton( p, 0, 0, width()-12, height(), isEnabled() ? colorGroup() : palette().disabled(), f && !d->m_arrowPressed );
380
QStyle::SFlags flags = QStyle::Style_Default;
381
if (isEnabled()) flags |= QStyle::Style_Enabled;
382
if (isOn()) flags |= QStyle::Style_On;
383
if (d->m_isRaised) flags |= QStyle::Style_Raised;
384
if (hasFocus()) flags |= QStyle::Style_HasFocus;
398
style().drawToolButton( p, width()-13, 0, 13, height(), isEnabled() ? colorGroup() : palette().disabled(), f && d->m_arrowPressed );
399
style().drawItem( p, width()-13, 0, 13, height(), AlignCenter, colorGroup(), isEnabled(), &arrow_pix, QString::null );
403
if (kapp->kstyle()) {
404
kapp->kstyle()->drawKToolBarButton(p, 0, 0, width(), height(),
405
isEnabled()? colorGroup() : palette().disabled(), f,
406
d->m_isRaised, isEnabled(), false, KStyle::IconTextRight, d->m_iconMode != TK::IconOnly ? d->m_text:QString(""),
407
pixmap(), &ref_font, this);
409
style().drawToolButton( p, 0, 0, width(), height(), isEnabled() ? colorGroup() : palette().disabled(), f );
413
p->drawPixmap(width()-11+z,(height()-4)/2+z ,arrow_pix);
416
if (kapp->kstyle()) {
417
kapp->kstyle()->drawKToolBarButton(p, 0, 0, width(), height(),
418
isEnabled()? colorGroup() : palette().disabled(), f,
419
d->m_isRaised, isEnabled(), d->m_popup, iconType, d->m_text,
420
pixmap(), &ref_font, this);
422
style().drawToolButton( p, 0, 0, width(), height(), isEnabled() ? colorGroup() : palette().disabled(), f );
386
style().drawComplexControl( QStyle::CC_ToolButton, p, this, QRect( 0, 0, width()-12, height() ), colorGroup(), flags, QStyle::SC_ToolButton );
387
style().drawComplexControl( QStyle::CC_ToolButton, p, this, QRect( width()-13, 0, 13, height() ), colorGroup(), flags, QStyle::SC_ToolButton );
388
style().drawItem( p, QRect( width()-13, 0, 13, height() ), AlignCenter, colorGroup(), isEnabled(), &arrow_pix, QString::null );
390
qDrawShadeLine( p, width()-12, 0, width()-12, height(), colorGroup(), true );
393
style().drawControl( QStyle::CE_PushButton, p, this, QRect( 0, 0, width(), height() ), isEnabled() ? colorGroup() : palette().disabled(), f );
396
p->drawPixmap(width()-11+z,(height()-4)/2+z ,arrow_pix);
399
style().drawControl( QStyle::CE_PushButton, p, this, QRect( 0, 0, width(), height() ), isEnabled() ? colorGroup() : palette().disabled(), f );
428
404
void TKToolBarButton::paletteChange(const QPalette &)
430
406
makeDisabledPixmap();
431
407
if ( !isEnabled() )
432
QButton::setPixmap( disabledPixmap );
408
QToolButton::setPixmap( disabledPixmap );
434
QButton::setPixmap( defaultPixmap );
410
QToolButton::setPixmap( defaultPixmap );