summaryrefslogtreecommitdiff
path: root/scene/gui/spin_box.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/spin_box.cpp')
-rw-r--r--scene/gui/spin_box.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 1200877127..94628f7cea 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -29,8 +29,9 @@
/*************************************************************************/
#include "spin_box.h"
+
+#include "core/input/input.h"
#include "core/math/expression.h"
-#include "core/os/input.h"
Size2 SpinBox::get_minimum_size() const {
@@ -59,7 +60,7 @@ void SpinBox::_text_entered(const String &p_string) {
return;
}
- Variant value = expr->execute(Array(), NULL, false);
+ Variant value = expr->execute(Array(), nullptr, false);
if (value.get_type() != Variant::NIL) {
set_value(value);
_value_changed(0);
@@ -195,7 +196,7 @@ void SpinBox::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<Texture2D> updown = get_icon("updown");
+ Ref<Texture2D> updown = get_theme_icon("updown");
_adjust_width_for_icon(updown);
@@ -209,7 +210,7 @@ void SpinBox::_notification(int p_what) {
//_value_changed(0);
} else if (p_what == NOTIFICATION_ENTER_TREE) {
- _adjust_width_for_icon(get_icon("updown"));
+ _adjust_width_for_icon(get_theme_icon("updown"));
_value_changed(0);
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
@@ -267,7 +268,6 @@ void SpinBox::_bind_methods() {
//ClassDB::bind_method(D_METHOD("_value_changed"),&SpinBox::_value_changed);
ClassDB::bind_method(D_METHOD("_gui_input"), &SpinBox::_gui_input);
- ClassDB::bind_method(D_METHOD("_text_entered"), &SpinBox::_text_entered);
ClassDB::bind_method(D_METHOD("set_align", "align"), &SpinBox::set_align);
ClassDB::bind_method(D_METHOD("get_align"), &SpinBox::get_align);
ClassDB::bind_method(D_METHOD("set_suffix", "suffix"), &SpinBox::set_suffix);
@@ -277,10 +277,7 @@ void SpinBox::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_editable", "editable"), &SpinBox::set_editable);
ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable);
ClassDB::bind_method(D_METHOD("apply"), &SpinBox::apply);
- ClassDB::bind_method(D_METHOD("_line_edit_focus_exit"), &SpinBox::_line_edit_focus_exit);
ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit);
- ClassDB::bind_method(D_METHOD("_line_edit_input"), &SpinBox::_line_edit_input);
- ClassDB::bind_method(D_METHOD("_range_click_timeout"), &SpinBox::_range_click_timeout);
ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable");
@@ -297,12 +294,12 @@ SpinBox::SpinBox() {
line_edit->set_anchors_and_margins_preset(Control::PRESET_WIDE);
line_edit->set_mouse_filter(MOUSE_FILTER_PASS);
//connect("value_changed",this,"_value_changed");
- line_edit->connect_compat("text_entered", this, "_text_entered", Vector<Variant>(), CONNECT_DEFERRED);
- line_edit->connect_compat("focus_exited", this, "_line_edit_focus_exit", Vector<Variant>(), CONNECT_DEFERRED);
- line_edit->connect_compat("gui_input", this, "_line_edit_input");
+ line_edit->connect("text_entered", callable_mp(this, &SpinBox::_text_entered), Vector<Variant>(), CONNECT_DEFERRED);
+ line_edit->connect("focus_exited", callable_mp(this, &SpinBox::_line_edit_focus_exit), Vector<Variant>(), CONNECT_DEFERRED);
+ line_edit->connect("gui_input", callable_mp(this, &SpinBox::_line_edit_input));
drag.enabled = false;
range_click_timer = memnew(Timer);
- range_click_timer->connect_compat("timeout", this, "_range_click_timeout");
+ range_click_timer->connect("timeout", callable_mp(this, &SpinBox::_range_click_timeout));
add_child(range_click_timer);
}