diff options
Diffstat (limited to 'scene/gui/spin_box.h')
-rw-r--r-- | scene/gui/spin_box.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h index 9ec3885f1f..0aae9efe78 100644 --- a/scene/gui/spin_box.h +++ b/scene/gui/spin_box.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -38,26 +38,30 @@ class SpinBox : public Range { GDCLASS(SpinBox, Range); - LineEdit *line_edit; + LineEdit *line_edit = nullptr; int last_w = 0; + bool update_on_text_changed = false; - Timer *range_click_timer; + Timer *range_click_timer = nullptr; void _range_click_timeout(); void _release_mouse(); void _text_submitted(const String &p_string); - virtual void _value_changed(double) override; + virtual void _value_changed(double p_value) override; + void _text_changed(const String &p_string); + String prefix; String suffix; + double custom_arrow_step = 0.0; void _line_edit_input(const Ref<InputEvent> &p_event); struct Drag { - float base_val = 0.0; + double base_val = 0.0; bool allowed = false; bool enabled = false; Vector2 capture_pos; - float diff_y = 0.0; + double diff_y = 0.0; } drag; void _line_edit_focus_exit(); @@ -76,10 +80,10 @@ public: virtual Size2 get_minimum_size() const override; - void set_align(LineEdit::Align p_align); - LineEdit::Align get_align() const; + void set_horizontal_alignment(HorizontalAlignment p_alignment); + HorizontalAlignment get_horizontal_alignment() const; - void set_editable(bool p_editable); + void set_editable(bool p_enabled); bool is_editable() const; void set_suffix(const String &p_suffix); @@ -88,7 +92,12 @@ public: void set_prefix(const String &p_prefix); String get_prefix() const; + void set_update_on_text_changed(bool p_enabled); + bool get_update_on_text_changed() const; + void apply(); + void set_custom_arrow_step(const double p_custom_arrow_step); + double get_custom_arrow_step() const; SpinBox(); }; |