Code simplification

This commit is contained in:
Markus Gans 2016-07-03 20:16:43 +02:00
parent 71b5b16865
commit b7c11c7c90
1 changed files with 32 additions and 33 deletions

View File

@ -583,8 +583,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
if ( mouse_y == 1 ) if ( mouse_y == 1 )
{ {
if ( mouse_x >= x1 if ( mouse_x >= x1 && mouse_x < x2 )
&& mouse_x < x2 )
{ {
// Mouse pointer over item // Mouse pointer over item
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() ) if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
@ -662,10 +661,9 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
if ( mouse_y == 1 ) if ( mouse_y == 1 )
{ {
if ( mouse_x >= x1 if ( (*iter)->isEnabled() && (*iter)->isSelected() )
&& mouse_x < x2 {
&& (*iter)->isEnabled() if ( mouse_x >= x1 && mouse_x < x2 )
&& (*iter)->isSelected() )
{ {
// Mouse pointer over item // Mouse pointer over item
if ( (*iter)->hasMenu() ) if ( (*iter)->hasMenu() )
@ -698,13 +696,14 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
} }
} }
} }
else if ( (*iter)->isEnabled() && (*iter)->isSelected() ) else
{ {
(*iter)->unsetSelected(); (*iter)->unsetSelected();
if ( getSelectedItem() == *iter ) if ( getSelectedItem() == *iter )
setSelectedItem(0); setSelectedItem(0);
redraw(); redraw();
} }
}
++iter; ++iter;
} }
} }