Use widget info structs instead of direct widget access where possible

pull/1/head
Timothy Pearson 12 years ago
parent 0be8c502f5
commit fad7c06d70

@ -2853,7 +2853,7 @@ void LipstikStyle::drawControl(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;
@ -2908,10 +2908,10 @@ void LipstikStyle::drawControl(ControlElement element,
} }
} else { } else {
// Draw inactive menu item // Draw inactive menu item
if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) { if ( !ceData.bgPixmap.isNull() ) {
// Draw the transparency pixmap // Draw the transparency pixmap
// Transparency in KDE3/TQt3 is an EVIL hack! Beware! // Transparency in KDE3/TQt3 is an EVIL hack! Beware!
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r ); p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
} else { } else {
// Draw a solid background // Draw a solid background
p->fillRect( r, cg.background().light( 105 ) ); p->fillRect( r, cg.background().light( 105 ) );
@ -2936,10 +2936,10 @@ void LipstikStyle::drawControl(ControlElement element,
p->drawWinFocusRect( r ); p->drawWinFocusRect( r );
} }
} }
} else if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) { } else if ( !ceData.bgPixmap.isNull() ) {
// Draw the transparency pixmap // Draw the transparency pixmap
// Transparency in KDE3/TQt3 is an EVIL hack! Beware! // Transparency in KDE3/TQt3 is an EVIL hack! Beware!
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r ); p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
} else { } else {
// Draw a solid background // Draw a solid background
p->fillRect( r, cg.background().light( 105 ) ); p->fillRect( r, cg.background().light( 105 ) );
@ -3418,10 +3418,9 @@ void LipstikStyle::drawComplexControl(ComplexControl control,
{ {
// Tricky... (I'm lucky TQtCurve has already gone there... thanks Craig!) // Tricky... (I'm lucky TQtCurve has already gone there... thanks Craig!)
if (_drawToolBarGradient) { if (_drawToolBarGradient) {
const TQToolBar *tbar=widget->parentWidget() ? ::tqqt_cast<const TQToolBar *>(widget->parentWidget()) : NULL;
bool horizontal=false; bool horizontal=false;
if ( tbar != NULL ) { if ( ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING) ) {
if ( Qt::Horizontal==tbar->orientation() ) { if ( TQt::Horizontal==ceData.toolBarData.orientation ) {
horizontal=true; horizontal=true;
} }
} }
@ -3661,11 +3660,11 @@ TQRect LipstikStyle::subRect(SubRect r, const TQStyleControlElementData ceData,
// Don't use KStyles progressbar subrect // Don't use KStyles progressbar subrect
// TODO: // TODO:
case SR_ProgressBarGroove: { case SR_ProgressBarGroove: {
return TQRect(widget->rect()); return TQRect(ceData.rect);
} }
case SR_ProgressBarContents: case SR_ProgressBarContents:
case SR_ProgressBarLabel: { case SR_ProgressBarLabel: {
TQRect rw = widget->rect(); TQRect rw = ceData.rect;
return TQRect(rw.left()+2, rw.top()+2, rw.width()-4, rw.height()-4 ); return TQRect(rw.left()+2, rw.top()+2, rw.width()-4, rw.height()-4 );
} }
@ -3682,11 +3681,7 @@ TQRect LipstikStyle::querySubControlMetrics(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) {
@ -3947,7 +3942,7 @@ TQSize LipstikStyle::sizeFromContents(ContentsType t,
case CT_ToolButton: case CT_ToolButton:
{ {
if(widget->parent() && ::tqqt_cast<TQToolBar*>(widget->parent()) ) if (ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING))
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::sizeFromContents (t, ceData, elementFlags, s, opt, widget); return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);

Loading…
Cancel
Save