Improve sub-sub-menu handling

This commit is contained in:
Markus Gans 2015-12-12 00:50:59 +01:00
parent 700c10ef1f
commit 8099c16b57
4 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,6 @@
2015-12-12 Markus Gans <guru.mail@muenster.de>
* Improve sub-sub-menu handling
2015-12-10 Markus Gans <guru.mail@muenster.de> 2015-12-10 Markus Gans <guru.mail@muenster.de>
* PC encoding: Avoid to print ASCII sign 0x00..0x1f in xterm * PC encoding: Avoid to print ASCII sign 0x00..0x1f in xterm
* Newfont Bullet sign * Newfont Bullet sign

View File

@ -180,7 +180,7 @@ void FMenu::menu_dimension()
while ( iter != end ) while ( iter != end )
{ {
(*iter)->setGeometry (item_X, item_Y, int(maxItemWidth), 1); (*iter)->setGeometry (item_X, item_Y, int(maxItemWidth), 1);
if ( (*iter)->hasMenu() ) if ( (*iter)->hasMenu() )
{//(*iter)->setText( FString().setNumber(itemlist.size()) ); {//(*iter)->setText( FString().setNumber(itemlist.size()) );
int menu_X = (*iter)->getGlobalX() + int(maxItemWidth); int menu_X = (*iter)->getGlobalX() + int(maxItemWidth);
@ -290,8 +290,8 @@ bool FMenu::containsMenuStructure (int x, int y) const
if ( getGeometryGlobal().contains(x,y) ) if ( getGeometryGlobal().contains(x,y) )
return true; return true;
else if ( si && si->hasMenu() ) else if ( si && si->hasMenu() && open_sub_menu )
return si->getMenu()->getGeometryGlobal().contains(x,y); return si->getMenu()->containsMenuStructure(x,y);
else if ( item && item->getGeometryGlobal().contains(x,y) ) else if ( item && item->getGeometryGlobal().contains(x,y) )
return true; return true;
else else
@ -1207,6 +1207,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
setClickedWidget(open_sub_menu); setClickedWidget(open_sub_menu);
open_sub_menu->onMouseMove(_ev); open_sub_menu->onMouseMove(_ev);
delete _ev; delete _ev;
return;
} }
else if ( ! mouse_over_menu && mouse_over_supermenu ) else if ( ! mouse_over_menu && mouse_over_supermenu )
{ {
@ -1219,6 +1220,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
setClickedWidget(smenu); setClickedWidget(smenu);
smenu->onMouseMove(_ev); smenu->onMouseMove(_ev);
delete _ev; delete _ev;
return;
} }
else if ( mouse_over_menubar ) else if ( mouse_over_menubar )
{ {
@ -1233,6 +1235,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
mbar->mouse_down = true; mbar->mouse_down = true;
mbar->onMouseMove(_ev); mbar->onMouseMove(_ev);
delete _ev; delete _ev;
return;
} }
else if ( ! hasSelectedItem() && statusBar() && mouse_over_menu ) else if ( ! hasSelectedItem() && statusBar() && mouse_over_menu )
{ {
@ -1250,7 +1253,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
if ( focus_changed ) if ( focus_changed )
redraw(); redraw();
if ( show_sub_menu ) if ( show_sub_menu )
{ {
// close open sub menu // close open sub menu

View File

@ -199,12 +199,12 @@ Menu::Menu (FWidget* parent)
Headline1->ignorePadding(); Headline1->ignorePadding();
Headline1->setGeometry(3,2,5,1); Headline1->setGeometry(3,2,5,1);
Headline1->setEmphasis(); Headline1->setEmphasis();
FLabel* Headline2 = new FLabel(" Function ", this); FLabel* Headline2 = new FLabel(" Function ", this);
Headline2->ignorePadding(); Headline2->ignorePadding();
Headline2->setGeometry(15,2,10,1); Headline2->setGeometry(15,2,10,1);
Headline2->setEmphasis(); Headline2->setEmphasis();
// Info label // Info label
FLabel* Info = new FLabel("<F10> Activate menu bar\n" FLabel* Info = new FLabel("<F10> Activate menu bar\n"
"<Meta>+<X> Exit", this); "<Meta>+<X> Exit", this);

View File

@ -720,7 +720,7 @@ void MyDialog::cb_view (FWidget*, void* data_ptr)
{ {
FString file; FString file;
FMenuItem* item = static_cast<FMenuItem*>(data_ptr); FMenuItem* item = static_cast<FMenuItem*>(data_ptr);
if ( item && item->getText() ) if ( item && item->getText() )
file = item->getText(); file = item->getText();
else else