diff options
-rw-r--r-- | include/vcl/scrbar.hxx | 26 | ||||
-rw-r--r-- | vcl/source/control/scrbar.cxx | 33 |
2 files changed, 28 insertions, 31 deletions
diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx index 946bcd9434df..bbe334b30379 100644 --- a/include/vcl/scrbar.hxx +++ b/include/vcl/scrbar.hxx @@ -93,17 +93,18 @@ public: virtual ~ScrollBar(); virtual void dispose() SAL_OVERRIDE; - virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; - virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE; - virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; - virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; - virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; - virtual void Resize() SAL_OVERRIDE; - virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; - virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; - virtual void GetFocus() SAL_OVERRIDE; - virtual void LoseFocus() SAL_OVERRIDE; + virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE; + virtual void Tracking(const TrackingEvent& rTEvt) SAL_OVERRIDE; + virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; + virtual void Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags) SAL_OVERRIDE; + virtual void Resize() SAL_OVERRIDE; + virtual void StateChanged(StateChangedType nType) SAL_OVERRIDE; + virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE; + virtual bool PreNotify(NotifyEvent& rNEvt) SAL_OVERRIDE; + virtual void GetFocus() SAL_OVERRIDE; + virtual void LoseFocus() SAL_OVERRIDE; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; using Window::Scroll; void Scroll(); @@ -151,7 +152,8 @@ class VCL_DLLPUBLIC ScrollBarBox : public vcl::Window private: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings(); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext); public: explicit ScrollBarBox( vcl::Window* pParent, WinBits nStyle = 0 ); diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 696cae77366f..8e9f4b7d80ba 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -106,7 +106,6 @@ void ScrollBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) long nScrollSize = GetSettings().GetStyleSettings().GetScrollBarSize(); SetSizePixel( Size( nScrollSize, nScrollSize ) ); - SetBackground(); } void ScrollBar::ImplInitStyle( WinBits nStyle ) @@ -1121,6 +1120,11 @@ void ScrollBar::KeyInput( const KeyEvent& rKEvt ) Control::KeyInput( rKEvt ); } +void ScrollBar::ApplySettings(vcl::RenderContext& rRenderContext) +{ + rRenderContext.SetBackground(); +} + void ScrollBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { ImplDraw(rRenderContext, SCRBAR_DRAW_ALL); @@ -1448,14 +1452,13 @@ Size ScrollBar::getCurrentCalcSize() const return aCtrlRegion.GetSize(); } -void ScrollBarBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) +void ScrollBarBox::ImplInit(vcl::Window* pParent, WinBits nStyle) { Window::ImplInit( pParent, nStyle, NULL ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); long nScrollSize = rStyleSettings.GetScrollBarSize(); - SetSizePixel( Size( nScrollSize, nScrollSize ) ); - ImplInitSettings(); + SetSizePixel(Size(nScrollSize, nScrollSize)); } ScrollBarBox::ScrollBarBox( vcl::Window* pParent, WinBits nStyle ) : @@ -1464,18 +1467,12 @@ ScrollBarBox::ScrollBarBox( vcl::Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); } -void ScrollBarBox::ImplInitSettings() +void ScrollBarBox::ApplySettings(vcl::RenderContext& rRenderContext) { - // FIXME: Hack so that we can build DockingWindows even without background - // and not everything has been switched over yet - if ( IsBackground() ) + if (rRenderContext.IsBackground()) { - Color aColor; - if ( IsControlBackground() ) - aColor = GetControlBackground(); - else - aColor = GetSettings().GetStyleSettings().GetFaceColor(); - SetBackground( aColor ); + Color aColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor(); + ApplyControlBackground(rRenderContext, aColor); } } @@ -1483,9 +1480,8 @@ void ScrollBarBox::StateChanged( StateChangedType nType ) { Window::StateChanged( nType ); - if ( nType == StateChangedType::ControlBackground ) + if (nType == StateChangedType::ControlBackground) { - ImplInitSettings(); Invalidate(); } } @@ -1494,10 +1490,9 @@ void ScrollBarBox::DataChanged( const DataChangedEvent& rDCEvt ) { Window::DataChanged( rDCEvt ); - if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) + if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) { - ImplInitSettings(); Invalidate(); } } |