From 74dac1c21d3ad1f446874fd29f7e670e77a196b5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 7 Aug 2012 01:32:24 -0500 Subject: Automated update from Qt3 --- src/styles/qsgistyle.cpp | 124 +++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'src/styles/qsgistyle.cpp') diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index e6daeec18..930a34d09 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -65,7 +65,7 @@ struct SliderLastPosition { SliderLastPosition() : rect(0,-1,0,-1), slider(0) {} TQRect rect; - const TQSlider* slider; + const void* slider; }; #endif @@ -74,7 +74,7 @@ struct ScrollbarLastPosition { ScrollbarLastPosition() : rect( 0,-1, 0,-1 ), scrollbar(0) {} TQRect rect; - const TQScrollBar *scrollbar; + const void* scrollbar; }; #endif @@ -86,7 +86,7 @@ public: { } - const TQWidget *hotWidget; + const void* hotWidget; TQPoint mousePos; #ifndef QT_NO_SCROLLBAR ScrollbarLastPosition lastScrollbarRect; @@ -136,10 +136,10 @@ TQSGIStyle::~TQSGIStyle() bold italic font for menu options. */ void -TQSGIStyle::polish( TQApplication* app) +TQSGIStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { isApplicationStyle = 1; - TQMotifStyle::polish( app ); + TQMotifStyle::polish( ceData, elementFlags, ptr ); TQPalette pal = TQApplication::palette(); // check this on SGI-Boxes @@ -181,7 +181,7 @@ TQSGIStyle::polish( TQApplication* app) /*! \reimp */ void -TQSGIStyle::unPolish( TQApplication* /* app */ ) +TQSGIStyle::applicationUnPolish( TQStyleControlElementData, ControlElementFlags, void * ) { TQFont f = TQApplication::font(); TQApplication::setFont( f, TRUE ); // get rid of the special fonts for special widget classes @@ -194,9 +194,9 @@ TQSGIStyle::unPolish( TQApplication* /* app */ ) hovering. */ void -TQSGIStyle::polish( TQWidget* w ) +TQSGIStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { - TQMotifStyle::polish(w); + TQMotifStyle::polish(ceData, elementFlags, ptr); if ( !isApplicationStyle ) { TQPalette sgiPal = TQApplication::palette(); @@ -214,7 +214,7 @@ TQSGIStyle::polish( TQWidget* w ) sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().base() ); } - if ( ::tqt_cast(w) || ::tqt_cast(w) ) { + if ( (ceData.widgetObjectTypes.contains("TQLineEdit")) || (ceData.widgetObjectTypes.contains("TQTextEdit")) ) { // different basecolor and highlighting in Q(Multi)LineEdit sgiPal.setColor( TQColorGroup::Base, TQColor(211,181,181) ); sgiPal.setColor( TQPalette::Active, TQColorGroup::Highlight, sgiPal.active().midlight() ); @@ -224,89 +224,89 @@ TQSGIStyle::polish( TQWidget* w ) sgiPal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, sgiPal.disabled().midlight() ); sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().text() ); - } else if ( ::tqt_cast(w) || ::tqt_cast(w) ) { + } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQToolBar")) ) { sgiPal.setColor( TQColorGroup::Button, sgiPal.active().midlight() ); } - w->setPalette( sgiPal ); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetPalette, TQStyleWidgetActionRequestData(sgiPal)); } - if ( ::tqt_cast(w) || ::tqt_cast(w) || ::tqt_cast(w) ) { - w->installEventFilter( this ); - w->setMouseTracking( TRUE ); + if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) { + installObjectEventHandler(ceData, elementFlags, ptr, this); + widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking); #ifndef QT_NO_SCROLLBAR - if ( ::tqt_cast(w) ) - w->setBackgroundMode( TQWidget::NoBackground ); + if ( ceData.widgetObjectTypes.contains("TQScrollBar") ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::NoBackground)); + } #endif - } else if ( ::tqt_cast(w) ) { + } else if ( ceData.widgetObjectTypes.contains("TQComboBox") ) { TQFont f = TQApplication::font(); f.setBold( TRUE ); f.setItalic( TRUE ); - w->setFont( f ); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); #ifndef QT_NO_MENUBAR - } else if ( ::tqt_cast(w) ) { - ((TQFrame*) w)->setFrameStyle(TQFrame::StyledPanel | TQFrame::Raised); - w->setBackgroundMode( TQWidget::PaletteBackground ); + } else if ( ceData.widgetObjectTypes.contains("TQMenuBar") ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised)); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground)); TQFont f = TQApplication::font(); f.setBold( TRUE ); f.setItalic( TRUE ); - w->setFont( f ); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); #endif #ifndef QT_NO_POPUPMENU - } else if ( ::tqt_cast(w) ) { - ((TQFrame*) w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) + 1 ); + } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) { + TQStyleWidgetActionRequestData requestData; + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) + 1)); TQFont f = TQApplication::font(); f.setBold( TRUE ); f.setItalic( TRUE ); - w->setFont( f ); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f)); #endif - } else if ( ::tqt_cast(w) || w->inherits("TQToolBarSeparator") ) { - w->setBackgroundMode( TQWidget::PaletteBackground ); + } else if ( (ceData.widgetObjectTypes.contains("TQToolBar")) || (ceData.widgetObjectTypes.contains("TQToolBarSeparator")) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground)); } } /*! \reimp */ void -TQSGIStyle::unPolish( TQWidget* w ) +TQSGIStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr ) { - if ( ::tqt_cast(w) || ::tqt_cast(w) || ::tqt_cast(w) ) { - w->removeEventFilter( this ); + if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) { + removeObjectEventHandler(ceData, elementFlags, ptr, this); #ifndef QT_NO_POPUPMENU - } else if ( ::tqt_cast(w) ) { - ((TQFrame*)w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) ); - w->setFont( TQApplication::font() ); + } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ))); + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font())); #endif #if !defined(QT_NO_MENUBAR) || !defined(QT_NO_COMBOBOX) - } else if ( ::tqt_cast(w) || ::tqt_cast(w) ) { - w->setFont( TQApplication::font() ); + } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQComboBox")) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font())); #endif } } /*! \reimp */ -bool TQSGIStyle::eventFilter( TQObject* o, TQEvent* e ) +bool TQSGIStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) { - if ( !o->isWidgetType() || e->type() == TQEvent::Paint ) - return TQMotifStyle::eventFilter( o, e ); - - TQWidget *widget = (TQWidget*)o; + if ( (!(ceData.widgetObjectTypes.contains("TQWidget"))) || (e->type() == TQEvent::Paint) ) + return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e ); switch ( e->type() ) { case TQEvent::MouseButtonPress: { #ifndef QT_NO_SCROLLBAR - if ( ::tqt_cast(widget) ) { - d->lastScrollbarRect.rect = ((TQScrollBar*)widget)->sliderRect(); - d->lastScrollbarRect.scrollbar = ((TQScrollBar*)widget); - widget->repaint( FALSE ); + if (ceData.widgetObjectTypes.contains("TQScrollBar")) { + d->lastScrollbarRect.rect = ceData.sliderRect; + d->lastScrollbarRect.scrollbar = source; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); } else #endif { #ifndef QT_NO_SLIDER - if ( ::tqt_cast(widget) ) { - d->lastSliderRect.rect = ((TQSlider*)widget)->sliderRect(); - d->lastSliderRect.slider = ((TQSlider*)widget); - widget->repaint( FALSE ); + if (ceData.widgetObjectTypes.contains("TQSlider")) { + d->lastSliderRect.rect = ceData.sliderRect; + d->lastSliderRect.slider = source; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); } #endif } @@ -317,52 +317,52 @@ bool TQSGIStyle::eventFilter( TQObject* o, TQEvent* e ) { if ( 0 ) { #ifndef QT_NO_SCROLLBAR - } else if ( ::tqt_cast(widget) ) { + } else if (ceData.widgetObjectTypes.contains("TQScrollBar")) { TQRect oldRect = d->lastScrollbarRect.rect; d->lastScrollbarRect.rect = TQRect( 0, -1, 0, -1 ); - widget->repaint( oldRect, FALSE ); + widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect)); #endif #ifndef QT_NO_SLIDER - } else if ( ::tqt_cast(widget) ) { + } else if (ceData.widgetObjectTypes.contains("TQSlider")) { TQRect oldRect = d->lastSliderRect.rect; d->lastSliderRect.rect = TQRect( 0, -1, 0, -1 ); - widget->repaint( oldRect, FALSE ); + widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect)); #endif } } break; case TQEvent::MouseMove: - if ( !widget->isActiveWindow() ) + if ( !(elementFlags & CEF_IsActiveWindow) ) break; if ( ((TQMouseEvent*)e)->button() ) break; - d->hotWidget = widget; + d->hotWidget = source; d->mousePos = ((TQMouseEvent*)e)->pos(); - widget->repaint( FALSE ); + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); break; case TQEvent::Enter: - if ( !widget->isActiveWindow() ) + if ( !(elementFlags & CEF_IsActiveWindow) ) break; - d->hotWidget = widget; - widget->repaint( FALSE ); + d->hotWidget = source; + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); break; case TQEvent::Leave: - if ( !widget->isActiveWindow() ) + if ( !(elementFlags & CEF_IsActiveWindow) ) break; - if ( widget == d->hotWidget) { + if ( source == d->hotWidget) { d->hotWidget = 0; - widget->repaint( FALSE ); + widgetActionRequest(ceData, elementFlags, source, WAR_Repaint); } break; default: break; } - return TQMotifStyle::eventFilter( o, e ); + return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e ); } static const int sgiItemFrame = 2; // menu item frame width -- cgit v1.2.1