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.
// 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;
@ -2908,10 +2908,10 @@ void LipstikStyle::drawControl(ControlElement element,
}
} else {
// Draw inactive menu item
if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) {
if ( !ceData.bgPixmap.isNull() ) {
// Draw the transparency pixmap
// Transparency in KDE3/TQt3 is an EVIL hack! Beware!
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r );
p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
} else {
// Draw a solid background
p->fillRect( r, cg.background().light( 105 ) );
@ -2936,10 +2936,10 @@ void LipstikStyle::drawControl(ControlElement element,
p->drawWinFocusRect( r );
}
}
} else if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) {
} else if ( !ceData.bgPixmap.isNull() ) {
// Draw the transparency pixmap
// Transparency in KDE3/TQt3 is an EVIL hack! Beware!
p->drawPixmap( r.topLeft(), *widget->erasePixmap(), r );
p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
} else {
// Draw a solid background
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!)
if (_drawToolBarGradient) {
const TQToolBar *tbar=widget->parentWidget() ? ::tqqt_cast<const TQToolBar *>(widget->parentWidget()) : NULL;
bool horizontal=false;
if ( tbar != NULL ) {
if ( Qt::Horizontal==tbar->orientation() ) {
if ( ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING) ) {
if ( TQt::Horizontal==ceData.toolBarData.orientation ) {
horizontal=true;
}
}
@ -3661,11 +3660,11 @@ TQRect LipstikStyle::subRect(SubRect r, const TQStyleControlElementData ceData,
// Don't use KStyles progressbar subrect
// TODO:
case SR_ProgressBarGroove: {
return TQRect(widget->rect());
return TQRect(ceData.rect);
}
case SR_ProgressBarContents:
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 );
}
@ -3682,11 +3681,7 @@ TQRect LipstikStyle::querySubControlMetrics(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) {
@ -3947,7 +3942,7 @@ TQSize LipstikStyle::sizeFromContents(ContentsType t,
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 );
else
return KStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
@ -4003,17 +3998,17 @@ bool LipstikStyle::objectEventHandler( TQStyleControlElementData ceData, Control
if ( ::tqqt_cast<TQSpinWidget*>(widget->parentWidget()) )
{
TQWidget* spinbox = widget->parentWidget();
if ((ev->type() == TQEvent::FocusIn) || (ev->type() == TQEvent::FocusOut))
{
spinbox->repaint(false);
}
return false;
TQWidget* spinbox = widget->parentWidget();
if ((ev->type() == TQEvent::FocusIn) || (ev->type() == TQEvent::FocusOut))
{
spinbox->repaint(false);
}
return false;
}
if ((ev->type() == TQEvent::FocusIn) || (ev->type() == TQEvent::FocusOut))
{
widget->repaint(false);
widget->repaint(false);
}
return false;
}
@ -4023,14 +4018,14 @@ bool LipstikStyle::objectEventHandler( TQStyleControlElementData ceData, Control
{
if ((ev->type() == TQEvent::Show) && !animationTimer->isActive())
{
animationTimer->start( 50, false );
animationTimer->start( 50, false );
}
}
if ( !qstrcmp(obj->name(), "kde toolbar widget") )
{
TQWidget* lb = TQT_TQWIDGET(obj);
if (lb->backgroundMode() == TQt::PaletteButton)
lb->setBackgroundMode(TQt::PaletteBackground);
lb->setBackgroundMode(TQt::PaletteBackground);
removeObjectEventHandler(ceData, elementFlags, source, this);
}
}

Loading…
Cancel
Save