From 5cbb5d860cd870b552cf235e4ea385e3941dbc79 Mon Sep 17 00:00:00 2001 From: Erwan Tulou Date: Thu, 14 Jan 2010 10:01:45 +0100 Subject: [PATCH] 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. --- modules/gui/skins2/controls/ctrl_checkbox.cpp | 2 -- modules/gui/skins2/controls/ctrl_list.cpp | 8 ++------ modules/gui/skins2/controls/ctrl_tree.cpp | 2 -- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/gui/skins2/controls/ctrl_checkbox.cpp b/modules/gui/skins2/controls/ctrl_checkbox.cpp index 89c2c57ea2..0f0116faf3 100644 --- a/modules/gui/skins2/controls/ctrl_checkbox.cpp +++ b/modules/gui/skins2/controls/ctrl_checkbox.cpp @@ -276,7 +276,5 @@ void CtrlCheckbox::changeButton() // Notify the window the tooltip has changed notifyTooltipChange(); - // Refresh - notifyLayout(); } diff --git a/modules/gui/skins2/controls/ctrl_list.cpp b/modules/gui/skins2/controls/ctrl_list.cpp index 28c8be54b6..4bf7d1e757 100644 --- a/modules/gui/skins2/controls/ctrl_list.cpp +++ b/modules/gui/skins2/controls/ctrl_list.cpp @@ -78,9 +78,8 @@ void CtrlList::onUpdate( Subject &rPercent, void *arg ) // Get the size of the control const Position *pPos = getPosition(); if( !pPos ) - { return; - } + int height = pPos->getHeight(); // How many lines can be displayed ? @@ -114,9 +113,8 @@ void CtrlList::onResize() // Get the size of the control const Position *pPos = getPosition(); if( !pPos ) - { return; - } + int height = pPos->getHeight(); // How many lines can be displayed ? @@ -142,14 +140,12 @@ void CtrlList::onResize() } makeImage(); - notifyLayout(); } void CtrlList::onPositionChange() { makeImage(); - notifyLayout(); } diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp index 7450b48ee5..31d9cb503e 100644 --- a/modules/gui/skins2/controls/ctrl_tree.cpp +++ b/modules/gui/skins2/controls/ctrl_tree.cpp @@ -244,13 +244,11 @@ void CtrlTree::onResize() // Redraw the control if the position has changed m_firstPos = it; makeImage(); - notifyLayout(); } void CtrlTree::onPositionChange() { makeImage(); - notifyLayout(); } void CtrlTree::handleEvent( EvtGeneric &rEvent ) -- 2.39.5