]> git.sesse.net Git - vlc/commitdiff
skins2: sliderBg (same issue as slider wrt to notifyLayout)
authorErwan Tulou <erwan10@videolan.org>
Thu, 25 Apr 2013 21:29:28 +0000 (23:29 +0200)
committerErwan Tulou <erwan10@videolan.org>
Thu, 25 Apr 2013 21:33:22 +0000 (23:33 +0200)
modules/gui/skins2/controls/ctrl_slider.cpp
modules/gui/skins2/controls/ctrl_slider.hpp

index 3d627d98ad78336eb9f17ed68824315fdd14dd0e..8dd5d8daeb4adb4e99dec352c4687253f1ce7613 100644 (file)
@@ -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();
 }
 
 
index 4be24de5b80e8c866140f034d58d25ce3968a4cf..8a5911173083db47a0cc8d94c725349848dd95e9 100644 (file)
@@ -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"; }