diff options
author | Poommetee Ketson <poommetee@protonmail.com> | 2017-12-12 09:37:37 +0700 |
---|---|---|
committer | Poommetee Ketson <poommetee@protonmail.com> | 2017-12-12 09:41:17 +0700 |
commit | 9888a56639e8f033c4258043f768cbad53f82fd0 (patch) | |
tree | 398fadf04f7e03ebedaccf6fe591851bcee3e833 | |
parent | 36ce7c444d350b5fcd909f105fb6ca200f9d09df (diff) |
Change statable to multistate, remove extra separator
-rw-r--r-- | doc/classes/PopupMenu.xml | 4 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 28 | ||||
-rw-r--r-- | scene/gui/popup_menu.h | 12 |
4 files changed, 24 insertions, 25 deletions
diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index 42ed57e4af..372a97ecd9 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -391,7 +391,7 @@ <description> </description> </method> - <method name="set_item_statable"> + <method name="set_item_multistate"> <return type="void"> </return> <argument index="0" name="idx" type="int"> @@ -441,7 +441,7 @@ <description> </description> </method> - <method name="toggle_item_statable"> + <method name="toggle_item_multistate"> <return type="void"> </return> <argument index="0" name="idx" type="int"> diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 80638c6f1e..cefc957ebf 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4268,7 +4268,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) { case MENU_VISIBILITY_SKELETON: { const int idx = view_menu->get_popup()->get_item_index(MENU_VISIBILITY_SKELETON); - view_menu->get_popup()->toggle_item_statable(idx); + view_menu->get_popup()->toggle_item_multistate(idx); // Change icon const int state = view_menu->get_popup()->get_item_state(idx); @@ -5077,8 +5077,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { p->add_shortcut(ED_SHORTCUT("spatial_editor/settings", TTR("Settings")), MENU_VIEW_CAMERA_SETTINGS); p->add_separator(); - p->add_statable_item(TTR("Skeleton Gizmo visibility"), 3, 1, MENU_VISIBILITY_SKELETON); - p->add_separator(); + p->add_multistate_item(TTR("Skeleton Gizmo visibility"), 3, 1, MENU_VISIBILITY_SKELETON); p->set_item_checked(p->get_item_index(MENU_VIEW_ORIGIN), true); p->set_item_checked(p->get_item_index(MENU_VIEW_GRID), true); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index e37cdd5cc9..32f889e826 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -624,7 +624,7 @@ void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bo update(); } -void PopupMenu::add_statable_item(const String &p_label, int p_max_states, int p_default_state, int p_ID, uint32_t p_accel) { +void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_ID, uint32_t p_accel) { Item item; item.text = p_label; @@ -839,14 +839,14 @@ void PopupMenu::set_item_h_offset(int p_idx, int p_offset) { update(); } -void PopupMenu::set_item_statable(int p_idx, int p_state) { +void PopupMenu::set_item_multistate(int p_idx, int p_state) { ERR_FAIL_INDEX(p_idx, items.size()); items[p_idx].state = p_state; update(); } -void PopupMenu::toggle_item_statable(int p_idx) { +void PopupMenu::toggle_item_multistate(int p_idx) { ERR_FAIL_INDEX(p_idx, items.size()); if (0 >= items[p_idx].max_states) { @@ -940,7 +940,7 @@ void PopupMenu::activate_item(int p_item) { if (!hide_on_checkable_item_selection || !pop->is_hide_on_checkable_item_selection()) break; } else if (0 < items[p_item].max_states) { - if (!hide_on_statable_item_selection || !pop->is_hide_on_statable_item_selection()) + if (!hide_on_multistate_item_selection || !pop->is_hide_on_multistate_item_selection()) break; } else if (!hide_on_item_selection || !pop->is_hide_on_item_selection()) break; @@ -957,7 +957,7 @@ void PopupMenu::activate_item(int p_item) { if (!hide_on_checkable_item_selection) return; } else if (0 < items[p_item].max_states) { - if (!hide_on_statable_item_selection) + if (!hide_on_multistate_item_selection) return; } else if (!hide_on_item_selection) return; @@ -1093,14 +1093,14 @@ bool PopupMenu::is_hide_on_checkable_item_selection() const { return hide_on_checkable_item_selection; } -void PopupMenu::set_hide_on_statable_item_selection(bool p_enabled) { +void PopupMenu::set_hide_on_multistate_item_selection(bool p_enabled) { - hide_on_statable_item_selection = p_enabled; + hide_on_multistate_item_selection = p_enabled; } -bool PopupMenu::is_hide_on_statable_item_selection() const { +bool PopupMenu::is_hide_on_multistate_item_selection() const { - return hide_on_statable_item_selection; + return hide_on_multistate_item_selection; } String PopupMenu::get_tooltip(const Point2 &p_pos) const { @@ -1161,10 +1161,10 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("set_item_as_checkable", "idx", "enable"), &PopupMenu::set_item_as_checkable); ClassDB::bind_method(D_METHOD("set_item_tooltip", "idx", "tooltip"), &PopupMenu::set_item_tooltip); ClassDB::bind_method(D_METHOD("set_item_shortcut", "idx", "shortcut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("set_item_statable", "idx", "state"), &PopupMenu::set_item_statable); + ClassDB::bind_method(D_METHOD("set_item_multistate", "idx", "state"), &PopupMenu::set_item_multistate); ClassDB::bind_method(D_METHOD("toggle_item_checked", "idx"), &PopupMenu::toggle_item_checked); - ClassDB::bind_method(D_METHOD("toggle_item_statable", "idx"), &PopupMenu::toggle_item_statable); + ClassDB::bind_method(D_METHOD("toggle_item_multistate", "idx"), &PopupMenu::toggle_item_multistate); ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &PopupMenu::get_item_text); ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &PopupMenu::get_item_icon); @@ -1196,8 +1196,8 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(D_METHOD("set_hide_on_checkable_item_selection", "enable"), &PopupMenu::set_hide_on_checkable_item_selection); ClassDB::bind_method(D_METHOD("is_hide_on_checkable_item_selection"), &PopupMenu::is_hide_on_checkable_item_selection); - ClassDB::bind_method(D_METHOD("set_hide_on_state_item_selection", "enable"), &PopupMenu::set_hide_on_statable_item_selection); - ClassDB::bind_method(D_METHOD("is_hide_on_state_item_selection"), &PopupMenu::is_hide_on_statable_item_selection); + ClassDB::bind_method(D_METHOD("set_hide_on_state_item_selection", "enable"), &PopupMenu::set_hide_on_multistate_item_selection); + ClassDB::bind_method(D_METHOD("is_hide_on_state_item_selection"), &PopupMenu::is_hide_on_multistate_item_selection); ClassDB::bind_method(D_METHOD("_submenu_timeout"), &PopupMenu::_submenu_timeout); @@ -1222,7 +1222,7 @@ PopupMenu::PopupMenu() { set_as_toplevel(true); set_hide_on_item_selection(true); set_hide_on_checkable_item_selection(true); - set_hide_on_statable_item_selection(false); + set_hide_on_multistate_item_selection(false); submenu_timer = memnew(Timer); submenu_timer->set_wait_time(0.3); diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 5a10bf0765..ee514f4c4b 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -90,7 +90,7 @@ class PopupMenu : public Popup { bool invalidated_click; bool hide_on_item_selection; bool hide_on_checkable_item_selection; - bool hide_on_statable_item_selection; + bool hide_on_multistate_item_selection; Vector2 moved; Array _get_items() const; @@ -120,7 +120,7 @@ public: void add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false); void add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false); - void add_statable_item(const String &p_label, int p_max_states, int p_default_state, int p_ID = -1, uint32_t p_accel = 0); + void add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_ID = -1, uint32_t p_accel = 0); void set_item_text(int p_idx, const String &p_text); void set_item_icon(int p_idx, const Ref<Texture> &p_icon); @@ -135,8 +135,8 @@ public: 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_statable(int p_idx, int p_state); - void toggle_item_statable(int p_idx); + void set_item_multistate(int p_idx, int p_state); + void toggle_item_multistate(int p_idx); void toggle_item_checked(int p_idx); @@ -183,8 +183,8 @@ public: void set_hide_on_checkable_item_selection(bool p_enabled); bool is_hide_on_checkable_item_selection() const; - void set_hide_on_statable_item_selection(bool p_enabled); - bool is_hide_on_statable_item_selection() const; + void set_hide_on_multistate_item_selection(bool p_enabled); + bool is_hide_on_multistate_item_selection() const; PopupMenu(); ~PopupMenu(); |