Commit c5ca8aa0 authored by Erwan Tulou's avatar Erwan Tulou
Browse files

skins2: sliderBg (same issue as slider wrt to notifyLayout)

parent 56d4e908
...@@ -171,6 +171,7 @@ void CtrlSliderCursor::notifyLayout( int width, int height, ...@@ -171,6 +171,7 @@ void CtrlSliderCursor::notifyLayout( int width, int height,
} }
} }
void CtrlSliderCursor::onUpdate( Subject<VarPercent> &rVariable, void *arg ) void CtrlSliderCursor::onUpdate( Subject<VarPercent> &rVariable, void *arg )
{ {
(void)rVariable; (void)arg; (void)rVariable; (void)arg;
...@@ -473,6 +474,26 @@ void CtrlSliderBg::associateCursor( CtrlSliderCursor &rCursor ) ...@@ -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 CtrlSliderBg::onUpdate( Subject<VarPercent> &rVariable, void*arg )
{ {
(void)rVariable; (void)arg; (void)rVariable; (void)arg;
...@@ -482,14 +503,8 @@ void CtrlSliderBg::onUpdate( Subject<VarPercent> &rVariable, void*arg ) ...@@ -482,14 +503,8 @@ void CtrlSliderBg::onUpdate( Subject<VarPercent> &rVariable, void*arg )
m_position = position; m_position = position;
// Compute the resize factors // redraw the entire control
float factorX, factorY; notifyLayout();
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 );
} }
......
...@@ -157,6 +157,10 @@ public: ...@@ -157,6 +157,10 @@ public:
/// Method called when the control is resized /// Method called when the control is resized
virtual void onResize(); 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) /// Get the type of control (custom RTTI)
virtual string getType() const { return "slider_bg"; } virtual string getType() const { return "slider_bg"; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment