]> git.sesse.net Git - vlc/commitdiff
skins2: slider fix notifyLayout wrongly removed
authorErwan Tulou <erwan10@videolan.org>
Thu, 25 Apr 2013 20:42:36 +0000 (22:42 +0200)
committerErwan Tulou <erwan10@videolan.org>
Thu, 25 Apr 2013 20:57:12 +0000 (22:57 +0200)
redefining notifyLayout is mandatory for sliders, because the default
notifyLayout based on position doesn't work well for this complicated control.
This function is called when visibility is turned on or off.

modules/gui/skins2/controls/ctrl_slider.cpp
modules/gui/skins2/controls/ctrl_slider.hpp

index 17c3b7368ae8aa201d74fec93a4456845ee3ccfc..3d627d98ad78336eb9f17ed68824315fdd14dd0e 100644 (file)
@@ -153,6 +153,24 @@ void CtrlSliderCursor::onResize()
 }
 
 
+void CtrlSliderCursor::notifyLayout( int width, int height,
+                                     int xOffSet, int yOffSet )
+{
+    if( width > 0 && height > 0 )
+    {
+        CtrlGeneric::notifyLayout( width, height, xOffSet, yOffSet );
+    }
+    else
+    {
+        onPositionChange();
+        const Position *pPos = getPosition();
+        CtrlGeneric::notifyLayout( m_lastCursorRect.width,
+                                   m_lastCursorRect.height,
+                                   m_lastCursorRect.x - pPos->getLeft(),
+                                   m_lastCursorRect.y - pPos->getTop() );
+    }
+}
+
 void CtrlSliderCursor::onUpdate( Subject<VarPercent> &rVariable, void *arg  )
 {
     (void)rVariable; (void)arg;
index 0b4e069f1699430f353966259e7bd106ed56e88f..4be24de5b80e8c866140f034d58d25ce3968a4cf 100644 (file)
@@ -71,6 +71,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 text of the tooltip
     virtual UString getTooltipText() const { return m_tooltip; }