From: Erwan Tulou Date: Thu, 25 Apr 2013 21:29:28 +0000 (+0200) Subject: skins2: sliderBg (same issue as slider wrt to notifyLayout) X-Git-Tag: 2.1.0-git~434 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c5ca8aa09edaa0369d0f2a18806f24b159b66d5a;p=vlc skins2: sliderBg (same issue as slider wrt to notifyLayout) --- diff --git a/modules/gui/skins2/controls/ctrl_slider.cpp b/modules/gui/skins2/controls/ctrl_slider.cpp index 3d627d98ad..8dd5d8daeb 100644 --- a/modules/gui/skins2/controls/ctrl_slider.cpp +++ b/modules/gui/skins2/controls/ctrl_slider.cpp @@ -171,6 +171,7 @@ void CtrlSliderCursor::notifyLayout( int width, int height, } } + void CtrlSliderCursor::onUpdate( Subject &rVariable, void *arg ) { (void)rVariable; (void)arg; @@ -473,6 +474,26 @@ void CtrlSliderBg::associateCursor( CtrlSliderCursor &rCursor ) } +void CtrlSliderBg::notifyLayout( int width, int height, + int xOffSet, int yOffSet ) +{ + if( width > 0 && height > 0 ) + { + CtrlGeneric::notifyLayout( width, height, xOffSet, yOffSet ); + } + else + { + // Compute the resize factors + float factorX, factorY; + getResizeFactors( factorX, factorY ); + // real background size + int width = m_bgWidth - (int)(m_padHoriz * factorX); + int height = m_bgHeight - (int)(m_padVert * factorY); + CtrlGeneric::notifyLayout( width, height ); + } +} + + void CtrlSliderBg::onUpdate( Subject &rVariable, void*arg ) { (void)rVariable; (void)arg; @@ -482,14 +503,8 @@ void CtrlSliderBg::onUpdate( Subject &rVariable, void*arg ) m_position = position; - // Compute the resize factors - float factorX, factorY; - getResizeFactors( factorX, factorY ); - // real background size - int width = m_bgWidth - (int)(m_padHoriz * factorX); - int height = m_bgHeight - (int)(m_padVert * factorY); - - notifyLayout( width, height ); + // redraw the entire control + notifyLayout(); } diff --git a/modules/gui/skins2/controls/ctrl_slider.hpp b/modules/gui/skins2/controls/ctrl_slider.hpp index 4be24de5b8..8a59111730 100644 --- a/modules/gui/skins2/controls/ctrl_slider.hpp +++ b/modules/gui/skins2/controls/ctrl_slider.hpp @@ -157,6 +157,10 @@ public: /// Method called when the control is resized virtual void onResize(); + /// Method called to notify are to be updated + virtual void notifyLayout( int witdh = -1, int height = -1, + int xOffSet = 0, int yOffSet = 0 ); + /// Get the type of control (custom RTTI) virtual string getType() const { return "slider_bg"; }