diff options
Diffstat (limited to 'src/styles/qmotifplusstyle.cpp')
-rw-r--r-- | src/styles/qmotifplusstyle.cpp | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp index 129f0a2d2..2ad7e7f5a 100644 --- a/src/styles/qmotifplusstyle.cpp +++ b/src/styles/qmotifplusstyle.cpp @@ -69,7 +69,9 @@ struct TQMotifPlusStylePrivate scrollbarElement(0), lastElement(0), ref(1) { ; } - TQGuardedPtr<TQWidget> hoverWidget; + void* hoverWidget; + TQStyleControlElementData hoverWidgetData; + TQStyle::ControlElementFlags hoverWidgetFlags; bool hovering, sliderActive, mousePressed; int scrollbarElement, lastElement, ref; TQPoint mousePos; @@ -176,52 +178,58 @@ void TQMotifPlusStyle::polish(TQPalette &) /*! \reimp */ -void TQMotifPlusStyle::polish(TQWidget *widget) +void TQMotifPlusStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr) { + if (ceData.widgetObjectTypes.contains("TQWidget")) { #ifndef QT_NO_FRAME - if (::tqt_cast<TQFrame*>(widget) && ((TQFrame *) widget)->frameStyle() == TQFrame::Panel) - ((TQFrame *) widget)->setFrameStyle(TQFrame::WinPanel); + if ((ceData.widgetObjectTypes.contains("TQFrame")) && (ceData.frameStyle == TQFrame::Panel)) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::WinPanel)); + } #endif #ifndef QT_NO_MENUBAR - if (::tqt_cast<TQMenuBar*>(widget) && ((TQMenuBar *) widget)->frameStyle() != TQFrame::NoFrame) - ((TQMenuBar *) widget)->setFrameStyle(TQFrame::StyledPanel | TQFrame::Raised); + if ((ceData.widgetObjectTypes.contains("TQMenuBar")) && (ceData.frameStyle != TQFrame::NoFrame)) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised)); + } #endif #ifndef QT_NO_TOOLBAR - if (::tqt_cast<TQToolBar*>(widget)) - widget->layout()->setMargin(2); + if (ceData.widgetObjectTypes.contains("TQToolBar")) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetLayoutMargin, TQStyleWidgetActionRequestData(2)); + } #endif + } if (useHoveringHighlight) { - if (::tqt_cast<TQButton*>(widget) || ::tqt_cast<TQComboBox*>(widget)) - widget->installEventFilter(this); + if ((ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQComboBox"))) { + installObjectEventHandler(ceData, elementFlags, ptr, this); + } - if (::tqt_cast<TQScrollBar*>(widget) || ::tqt_cast<TQSlider*>(widget)) { - widget->setMouseTracking(TRUE); - widget->installEventFilter(this); + if ((ceData.widgetObjectTypes.contains("TQScrollBar")) || (ceData.widgetObjectTypes.contains("TQSlider"))) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking); + installObjectEventHandler(ceData, elementFlags, ptr, this); } } - TQMotifStyle::polish(widget); + TQMotifStyle::polish(ceData, elementFlags, ptr); } /*! \reimp */ -void TQMotifPlusStyle::unPolish(TQWidget *widget) +void TQMotifPlusStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr) { - widget->removeEventFilter(this); - TQMotifStyle::unPolish(widget); + removeObjectEventHandler(ceData, elementFlags, ptr, this); + TQMotifStyle::unPolish(ceData, elementFlags, ptr); } /*! \reimp */ -void TQMotifPlusStyle::polish(TQApplication *) +void TQMotifPlusStyle::applicationPolish(TQStyleControlElementData, ControlElementFlags, void *) { } /*! \reimp */ -void TQMotifPlusStyle::unPolish(TQApplication *) +void TQMotifPlusStyle::applicationUnPolish(TQStyleControlElementData, ControlElementFlags, void *) { } @@ -1477,14 +1485,14 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control, /*! \reimp */ -bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event) +bool TQMotifPlusStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event ) { switch(event->type()) { case TQEvent::MouseButtonPress: { singleton->mousePressed = TRUE; - if (!::tqt_cast<TQSlider*>(object)) + if (!ceData.widgetObjectTypes.contains("TQSlider")) break; singleton->sliderActive = TRUE; @@ -1495,50 +1503,52 @@ bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event) { singleton->mousePressed = FALSE; - if (!::tqt_cast<TQSlider*>(object)) + if (!ceData.widgetObjectTypes.contains("TQSlider")) break; singleton->sliderActive = FALSE; - ((TQWidget *) object)->repaint(FALSE); + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); break; } case TQEvent::Enter: { - if (! object->isWidgetType()) + if (!ceData.widgetObjectTypes.contains("TQWidget")) break; - singleton->hoverWidget = (TQWidget *) object; - if (! singleton->hoverWidget->isEnabled()) { + singleton->hoverWidget = source; + singleton->hoverWidgetData = ceData; + singleton->hoverWidgetFlags = elementFlags; + if (!(singleton->hoverWidgetFlags & CEF_IsEnabled)) { singleton->hoverWidget = 0; break; } - singleton->hoverWidget->repaint(FALSE); + widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint); break; } case TQEvent::Leave: { - if (object != singleton->hoverWidget) + if (source != singleton->hoverWidget) break; - TQWidget *w = singleton->hoverWidget; + void *w = singleton->hoverWidget; singleton->hoverWidget = 0; - w->repaint(FALSE); + widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, w, WAR_Repaint); break; } case TQEvent::MouseMove: { - if (! object->isWidgetType() || object != singleton->hoverWidget) + if ((!ceData.widgetObjectTypes.contains("TQWidget")) || source != singleton->hoverWidget) break; - if (!::tqt_cast<TQScrollBar*>(object) && ! ::tqt_cast<TQSlider*>(object)) + if ((!ceData.widgetObjectTypes.contains("TQScrollBar")) && (!ceData.widgetObjectTypes.contains("TQSlider"))) break; singleton->mousePos = ((TQMouseEvent *) event)->pos(); if (! singleton->mousePressed) { singleton->hovering = TRUE; - singleton->hoverWidget->repaint(FALSE); + widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint); singleton->hovering = FALSE; } @@ -1549,7 +1559,7 @@ bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event) break; } - return TQMotifStyle::eventFilter(object, event); + return TQMotifStyle::objectEventHandler(ceData, elementFlags, source, event); } |