diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-31 23:31:32 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-10-31 23:31:32 -0500 |
commit | fad7c06d70b0a62894e706c9a1a9859bceca8d61 (patch) | |
tree | 9292096dd6ae0bf6007e93b2e56779397f64322f | |
parent | 0be8c502f5b20a3d2dfd36f24b733faf6bc1fb38 (diff) | |
download | tde-style-lipstik-fad7c06d70b0a62894e706c9a1a9859bceca8d61.tar.gz tde-style-lipstik-fad7c06d70b0a62894e706c9a1a9859bceca8d61.zip |
Use widget info structs instead of direct widget access where possible
-rw-r--r-- | style/lipstik.cpp | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/style/lipstik.cpp b/style/lipstik.cpp index f10f93f..64ac986 100644 --- a/style/lipstik.cpp +++ b/style/lipstik.cpp @@ -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); } } |