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;
}
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: {
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);
} else if (checkable) {
if (mi->isChecked()) {
int xp = xpos;
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);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, sh), cg, sf);
}
}

@ -262,6 +262,8 @@ void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe,
{
bool down = flags & Style_Down;
bool on = flags & Style_On;
bool active = flags & Style_Active;
bool reverse = TQApplication::reverseLayout();
switch(pe)
{
@ -851,6 +853,42 @@ void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe,
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:
{
@ -1345,8 +1383,7 @@ void HighColorStyle::drawControl( TQ_ControlElement element,
// Do we have an icon and are checked at the same time?
// Then draw a "pressed" background behind the icon
if ( checkable && !active && mi->isChecked() )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(),
cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags);
// Draw the icon
TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode );
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)
else if ( checkable && mi->isChecked() ) {
int cx = reverse ? x+w - checkcol : 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, 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 );
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);
}
// 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
void HighContrastStyle::tqdrawPrimitive (TQ_PrimitiveElement pe,
void HighContrastStyle::drawPrimitive (TQ_PrimitiveElement pe,
TQPainter *p,
TQStyleControlElementData ceData,
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
// -------------------------------------------------------------------
case PE_ArrowUp:
@ -1043,7 +1078,7 @@ void HighContrastStyle::drawControl (TQ_ControlElement element,
// Then draw a square border around the icon
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() ) {
int cx = reverse ? x+w - checkcol : x;
TQRect rc (cx, y, checkcol, 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());
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(cx, y, checkcol, h), cg, flags);
}
// Time to draw the menu item label...

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

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

@ -732,6 +732,7 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleCon
bool enabled = ( flags & Style_Enabled );
bool down = ( flags & Style_Down );
bool on = flags & Style_On;
bool active = flags & Style_Active;
TQColorGroup g = g_base;
switch ( pe )
@ -1085,6 +1086,34 @@ void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, TQStyleCon
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:
handled = false;
}
@ -1525,7 +1554,7 @@ void KThemeStyle::drawControl( ControlElement element,
// Do we have an icon and are checked at the same time?
// Then draw a "pressed" background behind the icon
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
TQPixmap pixmap = mi->iconSet() ->pixmap( TQIconSet::Small, mode );
@ -1549,11 +1578,7 @@ void KThemeStyle::drawControl( ControlElement element,
// &cg_ours.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_ours, cflags );
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(cx, y, checkcol, h), cg, how);
}
// 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());
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:
if (pe == PE_HeaderArrow) {
if (flags & Style_Down)
@ -837,7 +849,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
if (mi->isChecked() &&
! (flags & Style_Active) &
(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()) {
TQIconSet::Mode mode =
@ -856,8 +868,7 @@ void LightStyleV2::drawControl( TQ_ControlElement control,
p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap);
} else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg,
(flags & Style_Enabled) | Style_On);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, cr, cg, flags);
TQColor textcolor;
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());
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:
if (pe == PE_HeaderArrow) {
if (flags & Style_Down)
@ -957,7 +969,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
if (mi->isChecked() &&
! (flags & Style_Active) &
(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()) {
TQIconSet::Mode mode =
@ -976,8 +988,7 @@ void LightStyleV3::drawControl( TQ_ControlElement control,
p->setPen(cg.text());
p->drawPixmap(pmr.topLeft(), pixmap);
} else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg,
(flags & Style_Enabled) | Style_On);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, cr, cg, flags);
TQColor textcolor;
TQColor embosscolor;

@ -2070,6 +2070,35 @@ void PlastikStyle::drawPrimitive(TQ_PrimitiveElement pe,
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_SpinWidgetDown:
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.
// 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 ) );
break;
@ -2507,16 +2536,16 @@ void PlastikStyle::drawControl(TQ_ControlElement element,
_contrast+3, Draw_Top|Draw_Bottom|Is_Horizontal);
}
else {
if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() )
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r );
if ( ceData.bgPixmap.isNull() )
p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
else p->fillRect( r, cg.background().light(105) );
if(_drawFocusRect)
p->drawWinFocusRect( r );
}
}
// Draw the transparency pixmap
else if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() )
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r );
else if ( !ceData.bgPixmap.isNull() )
p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
// Draw a solid background
else
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?
// Then draw a "pressed" background behind the icon
if ( checkable && /*!active &&*/ mi->isChecked() )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(),
cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
// Draw the icon
TQPixmap pixmap = mi->iconSet()->pixmap(TQIconSet::Small, mode);
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 -
// if it's active the "pressed" background is already drawn
// if ( ! active )
qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1,
&cg.brush(TQColorGroup::Midlight) );
drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
// Draw the checkmark
SFlags cflags = Style_On;
if (enabled)
cflags |= Style_Enabled;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(r.x(), r.y(), checkcol, r.height()), cg, flags);
}
// Time to draw the menu item label...
@ -3191,11 +3214,7 @@ TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control,
const TQStyleOption &opt,
const TQWidget *widget) const
{
if (!widget) {
return TQRect();
}
TQRect r(widget->rect());
TQRect r(ceData.rect);
switch (control) {
case CC_ComboBox: {
switch (subcontrol) {

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

Loading…
Cancel
Save