Commit 5cbb5d86 authored by Erwan Tulou's avatar Erwan Tulou

skins2: remove unnecessary notifyLayout()

In today's implementation, notifyLayout() for a control leads to a whole
 layout rebuilt. Therefore, this function must be called _only_ if needed.

- Never needed in onResize() since we are already in the process of rebuilding
the whole layout. Calling notifyLayout() means the job is done twice.
- Never needed in onPositionChange() for the same reason as onResize().
- Not needed for a checkbox since already called in setImage() two lines above.
parent e0674167
...@@ -276,7 +276,5 @@ void CtrlCheckbox::changeButton() ...@@ -276,7 +276,5 @@ void CtrlCheckbox::changeButton()
// Notify the window the tooltip has changed // Notify the window the tooltip has changed
notifyTooltipChange(); notifyTooltipChange();
// Refresh
notifyLayout();
} }
...@@ -78,9 +78,8 @@ void CtrlList::onUpdate( Subject<VarPercent> &rPercent, void *arg ) ...@@ -78,9 +78,8 @@ void CtrlList::onUpdate( Subject<VarPercent> &rPercent, void *arg )
// Get the size of the control // Get the size of the control
const Position *pPos = getPosition(); const Position *pPos = getPosition();
if( !pPos ) if( !pPos )
{
return; return;
}
int height = pPos->getHeight(); int height = pPos->getHeight();
// How many lines can be displayed ? // How many lines can be displayed ?
...@@ -114,9 +113,8 @@ void CtrlList::onResize() ...@@ -114,9 +113,8 @@ void CtrlList::onResize()
// Get the size of the control // Get the size of the control
const Position *pPos = getPosition(); const Position *pPos = getPosition();
if( !pPos ) if( !pPos )
{
return; return;
}
int height = pPos->getHeight(); int height = pPos->getHeight();
// How many lines can be displayed ? // How many lines can be displayed ?
...@@ -142,14 +140,12 @@ void CtrlList::onResize() ...@@ -142,14 +140,12 @@ void CtrlList::onResize()
} }
makeImage(); makeImage();
notifyLayout();
} }
void CtrlList::onPositionChange() void CtrlList::onPositionChange()
{ {
makeImage(); makeImage();
notifyLayout();
} }
......
...@@ -244,13 +244,11 @@ void CtrlTree::onResize() ...@@ -244,13 +244,11 @@ void CtrlTree::onResize()
// Redraw the control if the position has changed // Redraw the control if the position has changed
m_firstPos = it; m_firstPos = it;
makeImage(); makeImage();
notifyLayout();
} }
void CtrlTree::onPositionChange() void CtrlTree::onPositionChange()
{ {
makeImage(); makeImage();
notifyLayout();
} }
void CtrlTree::handleEvent( EvtGeneric &rEvent ) void CtrlTree::handleEvent( EvtGeneric &rEvent )
......
Markdown is supported
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