summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-10-02 10:36:20 +0200
committerGitHub <noreply@github.com>2018-10-02 10:36:20 +0200
commit3c173ebca419f4aad9c56631a957178b6df0eeee (patch)
tree58b2021ac4f464feb289a1d734e276b16ce59a3b /scene/gui
parentb4c1d40869066e50d50dfb1bdb4dd3f68b99cd91 (diff)
parentdafa4072fc8b86b7571bb5f041e20a53ed66cf4c (diff)
Merge pull request #21395 from mrcdk/spin_box_expose_align
Expose the align property of the SpinBox's LineEdit control
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/spin_box.cpp13
-rw-r--r--scene/gui/spin_box.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 2221923093..f766c0722d 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -217,6 +217,16 @@ void SpinBox::_notification(int p_what) {
}
}
+void SpinBox::set_align(LineEdit::Align p_align) {
+
+ line_edit->set_align(p_align);
+}
+
+LineEdit::Align SpinBox::get_align() const {
+
+ return line_edit->get_align();
+}
+
void SpinBox::set_suffix(const String &p_suffix) {
suffix = p_suffix;
@@ -253,6 +263,8 @@ 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);
ClassDB::bind_method(D_METHOD("get_suffix"), &SpinBox::get_suffix);
ClassDB::bind_method(D_METHOD("set_prefix", "prefix"), &SpinBox::set_prefix);
@@ -264,6 +276,7 @@ void SpinBox::_bind_methods() {
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_PROPERTYNZ(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");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "prefix"), "set_prefix", "get_prefix");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "suffix"), "set_suffix", "get_suffix");
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index 8863f44bef..f1ee26d9f3 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -76,6 +76,9 @@ public:
virtual Size2 get_minimum_size() const;
+ void set_align(LineEdit::Align p_align);
+ LineEdit::Align get_align() const;
+
void set_editable(bool p_editable);
bool is_editable() const;