Update to new style API

pull/1/head
Timothy Pearson 12 years ago
parent 0530187e92
commit b80c68a29b

@ -1285,11 +1285,13 @@ void LipstikStyle::renderTab(TQPainter *p,
void LipstikStyle::drawKStylePrimitive(KStylePrimitive kpe, void LipstikStyle::drawKStylePrimitive(KStylePrimitive kpe,
TQPainter *p, TQPainter *p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt) const const TQStyleOption& opt,
const TQWidget* widget) const
{ {
// some "global" vars... // some "global" vars...
const bool enabled = (flags & Style_Enabled); const bool enabled = (flags & Style_Enabled);
@ -1557,9 +1559,9 @@ void LipstikStyle::drawKStylePrimitive(KStylePrimitive kpe,
p->drawLine( centerx, centery - radius, centerx, centery + radius ); p->drawLine( centerx, centery - radius, centerx, centery + radius );
} else if(_drawTriangularExpander) { } else if(_drawTriangularExpander) {
if( flags & Style_On ) if( flags & Style_On )
tqdrawPrimitive(PE_ArrowRight, p, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags);
if( flags & Style_Off ) if( flags & Style_Off )
tqdrawPrimitive(PE_ArrowDown, p, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags);
} }
break; break;
@ -1638,13 +1640,15 @@ void LipstikStyle::drawKStylePrimitive(KStylePrimitive kpe,
} }
default: default:
KStyle::drawKStylePrimitive(kpe, p, widget, r, cg, flags, opt); KStyle::drawKStylePrimitive(kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void LipstikStyle::tqdrawPrimitive(PrimitiveElement pe, void LipstikStyle::drawPrimitive(PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -1877,7 +1881,7 @@ void LipstikStyle::tqdrawPrimitive(PrimitiveElement pe,
surfaceFlags); surfaceFlags);
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, r, cg, flags); drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, r, cg, flags);
break; break;
} }
@ -1903,7 +1907,7 @@ void LipstikStyle::tqdrawPrimitive(PrimitiveElement pe,
surfaceFlags); surfaceFlags);
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, r, cg, flags); drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ceData, elementFlags, r, cg, flags);
break; break;
} }
@ -1932,7 +1936,7 @@ void LipstikStyle::tqdrawPrimitive(PrimitiveElement pe,
renderSurface(p, TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2), renderSurface(p, TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2),
cg.background(), contentColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags); cg.background(), contentColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags);
tqdrawPrimitive(PE_CheckMark, p, r, cg, flags); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, flags);
break; break;
} }
@ -2410,8 +2414,8 @@ void LipstikStyle::tqdrawPrimitive(PrimitiveElement pe,
const TQWMatrix oldMatrix( p->worldMatrix() ); const TQWMatrix oldMatrix( p->worldMatrix() );
if (flags & Style_Down) { if (flags & Style_Down) {
p->translate(pixelMetric(PM_ButtonShiftHorizontal), p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
pixelMetric(PM_ButtonShiftVertical)); pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
} }
a.translate((r.x()+r.width()/2), (r.y()+r.height()/2)); a.translate((r.x()+r.width()/2), (r.y()+r.height()/2));
@ -2446,7 +2450,7 @@ void LipstikStyle::tqdrawPrimitive(PrimitiveElement pe,
} }
default: { default: {
return KStyle::tqdrawPrimitive(pe, p, r, cg, flags, opt); return KStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
} }
} }
} }
@ -2454,11 +2458,13 @@ void LipstikStyle::tqdrawPrimitive(PrimitiveElement pe,
void LipstikStyle::drawControl(ControlElement element, void LipstikStyle::drawControl(ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt) const const TQStyleOption& opt,
const TQWidget *widget) const
{ {
const bool reverseLayout = TQApplication::reverseLayout(); const bool reverseLayout = TQApplication::reverseLayout();
@ -2650,7 +2656,7 @@ void LipstikStyle::drawControl(ControlElement element,
renderTab(p, r, cg, mouseOver, selected, true, pos, false, cornerWidget); renderTab(p, r, cg, mouseOver, selected, true, pos, false, cornerWidget);
break; break;
default: default:
KStyle::drawControl(element, p, widget, r, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
break; break;
@ -2670,12 +2676,12 @@ void LipstikStyle::drawControl(ControlElement element,
TQColorGroup g2 = cg; TQColorGroup g2 = cg;
if (isDefault) if (isDefault)
g2.setColor(TQColorGroup::Background, cg.background().dark(120) ); g2.setColor(TQColorGroup::Background, cg.background().dark(120) );
tqdrawPrimitive(PE_ButtonBevel, p, drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags,
isDefault?TQRect(r.x()+1,r.y()+1,r.width()-2,r.height()-2):r, isDefault?TQRect(r.x()+1,r.y()+1,r.width()-2,r.height()-2):r,
g2, flags, TQStyleOption(button) ); g2, flags, TQStyleOption(button) );
if (isDefault ) { if (isDefault ) {
tqdrawPrimitive(PE_ButtonDefault, p, r, cg, flags); drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags);
} }
break; break;
@ -2693,15 +2699,15 @@ void LipstikStyle::drawControl(ControlElement element,
// Shift button contents if pushed. // Shift button contents if pushed.
if ( active ) if ( active )
{ {
x += pixelMetric(PM_ButtonShiftHorizontal, widget); x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
y += pixelMetric(PM_ButtonShiftVertical, widget); y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
flags |= Style_Sunken; flags |= Style_Sunken;
} }
// Does the button have a popup menu? // Does the button have a popup menu?
if ( button->isMenuButton() ) if ( button->isMenuButton() )
{ {
int dx = pixelMetric( PM_MenuButtonIndicator, widget ); int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
if ( button->iconSet() && !button->iconSet()->isNull() && if ( button->iconSet() && !button->iconSet()->isNull() &&
(dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w ) (dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w )
{ {
@ -2710,7 +2716,7 @@ void LipstikStyle::drawControl(ControlElement element,
else else
{ {
p->setPen(cg.buttonText()); p->setPen(cg.buttonText());
tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ),
cg, flags, opt ); cg, flags, opt );
w -= dx; w -= dx;
} }
@ -2736,7 +2742,7 @@ void LipstikStyle::drawControl(ControlElement element,
p->drawPixmap( x + 4, y + h / 2 - pixmap.height() / 2, pixmap ); p->drawPixmap( x + 4, y + h / 2 - pixmap.height() / 2, pixmap );
if (cornArrow) //Draw over the icon if (cornArrow) //Draw over the icon
tqdrawPrimitive( PE_ArrowDown, p, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ), drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ),
cg, flags, opt ); cg, flags, opt );
@ -2752,8 +2758,8 @@ void LipstikStyle::drawControl(ControlElement element,
if ( flags & Style_HasFocus ) if ( flags & Style_HasFocus )
tqdrawPrimitive( PE_FocusRect, p, drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ),
cg, flags ); cg, flags );
break; break;
} }
@ -2803,9 +2809,9 @@ void LipstikStyle::drawControl(ControlElement element,
p->drawText(r, text_flags, mi->text()); p->drawText(r, text_flags, mi->text());
} else { } else {
if (down) { if (down) {
tqdrawPrimitive(PE_ButtonTool, p, r, cg, flags|Style_Down, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags|Style_Down, opt);
} else { } else {
tqdrawPrimitive(PE_ButtonTool, p, r, cg, flags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags, opt);
} }
p->setPen(cg.buttonText() ); p->setPen(cg.buttonText() );
p->drawText(r, text_flags, mi->text()); p->drawText(r, text_flags, mi->text());
@ -2837,7 +2843,7 @@ void LipstikStyle::drawControl(ControlElement element,
bool enabled = mi->isEnabled(); bool enabled = mi->isEnabled();
bool checkable = popupmenu->isCheckable(); bool checkable = popupmenu->isCheckable();
bool active = flags & Style_Active; bool active = flags & Style_Active;
bool etchtext = styleHint( SH_EtchDisabledText ); bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
bool reverse = TQApplication::reverseLayout(); bool reverse = TQApplication::reverseLayout();
if ( checkable ) if ( checkable )
@ -2973,7 +2979,7 @@ void LipstikStyle::drawControl(ControlElement element,
SFlags cflags = Style_On; SFlags cflags = Style_On;
if (enabled) if (enabled)
cflags |= Style_Enabled; cflags |= Style_Enabled;
tqdrawPrimitive( PE_CheckMark, p, cr, cg, cflags ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
} }
} }
@ -2990,7 +2996,7 @@ void LipstikStyle::drawControl(ControlElement element,
SFlags cflags = Style_On; SFlags cflags = Style_On;
if (enabled) if (enabled)
cflags |= Style_Enabled; cflags |= Style_Enabled;
tqdrawPrimitive( PE_CheckMark, p, cr, cg, cflags ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
} }
// Time to draw the menu item label... // Time to draw the menu item label...
@ -3099,7 +3105,7 @@ void LipstikStyle::drawControl(ControlElement element,
// Does the menu item have a submenu? // Does the menu item have a submenu?
if ( mi->popup() ) { if ( mi->popup() ) {
PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
int dim = pixelMetric(PM_MenuButtonIndicator) - 1; int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - 1;
TQRect vr = visualRect( TQRect( r.x() + r.width() - 5 - 1 - dim, TQRect vr = visualRect( TQRect( r.x() + r.width() - 5 - 1 - dim,
r.y() + r.height() / 2 - dim / 2, dim, dim), r ); r.y() + r.height() / 2 - dim / 2, dim, dim), r );
@ -3110,12 +3116,12 @@ void LipstikStyle::drawControl(ControlElement element,
p->setPen(cg.highlightedText()); p->setPen(cg.highlightedText());
else else
p->setPen(cg.buttonText()); p->setPen(cg.buttonText());
tqdrawPrimitive( arrow, p, vr, cg, Style_Enabled ); drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, Style_Enabled );
} }
else else
{ {
p->setPen(cg.buttonText()); p->setPen(cg.buttonText());
tqdrawPrimitive( arrow, p, vr, cg, enabled? Style_Enabled : Style_Default ); drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, enabled? Style_Enabled : Style_Default );
} }
} }
break; break;
@ -3146,15 +3152,17 @@ void LipstikStyle::drawControl(ControlElement element,
break; break;
default: default:
KStyle::drawControl(element, p, widget, r, cg, flags, opt); KStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
void LipstikStyle::drawControlMask(ControlElement element, void LipstikStyle::drawControlMask(ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &opt) const const TQStyleOption &opt,
const TQWidget *w) const
{ {
switch (element) { switch (element) {
case CE_PushButton: { case CE_PushButton: {
@ -3165,16 +3173,18 @@ void LipstikStyle::drawControlMask(ControlElement element,
} }
default: { default: {
KStyle::drawControlMask (element, p, w, r, opt); KStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w);
} }
} }
} }
void LipstikStyle::drawComplexControlMask(ComplexControl c, void LipstikStyle::drawComplexControlMask(ComplexControl c,
TQPainter *p, TQPainter *p,
const TQWidget *w, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &o) const const TQStyleOption &o,
const TQWidget *w) const
{ {
switch (c) { switch (c) {
case CC_SpinWidget: case CC_SpinWidget:
@ -3186,20 +3196,22 @@ void LipstikStyle::drawComplexControlMask(ComplexControl c,
break; break;
} }
default: { default: {
KStyle::drawComplexControlMask (c, p, w, r, o); KStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w);
} }
} }
} }
void LipstikStyle::drawComplexControl(ComplexControl control, void LipstikStyle::drawComplexControl(ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption& opt) const const TQStyleOption& opt,
const TQWidget *widget) const
{ {
const bool reverseLayout = TQApplication::reverseLayout(); const bool reverseLayout = TQApplication::reverseLayout();
@ -3231,7 +3243,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
if (_inputFocusHighlight && hasFocus && editable && enabled) if (_inputFocusHighlight && hasFocus && editable && enabled)
{ {
TQRect editField = querySubControlMetrics(control, widget, SC_ComboBoxEditField); TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget);
TQRect editFrame = r; TQRect editFrame = r;
TQRect buttonFrame = r; TQRect buttonFrame = r;
@ -3320,7 +3332,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
cg.background(), buttonColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), cg.background(), buttonColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2),
surfaceFlags); surfaceFlags);
if (hasFocus) { if (hasFocus) {
tqdrawPrimitive(PE_FocusRect, p, drawPrimitive(PE_FocusRect, p, ceData, elementFlags,
TQRect(RcontentSurface.x() + 2, TQRect(RcontentSurface.x() + 2,
RcontentSurface.y() + 2, RcontentSurface.y() + 2,
RcontentSurface.width() - 4, RcontentSurface.width() - 4,
@ -3363,7 +3375,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
} else { } else {
p->setPen(cg.foreground()); p->setPen(cg.foreground());
} }
tqdrawPrimitive(PE_SpinWidgetDown, p, RbuttonSurface, cg, Style_Default|Style_Enabled|Style_Raised); drawPrimitive(PE_SpinWidgetDown, p, ceData, elementFlags, RbuttonSurface, cg, Style_Default|Style_Enabled|Style_Raised);
// TQComboBox draws the text using cg.text(), we can override this // TQComboBox draws the text using cg.text(), we can override this
// from here // from here
@ -3378,15 +3390,15 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
const TQToolButton *tb = (const TQToolButton *) widget; const TQToolButton *tb = (const TQToolButton *) widget;
TQRect button, menuarea; TQRect button, menuarea;
button = querySubControlMetrics(control, widget, SC_ToolButton, opt); button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
SFlags bflags = flags, SFlags bflags = flags,
mflags = flags; mflags = flags;
if (kornMode) if (kornMode)
{ {
tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
break; break;
} }
else else
@ -3426,7 +3438,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
if ( widget == hoverWidget && tb->parentWidget()->inherits( "KTabWidget" )) { if ( widget == hoverWidget && tb->parentWidget()->inherits( "KTabWidget" )) {
renderButton(p, r, cg, false, true, false, true, false ); renderButton(p, r, cg, false, true, false, true, false );
} else { } else {
tqdrawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
} }
} else if (tb->parentWidget() && } else if (tb->parentWidget() &&
tb->parentWidget()->backgroundPixmap() && tb->parentWidget()->backgroundPixmap() &&
@ -3439,15 +3451,15 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
// Draw a toolbutton menu indicator if required // Draw a toolbutton menu indicator if required
if (controls & SC_ToolButtonMenu) { if (controls & SC_ToolButtonMenu) {
if (mflags & (Style_Down | Style_On | Style_Raised)) { if (mflags & (Style_Down | Style_On | Style_Raised)) {
tqdrawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
} }
tqdrawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
} }
if (tb->hasFocus() && !tb->focusProxy()) { if (tb->hasFocus() && !tb->focusProxy()) {
TQRect fr = tb->rect(); TQRect fr = tb->rect();
fr.addCoords(2, 2, -2, -2); fr.addCoords(2, 2, -2, -2);
tqdrawPrimitive(PE_FocusRect, p, fr, cg); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
} }
// Set the color for the ToolButton menu indicator // Set the color for the ToolButton menu indicator
@ -3477,7 +3489,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
const bool heightDividable = ((r.height()%2) == 0); const bool heightDividable = ((r.height()%2) == 0);
if (_inputFocusHighlight && hasFocus && enabled) if (_inputFocusHighlight && hasFocus && enabled)
{ {
TQRect editField = querySubControlMetrics(control, widget, SC_SpinWidgetEditField); TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetEditField, TQStyleOption::Default);
TQRect editFrame = r; TQRect editFrame = r;
TQRect buttonFrame = r; TQRect buttonFrame = r;
@ -3508,7 +3520,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
} }
else else
{ {
renderContour(p, querySubControlMetrics(control, widget, SC_SpinWidgetFrame), renderContour(p, querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetFrame, TQStyleOption::Default, widget),
cg.background(), getColor(cg, ButtonContour, enabled) ); cg.background(), getColor(cg, ButtonContour, enabled) );
} }
p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) ); p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) );
@ -3572,7 +3584,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
else else
pe = PE_SpinWidgetUp; pe = PE_SpinWidgetUp;
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive(pe, p, upRect, cg, sflags); drawPrimitive(pe, p, ceData, elementFlags, upRect, cg, sflags);
sflags = Style_Default | Style_Enabled; sflags = Style_Default | Style_Enabled;
if (active == SC_SpinWidgetDown) { if (active == SC_SpinWidgetDown) {
@ -3585,7 +3597,7 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
else else
pe = PE_SpinWidgetDown; pe = PE_SpinWidgetDown;
p->setPen(cg.foreground()); p->setPen(cg.foreground());
tqdrawPrimitive(pe, p, downRect, cg, sflags); drawPrimitive(pe, p, ceData, elementFlags, downRect, cg, sflags);
// thin frame around the input area // thin frame around the input area
const TQRect Rcontent = TQRect(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1, const TQRect Rcontent = TQRect(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1,
@ -3618,19 +3630,19 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
} }
default: default:
KStyle::drawComplexControl(control, p, widget, KStyle::drawComplexControl(control, p, ceData, elementFlags,
r, cg, flags, controls, r, cg, flags, controls,
active, opt); active, opt, widget);
break; break;
} }
} }
TQRect LipstikStyle::subRect(SubRect r, const TQWidget *widget) const TQRect LipstikStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch (r) { switch (r) {
case SR_ComboBoxFocusRect: { case SR_ComboBoxFocusRect: {
return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget );
} }
// Don't use KStyles progressbar subrect // Don't use KStyles progressbar subrect
@ -3645,15 +3657,17 @@ TQRect LipstikStyle::subRect(SubRect r, const TQWidget *widget) const
} }
default: { default: {
return KStyle::subRect(r, widget); return KStyle::subRect(r, ceData, elementFlags, widget);
} }
} }
} }
TQRect LipstikStyle::querySubControlMetrics(ComplexControl control, TQRect LipstikStyle::querySubControlMetrics(ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption &opt) const const TQStyleOption &opt,
const TQWidget *widget) const
{ {
if (!widget) { if (!widget) {
return TQRect(); return TQRect();
@ -3668,7 +3682,7 @@ TQRect LipstikStyle::querySubControlMetrics(ComplexControl control,
return TQRect(r.left()+2, r.top()+2, r.width()-4-15-1, r.height()-4); return TQRect(r.left()+2, r.top()+2, r.width()-4-15-1, r.height()-4);
} }
default: { default: {
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
} }
break; break;
@ -3712,18 +3726,18 @@ TQRect LipstikStyle::querySubControlMetrics(ComplexControl control,
return TQRect(buttonsLeft, r.top()+1, bs.width(), r.height()-2); return TQRect(buttonsLeft, r.top()+1, bs.width(), r.height()-2);
} }
default: { default: {
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
} }
break; break;
} }
default: { default: {
return KStyle::querySubControlMetrics(control, widget, subcontrol, opt); return KStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
} }
} }
int LipstikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const int LipstikStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
switch(m) { switch(m) {
// TABS // TABS
@ -3835,15 +3849,17 @@ int LipstikStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
} }
default: default:
return KStyle::pixelMetric(m, widget); return KStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
} }
TQSize LipstikStyle::tqsizeFromContents(ContentsType t, TQSize LipstikStyle::sizeFromContents(ContentsType t,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &s, const TQSize &s,
const TQStyleOption &opt) const const TQStyleOption &opt,
const TQWidget *widget) const
{ {
switch (t) { switch (t) {
case CT_PopupMenuItem: { case CT_PopupMenuItem: {
@ -3904,8 +3920,8 @@ TQSize LipstikStyle::tqsizeFromContents(ContentsType t,
{ {
const TQPushButton* btn = static_cast<const TQPushButton*>(widget); const TQPushButton* btn = static_cast<const TQPushButton*>(widget);
int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, widget); int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget);
int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, widget); int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget);
if ( btn->text().isEmpty() && s.width() < 32 ) return TQSize(w, h); if ( btn->text().isEmpty() && s.width() < 32 ) return TQSize(w, h);
return TQSize( w+25, h+5 ); return TQSize( w+25, h+5 );
@ -3916,27 +3932,29 @@ TQSize LipstikStyle::tqsizeFromContents(ContentsType t,
if(widget->parent() && ::tqqt_cast<TQToolBar*>(widget->parent()) ) if(widget->parent() && ::tqqt_cast<TQToolBar*>(widget->parent()) )
return TQSize( s.width()+2*4+_toolBarSpacing, s.height()+2*4 ); return TQSize( s.width()+2*4+_toolBarSpacing, s.height()+2*4 );
else else
return KStyle::tqsizeFromContents (t, widget, s, opt); return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
} }
default: default:
return KStyle::tqsizeFromContents (t, widget, s, opt); return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
} }
return KStyle::tqsizeFromContents (t, widget, s, opt); return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
} }
int LipstikStyle::styleHint( StyleHint stylehint, int LipstikStyle::styleHint( StyleHint stylehint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &option, const TQStyleOption &option,
TQStyleHintReturn* returnData ) const TQStyleHintReturn* returnData,
const TQWidget *widget ) const
{ {
switch (stylehint) { switch (stylehint) {
case SH_PopupMenu_SubMenuPopupDelay: case SH_PopupMenu_SubMenuPopupDelay:
return 96; // Motif-like delay... return 96; // Motif-like delay...
default: default:
return KStyle::styleHint(stylehint, widget, option, returnData); return KStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
} }
} }

@ -75,14 +75,18 @@ public:
void drawKStylePrimitive(KStylePrimitive kpe, void drawKStylePrimitive(KStylePrimitive kpe,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
void tqdrawPrimitive(PrimitiveElement pe, void drawPrimitive(PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -90,49 +94,59 @@ public:
void drawControl(ControlElement element, void drawControl(ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawControlMask( ControlElement, TQPainter *, const TQWidget *, const TQRect &, const TQStyleOption &) const; void drawControlMask( ControlElement, TQPainter *, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &, const TQStyleOption &, const TQWidget *) const;
void drawComplexControl(ComplexControl control, void drawComplexControl(ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
SCFlags controls = SC_All, SCFlags controls = SC_All,
SCFlags active = SC_None, SCFlags active = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int pixelMetric(PixelMetric m, int pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
TQRect subRect(SubRect r, TQRect subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags,
const TQWidget *widget ) const; const TQWidget *widget ) const;
TQRect querySubControlMetrics(ComplexControl control, TQRect querySubControlMetrics(ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption &opt = TQStyleOption::Default ) const; const TQStyleOption &opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControlMask(TQStyle::ComplexControl c, void drawComplexControlMask(TQStyle::ComplexControl c,
TQPainter *p, TQPainter *p,
const TQWidget *w, const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQStyleOption &o=TQStyleOption::Default) const; const TQStyleOption &o=TQStyleOption::Default,
const TQWidget *w = 0) const;
TQSize tqsizeFromContents(TQStyle::ContentsType t, TQSize sizeFromContents(TQStyle::ContentsType t,
const TQWidget *w, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &s, const TQSize &s,
const TQStyleOption &o) const; const TQStyleOption &o,
const TQWidget *w = 0) const;
int styleHint(StyleHint, const TQWidget * = 0, int styleHint(StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0 ) const; TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
protected: protected:
enum TabPosition enum TabPosition

Loading…
Cancel
Save