diff options
-rw-r--r-- | doc/classes/PopupMenu.xml | 15 | ||||
-rw-r--r-- | editor/editor_path.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/input_event_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 2 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 9 | ||||
-rw-r--r-- | scene/gui/popup_menu.h | 3 |
6 files changed, 28 insertions, 6 deletions
diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index bf80aa94a5..eb2b681071 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -201,6 +201,13 @@ Returns the accelerator of the item at the given [code]index[/code]. Accelerators are special combinations of keys that activate the item, no matter which control is focused. </description> </method> + <method name="get_item_horizontal_offset" qualifiers="const"> + <return type="int" /> + <argument index="0" name="index" type="int" /> + <description> + Returns the horizontal offset of the item at the given [code]index[/code]. + </description> + </method> <method name="get_item_icon" qualifiers="const"> <return type="Texture2D" /> <argument index="0" name="index" type="int" /> @@ -395,6 +402,14 @@ Enables/disables the item at the given [code]index[/code]. When it is disabled, it can't be selected and its action can't be invoked. </description> </method> + <method name="set_item_horizontal_offset"> + <return type="void" /> + <argument index="0" name="index" type="int" /> + <argument index="1" name="offset" type="int" /> + <description> + Sets the horizontal offset of the item at the given [code]index[/code]. + </description> + </method> <method name="set_item_icon"> <return type="void" /> <argument index="0" name="index" type="int" /> diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index 8747128962..6453db3b0b 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -72,7 +72,7 @@ void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) { int index = sub_objects_menu->get_item_count(); sub_objects_menu->add_icon_item(icon, proper_name, objects.size()); - sub_objects_menu->set_item_h_offset(index, p_depth * 10 * EDSCALE); + sub_objects_menu->set_item_horizontal_offset(index, p_depth * 10 * EDSCALE); objects.push_back(obj->get_instance_id()); _add_children_to_popup(obj, p_depth + 1); diff --git a/editor/plugins/input_event_editor_plugin.cpp b/editor/plugins/input_event_editor_plugin.cpp index fb0e260388..2acd0fca6e 100644 --- a/editor/plugins/input_event_editor_plugin.cpp +++ b/editor/plugins/input_event_editor_plugin.cpp @@ -84,8 +84,7 @@ InputEventConfigContainer::InputEventConfigContainer() { input_event_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); add_child(input_event_text); - open_config_button = memnew(Button); - open_config_button->set_text(TTR("Configure")); + open_config_button = EditorInspector::create_inspector_action_button(TTR("Configure")); open_config_button->connect("pressed", callable_mp(this, &InputEventConfigContainer::_configure_pressed)); add_child(open_config_button); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 9646462ead..08df4cdf3c 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2655,7 +2655,7 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) { } int index = menu_subresources->get_item_count(); menu_subresources->add_icon_item(icon, E.name.capitalize(), EDIT_SUBRESOURCE_BASE + subresources.size()); - menu_subresources->set_item_h_offset(index, p_depth * 10 * EDSCALE); + menu_subresources->set_item_horizontal_offset(index, p_depth * 10 * EDSCALE); subresources.push_back(obj->get_instance_id()); _add_children_to_popup(obj, p_depth + 1); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index c9eecf54dd..5931c112eb 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1274,6 +1274,11 @@ Ref<Shortcut> PopupMenu::get_item_shortcut(int p_idx) const { return items[p_idx].shortcut; } +int PopupMenu::get_item_horizontal_offset(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, items.size(), 0); + return items[p_idx].h_ofs; +} + int PopupMenu::get_item_state(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), -1); return items[p_idx].state; @@ -1339,7 +1344,7 @@ void PopupMenu::set_item_shortcut(int p_idx, const Ref<Shortcut> &p_shortcut, bo control->update(); } -void PopupMenu::set_item_h_offset(int p_idx, int p_offset) { +void PopupMenu::set_item_horizontal_offset(int p_idx, int p_offset) { if (p_idx < 0) { p_idx += get_item_count(); } @@ -1862,6 +1867,7 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("set_item_as_radio_checkable", "index", "enable"), &PopupMenu::set_item_as_radio_checkable); ClassDB::bind_method(D_METHOD("set_item_tooltip", "index", "tooltip"), &PopupMenu::set_item_tooltip); ClassDB::bind_method(D_METHOD("set_item_shortcut", "index", "shortcut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("set_item_horizontal_offset", "index", "offset"), &PopupMenu::set_item_horizontal_offset); ClassDB::bind_method(D_METHOD("set_item_multistate", "index", "state"), &PopupMenu::set_item_multistate); ClassDB::bind_method(D_METHOD("set_item_shortcut_disabled", "index", "disabled"), &PopupMenu::set_item_shortcut_disabled); @@ -1887,6 +1893,7 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("is_item_shortcut_disabled", "index"), &PopupMenu::is_item_shortcut_disabled); ClassDB::bind_method(D_METHOD("get_item_tooltip", "index"), &PopupMenu::get_item_tooltip); ClassDB::bind_method(D_METHOD("get_item_shortcut", "index"), &PopupMenu::get_item_shortcut); + ClassDB::bind_method(D_METHOD("get_item_horizontal_offset", "index"), &PopupMenu::get_item_horizontal_offset); ClassDB::bind_method(D_METHOD("set_current_index", "index"), &PopupMenu::set_current_index); ClassDB::bind_method(D_METHOD("get_current_index"), &PopupMenu::get_current_index); diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 53bc5a8c22..8218c6122e 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -186,7 +186,7 @@ public: void set_item_as_radio_checkable(int p_idx, bool p_radio_checkable); void set_item_tooltip(int p_idx, const String &p_tooltip); void set_item_shortcut(int p_idx, const Ref<Shortcut> &p_shortcut, bool p_global = false); - void set_item_h_offset(int p_idx, int p_offset); + void set_item_horizontal_offset(int p_idx, int p_offset); void set_item_multistate(int p_idx, int p_state); void toggle_item_multistate(int p_idx); void set_item_shortcut_disabled(int p_idx, bool p_disabled); @@ -212,6 +212,7 @@ public: bool is_item_shortcut_disabled(int p_idx) const; String get_item_tooltip(int p_idx) const; Ref<Shortcut> get_item_shortcut(int p_idx) const; + int get_item_horizontal_offset(int p_idx) const; int get_item_state(int p_idx) const; void set_current_index(int p_idx); |