diff options
Diffstat (limited to 'scene/gui/split_container.cpp')
-rw-r--r-- | scene/gui/split_container.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index 9796b32c6b..4736a1ad37 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -76,8 +76,8 @@ void SplitContainer::_resort() { bool second_expanded = (vertical ? second->get_v_size_flags() : second->get_h_size_flags()) & SIZE_EXPAND; // Determine the separation between items - Ref<Texture2D> g = get_theme_icon("grabber"); - int sep = get_theme_constant("separation"); + Ref<Texture2D> g = get_theme_icon(SNAME("grabber")); + int sep = get_theme_constant(SNAME("separation")); sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0; // Compute the minimum size @@ -131,8 +131,8 @@ Size2 SplitContainer::get_minimum_size() const { /* Calculate MINIMUM SIZE */ Size2i minimum; - Ref<Texture2D> g = get_theme_icon("grabber"); - int sep = get_theme_constant("separation"); + Ref<Texture2D> g = get_theme_icon(SNAME("grabber")); + int sep = get_theme_constant(SNAME("separation")); sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0; for (int i = 0; i < 2; i++) { @@ -173,7 +173,7 @@ void SplitContainer::_notification(int p_what) { } break; case NOTIFICATION_MOUSE_EXIT: { mouse_inside = false; - if (get_theme_constant("autohide")) { + if (get_theme_constant(SNAME("autohide"))) { update(); } } break; @@ -182,7 +182,7 @@ void SplitContainer::_notification(int p_what) { return; } - if (collapsed || (!dragging && !mouse_inside && get_theme_constant("autohide"))) { + if (collapsed || (!dragging && !mouse_inside && get_theme_constant(SNAME("autohide")))) { return; } @@ -190,8 +190,8 @@ void SplitContainer::_notification(int p_what) { return; } - int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_theme_constant("separation") : 0; - Ref<Texture2D> tex = get_theme_icon("grabber"); + int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_theme_constant(SNAME("separation")) : 0; + Ref<Texture2D> tex = get_theme_icon(SNAME("grabber")); Size2 size = get_size(); if (vertical) { @@ -206,7 +206,7 @@ void SplitContainer::_notification(int p_what) { } } -void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) { +void SplitContainer::gui_input(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility != DRAGGER_VISIBLE) { @@ -218,7 +218,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) { if (mb.is_valid()) { if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { if (mb->is_pressed()) { - int sep = get_theme_constant("separation"); + int sep = get_theme_constant(SNAME("separation")); if (vertical) { if (mb->get_position().y > middle_sep && mb->get_position().y < middle_sep + sep) { @@ -244,14 +244,14 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) { if (mm.is_valid()) { bool mouse_inside_state = false; if (vertical) { - mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_theme_constant("separation"); + mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_theme_constant(SNAME("separation")); } else { - mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_theme_constant("separation"); + mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_theme_constant(SNAME("separation")); } if (mouse_inside != mouse_inside_state) { mouse_inside = mouse_inside_state; - if (get_theme_constant("autohide")) { + if (get_theme_constant(SNAME("autohide"))) { update(); } } @@ -267,7 +267,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) { } should_clamp_split_offset = true; queue_sort(); - emit_signal("dragged", get_split_offset()); + emit_signal(SNAME("dragged"), get_split_offset()); } } @@ -277,7 +277,7 @@ Control::CursorShape SplitContainer::get_cursor_shape(const Point2 &p_pos) const } if (!collapsed && _getch(0) && _getch(1) && dragger_visibility == DRAGGER_VISIBLE) { - int sep = get_theme_constant("separation"); + int sep = get_theme_constant(SNAME("separation")); if (vertical) { if (p_pos.y > middle_sep && p_pos.y < middle_sep + sep) { @@ -337,8 +337,6 @@ bool SplitContainer::is_collapsed() const { } void SplitContainer::_bind_methods() { - ClassDB::bind_method(D_METHOD("_gui_input"), &SplitContainer::_gui_input); - ClassDB::bind_method(D_METHOD("set_split_offset", "offset"), &SplitContainer::set_split_offset); ClassDB::bind_method(D_METHOD("get_split_offset"), &SplitContainer::get_split_offset); ClassDB::bind_method(D_METHOD("clamp_split_offset"), &SplitContainer::clamp_split_offset); |