Commit 9427bb62 authored by Erwan Tulou's avatar Erwan Tulou

skins2: small optimisation

Only update image and notify for those mouse events that we care about.
This removes the job being done twice (once on mouse pressed and once
 on mouse released)
parent 6028275a
...@@ -512,6 +512,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -512,6 +512,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
it->m_selected = (*it).m_selected || select; it->m_selected = (*it).m_selected || select;
select = nextSelect; select = nextSelect;
} }
// Redraw the control
makeImage();
notifyLayout();
} }
else if( rEvent.getAsString().find( "mouse:left:down:ctrl" ) != else if( rEvent.getAsString().find( "mouse:left:down:ctrl" ) !=
string::npos ) string::npos )
...@@ -523,6 +526,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -523,6 +526,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
it->m_selected = !it->m_selected; it->m_selected = !it->m_selected;
m_pLastSelected = &*it; m_pLastSelected = &*it;
} }
// Redraw the control
makeImage();
notifyLayout();
} }
else if( rEvent.getAsString().find( "mouse:left:down:shift" ) != else if( rEvent.getAsString().find( "mouse:left:down:shift" ) !=
string::npos ) string::npos )
...@@ -551,6 +557,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -551,6 +557,9 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
it->m_selected = select; it->m_selected = select;
select = nextSelect; select = nextSelect;
} }
// Redraw the control
makeImage();
notifyLayout();
} }
else if( rEvent.getAsString().find( "mouse:left:down" ) != else if( rEvent.getAsString().find( "mouse:left:down" ) !=
string::npos ) string::npos )
...@@ -585,8 +594,10 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -585,8 +594,10 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
} }
} }
} }
// Redraw the control
makeImage();
notifyLayout();
} }
else if( rEvent.getAsString().find( "mouse:left:dblclick" ) != else if( rEvent.getAsString().find( "mouse:left:dblclick" ) !=
string::npos ) string::npos )
{ {
...@@ -596,11 +607,11 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -596,11 +607,11 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
// Execute the action associated to this item // Execute the action associated to this item
m_rTree.action( &*it ); m_rTree.action( &*it );
} }
}
// Redraw the control // Redraw the control
makeImage(); makeImage();
notifyLayout(); notifyLayout();
} }
}
else if( rEvent.getAsString().find( "scroll" ) != string::npos ) else if( rEvent.getAsString().find( "scroll" ) != string::npos )
{ {
......
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