summaryrefslogtreecommitdiff
path: root/scene/gui/popup_menu.cpp
diff options
context:
space:
mode:
authorAnton Yabchinskiy <arn@bestmx.ru>2015-11-02 20:25:01 +0300
committerAnton Yabchinskiy <arn@bestmx.ru>2015-11-02 20:25:01 +0300
commit3b9868d2e44740c03861c64020a8b5d4d6da031d (patch)
tree8ff5f9671122f946487848ce286d336c9b650c2c /scene/gui/popup_menu.cpp
parentdc8df8a91a995796f0f330bf6bb6b209f6dfce08 (diff)
parentb2f9acb8c96aed0505cbac21661e21e4acef710f (diff)
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'scene/gui/popup_menu.cpp')
-rw-r--r--scene/gui/popup_menu.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index e706053592..6c21ea639f 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -323,8 +323,10 @@ void PopupMenu::_input_event(const InputEvent &p_event) {
invalidated_click=false;
break;
}
- if (over<0 || items[over].separator || items[over].disabled)
+ if (over<0 || items[over].separator || items[over].disabled) {
+ hide();
break; //non-activable
+ }
if (items[over].submenu!="") {
@@ -738,10 +740,18 @@ int PopupMenu::find_item_by_accelerator(uint32_t p_accel) const {
void PopupMenu::activate_item(int p_item) {
-
ERR_FAIL_INDEX(p_item,items.size());
ERR_FAIL_COND(items[p_item].separator);
emit_signal("item_pressed",items[p_item].ID);
+
+ //hide all parent PopupMenue's
+ Node *next = get_parent();
+ PopupMenu *pop = next->cast_to<PopupMenu>();
+ while (pop) {
+ pop->hide();
+ next = next->get_parent();
+ pop = next->cast_to<PopupMenu>();
+ }
hide();
}