diff options
author | Mavridis Philippe <[email protected]> | 2024-03-10 21:37:49 +0200 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2024-03-10 21:37:49 +0200 |
commit | 1e1d6770409947fd00314c3810afbb23c7679fd2 (patch) | |
tree | a4d37eef2150964ee1679d386cf150e534c81700 | |
parent | fb37c54a9eaac86a3d8be09ee460eab0a0902d26 (diff) | |
download | tde-style-polyester-1e1d6770409947fd00314c3810afbb23c7679fd2.tar.gz tde-style-polyester-1e1d6770409947fd00314c3810afbb23c7679fd2.zip |
Port to new Style API
I still wonder how it is different from the old approach or where to find the
appropriate docs...
Signed-off-by: Mavridis Philippe <[email protected]>
-rw-r--r-- | style/config/CMakeLists.txt | 4 | ||||
-rwxr-xr-x | style/config/polyesterconf.cpp | 14 | ||||
-rwxr-xr-x | style/polyester.cpp | 538 | ||||
-rwxr-xr-x | style/polyester.h | 82 |
4 files changed, 352 insertions, 286 deletions
diff --git a/style/config/CMakeLists.txt b/style/config/CMakeLists.txt index 095f5a6..b5d8768 100644 --- a/style/config/CMakeLists.txt +++ b/style/config/CMakeLists.txt @@ -27,5 +27,9 @@ tde_add_kpart(tdestyle_polyester_config configdialog.ui polyesterconf.cpp + LINK + tdecore-shared + tdeui-shared + DESTINATION ${PLUGIN_INSTALL_DIR} )
\ No newline at end of file diff --git a/style/config/polyesterconf.cpp b/style/config/polyesterconf.cpp index 04215dd..e11661f 100755 --- a/style/config/polyesterconf.cpp +++ b/style/config/polyesterconf.cpp @@ -46,7 +46,7 @@ DEALINGS IN THE SOFTWARE. extern "C" { - KDE_EXPORT TQWidget* allocate_kstyle_config(TQWidget* parent) + KDE_EXPORT TQWidget* allocate_tdestyle_config(TQWidget* parent) { TDEGlobal::locale()->insertCatalogue("polyester"); return new PolyesterStyleConfig(parent); @@ -352,11 +352,11 @@ TQString PolyesterStyleConfig::buttonType( int listnr ) int PolyesterStyleConfig::buttonItem( TQString kBType ) { - if( !strcmp(kBType,"gradients") ) + if( kBType == "gradients" ) return 1; - else if( !strcmp(kBType,"reverseGradients") ) + else if( kBType == "reverseGradients") return 2; - else if( !strcmp(kBType,"flat") ) + else if( kBType == "flat") return 3; else return 0; @@ -379,11 +379,11 @@ TQString PolyesterStyleConfig::scrollBarType( int listnr ) int PolyesterStyleConfig::scrollBarItem( TQString kSType ) { - if( !strcmp(kSType,"PlatinumStyleScrollBar") ) + if( kSType == "PlatinumStyleScrollBar") return 1; - else if( !strcmp(kSType,"NextStyleScrollBar") ) + else if( kSType == "NextStyleScrollBar") return 2; - else if( !strcmp(kSType,"WindowsStyleScrollBar") ) + else if( kSType == "WindowsStyleScrollBar") return 3; else return 0; diff --git a/style/polyester.cpp b/style/polyester.cpp index 4b4aad3..7fe513d 100755 --- a/style/polyester.cpp +++ b/style/polyester.cpp @@ -157,7 +157,7 @@ class PolyesterStylePlugin : public TQStylePlugin } }; -KDE_Q_EXPORT_PLUGIN( PolyesterStylePlugin ) +TQ_EXPORT_PLUGIN( PolyesterStylePlugin ) // -- end -- PolyesterStyle::PolyesterStyle() : TDEStyle( AllowMenuTransparency, ThreeButtonScrollBar), @@ -315,28 +315,30 @@ void PolyesterStyle::animate() { for ( AnimWidgetMap::iterator it = animWidgets.begin(); it != animWidgets.end(); ++it) { TQWidget *widget = it.key(); - if( animWidgets[widget].active == true ) { - mustStop = false; - if(abs(animWidgets[widget].animFrame) < ANIMATIONSTEPS) { - if ( _animateButton ) { - animWidgets[widget].animFrame += animationDelta; - widget->repaint(false); - } else { - animWidgets[widget].animFrame = ANIMATIONSTEPS; - } + int frame = abs((int)animWidgets[widget].animFrame); + + if (animWidgets[widget].active) { + mustStop = false; + if (frame < ANIMATIONSTEPS) { + if ( _animateButton ) { + animWidgets[widget].animFrame += animationDelta; + widget->repaint(false); + } else { + animWidgets[widget].animFrame = ANIMATIONSTEPS; } - } else { - if(abs(animWidgets[widget].animFrame) > 0) { - mustStop = false; - if ( _animateButton ) { - animWidgets[widget].animFrame -= animationDelta; - widget->repaint(false); - } else { - animWidgets[widget].animFrame = 0; - } - // btnAnimTimer->start(TIMERINTERVAL, true); // single-shot + } + } else { + if (frame > 0) { + mustStop = false; + if ( _animateButton ) { + animWidgets[widget].animFrame -= animationDelta; + widget->repaint(false); + } else { + animWidgets[widget].animFrame = 0; } + // btnAnimTimer->start(TIMERINTERVAL, true); // single-shot } + } } if( !mustStop ) @@ -353,113 +355,124 @@ PolyesterStyle::~PolyesterStyle() delete verticalLine; } -void PolyesterStyle::polish(TQApplication* app) +void PolyesterStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags, void *ptr) { - if (!qstrcmp(app->argv()[0], "kicker")) - kickerMode = true; - else if (!qstrcmp(app->argv()[0], "korn")) - kornMode = true; + if (ceData.widgetObjectTypes.contains("TQApplication")) + { + TQApplication *app = reinterpret_cast<TQApplication*>(ptr); + if (!qstrcmp(app->argv()[0], "kicker")) + kickerMode = true; + else if (!qstrcmp(app->argv()[0], "korn")) + kornMode = true; + } } -void PolyesterStyle::polish(TQWidget* widget) +void PolyesterStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) { - if( !strcmp(widget->name(), "__tdehtml") ) { // is it a tdehtml widget...? - tdehtmlWidgets[widget] = true; - connect(widget, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(tdehtmlWidgetDestroyed(TQObject*))); - } - - // use tqt_cast where possible to check if the widget inheits one of the classes. might improve - // performance compared to TQObject::inherits() - if ( ::tqt_cast<TQPushButton*>(widget) || ::tqt_cast<TQComboBox*>(widget) || - ::tqt_cast<TQSpinWidget*>(widget) || ::tqt_cast<TQSlider*>(widget) || - ::tqt_cast<TQCheckBox*>(widget) || ::tqt_cast<TQRadioButton*>(widget) || - ::tqt_cast<TQToolButton*>(widget) || widget->inherits("TQSplitterHandle") ) - { -// widget->setBackgroundMode(PaletteBackground); - widget->installEventFilter(this); + if (ceData.widgetObjectTypes.contains("TQWidget")) { + TQWidget *widget = reinterpret_cast<TQWidget *>(ptr); - if( _animateButton ) - { - //TODO: discover if it's going to stay deleted... - //if (!btnAnimTimer->isActive()) - // btnAnimTimer->start( TIMERINTERVAL, false ); - - animWidgets[widget].active = false; - connect(widget, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(animWidgetDestroyed(TQObject*))); + if( !strcmp(widget->name(), "__tdehtml") ) { // is it a tdehtml widget...? + tdehtmlWidgets[widget] = true; + connect(widget, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(tdehtmlWidgetDestroyed(TQObject*))); } - TQSlider *slider = ::tqt_cast<TQSlider*>(widget); - if(slider) + // use tqt_cast where possible to check if the widget inheits one of the classes. might improve + // performance compared to TQObject::inherits() + if (widget->inherits("TQPushButton") || widget->inherits("TQComboBox") || + widget->inherits("TQSpinWidget") || widget->inherits("TQSlider") || + widget->inherits("TQCheckBox") || widget->inherits("TQRadioButton") || + widget->inherits("TQToolButton") || widget->inherits("TQSplitterHandle")) { - connect(slider, TQ_SIGNAL(sliderMoved(int)), this, TQ_SLOT(sliderThumbMoved(int))); - connect(slider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(sliderThumbMoved(int))); - } - } else if (::tqt_cast<TQLineEdit*>(widget)) { - widget->installEventFilter(this); - } else if (::tqt_cast<TQTabBar*>(widget)) { - widget->setMouseTracking(true); - widget->installEventFilter(this); - } else if (::tqt_cast<TQPopupMenu*>(widget)) { - widget->setBackgroundMode( NoBackground ); - } else if ( !qstrcmp(widget->name(), "tde toolbar widget") ) { - widget->installEventFilter(this); - } else if (::tqt_cast<TQHeader*>(widget)) { - connect(widget->parent(), TQ_SIGNAL(contentsMoving(int, int)), widget, TQ_SLOT(update())); - widget->installEventFilter(this); - }else if (::tqt_cast<TQScrollBar*>(widget)) { - widget->installEventFilter(this); - } + // widget->setBackgroundMode(PaletteBackground); + widget->installEventFilter(this); - if( _animateProgressBar && ::tqt_cast<TQProgressBar*>(widget) ) - { - widget->installEventFilter(this); - progAnimWidgets[widget] = 0; - connect(widget, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(progressBarDestroyed(TQObject*))); - if (!animationTimer->isActive()) - animationTimer->start( 50, false ); - } + if( _animateButton ) + { + //TODO: discover if it's going to stay deleted... + //if (!btnAnimTimer->isActive()) + // btnAnimTimer->start( TIMERINTERVAL, false ); + animWidgets[widget].active = false; + connect(widget, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(animWidgetDestroyed(TQObject*))); + } + TQSlider *slider = ::tqt_cast<TQSlider*>(widget); + if (slider) + { + connect(slider, TQ_SIGNAL(sliderMoved(int)), this, TQ_SLOT(sliderThumbMoved(int))); + connect(slider, TQ_SIGNAL(valueChanged(int)), this, TQ_SLOT(sliderThumbMoved(int))); + } + } else if (widget->inherits("TQLineEdit")) { + widget->installEventFilter(this); + } else if (widget->inherits("TQTabBar")) { + widget->setMouseTracking(true); + widget->installEventFilter(this); + } else if (widget->inherits("TQPopupMenu")) { + widget->setBackgroundMode( NoBackground ); + } else if ( !qstrcmp(widget->name(), "tde toolbar widget") ) { + widget->installEventFilter(this); + } else if (widget->inherits("TQHeader")) { + connect(widget->parent(), TQ_SIGNAL(contentsMoving(int, int)), widget, TQ_SLOT(update())); + widget->installEventFilter(this); + }else if (widget->inherits("TQScrollBar")) { + widget->installEventFilter(this); + } + + if ( _animateProgressBar && widget->inherits("TQProgressBar") ) + { + widget->installEventFilter(this); + progAnimWidgets[widget] = 0; + connect(widget, TQ_SIGNAL(destroyed(TQObject*)), this, TQ_SLOT(progressBarDestroyed(TQObject*))); + if (!animationTimer->isActive()) + animationTimer->start( 50, false ); + } + } - TDEStyle::polish(widget); + TDEStyle::polish(ceData, elementFlags, ptr); } -void PolyesterStyle::unPolish(TQWidget* widget) +void PolyesterStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) { - if( !strcmp(widget->name(), "__tdehtml") ) { // is it a tdehtml widget...? - tdehtmlWidgets.remove(widget); - } + if (ceData.widgetObjectTypes.contains("TQWidget")) { + TQWidget *widget = reinterpret_cast<TQWidget *>(ptr); - // use tqt_cast to check if the widget inheits one of the classes. - if ( ::tqt_cast<TQPushButton*>(widget) || ::tqt_cast<TQComboBox*>(widget) || - ::tqt_cast<TQSpinWidget*>(widget) || ::tqt_cast<TQSlider*>(widget) || - ::tqt_cast<TQCheckBox*>(widget) || ::tqt_cast<TQRadioButton*>(widget) || - ::tqt_cast<TQToolButton*>(widget) || ::tqt_cast<TQLineEdit*>(widget) || - widget->inherits("TQSplitterHandle") ) - { - widget->removeEventFilter(this); - animWidgets.remove(widget); - } - else if (::tqt_cast<TQTabBar*>(widget) || ::tqt_cast<TQHeader*>(widget) - || ::tqt_cast<TQScrollBar*>(widget)) { - widget->setMouseTracking(false); - widget->removeEventFilter(this); - } else if (::tqt_cast<TQPopupMenu*>(widget)) { - widget->setBackgroundMode( PaletteBackground ); - } else if ( !qstrcmp(widget->name(), "tde toolbar widget") ) { - widget->removeEventFilter(this); - } + if( !strcmp(widget->name(), "__tdehtml") ) { // is it a tdehtml widget...? + tdehtmlWidgets.remove(widget); + } - const TQSlider *slider = ::tqt_cast<TQSlider*>(widget); - if(slider && sliderValues.contains(slider)) - sliderValues.remove(slider); + // use tqt_cast to check if the widget inheits one of the classes. - if ( ::tqt_cast<TQProgressBar*>(widget) ) - { - progAnimWidgets.remove(widget); - } + if (widget->inherits("TQPushButton") || widget->inherits("TQComboBox") || + widget->inherits("TQSpinWidget") || widget->inherits("TQSlider") || + widget->inherits("TQCheckBox") || widget->inherits("TQRadioButton") || + widget->inherits("TQToolButton") || widget->inherits("TQLineEdit") || + widget->inherits("TQSplitterHandle")) + { + widget->removeEventFilter(this); + animWidgets.remove(widget); + } + else if (widget->inherits("TQTabBar") || widget->inherits("TQHeader") || + widget->inherits("TQScrollBar")) + { + widget->setMouseTracking(false); + widget->removeEventFilter(this); + } else if (widget->inherits("TQPopupMenu")) { + widget->setBackgroundMode( PaletteBackground ); + } else if ( !qstrcmp(widget->name(), "tde toolbar widget") ) { + widget->removeEventFilter(this); + } + + const TQSlider *slider = reinterpret_cast<TQSlider*>(widget); + if (slider && sliderValues.contains(slider)) + sliderValues.remove(slider); - TDEStyle::unPolish(widget); + if ( widget->inherits("TQProgressBar") ) + { + progAnimWidgets.remove(widget); + } + } + TDEStyle::unPolish(ceData, elementFlags, ptr); } /*a bunch of TQ_SLOTs stuff...*/ @@ -795,13 +808,13 @@ void PolyesterStyle::renderSurface(TQPainter *p, if (drawLeft) left++; if (drawTop) top++; - if( !strcmp(_buttonStyle,"gradients" ) /*|| sunken*/ ){ + if( _buttonStyle == "gradients" /*|| sunken*/ ){ //polyester style renderGradient(p, TQRect(drawLeft?r.left()+1:r.left(), drawTop?r.top()+1:r.top(), width, height), colorTop2, colorBottom2, horizontal); } - else if( !strcmp(_buttonStyle,"glass" ) ){ + else if( _buttonStyle == "glass" ){ //glass buttons /*create a copy of the two colors, otherwise ugly things(tm) happens...*/ const TQColor colorTop3 = TQColor(colorTop1.rgb()).light(100+_contrast); @@ -822,7 +835,7 @@ void PolyesterStyle::renderSurface(TQPainter *p, horizontal?top+height/2:top, horizontal?width:halfsize, horizontal?halfsize:height), colorBottom2, colorTop2, horizontal); - }else if( !strcmp(_buttonStyle,"reverseGradients" ) ){ + }else if( _buttonStyle == "reverseGradients" ){ //lipstik style renderGradient(p, TQRect(drawLeft?r.left()+1:r.left(), drawTop?r.top()+1:r.top(), width, height), @@ -903,7 +916,7 @@ void PolyesterStyle::renderPixel(TQPainter *p, const TQColor &color, const TQColor &background, bool fullAlphaBlend) const -{ +{ if(fullAlphaBlend) // full alpha blend: paint into an image with alpha buffer and convert to a pixmap ... { @@ -1107,15 +1120,15 @@ void PolyesterStyle::renderGradient(TQPainter *painter, int rDiff, gDiff, bDiff; int rc, gc, bc; - register int x, y; + int x, y; rDiff = ( c2.red()) - (rc = c1.red()); gDiff = ( c2.green()) - (gc = c1.green()); bDiff = ( c2.blue()) - (bc = c1.blue()); - register int rl = rc << 16; - register int gl = gc << 16; - register int bl = bc << 16; + int rl = rc << 16; + int gl = gc << 16; + int bl = bc << 16; int rdelta = ((1<<16) / (horizontal ? r_h : r_w)) * rDiff; int gdelta = ((1<<16) / (horizontal ? r_h : r_w)) * gDiff; @@ -1279,17 +1292,17 @@ void PolyesterStyle::renderTab(TQPainter *p, renderGradient(p, TQRect(Rs.right(), Rs.y()+1, 1, Rs.height()-1), getColor(g,PanelDark), getColor(g,PanelDark2)); - if( !strcmp(_buttonStyle,"glass" ) ){ + if( _buttonStyle == "glass" ){ renderGradient(p, TQRect(Rs.x()+1, Rs.y()+1, Rs.width()-2, Rs.height()/2), g.background().light(100+_contrast), g.background()); renderGradient(p, TQRect(Rs.x()+1, Rs.y()+Rs.height()/2, Rs.width()-2, Rs.height()/2), g.background().dark(100+_contrast), g.background()); - }else if( !strcmp(_buttonStyle,"gradients" ) ) + }else if( _buttonStyle == "gradients" ) renderGradient(p, TQRect(Rs.x()+1, Rs.y()+1, Rs.width()-2, Rs.height()-1), getColor(g,PanelLight), g.background()); - else if( !strcmp(_buttonStyle,"reverseGradients" ) ) + else if( _buttonStyle == "reverseGradients" ) renderGradient(p, TQRect(Rs.x()+1, Rs.y()+1, Rs.width()-2, Rs.height()-1), g.background().dark(100+_contrast), g.background()); @@ -1548,12 +1561,14 @@ void PolyesterStyle::sliderThumbMoved(int val) } void PolyesterStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, - TQPainter *p, - const TQWidget* widget, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt) const + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt, + const TQWidget *widget) const { // some "global" vars... const bool enabled = (flags & Style_Enabled); @@ -1562,7 +1577,7 @@ void PolyesterStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, // ------ switch( kpe ) { case KPE_SliderGroove: { - const TQSlider* slider = (const TQSlider*)widget; + const TQSlider* slider = static_cast<const TQSlider *>(widget); bool horizontal = slider->orientation() == Horizontal; int value = slider->value(); @@ -1572,8 +1587,8 @@ void PolyesterStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, if (horizontal) { int center = r.y()+r.height()/2; //double coloredWidth = ((double)r.width()/slider->maxValue())*slider->value(); - double sliderLength = pixelMetric( PM_SliderLength, widget); - double halfSliderLength = pixelMetric( PM_SliderLength, widget)/2; + double sliderLength = pixelMetric( PM_SliderLength, ceData, elementFlags, widget); + double halfSliderLength = pixelMetric( PM_SliderLength, ceData, elementFlags, widget)/2; double coloredWidth = ((((double)r.width()-sliderLength)/ (slider->maxValue()-slider->minValue()))* (slider->value() - slider->minValue()) @@ -1614,8 +1629,8 @@ void PolyesterStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, } else { int center = r.x()+r.width()/2; //double coloredHeight = ((double)r.height()/slider->maxValue())*slider->value(); - double sliderLength = pixelMetric( PM_SliderLength, widget); - double halfSliderLength = pixelMetric( PM_SliderLength, widget)/2; + double sliderLength = pixelMetric( PM_SliderLength, ceData, elementFlags, widget); + double halfSliderLength = pixelMetric( PM_SliderLength, ceData, elementFlags, widget)/2; double nonColoredHeight = ((((double)r.height()-sliderLength)/ (slider->maxValue()-slider->minValue()))* (slider->value() - slider->minValue()) @@ -1653,7 +1668,7 @@ void PolyesterStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, } case KPE_SliderHandle: { - const TQSlider* slider = (const TQSlider*)widget; + const TQSlider* slider = static_cast<const TQSlider *>(widget); bool horizontal = slider->orientation() == Horizontal; const bool pressed = (flags&Style_Active); @@ -1836,9 +1851,9 @@ void PolyesterStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, p->drawLine( centerx, centery - radius, centerx, centery + radius ); } else if(_drawTriangularExpander) { if( flags & Style_On ) - drawPrimitive(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 ) - drawPrimitive(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; @@ -1917,17 +1932,19 @@ void PolyesterStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe, } default: - TDEStyle::drawTDEStylePrimitive(kpe, p, widget, r, cg, flags, opt); + TDEStyle::drawTDEStylePrimitive(kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void PolyesterStyle::drawPrimitive(PrimitiveElement pe, - TQPainter *p, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption &opt ) const + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption &opt ) const { bool down = flags & Style_Down; bool on = flags & Style_On; @@ -2344,7 +2361,7 @@ void PolyesterStyle::drawPrimitive(PrimitiveElement pe, surfaceFlags); p->setPen(cg.foreground()); - drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, r, cg, flags); + drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, r, cg, flags); break; } @@ -2395,7 +2412,7 @@ void PolyesterStyle::drawPrimitive(PrimitiveElement pe, surfaceFlags); p->setPen(cg.foreground()); - drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, r, cg, flags); + drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ceData, elementFlags, r, cg, flags); break; } @@ -2425,7 +2442,7 @@ void PolyesterStyle::drawPrimitive(PrimitiveElement pe, 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); - drawPrimitive(PE_CheckMark, p, r, cg, flags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, flags); break; } @@ -2822,8 +2839,8 @@ void PolyesterStyle::drawPrimitive(PrimitiveElement pe, const TQWMatrix oldMatrix( p->worldMatrix() ); if (flags & Style_Down) { - p->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); + p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags), + pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags)); } int x = r.x(); @@ -2873,19 +2890,21 @@ void PolyesterStyle::drawPrimitive(PrimitiveElement pe, } default: { - return TDEStyle::drawPrimitive(pe, p, r, cg, flags, opt); + return TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); } } } void PolyesterStyle::drawControl(ControlElement element, - TQPainter *p, - const TQWidget *widget, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt) const + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt, + const TQWidget *widget) const { const bool reverseLayout = TQApplication::reverseLayout(); @@ -3063,9 +3082,9 @@ void PolyesterStyle::drawControl(ControlElement element, if ( t->identifier() == tb->currentTab()) { tr.moveTop( tr.top() - - pixelMetric( TQStyle::PM_TabBarTabShiftVertical, tb ) ); + pixelMetric( TQStyle::PM_TabBarTabShiftVertical, ceData, elementFlags, tb ) ); tr.moveLeft( tr.left() - - pixelMetric( TQStyle::PM_TabBarTabShiftHorizontal, tb ) ); + pixelMetric( TQStyle::PM_TabBarTabShiftHorizontal, ceData, elementFlags, tb ) ); } if(_shadowedButtonsText) @@ -3079,7 +3098,7 @@ void PolyesterStyle::drawControl(ControlElement element, flags & Style_Enabled, 0, t->text() ); if ( (flags & Style_HasFocus) && !t->text().isEmpty() ) - drawPrimitive( PE_FocusRect, p, r, cg, Style_Default, opt ); + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, r, cg, Style_Default, opt ); break; } @@ -3087,7 +3106,7 @@ void PolyesterStyle::drawControl(ControlElement element, // RADIOBUTTONS // ------------ case CE_RadioButton: { - drawPrimitive(PE_ExclusiveIndicator, p, r, cg, flags); + drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags); const TQColor contentColor = enabled?cg.base():cg.background(); TQColor checkmarkColor = enabled?getColor(cg,CheckMark):cg.background(); @@ -3169,7 +3188,7 @@ void PolyesterStyle::drawControl(ControlElement element, renderTab(p, r, cg, mouseOver, selected, true, pos, false, cornerWidget); break; default: - TDEStyle::drawControl(element, p, widget, r, cg, flags, opt); + TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } break; @@ -3196,12 +3215,12 @@ void PolyesterStyle::drawControl(ControlElement element, g2.setColor( TQColorGroup::Button, cg.button().light(100+animFrame) ); } - drawPrimitive(PE_ButtonBevel, p, + drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, isDefault?TQRect(r.x()+1,r.y()+1,r.width()-2,r.height()-2):r, g2, flags, TQStyleOption(button) ); if (isDefault ) { - drawPrimitive(PE_ButtonDefault, p, r, cg, flags); + drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags); } break; @@ -3219,15 +3238,15 @@ void PolyesterStyle::drawControl(ControlElement element, // Shift button contents if pushed. if ( active ) { - x += pixelMetric(PM_ButtonShiftHorizontal, widget); - y += pixelMetric(PM_ButtonShiftVertical, widget); + x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget); + y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget); flags |= Style_Sunken; } // Does the button have a popup menu? if ( button->isMenuButton() ) { - int dx = pixelMetric( PM_MenuButtonIndicator, widget ); + int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); if ( button->iconSet() && !button->iconSet()->isNull() && (dx + button->iconSet()->pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w ) { @@ -3235,7 +3254,7 @@ void PolyesterStyle::drawControl(ControlElement element, } else { - drawPrimitive( 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 ); w -= dx; } @@ -3261,7 +3280,7 @@ void PolyesterStyle::drawControl(ControlElement element, p->drawPixmap( x + 4, y + h / 2 - pixmap.height() / 2, pixmap ); if (cornArrow) //Draw over the icon - drawPrimitive( 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 ); @@ -3305,8 +3324,8 @@ void PolyesterStyle::drawControl(ControlElement element, { TQColorGroup g2 = cg; - drawPrimitive( PE_FocusRect, p, - visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ), + drawPrimitive( PE_FocusRect, p, ceData, elementFlags, + visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), widget ), g2, flags, opt ); } break; @@ -3338,7 +3357,7 @@ void PolyesterStyle::drawControl(ControlElement element, if (active && focused) { if (down) { - //drawPrimitive(PE_ButtonTool, p, r, cg, flags|Style_Down, opt); + //drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags|Style_Down, opt); //code to draw the menubar item as a tab (ugly?) renderSurface(p, TQRect(r.left()+1, r.top()+1, r.width()-2, r.height()), cg.highlight(), cg.highlight(), cg.highlight(), @@ -3351,7 +3370,7 @@ void PolyesterStyle::drawControl(ControlElement element, _contrast, Is_Horizontal|Draw_Right|Draw_Top|Draw_Left|Draw_Bottom); renderContour(p, r, getColor(cg, MenuBarEmphasis), getColor(cg, MenuBarEmphasis).dark(120+_contrast*8), Draw_Right|Draw_Top|Draw_Left|Round_UpperRight|Round_UpperLeft|Draw_Bottom|Round_BottomRight|Round_BottomLeft); //not used this because of the possible custom menubar color - //drawPrimitive(PE_ButtonTool, p, r, cg, flags, opt); + //drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -3395,7 +3414,7 @@ void PolyesterStyle::drawControl(ControlElement element, bool enabled = mi->isEnabled(); bool checkable = popupmenu->isCheckable(); bool active = flags & Style_Active; - bool etchtext = styleHint( SH_EtchDisabledText ); + bool etchtext = styleHint(SH_EtchDisabledText, ceData, elementFlags); bool reverse = TQApplication::reverseLayout(); if ( checkable ) checkcol = TQMAX( checkcol, 20 ); @@ -3511,7 +3530,7 @@ void PolyesterStyle::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 && /*!active &&*/ mi->isChecked() ) - drawPrimitive(TQStyle::PE_Indicator, p, cr, cg, + drawPrimitive(TQStyle::PE_Indicator, p, ceData, elementFlags, cr, cg, TQStyle::Style_Enabled | TQStyle::Style_Active | TQStyle::Style_Off ); /*qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );*/ @@ -3526,7 +3545,7 @@ void PolyesterStyle::drawControl(ControlElement element, else if ( checkable && mi->isChecked() ) { int style = TQStyle::Style_Enabled | TQStyle::Style_Active | TQStyle::Style_On ; - drawPrimitive(TQStyle::PE_Indicator, p, cr, cg, style); + drawPrimitive(TQStyle::PE_Indicator, p, ceData, elementFlags, cr, cg, style); } // Time to draw the menu item label... @@ -3632,7 +3651,7 @@ void PolyesterStyle::drawControl(ControlElement element, // Does the menu item have a submenu? if ( mi->popup() ) { 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, r.y() + r.height() / 2 - dim / 2, dim, dim), r ); @@ -3644,9 +3663,9 @@ void PolyesterStyle::drawControl(ControlElement element, TQColorGroup g2( discol, cg.highlight(), white, white, enabled ? white : discol, discol, white ); - drawPrimitive( arrow, p, vr, g2, Style_Enabled ); + drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled ); } else - drawPrimitive( arrow, p, vr, cg, + drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, enabled ? Style_Enabled : Style_Default ); } break; @@ -3720,15 +3739,17 @@ void PolyesterStyle::drawControl(ControlElement element, } default: - TDEStyle::drawControl(element, p, widget, r, cg, flags, opt); + TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); } } void PolyesterStyle::drawControlMask(ControlElement element, - TQPainter *p, - const TQWidget *w, - const TQRect &r, - const TQStyleOption &opt) const + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQStyleOption &opt, + const TQWidget *w) const { switch (element) { case CE_PushButton: { @@ -3739,16 +3760,18 @@ void PolyesterStyle::drawControlMask(ControlElement element, } default: { - TDEStyle::drawControlMask (element, p, w, r, opt); + TDEStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w); } } } void PolyesterStyle::drawComplexControlMask(ComplexControl c, - TQPainter *p, - const TQWidget *w, - const TQRect &r, - const TQStyleOption &o) const + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQStyleOption &o, + const TQWidget *w) const { switch (c) { case CC_SpinWidget: @@ -3760,20 +3783,22 @@ void PolyesterStyle::drawComplexControlMask(ComplexControl c, break; } default: { - TDEStyle::drawComplexControlMask (c, p, w, r, o); + TDEStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w); } } } void PolyesterStyle::drawComplexControl(ComplexControl control, - TQPainter *p, - const TQWidget *widget, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - SCFlags controls, - SCFlags active, - const TQStyleOption& opt) const + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags controls, + SCFlags active, + const TQStyleOption& opt, + const TQWidget *widget) const { const bool reverseLayout = TQApplication::reverseLayout(); @@ -3811,7 +3836,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, if (_inputFocusHighlight && hasFocus && editable && enabled) { - TQRect editField = querySubControlMetrics(control, widget, SC_ComboBoxEditField); + TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_ComboBoxEditField, opt, widget); TQRect editFrame = r; TQRect buttonFrame = r; @@ -3893,7 +3918,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, cg.background(), buttonColor, highlightColor, enabled?_contrast+3:(_contrast/2), surfaceFlags); if (hasFocus) { - drawPrimitive(PE_FocusRect, p, + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, TQRect(RcontentSurface.x() + 2, RcontentSurface.y() + 2, RcontentSurface.width() - 4, @@ -3932,7 +3957,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, } p->setPen(cg.foreground()); - drawPrimitive(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 // from here TODO: shadow here? @@ -3954,8 +3979,8 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, } TQRect button, menuarea; - button = querySubControlMetrics(control, widget, SC_ToolButton, opt); - menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); + button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); + menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget); SFlags bflags = flags, mflags = flags; @@ -3963,7 +3988,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight; if (kornMode) { - drawPrimitive(PE_ButtonTool, p, button, g2, bflags, opt); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, g2, bflags, opt); break; } else { @@ -3983,7 +4008,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, if (controls & SC_ToolButton) { // If we're pressed, on, or raised... if (bflags & (Style_Down | Style_On | Style_Raised) || widget==hoverWidget ) { - drawPrimitive(PE_ButtonTool, p, button, g2, bflags, opt); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, g2, bflags, opt); if( _animateButton && tb->autoRaise() && !(bflags & Style_On) && !active ) renderContour(p, r, cg.background(), cg.background().dark(100+(abs(animFrame)*_contrast)), borderFlags); @@ -3998,15 +4023,15 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, // Draw a toolbutton menu indicator if required if (controls & SC_ToolButtonMenu) { if (mflags & (Style_Down | Style_On | Style_Raised)) { - drawPrimitive(PE_ButtonDropDown, p, menuarea, g2, mflags, opt); + drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, g2, mflags, opt); } - drawPrimitive(PE_ArrowDown, p, menuarea, g2, mflags, opt); + drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, g2, mflags, opt); } if (tb->hasFocus() && !tb->focusProxy()) { TQRect fr = tb->rect(); fr.addCoords(2, 2, -2, -2); - drawPrimitive(PE_FocusRect, p, fr, g2, Style_Default, opt); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, g2, Style_Default, opt); } // Set the color for the ToolButton menu indicator @@ -4041,7 +4066,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, const bool heightDividable = ((r.height()%2) == 0); if (_inputFocusHighlight && hasFocus && enabled) { - TQRect editField = querySubControlMetrics(control, widget, SC_SpinWidgetEditField); + TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetEditField, opt, widget); TQRect editFrame = r; TQRect buttonFrame = r; @@ -4072,7 +4097,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, } else { - renderContour(p, querySubControlMetrics(control, widget, SC_SpinWidgetFrame), + renderContour(p, querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetFrame, opt, widget), cg.background(), getColor(cg, ButtonContour, enabled) ); } p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) ); @@ -4139,7 +4164,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, else pe = PE_SpinWidgetUp; p->setPen(cg.foreground()); - drawPrimitive(pe, p, upRect, cg, sflags); + drawPrimitive(pe, p, ceData, elementFlags, upRect, cg, sflags); sflags = Style_Default | Style_Enabled; if (active == SC_SpinWidgetDown) { @@ -4152,7 +4177,7 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, else pe = PE_SpinWidgetDown; p->setPen(cg.foreground()); - drawPrimitive(pe, p, downRect, cg, sflags); + drawPrimitive(pe, p, ceData, elementFlags, downRect, cg, sflags); // thin frame around the input area const TQRect Rcontent = TQRect(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1, @@ -4185,19 +4210,22 @@ void PolyesterStyle::drawComplexControl(ComplexControl control, } default: - TDEStyle::drawComplexControl(control, p, widget, + TDEStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, controls, - active, opt); + active, opt, widget); break; } } -TQRect PolyesterStyle::subRect(SubRect r, const TQWidget *widget) const +TQRect PolyesterStyle::subRect(SubRect r, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget) const { switch (r) { case SR_ComboBoxFocusRect: { - return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); + return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ); } // Don't use TDEStyles progressbar subrect @@ -4212,15 +4240,17 @@ TQRect PolyesterStyle::subRect(SubRect r, const TQWidget *widget) const } default: { - return TDEStyle::subRect(r, widget); + return TDEStyle::subRect(r, ceData, elementFlags, widget); } } } TQRect PolyesterStyle::querySubControlMetrics(ComplexControl control, - const TQWidget *widget, - SubControl subcontrol, - const TQStyleOption &opt) const + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl subcontrol, + const TQStyleOption &opt, + const TQWidget *widget) const { if (!widget) { return TQRect(); @@ -4235,7 +4265,7 @@ TQRect PolyesterStyle::querySubControlMetrics(ComplexControl control, return TQRect(r.left()+2, r.top()+2, r.width()-4-15-1, r.height()-4); } default: { - return TDEStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } break; @@ -4279,18 +4309,21 @@ TQRect PolyesterStyle::querySubControlMetrics(ComplexControl control, return TQRect(buttonsLeft, r.top()+1, bs.width(), r.height()-2); } default: { - return TDEStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } break; } default: { - return TDEStyle::querySubControlMetrics(control, widget, subcontrol, opt); + return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget); } } } -int PolyesterStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +int PolyesterStyle::pixelMetric(PixelMetric m, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget) const { switch(m) { // TABS @@ -4307,20 +4340,15 @@ int PolyesterStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const return 1; } -#if (TQT_VERSION >= 0x030300) // requires TQt 3.3 // extra space between menubar items case PM_MenuBarItemSpacing: { return 5; } -#endif - -// #if (TQT_VERSION >= 0x030300) // requires TQt 3.3 // // extra space between toolbar items // case PM_ToolBarItemSpacing: { // return 4; // } -// #endif // SCROLL BAR case PM_ScrollBarSliderMin: { @@ -4391,26 +4419,31 @@ int PolyesterStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const } default: - return TDEStyle::pixelMetric(m, widget); + return TDEStyle::pixelMetric(m, ceData, elementFlags, widget); } } -int PolyesterStyle::kPixelMetric(TDEStylePixelMetric kpm, const TQWidget *widget) const +int PolyesterStyle::kPixelMetric(TDEStylePixelMetric kpm, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget) const { switch(kpm) { case KPM_MenuItemSeparatorHeight: return 2; default: - return TDEStyle::kPixelMetric(kpm, widget); + return TDEStyle::kPixelMetric(kpm, ceData, elementFlags, widget); } } TQSize PolyesterStyle::sizeFromContents(ContentsType t, - const TQWidget *widget, - const TQSize &s, - const TQStyleOption &opt) const + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQSize &s, + const TQStyleOption &opt, + const TQWidget *widget) const { switch (t) { case CT_PopupMenuItem: { @@ -4471,8 +4504,8 @@ TQSize PolyesterStyle::sizeFromContents(ContentsType t, { const TQPushButton* btn = static_cast<const TQPushButton*>(widget); - int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, widget); - int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, widget); + int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget); + int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget); if ( btn->text().isEmpty() && s.width() < 32 ) return TQSize(w, h); return TQSize( w+25, h+5 ); @@ -4483,20 +4516,22 @@ TQSize PolyesterStyle::sizeFromContents(ContentsType t, if(widget->parent() && ::tqt_cast<TQToolBar*>(widget->parent()) ) return TQSize( s.width()+2*4, s.height()+2*4 ); else - return TDEStyle::sizeFromContents (t, widget, s, opt); + return TDEStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); } default: - return TDEStyle::sizeFromContents (t, widget, s, opt); + return TDEStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); } - return TDEStyle::sizeFromContents (t, widget, s, opt); + return TDEStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget); } -int PolyesterStyle::styleHint( StyleHint stylehint, - const TQWidget *widget, - const TQStyleOption &option, - TQStyleHintReturn* returnData ) const +int PolyesterStyle::styleHint(StyleHint stylehint, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption &option, + TQStyleHintReturn* returnData, + const TQWidget *widget) const { switch (stylehint) { case SH_PopupMenu_SubMenuPopupDelay: @@ -4507,10 +4542,6 @@ int PolyesterStyle::styleHint( StyleHint stylehint, if (_centeredTabBar && !TQApplication::reverseLayout()) return TQt::AlignHCenter; - //Suggestion by Daniel Molkentin, - //algorithm from QT4 TQWindowsXPStyle Copyright 2006 Trolltech -//this exists since TQt3.2 -#if (TQT_VERSION >= 0x030200) case SH_LineEdit_PasswordCharacter: { if (widget) @@ -4530,9 +4561,9 @@ int PolyesterStyle::styleHint( StyleHint stylehint, return '*'; } } -#endif + default: - return TDEStyle::styleHint(stylehint, widget, option, returnData); + return TDEStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget); } } @@ -4545,7 +4576,7 @@ bool PolyesterStyle::eventFilter(TQObject *obj, TQEvent *ev) if (!obj->isWidgetType() ) return false; //header mouse over - if ( ::tqt_cast<TQHeader*>(obj) ) { + if ( obj->inherits("TQHeader") ) { TQWidget* widget = static_cast<TQWidget*>(obj); if ((ev->type() == TQEvent::Leave) && static_cast<TQWidget*>(obj)->isEnabled()) { @@ -4571,7 +4602,7 @@ bool PolyesterStyle::eventFilter(TQObject *obj, TQEvent *ev) } } /*Scrollbar Mouse over*/ - if ( ::tqt_cast<TQScrollBar*>(obj) ) { + if ( obj->inherits("TQScrollBar") ) { TQWidget* widget = static_cast<TQWidget*>(obj); if ((ev->type() == TQEvent::Enter) && static_cast<TQWidget*>(obj)->isEnabled()) @@ -4586,10 +4617,10 @@ bool PolyesterStyle::eventFilter(TQObject *obj, TQEvent *ev) } } // focus highlight - if ( ::tqt_cast<TQLineEdit*>(obj) ) { + if ( obj->inherits("TQLineEdit") ) { TQWidget* widget = static_cast<TQWidget*>(obj); - if ( ::tqt_cast<TQSpinWidget*>(widget->parentWidget()) ) + if ( widget->parentWidget()->inherits("TQSpinWidget") ) { TQWidget* spinbox = widget->parentWidget(); if ((ev->type() == TQEvent::FocusIn) || (ev->type() == TQEvent::FocusOut)) @@ -4607,9 +4638,10 @@ bool PolyesterStyle::eventFilter(TQObject *obj, TQEvent *ev) } //Hover highlight... use tqt_cast to check if the widget inheits one of the classes. - if ( ::tqt_cast<TQPushButton*>(obj) || ::tqt_cast<TQComboBox*>(obj) || - ::tqt_cast<TQSpinWidget*>(obj) || ::tqt_cast<TQCheckBox*>(obj) || - ::tqt_cast<TQRadioButton*>(obj) || ::tqt_cast<TQToolButton*>(obj) || obj->inherits("TQSplitterHandle") ) + if (obj->inherits("TQPushButton") || obj->inherits("TQComboBox") || + obj->inherits("TQSpinWidget") || obj->inherits("TQCheckBox") || + obj->inherits("TQRadioButton") || obj->inherits("TQToolButton") || + obj->inherits("TQSplitterHandle")) { if ((ev->type() == TQEvent::Enter) && static_cast<TQWidget*>(obj)->isEnabled()) { @@ -4645,7 +4677,7 @@ bool PolyesterStyle::eventFilter(TQObject *obj, TQEvent *ev) } return false; } - if ( ::tqt_cast<TQTabBar*>(obj) ) { + if ( obj->inherits("TQTabBar") ) { if ((ev->type() == TQEvent::Enter) && static_cast<TQWidget*>(obj)->isEnabled()) { TQWidget* tabbar = static_cast<TQWidget*>(obj); @@ -4683,7 +4715,7 @@ bool PolyesterStyle::eventFilter(TQObject *obj, TQEvent *ev) return false; } // Track show events for progress bars - if ( _animateProgressBar && ::tqt_cast<TQProgressBar*>(obj) ) + if ( _animateProgressBar && obj->inherits("TQProgressBar") ) { if ((ev->type() == TQEvent::Show) && !animationTimer->isActive()) { diff --git a/style/polyester.h b/style/polyester.h index 84f1133..6ae1eb7 100755 --- a/style/polyester.h +++ b/style/polyester.h @@ -70,20 +70,24 @@ public: PolyesterStyle(); virtual ~PolyesterStyle(); - void polish(TQApplication* app ); - void polish(TQWidget* widget ); - void unPolish(TQWidget* widget ); + void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags, void *); + void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); + void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *); void drawTDEStylePrimitive(TDEStylePrimitive kpe, - TQPainter* p, - const TQWidget* widget, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = nullptr) const; void drawPrimitive(PrimitiveElement pe, TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, @@ -91,51 +95,77 @@ public: void drawControl(ControlElement element, TQPainter *p, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = nullptr) const; - void drawControlMask( ControlElement, TQPainter *, const TQWidget *, const TQRect &, const TQStyleOption &) const; + void drawControlMask(ControlElement element, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQStyleOption & = TQStyleOption::Default, + const TQWidget *widget = nullptr) const; void drawComplexControl(ComplexControl control, TQPainter *p, - const TQWidget *widget, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const; + const TQStyleOption& = TQStyleOption::Default, + const TQWidget *widget = nullptr) const; int pixelMetric(PixelMetric m, - const TQWidget *widget = 0 ) const; + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget = nullptr) const; - int kPixelMetric(TDEStylePixelMetric kpm, const TQWidget *widget) const; + int kPixelMetric(TDEStylePixelMetric kpm, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget) const; TQRect subRect(SubRect r, - const TQWidget *widget ) const; + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQWidget *widget = nullptr) const; TQRect querySubControlMetrics(ComplexControl control, - const TQWidget *widget, - SubControl subcontrol, - const TQStyleOption &opt = TQStyleOption::Default ) const; + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl subcontrol, + const TQStyleOption &opt = TQStyleOption::Default, + const TQWidget *widget = nullptr) const; void drawComplexControlMask(TQStyle::ComplexControl c, TQPainter *p, - const TQWidget *w, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQRect &r, - const TQStyleOption &o=TQStyleOption::Default) const; + const TQStyleOption &o=TQStyleOption::Default, + const TQWidget *widget = nullptr) const; TQSize sizeFromContents(TQStyle::ContentsType t, - const TQWidget *w, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQSize &s, - const TQStyleOption &o) const; + const TQStyleOption &o, + const TQWidget *widget = nullptr) const; - int styleHint(StyleHint, const TQWidget * = 0, + int styleHint(StyleHint hint, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, - TQStyleHintReturn * = 0 ) const; + TQStyleHintReturn * = nullptr, + const TQWidget *widget = nullptr) const; protected: enum TabPosition |