diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/root.c | 8 | ||||
-rw-r--r-- | src/ui/util.c | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/ui/root.c b/src/ui/root.c index a3c2e0ae..64043fd3 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -318,9 +318,12 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
318 | if (equal_Command(cmd, "menu.open")) { | 318 | if (equal_Command(cmd, "menu.open")) { |
319 | iWidget *button = pointer_Command(cmd); | 319 | iWidget *button = pointer_Command(cmd); |
320 | iWidget *menu = findChild_Widget(button, "menu"); | 320 | iWidget *menu = findChild_Widget(button, "menu"); |
321 | const iBool isPlacedUnder = argLabel_Command(cmd, "under"); | ||
321 | iAssert(menu); | 322 | iAssert(menu); |
322 | if (!isVisible_Widget(menu)) { | 323 | if (!isVisible_Widget(menu)) { |
323 | openMenu_Widget(menu, topLeft_Rect(bounds_Widget(button))); | 324 | openMenu_Widget(menu, |
325 | isPlacedUnder ? bottomLeft_Rect(bounds_Widget(button)) | ||
326 | : topLeft_Rect(bounds_Widget(button))); | ||
324 | } | 327 | } |
325 | else { | 328 | else { |
326 | closeMenu_Widget(menu); | 329 | closeMenu_Widget(menu); |
@@ -416,7 +419,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
416 | } | 419 | } |
417 | iWidget *menu = | 420 | iWidget *menu = |
418 | makeMenu_Widget(button, constData_Array(&items), size_Array(&items)); | 421 | makeMenu_Widget(button, constData_Array(&items), size_Array(&items)); |
419 | openMenu_Widget(menu, topLeft_Rect(bounds_Widget(button))); | 422 | openMenu_Widget(menu, bottomLeft_Rect(bounds_Widget(button))); |
420 | deinit_Array(&items); | 423 | deinit_Array(&items); |
421 | return iTrue; | 424 | return iTrue; |
422 | } | 425 | } |
@@ -1484,6 +1487,7 @@ void createUserInterface_Root(iRoot *d) { | |||
1484 | iLabelWidget *navMenu = | 1487 | iLabelWidget *navMenu = |
1485 | makeMenuButton_LabelWidget(menu_Icon, navMenuItems_, iElemCount(navMenuItems_)); | 1488 | makeMenuButton_LabelWidget(menu_Icon, navMenuItems_, iElemCount(navMenuItems_)); |
1486 | # endif | 1489 | # endif |
1490 | setCommand_LabelWidget(navMenu, collectNewCStr_String("menu.open under:1")); | ||
1487 | setAlignVisually_LabelWidget(navMenu, iTrue); | 1491 | setAlignVisually_LabelWidget(navMenu, iTrue); |
1488 | setId_Widget(addChildFlags_Widget(navBar, iClob(navMenu), collapse_WidgetFlag), "navbar.menu"); | 1492 | setId_Widget(addChildFlags_Widget(navBar, iClob(navMenu), collapse_WidgetFlag), "navbar.menu"); |
1489 | #endif | 1493 | #endif |
diff --git a/src/ui/util.c b/src/ui/util.c index 41e645de..31907721 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -680,7 +680,7 @@ static iBool isCommandIgnoredByMenus_(const char *cmd) { | |||
680 | static iLabelWidget *parentMenuButton_(const iWidget *menu) { | 680 | static iLabelWidget *parentMenuButton_(const iWidget *menu) { |
681 | if (isInstance_Object(menu->parent, &Class_LabelWidget)) { | 681 | if (isInstance_Object(menu->parent, &Class_LabelWidget)) { |
682 | iLabelWidget *button = (iLabelWidget *) menu->parent; | 682 | iLabelWidget *button = (iLabelWidget *) menu->parent; |
683 | if (!cmp_String(command_LabelWidget(button), "menu.open")) { | 683 | if (equal_Command(cstr_String(command_LabelWidget(button)), "menu.open")) { |
684 | return button; | 684 | return button; |
685 | } | 685 | } |
686 | } | 686 | } |