[vlc-commits] skins2: sliderBg (same issue as slider wrt to notifyLayout)
Erwan Tulou
git at videolan.org
Thu Apr 25 23:37:06 CEST 2013
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Apr 25 23:29:28 2013 +0200| [c5ca8aa09edaa0369d0f2a18806f24b159b66d5a] | committer: Erwan Tulou
skins2: sliderBg (same issue as slider wrt to notifyLayout)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c5ca8aa09edaa0369d0f2a18806f24b159b66d5a
---
modules/gui/skins2/controls/ctrl_slider.cpp | 31 ++++++++++++++++++++-------
modules/gui/skins2/controls/ctrl_slider.hpp | 4 ++++
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/modules/gui/skins2/controls/ctrl_slider.cpp b/modules/gui/skins2/controls/ctrl_slider.cpp
index 3d627d9..8dd5d8d 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<VarPercent> &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<VarPercent> &rVariable, void*arg )
{
(void)rVariable; (void)arg;
@@ -482,14 +503,8 @@ void CtrlSliderBg::onUpdate( Subject<VarPercent> &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 4be24de..8a59111 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"; }
More information about the vlc-commits
mailing list