aboutsummaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky2017-01-08 18:18:54 -0300
committerJuan Linietsky2017-01-08 18:18:54 -0300
commitfa170cbc5862f1fbe76702d5fffa26136269cbb9 (patch)
tree64f5a53b161ea715d4658df5455fa69d0a56f6ab /scene
parent1b0930c435b3aa4a3ab41b4936b9ceaa2f1da775 (diff)
downloadgodot-fa170cbc5862f1fbe76702d5fffa26136269cbb9.tar.gz
godot-fa170cbc5862f1fbe76702d5fffa26136269cbb9.tar.zst
godot-fa170cbc5862f1fbe76702d5fffa26136269cbb9.zip
PopupMenu now emits both index_pressed and id_pressed instead of item_pressed, closes #3188
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/line_edit.cpp2
-rw-r--r--scene/gui/option_button.cpp2
-rw-r--r--scene/gui/popup_menu.cpp6
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/tree.cpp2
5 files changed, 8 insertions, 6 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index d5214a0c1..30c04608e 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1361,7 +1361,7 @@ LineEdit::LineEdit() {
menu->add_item(TTR("Clear"),MENU_CLEAR);
menu->add_separator();
menu->add_item(TTR("Undo"),MENU_UNDO,KEY_MASK_CMD|KEY_Z);
- menu->connect("item_pressed",this,"menu_option");
+ menu->connect("id_pressed",this,"menu_option");
expand_to_text_length=false;
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 010cacc14..1b5b21ae9 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -326,7 +326,7 @@ OptionButton::OptionButton() {
popup->hide();
popup->set_as_toplevel(true);
add_child(popup);
- popup->connect("item_pressed", this,"_selected");
+ popup->connect("id_pressed", this,"_selected");
current=-1;
set_text_align(ALIGN_LEFT);
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index c28c1cc61..34b2675c5 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -912,7 +912,8 @@ void PopupMenu::activate_item(int p_item) {
ERR_FAIL_INDEX(p_item,items.size());
ERR_FAIL_COND(items[p_item].separator);
int id = items[p_item].ID>=0?items[p_item].ID:p_item;
- emit_signal("item_pressed",id);
+ emit_signal("id_pressed",id);
+ emit_signal("index_pressed",p_item);
//hide all parent PopupMenue's
Node *next = get_parent();
@@ -1157,7 +1158,8 @@ void PopupMenu::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::ARRAY,"items",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_items"),_SCS("_get_items") );
ADD_PROPERTYNO( PropertyInfo(Variant::BOOL, "hide_on_item_selection" ), _SCS("set_hide_on_item_selection"), _SCS("is_hide_on_item_selection") );
- ADD_SIGNAL( MethodInfo("item_pressed", PropertyInfo( Variant::INT,"ID") ) );
+ ADD_SIGNAL( MethodInfo("id_pressed", PropertyInfo( Variant::INT,"ID") ) );
+ ADD_SIGNAL( MethodInfo("index_pressed", PropertyInfo( Variant::INT,"index") ) );
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 250efb7dc..cbc0c283d 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4836,7 +4836,7 @@ TextEdit::TextEdit() {
menu->add_item(TTR("Clear"),MENU_CLEAR);
menu->add_separator();
menu->add_item(TTR("Undo"),MENU_UNDO,KEY_MASK_CMD|KEY_Z);
- menu->connect("item_pressed",this,"menu_option");
+ menu->connect("id_pressed",this,"menu_option");
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index ca0a6d459..ba22320a2 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3688,7 +3688,7 @@ Tree::Tree() {
v_scroll->connect("value_changed", this,"_scroll_moved");
text_editor->connect("text_entered", this,"_text_editor_enter");
text_editor->connect("modal_close", this,"_text_editor_modal_close");
- popup_menu->connect("item_pressed", this,"_popup_select");
+ popup_menu->connect("id_pressed", this,"_popup_select");
value_editor->connect("value_changed", this,"_value_editor_changed");
value_editor->set_as_toplevel(true);