diff options
Diffstat (limited to 'editor/editor_spin_slider.cpp')
-rw-r--r-- | editor/editor_spin_slider.cpp | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index cd28a65c7b..509a316ef3 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -33,8 +33,7 @@ #include "core/input/input.h" #include "core/math/expression.h" #include "core/os/keyboard.h" -#include "editor_node.h" -#include "editor_scale.h" +#include "editor/editor_scale.h" String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const { if (grabber->is_visible()) { @@ -301,12 +300,7 @@ void EditorSpinSlider::_draw_spin_slider() { int vofs = (size.height - font->get_height(font_size)) / 2 + font->get_ascent(font_size); Color fc = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SNAME("font_color"), SNAME("LineEdit")); - Color lc; - if (use_custom_label_color) { - lc = custom_label_color; - } else { - lc = fc; - } + Color lc = get_theme_color(is_read_only() ? SNAME("read_only_label_color") : SNAME("label_color")); if (flat && !label.is_empty()) { Color label_bg_color = get_theme_color(SNAME("dark_color_3"), SNAME("Editor")); @@ -431,47 +425,49 @@ void EditorSpinSlider::_draw_spin_slider() { void EditorSpinSlider::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: - case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_THEME_CHANGED: { _update_value_input_stylebox(); - break; + } break; - case NOTIFICATION_INTERNAL_PROCESS: + case NOTIFICATION_INTERNAL_PROCESS: { if (value_input_dirty) { value_input_dirty = false; value_input->set_text(get_text_value()); } set_process_internal(false); - break; + } break; - case NOTIFICATION_DRAW: + case NOTIFICATION_DRAW: { _draw_spin_slider(); - break; + } break; case NOTIFICATION_WM_WINDOW_FOCUS_IN: case NOTIFICATION_WM_WINDOW_FOCUS_OUT: - case NOTIFICATION_EXIT_TREE: + case NOTIFICATION_EXIT_TREE: { if (grabbing_spinner) { grabber->hide(); Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); grabbing_spinner = false; grabbing_spinner_attempt = false; } - break; + } break; - case NOTIFICATION_MOUSE_ENTER: + case NOTIFICATION_MOUSE_ENTER: { mouse_over_spin = true; update(); - break; - case NOTIFICATION_MOUSE_EXIT: + } break; + + case NOTIFICATION_MOUSE_EXIT: { mouse_over_spin = false; update(); - break; - case NOTIFICATION_FOCUS_ENTER: + } break; + + case NOTIFICATION_FOCUS_ENTER: { if ((Input::get_singleton()->is_action_pressed("ui_focus_next") || Input::get_singleton()->is_action_pressed("ui_focus_prev")) && !value_input_just_closed) { _focus_entered(); } value_input_just_closed = false; - break; + } break; } } @@ -604,11 +600,6 @@ bool EditorSpinSlider::is_flat() const { return flat; } -void EditorSpinSlider::set_custom_label_color(bool p_use_custom_label_color, Color p_custom_label_color) { - use_custom_label_color = p_use_custom_label_color; - custom_label_color = p_custom_label_color; -} - void EditorSpinSlider::_focus_entered() { _ensure_input_popup(); Rect2 gr = get_screen_rect(); @@ -688,5 +679,4 @@ EditorSpinSlider::EditorSpinSlider() { value_input_just_closed = false; hide_slider = false; read_only = false; - use_custom_label_color = false; } |