summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-09-21 02:18:40 -0300
committerMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-12-11 19:23:26 -0200
commit8f9447310d83c6519df5579d02a6adcd79840c04 (patch)
treeeac89a74dae9c6af6d6bc7bb0cf925146222fede /editor
parent37e198c32006d18c9443bf65963ba8182b7d76a6 (diff)
Enable toggle behaviour for buttons that trigger popups
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_properties.cpp6
-rw-r--r--editor/plugins/theme_editor_plugin.cpp2
2 files changed, 8 insertions, 0 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index ff7ab051b5..f7b784afd9 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -786,6 +786,7 @@ EditorPropertyLayers::EditorPropertyLayers() {
grid->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(grid);
button = memnew(Button);
+ button->set_toggle_mode(true);
button->set_text("..");
button->connect("pressed", this, "_button_pressed");
hb->add_child(button);
@@ -794,7 +795,9 @@ EditorPropertyLayers::EditorPropertyLayers() {
add_child(layers);
layers->set_hide_on_checkable_item_selection(false);
layers->connect("id_pressed", this, "_menu_pressed");
+ layers->connect("popup_hide", button, "set_pressed", varray(false));
}
+
///////////////////// INT /////////////////////////
void EditorPropertyInteger::_value_changed(double val) {
@@ -2492,6 +2495,7 @@ void EditorPropertyResource::_resource_selected() {
RES res = get_edited_object()->get(get_edited_property());
if (res.is_null()) {
+ edit->set_pressed(true);
_update_menu();
return;
}
@@ -2709,7 +2713,9 @@ EditorPropertyResource::EditorPropertyResource() {
add_child(menu);
edit = memnew(Button);
edit->set_flat(true);
+ edit->set_toggle_mode(true);
menu->connect("id_pressed", this, "_menu_option");
+ menu->connect("popup_hide", edit, "set_pressed", varray(false));
edit->connect("pressed", this, "_update_menu");
hbc->add_child(edit);
edit->connect("gui_input", this, "_button_input");
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index acee1a6942..8272f2b02b 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -802,6 +802,7 @@ ThemeEditor::ThemeEditor() {
type_edit->set_h_size_flags(SIZE_EXPAND_FILL);
type_hbc->add_child(type_edit);
type_menu = memnew(MenuButton);
+ type_menu->set_flat(false);
type_menu->set_text("..");
type_hbc->add_child(type_menu);
@@ -819,6 +820,7 @@ ThemeEditor::ThemeEditor() {
name_edit->set_h_size_flags(SIZE_EXPAND_FILL);
name_hbc->add_child(name_edit);
name_menu = memnew(MenuButton);
+ type_menu->set_flat(false);
name_menu->set_text("..");
name_hbc->add_child(name_menu);