2014-02-10 09:10:30 +08:00
|
|
|
/*************************************************************************/
|
|
|
|
/* spin_box.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 20:16:55 +08:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 09:10:30 +08:00
|
|
|
/*************************************************************************/
|
2022-01-04 04:27:34 +08:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 09:10:30 +08:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 07:50:27 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
#include "spin_box.h"
|
2020-03-05 00:36:09 +08:00
|
|
|
|
2020-04-28 21:19:37 +08:00
|
|
|
#include "core/input/input.h"
|
2019-08-30 05:48:50 +08:00
|
|
|
#include "core/math/expression.h"
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
Size2 SpinBox::get_minimum_size() const {
|
|
|
|
Size2 ms = line_edit->get_combined_minimum_size();
|
2017-03-05 23:44:50 +08:00
|
|
|
ms.width += last_w;
|
2014-02-10 09:10:30 +08:00
|
|
|
return ms;
|
|
|
|
}
|
|
|
|
|
2022-03-10 15:17:38 +08:00
|
|
|
void SpinBox::_value_changed(double p_value) {
|
2020-09-03 19:22:16 +08:00
|
|
|
String value = TS->format_number(String::num(get_value(), Math::range_step_decimals(get_step())));
|
2021-12-09 17:42:46 +08:00
|
|
|
if (!prefix.is_empty()) {
|
2017-03-05 23:44:50 +08:00
|
|
|
value = prefix + " " + value;
|
2020-05-14 22:41:43 +08:00
|
|
|
}
|
2021-12-09 17:42:46 +08:00
|
|
|
if (!suffix.is_empty()) {
|
2017-03-05 23:44:50 +08:00
|
|
|
value += " " + suffix;
|
2020-05-14 22:41:43 +08:00
|
|
|
}
|
2014-02-10 09:10:30 +08:00
|
|
|
line_edit->set_text(value);
|
2022-03-10 15:17:38 +08:00
|
|
|
Range::_value_changed(p_value);
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
|
2021-06-17 00:43:34 +08:00
|
|
|
void SpinBox::_text_submitted(const String &p_string) {
|
2019-08-30 05:48:50 +08:00
|
|
|
Ref<Expression> expr;
|
2021-06-18 06:03:09 +08:00
|
|
|
expr.instantiate();
|
2020-09-03 19:22:16 +08:00
|
|
|
|
|
|
|
String num = TS->parse_number(p_string);
|
2019-08-30 20:28:32 +08:00
|
|
|
// Ignore the prefix and suffix in the expression
|
2020-09-03 19:22:16 +08:00
|
|
|
Error err = expr->parse(num.trim_prefix(prefix + " ").trim_suffix(" " + suffix));
|
2019-08-30 05:48:50 +08:00
|
|
|
if (err != OK) {
|
2017-01-14 19:26:56 +08:00
|
|
|
return;
|
2019-08-30 05:48:50 +08:00
|
|
|
}
|
|
|
|
|
2020-04-02 07:20:12 +08:00
|
|
|
Variant value = expr->execute(Array(), nullptr, false);
|
2019-08-30 05:48:50 +08:00
|
|
|
if (value.get_type() != Variant::NIL) {
|
|
|
|
set_value(value);
|
|
|
|
}
|
2020-04-26 20:10:11 +08:00
|
|
|
_value_changed(0);
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
|
2020-04-27 18:24:27 +08:00
|
|
|
void SpinBox::_text_changed(const String &p_string) {
|
|
|
|
int cursor_pos = line_edit->get_caret_column();
|
|
|
|
|
|
|
|
_text_submitted(p_string);
|
|
|
|
|
|
|
|
// Line edit 'set_text' method resets the cursor position so we need to undo that.
|
|
|
|
line_edit->set_caret_column(cursor_pos);
|
|
|
|
}
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
LineEdit *SpinBox::get_line_edit() {
|
|
|
|
return line_edit;
|
|
|
|
}
|
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
void SpinBox::_line_edit_input(const Ref<InputEvent> &p_event) {
|
2015-08-29 12:43:21 +08:00
|
|
|
}
|
|
|
|
|
2015-12-09 02:04:56 +08:00
|
|
|
void SpinBox::_range_click_timeout() {
|
2021-08-14 05:31:57 +08:00
|
|
|
if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(MouseButton::LEFT)) {
|
2017-09-10 21:37:49 +08:00
|
|
|
bool up = get_local_mouse_position().y < (get_size().height / 2);
|
2017-03-05 23:44:50 +08:00
|
|
|
set_value(get_value() + (up ? get_step() : -get_step()));
|
2015-12-09 02:04:56 +08:00
|
|
|
|
|
|
|
if (range_click_timer->is_one_shot()) {
|
|
|
|
range_click_timer->set_wait_time(0.075);
|
|
|
|
range_click_timer->set_one_shot(false);
|
|
|
|
range_click_timer->start();
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
range_click_timer->stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-07 05:22:24 +08:00
|
|
|
void SpinBox::_release_mouse() {
|
|
|
|
if (drag.enabled) {
|
|
|
|
drag.enabled = false;
|
|
|
|
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
|
|
|
warp_mouse(drag.capture_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-22 23:37:22 +08:00
|
|
|
void SpinBox::gui_input(const Ref<InputEvent> &p_event) {
|
2021-04-05 14:52:21 +08:00
|
|
|
ERR_FAIL_COND(p_event.is_null());
|
|
|
|
|
2016-11-25 02:15:42 +08:00
|
|
|
if (!is_editable()) {
|
|
|
|
return;
|
|
|
|
}
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
Ref<InputEventMouseButton> mb = p_event;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
if (mb.is_valid() && mb->is_pressed()) {
|
2017-06-03 16:54:24 +08:00
|
|
|
bool up = mb->get_position().y < (get_size().height / 2);
|
2017-05-20 23:38:03 +08:00
|
|
|
|
|
|
|
switch (mb->get_button_index()) {
|
2021-08-14 05:31:57 +08:00
|
|
|
case MouseButton::LEFT: {
|
2019-10-22 07:42:17 +08:00
|
|
|
line_edit->grab_focus();
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
set_value(get_value() + (up ? get_step() : -get_step()));
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2015-12-09 02:04:56 +08:00
|
|
|
range_click_timer->set_wait_time(0.6);
|
|
|
|
range_click_timer->set_one_shot(true);
|
|
|
|
range_click_timer->start();
|
|
|
|
|
2018-08-27 13:57:30 +08:00
|
|
|
drag.allowed = true;
|
|
|
|
drag.capture_pos = mb->get_position();
|
2014-02-10 09:10:30 +08:00
|
|
|
} break;
|
2021-08-14 05:31:57 +08:00
|
|
|
case MouseButton::RIGHT: {
|
2016-11-25 02:15:42 +08:00
|
|
|
line_edit->grab_focus();
|
2019-10-22 07:42:17 +08:00
|
|
|
set_value((up ? get_max() : get_min()));
|
2014-02-10 09:10:30 +08:00
|
|
|
} break;
|
2021-08-14 05:31:57 +08:00
|
|
|
case MouseButton::WHEEL_UP: {
|
2016-11-25 02:15:42 +08:00
|
|
|
if (line_edit->has_focus()) {
|
2017-05-20 23:38:03 +08:00
|
|
|
set_value(get_value() + get_step() * mb->get_factor());
|
2016-11-25 02:15:42 +08:00
|
|
|
accept_event();
|
|
|
|
}
|
2014-02-10 09:10:30 +08:00
|
|
|
} break;
|
2021-08-14 05:31:57 +08:00
|
|
|
case MouseButton::WHEEL_DOWN: {
|
2016-11-25 02:15:42 +08:00
|
|
|
if (line_edit->has_focus()) {
|
2017-05-20 23:38:03 +08:00
|
|
|
set_value(get_value() - get_step() * mb->get_factor());
|
2016-11-25 02:15:42 +08:00
|
|
|
accept_event();
|
|
|
|
}
|
2014-02-10 09:10:30 +08:00
|
|
|
} break;
|
2021-03-26 04:56:12 +08:00
|
|
|
default:
|
|
|
|
break;
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
}
|
2015-08-29 12:43:21 +08:00
|
|
|
|
2021-08-14 05:31:57 +08:00
|
|
|
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
|
2015-08-29 12:43:21 +08:00
|
|
|
//set_default_cursor_shape(CURSOR_ARROW);
|
2015-12-09 02:04:56 +08:00
|
|
|
range_click_timer->stop();
|
2021-03-07 05:22:24 +08:00
|
|
|
_release_mouse();
|
2018-08-27 13:57:30 +08:00
|
|
|
drag.allowed = false;
|
2015-08-29 12:43:21 +08:00
|
|
|
}
|
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
Ref<InputEventMouseMotion> mm = p_event;
|
|
|
|
|
2021-08-14 05:31:57 +08:00
|
|
|
if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
|
2015-08-29 12:43:21 +08:00
|
|
|
if (drag.enabled) {
|
2018-08-27 13:57:30 +08:00
|
|
|
drag.diff_y += mm->get_relative().y;
|
2021-10-16 07:22:57 +08:00
|
|
|
float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SIGN(drag.diff_y);
|
2018-08-27 13:57:30 +08:00
|
|
|
set_value(CLAMP(drag.base_val + get_step() * diff_y, get_min(), get_max()));
|
|
|
|
} else if (drag.allowed && drag.capture_pos.distance_to(mm->get_position()) > 2) {
|
2020-04-28 21:19:37 +08:00
|
|
|
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
|
2017-03-05 23:44:50 +08:00
|
|
|
drag.enabled = true;
|
|
|
|
drag.base_val = get_value();
|
2018-08-27 13:57:30 +08:00
|
|
|
drag.diff_y = 0;
|
2015-08-29 12:43:21 +08:00
|
|
|
}
|
|
|
|
}
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SpinBox::_line_edit_focus_exit() {
|
2019-08-12 18:39:27 +08:00
|
|
|
// discontinue because the focus_exit was caused by right-click context menu
|
2021-07-17 05:36:05 +08:00
|
|
|
if (line_edit->is_menu_visible()) {
|
2019-08-12 18:39:27 +08:00
|
|
|
return;
|
2020-05-14 22:41:43 +08:00
|
|
|
}
|
2019-08-12 18:39:27 +08:00
|
|
|
|
2021-06-17 00:43:34 +08:00
|
|
|
_text_submitted(line_edit->get_text());
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
|
2019-06-12 02:43:37 +08:00
|
|
|
inline void SpinBox::_adjust_width_for_icon(const Ref<Texture2D> &icon) {
|
2018-02-06 05:42:30 +08:00
|
|
|
int w = icon->get_width();
|
2020-09-03 19:22:16 +08:00
|
|
|
if ((w != last_w)) {
|
2020-12-23 00:24:29 +08:00
|
|
|
line_edit->set_offset(SIDE_LEFT, 0);
|
|
|
|
line_edit->set_offset(SIDE_RIGHT, -w);
|
2018-02-06 05:42:30 +08:00
|
|
|
last_w = w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
void SpinBox::_notification(int p_what) {
|
2022-02-16 01:06:48 +08:00
|
|
|
switch (p_what) {
|
|
|
|
case NOTIFICATION_DRAW: {
|
|
|
|
Ref<Texture2D> updown = get_theme_icon(SNAME("updown"));
|
|
|
|
|
|
|
|
_adjust_width_for_icon(updown);
|
|
|
|
|
|
|
|
RID ci = get_canvas_item();
|
|
|
|
Size2i size = get_size();
|
|
|
|
|
|
|
|
if (is_layout_rtl()) {
|
|
|
|
updown->draw(ci, Point2i(0, (size.height - updown->get_height()) / 2));
|
|
|
|
} else {
|
|
|
|
updown->draw(ci, Point2i(size.width - updown->get_width(), (size.height - updown->get_height()) / 2));
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case NOTIFICATION_ENTER_TREE: {
|
|
|
|
_adjust_width_for_icon(get_theme_icon(SNAME("updown")));
|
|
|
|
_value_changed(0);
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case NOTIFICATION_EXIT_TREE: {
|
|
|
|
_release_mouse();
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
|
|
|
_value_changed(0);
|
|
|
|
update();
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case NOTIFICATION_THEME_CHANGED: {
|
|
|
|
call_deferred(SNAME("update_minimum_size"));
|
|
|
|
get_line_edit()->call_deferred(SNAME("update_minimum_size"));
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
|
|
|
update();
|
|
|
|
} break;
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-25 10:58:47 +08:00
|
|
|
void SpinBox::set_horizontal_alignment(HorizontalAlignment p_alignment) {
|
|
|
|
line_edit->set_horizontal_alignment(p_alignment);
|
2018-08-25 11:17:07 +08:00
|
|
|
}
|
|
|
|
|
2021-11-25 10:58:47 +08:00
|
|
|
HorizontalAlignment SpinBox::get_horizontal_alignment() const {
|
|
|
|
return line_edit->get_horizontal_alignment();
|
2018-08-25 11:17:07 +08:00
|
|
|
}
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void SpinBox::set_suffix(const String &p_suffix) {
|
|
|
|
suffix = p_suffix;
|
2014-02-10 09:10:30 +08:00
|
|
|
_value_changed(0);
|
|
|
|
}
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
String SpinBox::get_suffix() const {
|
2014-02-10 09:10:30 +08:00
|
|
|
return suffix;
|
|
|
|
}
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void SpinBox::set_prefix(const String &p_prefix) {
|
|
|
|
prefix = p_prefix;
|
2014-02-10 09:10:30 +08:00
|
|
|
_value_changed(0);
|
|
|
|
}
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
String SpinBox::get_prefix() const {
|
2014-02-10 09:10:30 +08:00
|
|
|
return prefix;
|
|
|
|
}
|
|
|
|
|
2021-10-09 05:26:13 +08:00
|
|
|
void SpinBox::set_update_on_text_changed(bool p_enabled) {
|
|
|
|
if (update_on_text_changed == p_enabled) {
|
2020-04-27 18:24:27 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-09 05:26:13 +08:00
|
|
|
update_on_text_changed = p_enabled;
|
2020-04-27 18:24:27 +08:00
|
|
|
|
2021-10-09 05:26:13 +08:00
|
|
|
if (p_enabled) {
|
2020-04-27 18:24:27 +08:00
|
|
|
line_edit->connect("text_changed", callable_mp(this, &SpinBox::_text_changed), Vector<Variant>(), CONNECT_DEFERRED);
|
|
|
|
} else {
|
|
|
|
line_edit->disconnect("text_changed", callable_mp(this, &SpinBox::_text_changed));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SpinBox::get_update_on_text_changed() const {
|
|
|
|
return update_on_text_changed;
|
|
|
|
}
|
|
|
|
|
2021-10-09 05:26:13 +08:00
|
|
|
void SpinBox::set_editable(bool p_enabled) {
|
|
|
|
line_edit->set_editable(p_enabled);
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SpinBox::is_editable() const {
|
|
|
|
return line_edit->is_editable();
|
|
|
|
}
|
|
|
|
|
2020-01-09 21:44:23 +08:00
|
|
|
void SpinBox::apply() {
|
2021-06-17 00:43:34 +08:00
|
|
|
_text_submitted(line_edit->get_text());
|
2020-01-09 21:44:23 +08:00
|
|
|
}
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
void SpinBox::_bind_methods() {
|
2021-11-25 10:58:47 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("set_horizontal_alignment", "alignment"), &SpinBox::set_horizontal_alignment);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_horizontal_alignment"), &SpinBox::get_horizontal_alignment);
|
2017-03-05 23:44:50 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("set_suffix", "suffix"), &SpinBox::set_suffix);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_suffix"), &SpinBox::get_suffix);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_prefix", "prefix"), &SpinBox::set_prefix);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_prefix"), &SpinBox::get_prefix);
|
2021-10-09 05:26:13 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("set_editable", "enabled"), &SpinBox::set_editable);
|
2017-03-05 23:44:50 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable);
|
2021-10-09 05:26:13 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("set_update_on_text_changed", "enabled"), &SpinBox::set_update_on_text_changed);
|
2020-04-27 18:24:27 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("get_update_on_text_changed"), &SpinBox::get_update_on_text_changed);
|
2020-01-09 21:44:23 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("apply"), &SpinBox::apply);
|
2017-08-09 19:19:41 +08:00
|
|
|
ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit);
|
2017-03-05 23:44:50 +08:00
|
|
|
|
2021-11-25 10:58:47 +08:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_horizontal_alignment", "get_horizontal_alignment");
|
2017-03-05 23:44:50 +08:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable");
|
2020-04-27 18:24:27 +08:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "update_on_text_changed"), "set_update_on_text_changed", "get_update_on_text_changed");
|
2017-03-05 23:44:50 +08:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "prefix"), "set_prefix", "get_prefix");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "suffix"), "set_suffix", "get_suffix");
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SpinBox::SpinBox() {
|
2017-03-05 23:44:50 +08:00
|
|
|
line_edit = memnew(LineEdit);
|
2021-08-25 21:49:30 +08:00
|
|
|
add_child(line_edit, false, INTERNAL_MODE_FRONT);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2020-12-23 00:24:29 +08:00
|
|
|
line_edit->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
|
2019-05-21 20:49:53 +08:00
|
|
|
line_edit->set_mouse_filter(MOUSE_FILTER_PASS);
|
2021-11-25 10:58:47 +08:00
|
|
|
line_edit->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT);
|
2020-09-03 19:22:16 +08:00
|
|
|
|
2021-06-17 00:43:34 +08:00
|
|
|
line_edit->connect("text_submitted", callable_mp(this, &SpinBox::_text_submitted), Vector<Variant>(), CONNECT_DEFERRED);
|
2020-02-22 01:28:45 +08:00
|
|
|
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));
|
2015-12-09 02:04:56 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
range_click_timer = memnew(Timer);
|
2020-02-22 01:28:45 +08:00
|
|
|
range_click_timer->connect("timeout", callable_mp(this, &SpinBox::_range_click_timeout));
|
2021-08-25 21:49:30 +08:00
|
|
|
add_child(range_click_timer, false, INTERNAL_MODE_FRONT);
|
2014-02-10 09:10:30 +08:00
|
|
|
}
|