Style update

pull/16/head
Timothy Pearson 12 years ago
parent 40712e0646
commit d26d6ac236

@ -937,6 +937,34 @@ void AsteroidStyle::drawPrimitive(TQ_PrimitiveElement pe,
break; break;
} }
case PE_MenuItemIndicatorCheck: {
int x, y, w, h;
r.rect( &x, &y, &w, &h );
bool active = sf & Style_Active;
bool disabled = !(sf & Style_Enabled);
int xp = x;
SFlags cflags = Style_Default;
if (disabled) {
cflags |= Style_On;
} else {
cflags |= Style_Enabled;
}
p->setPen(active ? cg.highlightedText() : cg.buttonText());
TQRect rr = TQRect(xp, y, w, h);
if (backwards) {
rr = visualRect(rr, r);
}
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, rr, cg, cflags);
break;
}
default: { default: {
KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, sf, o); KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, sf, o);
} }
@ -1572,23 +1600,7 @@ void AsteroidStyle::drawControl(TQ_ControlElement ce,
p->drawPixmap(pmr.topLeft(), pixmap); p->drawPixmap(pmr.topLeft(), pixmap);
} else if (checkable) { } else if (checkable) {
if (mi->isChecked()) { if (mi->isChecked()) {
int xp = xpos; drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, sh), cg, sf);
SFlags cflags = Style_Default;
if (disabled) {
cflags |= Style_On;
} else {
cflags |= Style_Enabled;
}
p->setPen(active ? cg.highlightedText() : cg.buttonText());
TQRect rr = TQRect(xp, y, checkcol, sh);
if (backwards) {
rr = visualRect(rr, r);
}
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, rr, cg, cflags);
} }
} }

@ -260,8 +260,10 @@ void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt ) const
{ {
bool down = flags & Style_Down; bool down = flags & Style_Down;
bool on = flags & Style_On; bool on = flags & Style_On;
bool active = flags & Style_Active;
bool reverse = TQApplication::reverseLayout();
switch(pe) switch(pe)
{ {
@ -851,6 +853,42 @@ void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe,
break; break;
} }
case PE_MenuItemIndicatorFrame: {
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect(x, y, w, h), r );
int cx = reverse ? x+w - w : x;
// We only have to draw the background if the menu item is inactive -
// if it's active the "pressed" background is already drawn
if ( ! active )
qDrawShadePanel( p, cx, y, w, h, cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
}
break;
case PE_MenuItemIndicatorIconFrame: {
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect(x, y, w, h), r );
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
}
break;
case PE_MenuItemIndicatorCheck: {
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect(x, y, w, h), r );
int cx = reverse ? x+w - w : x;
// Draw the checkmark
SFlags cflags = Style_Default;
cflags |= active ? Style_Enabled : Style_On;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, w - itemFrame*2, h - itemFrame*2), cg, cflags );
}
break;
default: default:
{ {
@ -1345,8 +1383,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// Do we have an icon and are checked at the same time? // Do we have an icon and are checked at the same time?
// Then draw a "pressed" background behind the icon // Then draw a "pressed" background behind the icon
if ( checkable && !active && mi->isChecked() ) if ( checkable && !active && mi->isChecked() )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
// Draw the icon // Draw the icon
TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode );
TQRect pmr( 0, 0, pixmap.width(), pixmap.height() ); TQRect pmr( 0, 0, pixmap.width(), pixmap.height() );
@ -1356,20 +1393,8 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// Are we checked? (This time without an icon) // Are we checked? (This time without an icon)
else if ( checkable && mi->isChecked() ) { else if ( checkable && mi->isChecked() ) {
int cx = reverse ? x+w - checkcol : x; drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
// We only have to draw the background if the menu item is inactive -
// if it's active the "pressed" background is already drawn
if ( ! active )
qDrawShadePanel( p, cx, y, checkcol, h, cg, true, 1,
&cg.brush(TQColorGroup::Midlight) );
// Draw the checkmark
SFlags cflags = Style_Default;
cflags |= active ? Style_Enabled : Style_On;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame,
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags );
} }
// Time to draw the menu item label... // Time to draw the menu item label...

@ -337,7 +337,7 @@ void HighContrastStyle::drawArrow (TQPainter* p, TQRect r, TQ_PrimitiveElement a
} }
// This function draws primitive elements // This function draws primitive elements
void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe, void HighContrastStyle::drawPrimitive (TQ_PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData, TQStyleControlElementData ceData,
ControlElementFlags elementFlags, ControlElementFlags elementFlags,
@ -632,6 +632,41 @@ void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe,
} }
case PE_MenuItemIndicatorFrame:
{
// Draw nothing
break;
}
break;
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect(x, y, w, h), r );
drawRect (p, cr, 0, false);
break;
}
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect(x, y, w, h), r );
TQRect rc (x, y, w, h);
addOffset (&rc, 2*basicLineWidth);
TQPoint center = rc.center();
if (rc.width() > rc.height())
rc.setWidth (rc.height());
else
rc.setHeight (rc.width());
rc.moveCenter (center);
p->drawLine (rc.topLeft(), rc.bottomRight());
p->drawLine (rc.topRight(), rc.bottomLeft());
break;
}
// ARROWS // ARROWS
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case PE_ArrowUp: case PE_ArrowUp:
@ -1043,7 +1078,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
// Then draw a square border around the icon // Then draw a square border around the icon
if ( checkable && mi->isChecked() ) if ( checkable && mi->isChecked() )
{ {
drawRect (p, cr, 0, false); drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
} }
} }
@ -1051,17 +1086,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
else if ( checkable && mi->isChecked() ) { else if ( checkable && mi->isChecked() ) {
int cx = reverse ? x+w - checkcol : x; int cx = reverse ? x+w - checkcol : x;
TQRect rc (cx, y, checkcol, h); drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(cx, y, checkcol, h), cg, flags);
addOffset (&rc, 2*basicLineWidth);
TQPoint center = rc.center();
if (rc.width() > rc.height())
rc.setWidth (rc.height());
else
rc.setHeight (rc.width());
rc.moveCenter (center);
p->drawLine (rc.topLeft(), rc.bottomRight());
p->drawLine (rc.topRight(), rc.bottomLeft());
} }
// Time to draw the menu item label... // Time to draw the menu item label...

@ -69,7 +69,7 @@ class HighContrastStyle : public KStyle
const TQStyleOption& = TQStyleOption::Default, const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const; const TQWidget* widget = 0 ) const;
void tqdrawPrimitive( TQ_PrimitiveElement pe, void drawPrimitive( TQ_PrimitiveElement pe,
TQPainter* p, TQPainter* p,
TQStyleControlElementData ceData, TQStyleControlElementData ceData,
ControlElementFlags elementFlags, ControlElementFlags elementFlags,

@ -555,8 +555,9 @@ void KeramikStyle::drawPrimitive( TQ_PrimitiveElement pe,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt ) const
{ {
bool down = flags & Style_Down; bool down = flags & Style_Down;
bool on = flags & Style_On; bool on = flags & Style_On;
bool active = flags & Style_Active;
bool disabled = ( flags & Style_Enabled ) == 0; bool disabled = ( flags & Style_Enabled ) == 0;
int x, y, w, h; int x, y, w, h;
r.rect(&x, &y, &w, &h); r.rect(&x, &y, &w, &h);
@ -1129,6 +1130,41 @@ void KeramikStyle::drawPrimitive( TQ_PrimitiveElement pe,
break; break;
} }
case PE_PanelScrollBar:
{
Keramik::ScrollBarPainter( KeramikGroove1, 2, (ceData.orientation == TQt::Horizontal)?true:false ).draw( p, r, cg.button(), cg.background(), (( flags & Style_Enabled ) == 0)?true:false );
break;
}
case PE_MenuItemIndicatorFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
}
break;
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
}
break;
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );
SFlags cflags = Style_Default;
cflags |= active ? Style_Enabled : Style_On;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
}
break;
default: default:
{ {
// ARROWS // ARROWS
@ -1204,12 +1240,11 @@ void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe,
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case KPE_SliderGroove: case KPE_SliderGroove:
{ {
const TQSlider* slider = static_cast< const TQSlider* >( widget ); bool horizontal = ceData.orientation == TQt::Horizontal;
bool horizontal = slider->orientation() == Qt::Horizontal;
Keramik::TilePainter::PaintMode pmod = Keramik::TilePainter::PaintNormal; Keramik::TilePainter::PaintMode pmod = Keramik::TilePainter::PaintNormal;
if (slider->erasePixmap() && !slider->erasePixmap()->isNull()) if (!ceData.bgPixmap.isNull())
pmod = Keramik::TilePainter::PaintFullBlend; pmod = Keramik::TilePainter::PaintFullBlend;
if ( horizontal ) if ( horizontal )
@ -1224,8 +1259,7 @@ void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe,
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case KPE_SliderHandle: case KPE_SliderHandle:
{ {
const TQSlider* slider = static_cast< const TQSlider* >( widget ); bool horizontal = ceData.orientation == TQt::Horizontal;
bool horizontal = slider->orientation() == Qt::Horizontal;
TQColor hl = cg.highlight(); TQColor hl = cg.highlight();
if (!disabled && flags & Style_Active) if (!disabled && flags & Style_Active)
@ -1673,8 +1707,7 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
// Do we have an icon and are checked at the same time? // Do we have an icon and are checked at the same time?
// Then draw a "pressed" background behind the icon // Then draw a "pressed" background behind the icon
if ( checkable && /*!active &&*/ mi->isChecked() ) if ( checkable && /*!active &&*/ mi->isChecked() )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
// Draw the icon // Draw the icon
TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode ); TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode );
TQRect pmr( 0, 0, pixmap.width(), pixmap.height() ); TQRect pmr( 0, 0, pixmap.width(), pixmap.height() );
@ -1688,14 +1721,9 @@ void KeramikStyle::drawControl( TQ_ControlElement element,
// We only have to draw the background if the menu item is inactive - // We only have to draw the background if the menu item is inactive -
// if it's active the "pressed" background is already drawn // if it's active the "pressed" background is already drawn
// if ( ! active ) // if ( ! active )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
&cg.brush(TQColorGroup::Midlight) );
// Draw the checkmark // Draw the checkmark
SFlags cflags = Style_Default; drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
cflags |= active ? Style_Enabled : Style_On;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
} }
// Time to draw the menu item label... // Time to draw the menu item label...
@ -2620,27 +2648,26 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control,
case CC_ScrollBar: case CC_ScrollBar:
{ {
const TQScrollBar* sb = static_cast< const TQScrollBar* >( widget ); bool horizontal = ceData.orientation == TQt::Horizontal;
bool horizontal = sb->orientation() == Qt::Horizontal;
int addline, subline, sliderpos, sliderlen, maxlen, slidermin; int addline, subline, sliderpos, sliderlen, maxlen, slidermin;
if ( horizontal ) if ( horizontal )
{ {
subline = loader.size( keramik_scrollbar_hbar_arrow1 ).width(); subline = loader.size( keramik_scrollbar_hbar_arrow1 ).width();
addline = loader.size( keramik_scrollbar_hbar_arrow2 ).width(); addline = loader.size( keramik_scrollbar_hbar_arrow2 ).width();
maxlen = sb->width() - subline - addline + 2; maxlen = ceData.rect.width() - subline - addline + 2;
} }
else else
{ {
subline = loader.size( keramik_scrollbar_vbar_arrow1 ).height(); subline = loader.size( keramik_scrollbar_vbar_arrow1 ).height();
addline = loader.size( keramik_scrollbar_vbar_arrow2 ).height(); addline = loader.size( keramik_scrollbar_vbar_arrow2 ).height();
maxlen = sb->height() - subline - addline + 2; maxlen = ceData.rect.height() - subline - addline + 2;
} }
sliderpos = sb->sliderStart(); sliderpos = ceData.startStep;
if ( sb->minValue() != sb->maxValue() ) if ( ceData.minSteps != ceData.maxSteps )
{ {
int range = sb->maxValue() - sb->minValue(); int range = ceData.maxSteps - ceData.minSteps;
sliderlen = ( sb->pageStep() * maxlen ) / ( range + sb->pageStep() ); sliderlen = ( ceData.pageStep * maxlen ) / ( range + ceData.pageStep );
slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, sb ); slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
if ( sliderlen < slidermin ) sliderlen = slidermin; if ( sliderlen < slidermin ) sliderlen = slidermin;
if ( sliderlen > maxlen ) sliderlen = maxlen; if ( sliderlen > maxlen ) sliderlen = maxlen;
} }
@ -2649,28 +2676,28 @@ TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control,
switch ( subcontrol ) switch ( subcontrol )
{ {
case SC_ScrollBarGroove: case SC_ScrollBarGroove:
if ( horizontal ) return TQRect( subline, 0, maxlen, sb->height() ); if ( horizontal ) return TQRect( subline, 0, maxlen, ceData.rect.height() );
else return TQRect( 0, subline, sb->width(), maxlen ); else return TQRect( 0, subline, ceData.rect.width(), maxlen );
case SC_ScrollBarSlider: case SC_ScrollBarSlider:
if (horizontal) return TQRect( sliderpos, 0, sliderlen, sb->height() ); if (horizontal) return TQRect( sliderpos, 0, sliderlen, ceData.rect.height() );
else return TQRect( 0, sliderpos, sb->width(), sliderlen ); else return TQRect( 0, sliderpos, ceData.rect.width(), sliderlen );
case SC_ScrollBarSubLine: case SC_ScrollBarSubLine:
if ( horizontal ) return TQRect( 0, 0, subline, sb->height() ); if ( horizontal ) return TQRect( 0, 0, subline, ceData.rect.height() );
else return TQRect( 0, 0, sb->width(), subline ); else return TQRect( 0, 0, ceData.rect.width(), subline );
case SC_ScrollBarAddLine: case SC_ScrollBarAddLine:
if ( horizontal ) return TQRect( sb->width() - addline, 0, addline, sb->height() ); if ( horizontal ) return TQRect( ceData.rect.width() - addline, 0, addline, ceData.rect.height() );
else return TQRect( 0, sb->height() - addline, sb->width(), addline ); else return TQRect( 0, ceData.rect.height() - addline, ceData.rect.width(), addline );
case SC_ScrollBarSubPage: case SC_ScrollBarSubPage:
if ( horizontal ) return TQRect( subline, 0, sliderpos - subline, sb->height() ); if ( horizontal ) return TQRect( subline, 0, sliderpos - subline, ceData.rect.height() );
else return TQRect( 0, subline, sb->width(), sliderpos - subline ); else return TQRect( 0, subline, ceData.rect.width(), sliderpos - subline );
case SC_ScrollBarAddPage: case SC_ScrollBarAddPage:
if ( horizontal ) return TQRect( sliderpos + sliderlen, 0, sb->width() - addline - (sliderpos + sliderlen) , sb->height() ); if ( horizontal ) return TQRect( sliderpos + sliderlen, 0, ceData.rect.width() - addline - (sliderpos + sliderlen) , ceData.rect.height() );
else return TQRect( 0, sliderpos + sliderlen, sb->width(), sb->height() - addline - (sliderpos + sliderlen) else return TQRect( 0, sliderpos + sliderlen, ceData.rect.width(), ceData.rect.height() - addline - (sliderpos + sliderlen)
/*maxlen - sliderpos - sliderlen + subline - 5*/ ); /*maxlen - sliderpos - sliderlen + subline - 5*/ );
default: break; default: break;

@ -732,6 +732,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleCon
bool enabled = ( flags & Style_Enabled ); bool enabled = ( flags & Style_Enabled );
bool down = ( flags & Style_Down ); bool down = ( flags & Style_Down );
bool on = flags & Style_On; bool on = flags & Style_On;
bool active = flags & Style_Active;
TQColorGroup g = g_base; TQColorGroup g = g_base;
switch ( pe ) switch ( pe )
@ -1085,6 +1086,34 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleCon
break; break;
} }
case PE_MenuItemIndicatorFrame:
{
// Draw nothing
break;
}
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x, y, w, h ), r );
const TQColorGroup& cg_ours = *colorGroup( g_base, active ? MenuItemDown : MenuItem );
drawBaseButton( p, cr.x(), cr.y(), cr.width(), cr.height(), *colorGroup( cg_ours, BevelDown ), true, false, BevelDown );
break;
}
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x, y, w, h ), r );
const TQColorGroup& cg_ours = *colorGroup( g_base, active ? MenuItemDown : MenuItem );
SFlags cflags = Style_Default;
cflags |= active ? Style_Enabled : Style_On;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( x + itemFrame, y + itemFrame, w - itemFrame * 2, h - itemFrame * 2 ), cg_ours, cflags );
break;
}
default: default:
handled = false; handled = false;
} }
@ -1525,7 +1554,7 @@ void KThemeStyle::drawControl( ControlElement element,
// Do we have an icon and are checked at the same time? // Do we have an icon and are checked at the same time?
// Then draw a "pressed" background behind the icon // Then draw a "pressed" background behind the icon
if ( checkable && mi->isChecked() ) //!active && -- ?? if ( checkable && mi->isChecked() ) //!active && -- ??
drawBaseButton( p, cr.x(), cr.y(), cr.width(), cr.height(), *colorGroup( cg_ours, BevelDown ), true, false, BevelDown ); drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, how);
// Draw the icon // Draw the icon
TQPixmap pixmap = mi->iconSet() ->pixmap( TQIconSet::Small, mode ); TQPixmap pixmap = mi->iconSet() ->pixmap( TQIconSet::Small, mode );
@ -1549,11 +1578,7 @@ void KThemeStyle::drawControl( ControlElement element,
// &cg_ours.brush(TQColorGroup::Midlight) ); // &cg_ours.brush(TQColorGroup::Midlight) );
// Draw the checkmark // Draw the checkmark
SFlags cflags = Style_Default; drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(cx, y, checkcol, h), cg, how);
cflags |= active ? Style_Enabled : Style_On;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame,
checkcol - itemFrame * 2, h - itemFrame * 2 ), cg_ours, cflags );
} }
// Time to draw the menu item label... // Time to draw the menu item label...

@ -559,6 +559,18 @@ void LightStyleV2::drawPrimitive( TQ_PrimitiveElement pe,
p->fillRect(r.x(), r.y() + 2, r.width(), r.height() - 4, cg.highlight()); p->fillRect(r.x(), r.y() + 2, r.width(), r.height() - 4, cg.highlight());
break; break;
case PE_MenuItemIndicatorFrame:
case PE_MenuItemIndicatorIconFrame:
{
qDrawShadePanel(p, r, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
}
break;
case PE_MenuItemIndicatorCheck:
{
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | Style_On);
}
break;
default: default:
if (pe == PE_HeaderArrow) { if (pe == PE_HeaderArrow) {
if (flags & Style_Down) if (flags & Style_Down)
@ -837,7 +849,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
if (mi->isChecked() && if (mi->isChecked() &&
! (flags & Style_Active) & ! (flags & Style_Active) &
(flags & Style_Enabled)) (flags & Style_Enabled))
qDrawShadePanel(p, cr, cg, true, 1, &cg.brush(TQColorGroup::Midlight)); drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, cr, cg, flags);
if (mi->iconSet()) { if (mi->iconSet()) {
TQIconSet::Mode mode = TQIconSet::Mode mode =
@ -856,8 +868,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
p->setPen(cg.text()); p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap); p->drawPixmap(pmr.topLeft(), pixmap);
} else if ((elementFlags & CEF_IsCheckable) && mi->isChecked()) } else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, cr, cg, flags);
(flags & Style_Enabled) | Style_On);
TQColor textcolor; TQColor textcolor;
TQColor embosscolor; TQColor embosscolor;

@ -748,6 +748,18 @@ void LightStyleV3::drawPrimitive( TQ_PrimitiveElement pe,
p->fillRect(r.x(), r.y() + 2, r.width(), r.height() - 4, cg.highlight()); p->fillRect(r.x(), r.y() + 2, r.width(), r.height() - 4, cg.highlight());
break; break;
case PE_MenuItemIndicatorFrame:
case PE_MenuItemIndicatorIconFrame:
{
qDrawShadePanel(p, r, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
}
break;
case PE_MenuItemIndicatorCheck:
{
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) | Style_On);
}
break;
default: default:
if (pe == PE_HeaderArrow) { if (pe == PE_HeaderArrow) {
if (flags & Style_Down) if (flags & Style_Down)
@ -957,7 +969,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
if (mi->isChecked() && if (mi->isChecked() &&
! (flags & Style_Active) & ! (flags & Style_Active) &
(flags & Style_Enabled)) (flags & Style_Enabled))
qDrawShadePanel(p, cr, cg, true, 1, &cg.brush(TQColorGroup::Midlight)); drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, cr, cg, flags);
if (mi->iconSet()) { if (mi->iconSet()) {
TQIconSet::Mode mode = TQIconSet::Mode mode =
@ -976,8 +988,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
p->setPen(cg.text()); p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap); p->drawPixmap(pmr.topLeft(), pixmap);
} else if ((elementFlags & CEF_IsCheckable) && mi->isChecked()) } else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, cr, cg, flags);
(flags & Style_Enabled) | Style_On);
TQColor textcolor; TQColor textcolor;
TQColor embosscolor; TQColor embosscolor;

@ -2070,6 +2070,35 @@ void PlastikStyle::drawPrimitive(TQ_PrimitiveElement pe,
break; break;
} }
case PE_MenuItemIndicatorFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
break;
}
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
break;
}
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
TQRect cr = visualRect( TQRect( x + 2, y + 2, w - 1, h - 4 ), r );;
// Draw the checkmark
SFlags cflags = Style_On;
if (enabled)
cflags |= Style_Enabled;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
break;
}
case PE_SpinWidgetUp: case PE_SpinWidgetUp:
case PE_SpinWidgetDown: case PE_SpinWidgetDown:
case PE_HeaderArrow: case PE_HeaderArrow:
@ -2485,7 +2514,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
{ {
// Don't leave blank holes if we set NoBackground for the TQPopupMenu. // Don't leave blank holes if we set NoBackground for the TQPopupMenu.
// This only happens when the popupMenu spans more than one column. // This only happens when the popupMenu spans more than one column.
if (! ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) ) if ( ceData.bgPixmap.isNull() )
p->fillRect( r, cg.background().light( 105 ) ); p->fillRect( r, cg.background().light( 105 ) );
break; break;
@ -2507,16 +2536,16 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
_contrast+3, Draw_Top|Draw_Bottom|Is_Horizontal); _contrast+3, Draw_Top|Draw_Bottom|Is_Horizontal);
} }
else { else {
if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) if ( ceData.bgPixmap.isNull() )
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r ); p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
else p->fillRect( r, cg.background().light(105) ); else p->fillRect( r, cg.background().light(105) );
if(_drawFocusRect) if(_drawFocusRect)
p->drawWinFocusRect( r ); p->drawWinFocusRect( r );
} }
} }
// Draw the transparency pixmap // Draw the transparency pixmap
else if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) else if ( !ceData.bgPixmap.isNull() )
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r ); p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
// Draw a solid background // Draw a solid background
else else
p->fillRect( r, cg.background().light( 105 ) ); p->fillRect( r, cg.background().light( 105 ) );
@ -2545,8 +2574,7 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
// Do we have an icon and are checked at the same time? // Do we have an icon and are checked at the same time?
// Then draw a "pressed" background behind the icon // Then draw a "pressed" background behind the icon
if ( checkable && /*!active &&*/ mi->isChecked() ) if ( checkable && /*!active &&*/ mi->isChecked() )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
// Draw the icon // Draw the icon
TQPixmap pixmap = mi->iconSet()->pixmap(TQIconSet::Small, mode); TQPixmap pixmap = mi->iconSet()->pixmap(TQIconSet::Small, mode);
TQRect pmr( 0, 0, pixmap.width(), pixmap.height() ); TQRect pmr( 0, 0, pixmap.width(), pixmap.height() );
@ -2560,14 +2588,9 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
// We only have to draw the background if the menu item is inactive - // We only have to draw the background if the menu item is inactive -
// if it's active the "pressed" background is already drawn // if it's active the "pressed" background is already drawn
// if ( ! active ) // if ( ! active )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
&cg.brush(TQColorGroup::Midlight) );
// Draw the checkmark drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
SFlags cflags = Style_On;
if (enabled)
cflags |= Style_Enabled;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
} }
// Time to draw the menu item label... // Time to draw the menu item label...
@ -3191,11 +3214,7 @@ TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control,
const TQStyleOption &opt, const TQStyleOption &opt,
const TQWidget *widget) const const TQWidget *widget) const
{ {
if (!widget) { TQRect r(ceData.rect);
return TQRect();
}
TQRect r(widget->rect());
switch (control) { switch (control) {
case CC_ComboBox: { case CC_ComboBox: {
switch (subcontrol) { switch (subcontrol) {

@ -1155,9 +1155,8 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
// Many thanks to Brad Hughes for contributing this code. // Many thanks to Brad Hughes for contributing this code.
bool useThreeButtonScrollBar = (d->scrollbarType & ThreeButtonScrollBar); bool useThreeButtonScrollBar = (d->scrollbarType & ThreeButtonScrollBar);
const TQScrollBar *sb = (const TQScrollBar*)widget; bool maxedOut = (ceData.minSteps == ceData.maxSteps);
bool maxedOut = (sb->minValue() == sb->maxValue()); bool horizontal = (ceData.orientation == TQt::Horizontal);
bool horizontal = (sb->orientation() == Qt::Horizontal);
SFlags sflags = ((horizontal ? Style_Horizontal : Style_Default) | SFlags sflags = ((horizontal ? Style_Horizontal : Style_Default) |
(maxedOut ? Style_Default : Style_Enabled)); (maxedOut ? Style_Default : Style_Enabled));
@ -1222,7 +1221,7 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
sflags | ((active == SC_ScrollBarSlider) ? sflags | ((active == SC_ScrollBarSlider) ?
Style_Down : Style_Default)); Style_Down : Style_Default));
// Draw focus rect // Draw focus rect
if (sb->hasFocus()) { if (elementFlags & CEF_HasFocus) {
TQRect fr(slider.x() + 2, slider.y() + 2, TQRect fr(slider.x() + 2, slider.y() + 2,
slider.width() - 5, slider.height() - 5); slider.width() - 5, slider.height() - 5);
tqdrawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); tqdrawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
@ -1235,7 +1234,6 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
// SLIDER // SLIDER
// ------------------------------------------------------------------- // -------------------------------------------------------------------
case CC_Slider: { case CC_Slider: {
const TQSlider* slider = (const TQSlider*)widget;
TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, opt, widget); TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, opt, widget);
TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, opt, widget); TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, opt, widget);
@ -1244,11 +1242,10 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
TQPainter p2; TQPainter p2;
p2.begin(&pix); p2.begin(&pix);
if ( slider->parentWidget() && if ( (elementFlags & CEF_HasParentWidget) &&
slider->parentWidget()->backgroundPixmap() && !ceData.parentWidgetData.bgPixmap.isNull() ) {
!slider->parentWidget()->backgroundPixmap()->isNull() ) { TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
TQPixmap pixmap = *(slider->parentWidget()->backgroundPixmap()); p2.drawTiledPixmap(r, pixmap, ceData.pos);
p2.drawTiledPixmap(r, pixmap, slider->pos());
} else } else
pix.fill(cg.background()); pix.fill(cg.background());
@ -1257,8 +1254,9 @@ void KStyle::drawComplexControl( TQ_ComplexControl control,
drawKStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget ); drawKStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget );
// Draw the focus rect around the groove // Draw the focus rect around the groove
if (slider->hasFocus()) if (elementFlags & CEF_HasFocus) {
tqdrawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg); tqdrawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg);
}
} }
// Draw the tickmarks // Draw the tickmarks
@ -1476,19 +1474,18 @@ TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
bool platinumScrollBar = d->scrollbarType & PlatinumStyleScrollBar; bool platinumScrollBar = d->scrollbarType & PlatinumStyleScrollBar;
bool nextScrollBar = d->scrollbarType & NextStyleScrollBar; bool nextScrollBar = d->scrollbarType & NextStyleScrollBar;
const TQScrollBar *sb = (const TQScrollBar*)widget; bool horizontal = ceData.orientation == Qt::Horizontal;
bool horizontal = sb->orientation() == Qt::Horizontal; int sliderstart = ceData.startStep;
int sliderstart = sb->sliderStart();
int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
int maxlen = (horizontal ? sb->width() : sb->height()) int maxlen = (horizontal ? ceData.rect.width() : ceData.rect.height())
- (sbextent * (threeButtonScrollBar ? 3 : 2)); - (sbextent * (threeButtonScrollBar ? 3 : 2));
int sliderlen; int sliderlen;
// calculate slider length // calculate slider length
if (sb->maxValue() != sb->minValue()) if (ceData.maxSteps != ceData.minSteps)
{ {
uint range = sb->maxValue() - sb->minValue(); uint range = ceData.maxSteps - ceData.minSteps;
sliderlen = (sb->pageStep() * maxlen) / (range + sb->pageStep()); sliderlen = (ceData.pageStep * maxlen) / (range + ceData.pageStep);
int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
if ( sliderlen < slidermin || range > INT_MAX / 2 ) if ( sliderlen < slidermin || range > INT_MAX / 2 )
@ -1505,9 +1502,9 @@ TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
// top/left button // top/left button
if (platinumScrollBar) { if (platinumScrollBar) {
if (horizontal) if (horizontal)
ret.setRect(sb->width() - 2 * sbextent, 0, sbextent, sbextent); ret.setRect(ceData.rect.width() - 2 * sbextent, 0, sbextent, sbextent);
else else
ret.setRect(0, sb->height() - 2 * sbextent, sbextent, sbextent); ret.setRect(0, ceData.rect.height() - 2 * sbextent, sbextent, sbextent);
} else } else
ret.setRect(0, 0, sbextent, sbextent); ret.setRect(0, 0, sbextent, sbextent);
break; break;
@ -1522,9 +1519,9 @@ TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
ret.setRect(0, sbextent, sbextent, sbextent); ret.setRect(0, sbextent, sbextent, sbextent);
} else { } else {
if (horizontal) if (horizontal)
ret.setRect(sb->width() - sbextent, 0, sbextent, sbextent); ret.setRect(ceData.rect.width() - sbextent, 0, sbextent, sbextent);
else else
ret.setRect(0, sb->height() - sbextent, sbextent, sbextent); ret.setRect(0, ceData.rect.height() - sbextent, sbextent, sbextent);
} }
break; break;
} }
@ -1582,9 +1579,9 @@ TQRect KStyle::querySubControlMetrics( TQ_ComplexControl control,
fudge = sbextent; fudge = sbextent;
if (horizontal) if (horizontal)
ret.setRect(fudge, 0, sb->width() - sbextent * multi, sb->height()); ret.setRect(fudge, 0, ceData.rect.width() - sbextent * multi, ceData.rect.height());
else else
ret.setRect(0, fudge, sb->width(), sb->height() - sbextent * multi); ret.setRect(0, fudge, ceData.rect.width(), ceData.rect.height() - sbextent * multi);
break; break;
} }

Loading…
Cancel
Save