diff --git a/doc/classes/FoldableContainer.xml b/doc/classes/FoldableContainer.xml
index 677a65fcf96..7b1509fa72b 100644
--- a/doc/classes/FoldableContainer.xml
+++ b/doc/classes/FoldableContainer.xml
@@ -44,7 +44,7 @@
- The [FoldableGroup] associated with the container.
+ The [FoldableGroup] associated with the container. When multiple [FoldableContainer] nodes share the same group, only one of them is allowed to be unfolded.
If [code]true[/code], the container will becomes folded and will hide all its children.
@@ -53,14 +53,8 @@
Language code used for text shaping algorithms. If left empty, current locale is used instead.
-
- The Container's title text.
-
-
- Base text writing direction.
-
-
- Defines the behavior of the [FoldableContainer] when the text is longer than the available space.
+
+ The container's title text.
Title's horizontal text alignment as defined in the [enum HorizontalAlignment] enum.
@@ -68,6 +62,12 @@
Title's position as defined in the [enum TitlePosition] enum.
+
+ Title text writing direction.
+
+
+ Defines the behavior of the title when the text is longer than the available space.
+
diff --git a/scene/gui/foldable_container.cpp b/scene/gui/foldable_container.cpp
index 33489a356a8..c93bab06faf 100644
--- a/scene/gui/foldable_container.cpp
+++ b/scene/gui/foldable_container.cpp
@@ -110,23 +110,23 @@ Ref FoldableContainer::get_foldable_group() const {
return foldable_group;
}
-void FoldableContainer::set_text(const String &p_text) {
- if (text == p_text) {
+void FoldableContainer::set_title(const String &p_text) {
+ if (title == p_text) {
return;
}
- text = p_text;
+ title = p_text;
_shape();
update_minimum_size();
queue_redraw();
}
-String FoldableContainer::get_text() const {
- return text;
+String FoldableContainer::get_title() const {
+ return title;
}
-void FoldableContainer::set_text_alignment(HorizontalAlignment p_alignment) {
+void FoldableContainer::set_title_alignment(HorizontalAlignment p_alignment) {
ERR_FAIL_INDEX((int)p_alignment, 3);
- text_alignment = p_alignment;
+ title_alignment = p_alignment;
if (_get_actual_alignment() != text_buf->get_horizontal_alignment()) {
_shape();
@@ -134,8 +134,8 @@ void FoldableContainer::set_text_alignment(HorizontalAlignment p_alignment) {
}
}
-HorizontalAlignment FoldableContainer::get_text_alignment() const {
- return text_alignment;
+HorizontalAlignment FoldableContainer::get_title_alignment() const {
+ return title_alignment;
}
void FoldableContainer::set_language(const String &p_language) {
@@ -152,21 +152,21 @@ String FoldableContainer::get_language() const {
return language;
}
-void FoldableContainer::set_text_direction(TextDirection p_text_direction) {
+void FoldableContainer::set_title_text_direction(TextDirection p_text_direction) {
ERR_FAIL_INDEX(int(p_text_direction), 4);
- if (text_direction == p_text_direction) {
+ if (title_text_direction == p_text_direction) {
return;
}
- text_direction = p_text_direction;
+ title_text_direction = p_text_direction;
_shape();
queue_redraw();
}
-Control::TextDirection FoldableContainer::get_text_direction() const {
- return text_direction;
+Control::TextDirection FoldableContainer::get_title_text_direction() const {
+ return title_text_direction;
}
-void FoldableContainer::set_text_overrun_behavior(TextServer::OverrunBehavior p_overrun_behavior) {
+void FoldableContainer::set_title_text_overrun_behavior(TextServer::OverrunBehavior p_overrun_behavior) {
if (overrun_behavior == p_overrun_behavior) {
return;
}
@@ -176,7 +176,7 @@ void FoldableContainer::set_text_overrun_behavior(TextServer::OverrunBehavior p_
queue_redraw();
}
-TextServer::OverrunBehavior FoldableContainer::get_text_overrun_behavior() const {
+TextServer::OverrunBehavior FoldableContainer::get_title_text_overrun_behavior() const {
return overrun_behavior;
}
@@ -440,7 +440,7 @@ void FoldableContainer::_update_title_min_size() const {
title_minimum_size = title_ms;
title_minimum_size.width += icon->get_width();
- if (!text.is_empty()) {
+ if (!title.is_empty()) {
title_minimum_size.width += h_separation;
Size2 text_size = text_buf->get_size();
title_minimum_size.height += MAX(text_size.height, icon->get_height());
@@ -481,25 +481,25 @@ void FoldableContainer::_shape() {
text_buf->clear();
text_buf->set_width(-1);
- if (text_direction == TEXT_DIRECTION_INHERITED) {
+ if (title_text_direction == TEXT_DIRECTION_INHERITED) {
text_buf->set_direction(is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR);
} else {
- text_buf->set_direction((TextServer::Direction)text_direction);
+ text_buf->set_direction((TextServer::Direction)title_text_direction);
}
text_buf->set_horizontal_alignment(_get_actual_alignment());
text_buf->set_text_overrun_behavior(overrun_behavior);
- text_buf->add_string(atr(text), font, font_size, language);
+ text_buf->add_string(atr(title), font, font_size, language);
}
HorizontalAlignment FoldableContainer::_get_actual_alignment() const {
if (is_layout_rtl()) {
- if (text_alignment == HORIZONTAL_ALIGNMENT_RIGHT) {
+ if (title_alignment == HORIZONTAL_ALIGNMENT_RIGHT) {
return HORIZONTAL_ALIGNMENT_LEFT;
- } else if (text_alignment == HORIZONTAL_ALIGNMENT_LEFT) {
+ } else if (title_alignment == HORIZONTAL_ALIGNMENT_LEFT) {
return HORIZONTAL_ALIGNMENT_RIGHT;
}
}
- return text_alignment;
+ return title_alignment;
}
void FoldableContainer::_update_group() {
@@ -530,16 +530,16 @@ void FoldableContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_folded"), &FoldableContainer::is_folded);
ClassDB::bind_method(D_METHOD("set_foldable_group", "button_group"), &FoldableContainer::set_foldable_group);
ClassDB::bind_method(D_METHOD("get_foldable_group"), &FoldableContainer::get_foldable_group);
- ClassDB::bind_method(D_METHOD("set_text", "text"), &FoldableContainer::set_text);
- ClassDB::bind_method(D_METHOD("get_text"), &FoldableContainer::get_text);
- ClassDB::bind_method(D_METHOD("set_title_alignment", "alignment"), &FoldableContainer::set_text_alignment);
- ClassDB::bind_method(D_METHOD("get_title_alignment"), &FoldableContainer::get_text_alignment);
+ ClassDB::bind_method(D_METHOD("set_title", "text"), &FoldableContainer::set_title);
+ ClassDB::bind_method(D_METHOD("get_title"), &FoldableContainer::get_title);
+ ClassDB::bind_method(D_METHOD("set_title_alignment", "alignment"), &FoldableContainer::set_title_alignment);
+ ClassDB::bind_method(D_METHOD("get_title_alignment"), &FoldableContainer::get_title_alignment);
ClassDB::bind_method(D_METHOD("set_language", "language"), &FoldableContainer::set_language);
ClassDB::bind_method(D_METHOD("get_language"), &FoldableContainer::get_language);
- ClassDB::bind_method(D_METHOD("set_text_direction", "text_direction"), &FoldableContainer::set_text_direction);
- ClassDB::bind_method(D_METHOD("get_text_direction"), &FoldableContainer::get_text_direction);
- ClassDB::bind_method(D_METHOD("set_text_overrun_behavior", "overrun_behavior"), &FoldableContainer::set_text_overrun_behavior);
- ClassDB::bind_method(D_METHOD("get_text_overrun_behavior"), &FoldableContainer::get_text_overrun_behavior);
+ ClassDB::bind_method(D_METHOD("set_title_text_direction", "text_direction"), &FoldableContainer::set_title_text_direction);
+ ClassDB::bind_method(D_METHOD("get_title_text_direction"), &FoldableContainer::get_title_text_direction);
+ ClassDB::bind_method(D_METHOD("set_title_text_overrun_behavior", "overrun_behavior"), &FoldableContainer::set_title_text_overrun_behavior);
+ ClassDB::bind_method(D_METHOD("get_title_text_overrun_behavior"), &FoldableContainer::get_title_text_overrun_behavior);
ClassDB::bind_method(D_METHOD("set_title_position", "title_position"), &FoldableContainer::set_title_position);
ClassDB::bind_method(D_METHOD("get_title_position"), &FoldableContainer::get_title_position);
ClassDB::bind_method(D_METHOD("add_title_bar_control", "control"), &FoldableContainer::add_title_bar_control);
@@ -548,14 +548,14 @@ void FoldableContainer::_bind_methods() {
ADD_SIGNAL(MethodInfo("folding_changed", PropertyInfo(Variant::BOOL, "is_folded")));
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "folded"), "set_folded", "is_folded");
- ADD_PROPERTY(PropertyInfo(Variant::STRING, "text"), "set_text", "get_text");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title");
ADD_PROPERTY(PropertyInfo(Variant::INT, "title_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_title_alignment", "get_title_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "title_position", PROPERTY_HINT_ENUM, "Top,Bottom"), "set_title_position", "get_title_position");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "text_overrun_behavior", PROPERTY_HINT_ENUM, "Trim Nothing,Trim Characters,Trim Words,Ellipsis,Word Ellipsis"), "set_text_overrun_behavior", "get_text_overrun_behavior");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "title_text_overrun_behavior", PROPERTY_HINT_ENUM, "Trim Nothing,Trim Characters,Trim Words,Ellipsis,Word Ellipsis"), "set_title_text_overrun_behavior", "get_title_text_overrun_behavior");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "foldable_group", PROPERTY_HINT_RESOURCE_TYPE, "FoldableGroup"), "set_foldable_group", "get_foldable_group");
ADD_GROUP("BiDi", "");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_text_direction", "get_text_direction");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "title_text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_title_text_direction", "get_title_text_direction");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "language", PROPERTY_HINT_LOCALE_ID), "set_language", "get_language");
BIND_ENUM_CONSTANT(POSITION_TOP);
@@ -587,7 +587,7 @@ void FoldableContainer::_bind_methods() {
FoldableContainer::FoldableContainer(const String &p_text) {
text_buf.instantiate();
- set_text(p_text);
+ set_title(p_text);
set_focus_mode(FOCUS_ALL);
set_mouse_filter(MOUSE_FILTER_STOP);
}
diff --git a/scene/gui/foldable_container.h b/scene/gui/foldable_container.h
index 40a0b870c12..89c4e1f22e5 100644
--- a/scene/gui/foldable_container.h
+++ b/scene/gui/foldable_container.h
@@ -47,11 +47,11 @@ public:
private:
bool folded = false;
- String text;
+ String title;
Ref foldable_group;
String language;
- TextDirection text_direction = TEXT_DIRECTION_AUTO;
- HorizontalAlignment text_alignment = HORIZONTAL_ALIGNMENT_LEFT;
+ TextDirection title_text_direction = TEXT_DIRECTION_AUTO;
+ HorizontalAlignment title_alignment = HORIZONTAL_ALIGNMENT_LEFT;
TextServer::OverrunBehavior overrun_behavior = TextServer::OVERRUN_NO_TRIMMING;
TitlePosition title_position = POSITION_TOP;
@@ -114,17 +114,17 @@ public:
void set_foldable_group(const Ref &p_group);
Ref get_foldable_group() const;
- void set_text(const String &p_text);
- String get_text() const;
+ void set_title(const String &p_text);
+ String get_title() const;
- void set_text_alignment(HorizontalAlignment p_alignment);
- HorizontalAlignment get_text_alignment() const;
+ void set_title_alignment(HorizontalAlignment p_alignment);
+ HorizontalAlignment get_title_alignment() const;
- void set_text_direction(TextDirection p_text_direction);
- TextDirection get_text_direction() const;
+ void set_title_text_direction(TextDirection p_text_direction);
+ TextDirection get_title_text_direction() const;
- void set_text_overrun_behavior(TextServer::OverrunBehavior p_overrun_behavior);
- TextServer::OverrunBehavior get_text_overrun_behavior() const;
+ void set_title_text_overrun_behavior(TextServer::OverrunBehavior p_overrun_behavior);
+ TextServer::OverrunBehavior get_title_text_overrun_behavior() const;
void set_language(const String &p_language);
String get_language() const;