diff --git a/core/core_constants.cpp b/core/core_constants.cpp
index dd1754f010b..51fcfd5305d 100644
--- a/core/core_constants.cpp
+++ b/core/core_constants.cpp
@@ -142,27 +142,28 @@ void register_global_constants() {
BIND_CORE_ENUM_CONSTANT(CLOCKWISE);
BIND_CORE_ENUM_CONSTANT(COUNTERCLOCKWISE);
- BIND_CORE_ENUM_CONSTANT(HALIGN_LEFT);
- BIND_CORE_ENUM_CONSTANT(HALIGN_CENTER);
- BIND_CORE_ENUM_CONSTANT(HALIGN_RIGHT);
- BIND_CORE_ENUM_CONSTANT(HALIGN_FILL);
+ BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_LEFT);
+ BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_CENTER);
+ BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_RIGHT);
+ BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_FILL);
- BIND_CORE_ENUM_CONSTANT(VALIGN_TOP);
- BIND_CORE_ENUM_CONSTANT(VALIGN_CENTER);
- BIND_CORE_ENUM_CONSTANT(VALIGN_BOTTOM);
+ BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_TOP);
+ BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_CENTER);
+ BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_BOTTOM);
+ BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_FILL);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_TOP_TO);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_CENTER_TO);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_BOTTOM_TO);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TOP_TO);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_CENTER_TO);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BOTTOM_TO);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_TO_TOP);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_TO_CENTER);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_TO_BASELINE);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_TO_BOTTOM);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_TOP);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_CENTER);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_BASELINE);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_BOTTOM);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_TOP);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_CENTER);
- BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_BOTTOM);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TOP);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_CENTER);
+ BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BOTTOM);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPECIAL);
BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ESCAPE);
diff --git a/core/math/math_defs.h b/core/math/math_defs.h
index 900e90a598f..1c6139688bb 100644
--- a/core/math/math_defs.h
+++ b/core/math/math_defs.h
@@ -68,37 +68,38 @@ enum Orientation {
VERTICAL
};
-enum HAlign {
- HALIGN_LEFT,
- HALIGN_CENTER,
- HALIGN_RIGHT,
- HALIGN_FILL,
+enum HorizontalAlignment {
+ HORIZONTAL_ALIGNMENT_LEFT,
+ HORIZONTAL_ALIGNMENT_CENTER,
+ HORIZONTAL_ALIGNMENT_RIGHT,
+ HORIZONTAL_ALIGNMENT_FILL,
};
-enum VAlign {
- VALIGN_TOP,
- VALIGN_CENTER,
- VALIGN_BOTTOM
+enum VerticalAlignment {
+ VERTICAL_ALIGNMENT_TOP,
+ VERTICAL_ALIGNMENT_CENTER,
+ VERTICAL_ALIGNMENT_BOTTOM,
+ VERTICAL_ALIGNMENT_FILL,
};
-enum InlineAlign {
+enum InlineAlignment {
// Image alignment points.
- INLINE_ALIGN_TOP_TO = 0b0000,
- INLINE_ALIGN_CENTER_TO = 0b0001,
- INLINE_ALIGN_BOTTOM_TO = 0b0010,
- INLINE_ALIGN_IMAGE_MASK = 0b0011,
+ INLINE_ALIGNMENT_TOP_TO = 0b0000,
+ INLINE_ALIGNMENT_CENTER_TO = 0b0001,
+ INLINE_ALIGNMENT_BOTTOM_TO = 0b0010,
+ INLINE_ALIGNMENT_IMAGE_MASK = 0b0011,
// Text alignment points.
- INLINE_ALIGN_TO_TOP = 0b0000,
- INLINE_ALIGN_TO_CENTER = 0b0100,
- INLINE_ALIGN_TO_BASELINE = 0b1000,
- INLINE_ALIGN_TO_BOTTOM = 0b1100,
- INLINE_ALIGN_TEXT_MASK = 0b1100,
+ INLINE_ALIGNMENT_TO_TOP = 0b0000,
+ INLINE_ALIGNMENT_TO_CENTER = 0b0100,
+ INLINE_ALIGNMENT_TO_BASELINE = 0b1000,
+ INLINE_ALIGNMENT_TO_BOTTOM = 0b1100,
+ INLINE_ALIGNMENT_TEXT_MASK = 0b1100,
// Presets.
- INLINE_ALIGN_TOP = INLINE_ALIGN_TOP_TO | INLINE_ALIGN_TO_TOP,
- INLINE_ALIGN_CENTER = INLINE_ALIGN_CENTER_TO | INLINE_ALIGN_TO_CENTER,
- INLINE_ALIGN_BOTTOM = INLINE_ALIGN_BOTTOM_TO | INLINE_ALIGN_TO_BOTTOM
+ INLINE_ALIGNMENT_TOP = INLINE_ALIGNMENT_TOP_TO | INLINE_ALIGNMENT_TO_TOP,
+ INLINE_ALIGNMENT_CENTER = INLINE_ALIGNMENT_CENTER_TO | INLINE_ALIGNMENT_TO_CENTER,
+ INLINE_ALIGNMENT_BOTTOM = INLINE_ALIGNMENT_BOTTOM_TO | INLINE_ALIGNMENT_TO_BOTTOM
};
enum Side {
diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h
index 3f9f7e02b26..3fb4af49445 100644
--- a/core/variant/binder_common.h
+++ b/core/variant/binder_common.h
@@ -106,9 +106,9 @@ VARIANT_ENUM_CAST(KeyModifierMask);
VARIANT_ENUM_CAST(MIDIMessage);
VARIANT_ENUM_CAST(MouseButton);
VARIANT_ENUM_CAST(Orientation);
-VARIANT_ENUM_CAST(HAlign);
-VARIANT_ENUM_CAST(VAlign);
-VARIANT_ENUM_CAST(InlineAlign);
+VARIANT_ENUM_CAST(HorizontalAlignment);
+VARIANT_ENUM_CAST(VerticalAlignment);
+VARIANT_ENUM_CAST(InlineAlignment);
VARIANT_ENUM_CAST(PropertyHint);
VARIANT_ENUM_CAST(PropertyUsageFlags);
VARIANT_ENUM_CAST(Variant::Type);
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 41cc043a747..161e6278a2d 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1210,56 +1210,59 @@
-
+
Horizontal left alignment, usually for text-derived classes.
-
+
Horizontal center alignment, usually for text-derived classes.
-
+
Horizontal right alignment, usually for text-derived classes.
-
+
Expand row to fit width, usually for text-derived classes.
-
+
Vertical top alignment, usually for text-derived classes.
-
+
Vertical center alignment, usually for text-derived classes.
-
+
Vertical bottom alignment, usually for text-derived classes.
-
- Aligns the top of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGN_TO_*[/code] constant.
+
+ Expand rows to fit height, usually for text-derived classes.
-
- Aligns the center of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGN_TO_*[/code] constant.
+
+ Aligns the top of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.
-
- Aligns the bottom of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGN_TO_*[/code] constant.
+
+ Aligns the center of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.
-
- Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGN_*_TO[/code] constant to the top of the text.
+
+ Aligns the bottom of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.
-
- Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGN_*_TO[/code] constant to the center of the text.
+
+ Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the top of the text.
-
- Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGN_*_TO[/code] constant to the baseline of the text.
+
+ Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the center of the text.
-
+
+ Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the baseline of the text.
+
+
Aligns inline object (e.g. image, table) to the bottom of the text.
-
- Aligns top of the inline object (e.g. image, table) to the top of the text. Equvalent to [code]INLINE_ALIGN_TOP_TO | INLINE_ALIGN_TO_TOP[/code].
+
+ Aligns top of the inline object (e.g. image, table) to the top of the text. Equvalent to [code]INLINE_ALIGNMENT_TOP_TO | INLINE_ALIGNMENT_TO_TOP[/code].
-
- Aligns center of the inline object (e.g. image, table) to the center of the text. Equvalent to [code]INLINE_ALIGN_CENTER_TO | INLINE_ALIGN_TO_CENTER[/code].
+
+ Aligns center of the inline object (e.g. image, table) to the center of the text. Equvalent to [code]INLINE_ALIGNMENT_CENTER_TO | INLINE_ALIGNMENT_TO_CENTER[/code].
-
- Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equvalent to [code]INLINE_ALIGN_BOTTOM_TO | INLINE_ALIGN_TO_BOTTOM[/code].
+
+ Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equvalent to [code]INLINE_ALIGNMENT_BOTTOM_TO | INLINE_ALIGNMENT_TO_BOTTOM[/code].
Keycodes with this bit applied are non-printable.
diff --git a/doc/classes/AspectRatioContainer.xml b/doc/classes/AspectRatioContainer.xml
index 4c0af0b997c..237bec4e617 100644
--- a/doc/classes/AspectRatioContainer.xml
+++ b/doc/classes/AspectRatioContainer.xml
@@ -9,10 +9,10 @@
-
+
Specifies the horizontal relative position of child controls.
-
+
Specifies the vertical relative position of child controls.
@@ -36,13 +36,13 @@
The width and height of child controls is automatically adjusted to make their bounding rectangle cover the entire area of the container while keeping the aspect ratio.
When the bounding rectangle of child controls exceed the container's size and [member Control.rect_clip_content] is enabled, this allows to show only the container's area restricted by its own bounding rectangle.
-
+
Aligns child controls with the beginning (left or top) of the container.
-
+
Aligns child controls with the center of the container.
-
+
Aligns child controls with the end (right or bottom) of the container.
diff --git a/doc/classes/BoxContainer.xml b/doc/classes/BoxContainer.xml
index ec81b866f61..a968e855a5e 100644
--- a/doc/classes/BoxContainer.xml
+++ b/doc/classes/BoxContainer.xml
@@ -18,19 +18,16 @@
-
- The alignment of the container's children (must be one of [constant ALIGN_BEGIN], [constant ALIGN_CENTER], or [constant ALIGN_END]).
+
+ The alignment of the container's children (must be one of [constant ALIGNMENT_BEGIN], [constant ALIGNMENT_CENTER], or [constant ALIGNMENT_END]).
-
- Aligns children with the beginning of the container.
+
-
- Aligns children with the center of the container.
+
-
- Aligns children with the end of the container.
+
diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml
index 3145756511d..d1a19861e44 100644
--- a/doc/classes/Button.xml
+++ b/doc/classes/Button.xml
@@ -64,8 +64,8 @@
-
- Text alignment policy for the button's text, use one of the [enum TextAlign] constants.
+
+ Text alignment policy for the button's text, use one of the [enum @GlobalScope.HorizontalAlignment] constants.
When this property is enabled, text that is too large to fit the button is clipped, when disabled the Button will always be wide enough to hold the text.
@@ -80,8 +80,8 @@
Button's icon, if text is present the icon will be placed before the text.
To edit margin and spacing of the icon, use [theme_item hseparation] theme property and [code]content_margin_*[/code] properties of the used [StyleBox]es.
-
- Specifies if the icon should be aligned to the left, right, or center of a button. Uses the same [enum TextAlign] constants as the text alignment. If centered, text will draw on top of the icon.
+
+ Specifies if the icon should be aligned to the left, right, or center of a button. Uses the same [enum @GlobalScope.HorizontalAlignment] constants as the text alignment. If centered, text will draw on top of the icon.
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
@@ -93,17 +93,6 @@
Base text writing direction.
-
-
- Align the text to the left.
-
-
- Align the text to the center.
-
-
- Align the text to the right.
-
-
Default text [Color] of the [Button].
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index 98437ef2962..cf6a8bad5eb 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -143,7 +143,7 @@
-
+
@@ -236,7 +236,7 @@
-
+
@@ -253,7 +253,7 @@
# so the Control is only created once.
var default_font = Control.new().get_font("font")
var default_font_size = Control.new().get_font_size("font_size")
- draw_string(default_font, Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, font_size)
+ draw_string(default_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size)
[/gdscript]
[csharp]
// If using this method in a script that redraws constantly, move the
@@ -261,7 +261,7 @@
// so the Control is only created once.
Font defaultFont = new Control().GetFont("font");
int defaultFontSize = new Control().GetFontSize("font_size");
- DrawString(defaultFont, new Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, defaultFontSize);
+ DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, defaultFontSize);
[/csharp]
[/codeblocks]
See also [method Font.draw_string].
diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml
index 7dddacf3c98..32ef70a5cf9 100644
--- a/doc/classes/CheckBox.xml
+++ b/doc/classes/CheckBox.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml
index c0315b93bed..cf3aa869c31 100644
--- a/doc/classes/CheckButton.xml
+++ b/doc/classes/CheckButton.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml
index 01bc2837f14..275d6b65772 100644
--- a/doc/classes/Font.xml
+++ b/doc/classes/Font.xml
@@ -96,7 +96,7 @@
-
+
@@ -114,7 +114,7 @@
-
+
@@ -202,7 +202,7 @@
-
+
diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml
index bb273bcf487..e1d8b9e9f43 100644
--- a/doc/classes/Label.xml
+++ b/doc/classes/Label.xml
@@ -61,15 +61,15 @@
-
- Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the [enum Align] constants.
-
If set to something other than [constant AUTOWRAP_OFF], the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see [enum AutowrapMode].
If [code]true[/code], the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
+
+ Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the [enum HorizontalAlignment] constants.
+
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
@@ -102,38 +102,14 @@
If [code]true[/code], all the text displays as UPPERCASE.
-
- Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the [enum VAlign] constants.
+
+ Controls the text's vertical alignment. Supports top, center, bottom, and fill. Set it to one of the [enum VerticalAlignment] constants.
Restricts the number of characters to display. Set to -1 to disable.
-
- Align rows to the left (default).
-
-
- Align rows centered.
-
-
- Align rows to the right.
-
-
- Expand row to fit the width.
-
-
- Align the whole text to the top.
-
-
- Align the whole text to the center.
-
-
- Align the whole text to the bottom.
-
-
- Align the whole text by spreading the rows.
-
Autowrap is disabled.
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml
index 40e1057ed03..06094300deb 100644
--- a/doc/classes/LineEdit.xml
+++ b/doc/classes/LineEdit.xml
@@ -159,8 +159,8 @@
-
- Text alignment as defined in the [enum Align] enum.
+
+ Text alignment as defined in the [enum HorizontalAlignment] enum.
If [code]true[/code], the caret (text cursor) blinks.
@@ -292,18 +292,6 @@
-
- Aligns the text on the left-hand side of the [LineEdit].
-
-
- Centers the text in the middle of the [LineEdit].
-
-
- Aligns the text on the right-hand side of the [LineEdit].
-
-
- Expand row to fit the [LineEdit]'s width.
-
Cuts (copies and clears) the selected text.
diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml
index d914b86a334..d2f9b08fbfe 100644
--- a/doc/classes/OptionButton.xml
+++ b/doc/classes/OptionButton.xml
@@ -164,7 +164,7 @@
-
+
The index of the currently selected item, or [code]-1[/code] if no item is selected.
diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml
index a74b0ed8122..84956805c91 100644
--- a/doc/classes/RichTextLabel.xml
+++ b/doc/classes/RichTextLabel.xml
@@ -22,7 +22,7 @@
-
+
Adds an image's opening and closing tags to the tag stack, optionally providing a [code]width[/code] and [code]height[/code] to resize the image and a [code]color[/code] to tint the image.
If [code]width[/code] or [code]height[/code] is set to 0, the image size will be adjusted in order to keep the original aspect ratio.
@@ -279,7 +279,7 @@
-
+
@@ -296,7 +296,7 @@
-
+
Adds a [code][table=columns,inline_align][/code] tag to the tag stack.
@@ -451,18 +451,6 @@
-
- Makes text left aligned.
-
-
- Makes text centered.
-
-
- Makes text right aligned.
-
-
- Makes text fill width.
-
Each list item has a number marker.
diff --git a/doc/classes/SpinBox.xml b/doc/classes/SpinBox.xml
index 615f5e35865..392d4d6a652 100644
--- a/doc/classes/SpinBox.xml
+++ b/doc/classes/SpinBox.xml
@@ -12,14 +12,14 @@
add_child(spin_box)
var line_edit = spin_box.get_line_edit()
line_edit.context_menu_enabled = false
- spin_box.align = LineEdit.ALIGN_RIGHT
+ spin_box.horizontal_alignment = LineEdit.HORIZONTAL_ALIGNMENT_RIGHT
[/gdscript]
[csharp]
var spinBox = new SpinBox();
AddChild(spinBox);
var lineEdit = spinBox.GetLineEdit();
lineEdit.ContextMenuEnabled = false;
- spinBox.Align = LineEdit.AlignEnum.Right;
+ spinBox.AlignHorizontal = LineEdit.HorizontalAlignEnum.Right;
[/csharp]
[/codeblocks]
The above code will create a [SpinBox], disable context menu on it and set the text alignment to right.
@@ -44,8 +44,7 @@
-
- Sets the text alignment of the [SpinBox].
+
If [code]true[/code], the [SpinBox] will be editable. Otherwise, it will be read only.
diff --git a/doc/classes/TabBar.xml b/doc/classes/TabBar.xml
index a9b09fb0261..f97b3e08d1b 100644
--- a/doc/classes/TabBar.xml
+++ b/doc/classes/TabBar.xml
@@ -209,8 +209,7 @@
if [code]true[/code], the mouse's scroll wheel can be used to navigate the scroll view.
-
- The alignment of all tabs. See [enum TabAlign] for details.
+
Sets when the close button will appear on the tabs. See [enum CloseButtonDisplayPolicy] for details.
@@ -264,17 +263,13 @@
-
- Align the tabs to the left.
+
-
- Align the tabs to the center.
+
-
- Align the tabs to the right.
+
-
- Represents the size of the [enum TabAlign] enum.
+
Never show the close buttons.
diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml
index 2ac65492501..d6e1e13505d 100644
--- a/doc/classes/TabContainer.xml
+++ b/doc/classes/TabContainer.xml
@@ -141,8 +141,7 @@
If [code]true[/code], tabs can be rearranged with mouse drag.
-
- The alignment of all tabs in the tab container. See the [enum TabAlign] constants for details.
+
If [code]true[/code], tabs are visible. If [code]false[/code], tabs' content and titles are hidden.
@@ -171,14 +170,11 @@
-
- Align the tabs to the left.
+
-
- Align the tabs to the center.
+
-
- Align the tabs to the right.
+
diff --git a/doc/classes/TextLine.xml b/doc/classes/TextLine.xml
index 598d0fb859e..1eaccf46043 100644
--- a/doc/classes/TextLine.xml
+++ b/doc/classes/TextLine.xml
@@ -13,7 +13,7 @@
-
+
Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters.
@@ -122,7 +122,7 @@
-
+
Sets new size and alignment of embedded object.
@@ -144,8 +144,7 @@
-
- Text horizontal alignment.
+
Text writing direction.
diff --git a/doc/classes/TextParagraph.xml b/doc/classes/TextParagraph.xml
index a7122b827e8..6a510e4a744 100644
--- a/doc/classes/TextParagraph.xml
+++ b/doc/classes/TextParagraph.xml
@@ -13,7 +13,7 @@
-
+
Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters.
@@ -240,7 +240,7 @@
-
+
Sets new size and alignment of embedded object.
@@ -275,7 +275,7 @@
-
+
Paragraph horizontal alignment.
diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml
index 512078c56c5..6da45fdd4a6 100644
--- a/doc/classes/TextServer.xml
+++ b/doc/classes/TextServer.xml
@@ -886,7 +886,7 @@
-
+
Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters.
@@ -1213,7 +1213,7 @@
-
+
Sets new size and alignment of embedded object.
diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml
index 32f8107e0af..af558150e20 100644
--- a/doc/classes/TextServerExtension.xml
+++ b/doc/classes/TextServerExtension.xml
@@ -893,7 +893,7 @@
-
+
Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters.
@@ -1222,7 +1222,7 @@
-
+
Sets new size and alignment of embedded object.
diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml
index b997d87ac03..7da98788bb5 100644
--- a/doc/classes/TreeItem.xml
+++ b/doc/classes/TreeItem.xml
@@ -293,8 +293,8 @@
Returns the given column's text.
-
-
+
+
Returns the given column's text alignment.
@@ -623,12 +623,12 @@
Sets the given column's text value.
-
+
-
+
- Sets the given column's text alignment. See [enum TextAlign] for possible values.
+ Sets the given column's text alignment. See [enum HorizontalAlignment] for possible values.
@@ -679,14 +679,5 @@
-
- Align text to the left. See [code]set_text_align()[/code].
-
-
- Center text. See [code]set_text_align()[/code].
-
-
- Align text to the right. See [code]set_text_align()[/code].
-
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index dc0c62fbc92..9df76b8657a 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -612,7 +612,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
add_child(main_vbox);
tab_container = memnew(TabContainer);
- tab_container->set_tab_align(TabContainer::TabAlign::ALIGN_LEFT);
+ tab_container->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tab_container->set_use_hidden_tabs_for_min_size(true);
tab_container->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tab_container->connect("tab_selected", callable_mp(this, &InputEventConfigurationDialog::_tab_selected));
@@ -622,7 +622,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
VBoxContainer *vb = memnew(VBoxContainer);
vb->set_name(TTR("Listen for Input"));
event_as_text = memnew(Label);
- event_as_text->set_align(Label::ALIGN_CENTER);
+ event_as_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
vb->add_child(event_as_text);
// Mouse button detection rect (Mouse button event outside this ColorRect will be ignored)
mouse_detection_rect = memnew(ColorRect);
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index a970ce3f1de..9682fb07d2a 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -381,7 +381,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
draw_line(Point2(limit, i), Point2(right_limit, i), lc, Math::round(EDSCALE));
Color c = color;
c.a *= 0.5;
- draw_string(font, Point2(limit + 8, i - 2), TS->format_number(rtos(Math::snapped((iv + 1) * scale, step))), HALIGN_LEFT, -1, font_size, c);
+ draw_string(font, Point2(limit + 8, i - 2), TS->format_number(rtos(Math::snapped((iv + 1) * scale, step))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, c);
}
first = false;
@@ -452,8 +452,8 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
ep.point_rect.size = bezier_icon->get_size();
if (selection.has(i)) {
draw_texture(selected_icon, ep.point_rect.position);
- draw_string(font, ep.point_rect.position + Vector2(8, -font->get_height(font_size) - 8), TTR("Time:") + " " + TS->format_number(rtos(Math::snapped(offset, 0.001))), HALIGN_LEFT, -1, font_size, accent);
- draw_string(font, ep.point_rect.position + Vector2(8, -8), TTR("Value:") + " " + TS->format_number(rtos(Math::snapped(value, 0.001))), HALIGN_LEFT, -1, font_size, accent);
+ draw_string(font, ep.point_rect.position + Vector2(8, -font->get_height(font_size) - 8), TTR("Time:") + " " + TS->format_number(rtos(Math::snapped(offset, 0.001))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, accent);
+ draw_string(font, ep.point_rect.position + Vector2(8, -8), TTR("Value:") + " " + TS->format_number(rtos(Math::snapped(value, 0.001))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, accent);
} else {
draw_texture(bezier_icon, ep.point_rect.position);
}
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index a306fc20de3..c212523c984 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1622,7 +1622,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
if (frame != prev_frame && i >= prev_frame_ofs) {
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
- draw_string(font, Point2(get_name_limit() + i + 3 * EDSCALE, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), itos(frame), HALIGN_LEFT, zoomw - i, font_size, sub ? color_time_dec : color_time_sec);
+ draw_string(font, Point2(get_name_limit() + i + 3 * EDSCALE, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), itos(frame), HORIZONTAL_ALIGNMENT_LEFT, zoomw - i, font_size, sub ? color_time_dec : color_time_sec);
prev_frame_ofs = i + font->get_string_size(itos(frame), font_size).x + 5 * EDSCALE;
}
}
@@ -1640,7 +1640,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) {
int scd = sc < 0 ? prev_sc : sc;
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
- draw_string(font, Point2(get_name_limit() + i + 3, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), HALIGN_LEFT, zoomw - i, font_size, sub ? color_time_dec : color_time_sec);
+ draw_string(font, Point2(get_name_limit() + i + 3, (h - font->get_height(font_size)) / 2 + font->get_ascent(font_size)).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), HORIZONTAL_ALIGNMENT_LEFT, zoomw - i, font_size, sub ? color_time_dec : color_time_sec);
}
}
}
@@ -2029,7 +2029,7 @@ void AnimationTrackEdit::_notification(int p_what) {
Vector2 string_pos = Point2(ofs, (get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size));
string_pos = string_pos.floor();
- draw_string(font, string_pos, text, HALIGN_LEFT, limit - ofs - hsep, font_size, text_color);
+ draw_string(font, string_pos, text, HORIZONTAL_ALIGNMENT_LEFT, limit - ofs - hsep, font_size, text_color);
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
}
@@ -2340,7 +2340,7 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
int limit = MAX(0, p_clip_right - p_x - icon_to_draw->get_width());
if (limit > 0) {
- draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), text, HALIGN_LEFT, limit, font_size, color);
+ draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), text, HORIZONTAL_ALIGNMENT_LEFT, limit, font_size, color);
}
}
@@ -3234,7 +3234,7 @@ void AnimationTrackEditGroup::_notification(int p_what) {
int ofs = 0;
draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2));
ofs += separation + icon->get_width();
- draw_string(font, Point2(ofs, int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), node_name, HALIGN_LEFT, timeline->get_name_limit() - ofs, font_size, color);
+ draw_string(font, Point2(ofs, int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), node_name, HORIZONTAL_ALIGNMENT_LEFT, timeline->get_name_limit() - ofs, font_size, color);
int px = (-timeline->get_value() + timeline->get_play_position()) * timeline->get_zoom_scale() + timeline->get_name_limit();
@@ -6072,8 +6072,8 @@ AnimationTrackEditor::AnimationTrackEditor() {
info_message = memnew(Label);
info_message->set_text(TTR("Select an AnimationPlayer node to create and edit animations."));
- info_message->set_valign(Label::VALIGN_CENTER);
- info_message->set_align(Label::ALIGN_CENTER);
+ info_message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ info_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
info_message->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
info_message->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
index dd3e08b299a..3c117f28a8b 100644
--- a/editor/animation_track_editor_plugins.cpp
+++ b/editor/animation_track_editor_plugins.cpp
@@ -699,7 +699,7 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_
int limit = to_x - from_x - 4;
if (limit > 0) {
- draw_string(font, Point2(from_x + 2, int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), anim, HALIGN_LEFT, -1, font_size, color);
+ draw_string(font, Point2(from_x + 2, int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), anim, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color);
}
if (p_selected) {
@@ -1272,7 +1272,7 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec,
int limit = to_x - from_x - 4;
if (limit > 0) {
- draw_string(font, Point2(from_x + 2, int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), anim, HALIGN_LEFT, -1, font_size, color);
+ draw_string(font, Point2(from_x + 2, int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), anim, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color);
}
if (p_selected) {
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 0f6fdcdae51..e197c13c14c 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -624,7 +624,7 @@ FindReplaceBar::FindReplaceBar() {
vbc_lineedit = memnew(VBoxContainer);
add_child(vbc_lineedit);
- vbc_lineedit->set_alignment(ALIGN_CENTER);
+ vbc_lineedit->set_alignment(ALIGNMENT_CENTER);
vbc_lineedit->set_h_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *vbc_button = memnew(VBoxContainer);
add_child(vbc_button);
@@ -633,10 +633,10 @@ FindReplaceBar::FindReplaceBar() {
HBoxContainer *hbc_button_search = memnew(HBoxContainer);
vbc_button->add_child(hbc_button_search);
- hbc_button_search->set_alignment(ALIGN_END);
+ hbc_button_search->set_alignment(ALIGNMENT_END);
hbc_button_replace = memnew(HBoxContainer);
vbc_button->add_child(hbc_button_replace);
- hbc_button_replace->set_alignment(ALIGN_END);
+ hbc_button_replace->set_alignment(ALIGNMENT_END);
HBoxContainer *hbc_option_search = memnew(HBoxContainer);
vbc_option->add_child(hbc_option_search);
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 85cf1558fec..8ea028a7de4 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -59,7 +59,7 @@ EditorDebuggerNode::EditorDebuggerNode() {
add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_RIGHT));
tabs = memnew(TabContainer);
- tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->set_tabs_visible(false);
tabs->connect("tab_changed", callable_mp(this, &EditorDebuggerNode::_debugger_changed));
add_child(tabs);
diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp
index d4385630be4..8b1f0085d57 100644
--- a/editor/debugger/editor_network_profiler.cpp
+++ b/editor/debugger/editor_network_profiler.cpp
@@ -60,7 +60,7 @@ void EditorNetworkProfiler::_update_frame() {
TreeItem *node = counters_display->create_item(root);
for (int j = 0; j < counters_display->get_columns(); ++j) {
- node->set_text_align(j, j > 0 ? TreeItem::ALIGN_RIGHT : TreeItem::ALIGN_LEFT);
+ node->set_text_alignment(j, j > 0 ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT);
}
node->set_text(0, E.value.node_path);
@@ -149,7 +149,7 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
incoming_bandwidth_text = memnew(LineEdit);
incoming_bandwidth_text->set_editable(false);
incoming_bandwidth_text->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
- incoming_bandwidth_text->set_align(LineEdit::Align::ALIGN_RIGHT);
+ incoming_bandwidth_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
hb->add_child(incoming_bandwidth_text);
Control *down_up_spacer = memnew(Control);
@@ -163,7 +163,7 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
outgoing_bandwidth_text = memnew(LineEdit);
outgoing_bandwidth_text->set_editable(false);
outgoing_bandwidth_text->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
- outgoing_bandwidth_text->set_align(LineEdit::Align::ALIGN_RIGHT);
+ outgoing_bandwidth_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
hb->add_child(outgoing_bandwidth_text);
// Set initial texts in the incoming/outgoing bandwidth labels
diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp
index 952f46e9a5a..6106f1755d2 100644
--- a/editor/debugger/editor_performance_profiler.cpp
+++ b/editor/debugger/editor_performance_profiler.cpp
@@ -132,14 +132,14 @@ void EditorPerformanceProfiler::_monitor_draw() {
rect.size -= graph_style_box->get_minimum_size();
Color draw_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
draw_color.set_hsv(Math::fmod(hue_shift * float(current.frame_index), 0.9f), draw_color.get_s() * 0.9f, draw_color.get_v() * value_multiplier, 0.6f);
- monitor_draw->draw_string(graph_font, rect.position + Point2(0, graph_font->get_ascent(font_size)), current.item->get_text(0), HALIGN_LEFT, rect.size.x, font_size, draw_color);
+ monitor_draw->draw_string(graph_font, rect.position + Point2(0, graph_font->get_ascent(font_size)), current.item->get_text(0), HORIZONTAL_ALIGNMENT_LEFT, rect.size.x, font_size, draw_color);
draw_color.a = 0.9f;
float value_position = rect.size.width - graph_font->get_string_size(current.item->get_text(1), font_size).width;
if (value_position < 0) {
value_position = 0;
}
- monitor_draw->draw_string(graph_font, rect.position + Point2(value_position, graph_font->get_ascent(font_size)), current.item->get_text(1), HALIGN_LEFT, rect.size.x, font_size, draw_color);
+ monitor_draw->draw_string(graph_font, rect.position + Point2(value_position, graph_font->get_ascent(font_size)), current.item->get_text(1), HORIZONTAL_ALIGNMENT_LEFT, rect.size.x, font_size, draw_color);
rect.position.y += graph_font->get_height(font_size);
rect.size.height -= graph_font->get_height(font_size);
@@ -152,12 +152,12 @@ void EditorPerformanceProfiler::_monitor_draw() {
Color horizontal_line_color;
horizontal_line_color.set_hsv(draw_color.get_h(), draw_color.get_s() * 0.5f, draw_color.get_v() * 0.5f, 0.3f);
monitor_draw->draw_line(rect.position, rect.position + Vector2(rect.size.width, 0), horizontal_line_color, Math::round(EDSCALE));
- monitor_draw->draw_string(graph_font, rect.position + Vector2(0, graph_font->get_ascent(font_size)), _create_label(current.max, current.type), HALIGN_LEFT, rect.size.width, font_size, horizontal_line_color);
+ monitor_draw->draw_string(graph_font, rect.position + Vector2(0, graph_font->get_ascent(font_size)), _create_label(current.max, current.type), HORIZONTAL_ALIGNMENT_LEFT, rect.size.width, font_size, horizontal_line_color);
for (int j = 0; j < line_count; j++) {
Vector2 y_offset = Vector2(0, rect.size.height * (1.0f - float(j) / float(line_count)));
monitor_draw->draw_line(rect.position + y_offset, rect.position + Vector2(rect.size.width, 0) + y_offset, horizontal_line_color, Math::round(EDSCALE));
- monitor_draw->draw_string(graph_font, rect.position - Vector2(0, graph_font->get_descent(font_size)) + y_offset, _create_label(current.max * float(j) / float(line_count), current.type), HALIGN_LEFT, rect.size.width, font_size, horizontal_line_color);
+ monitor_draw->draw_string(graph_font, rect.position - Vector2(0, graph_font->get_descent(font_size)) + y_offset, _create_label(current.max * float(j) / float(line_count), current.type), HORIZONTAL_ALIGNMENT_LEFT, rect.size.width, font_size, horizontal_line_color);
}
}
@@ -191,7 +191,7 @@ void EditorPerformanceProfiler::_monitor_draw() {
if (text_top_left_position.y < 0) {
text_top_left_position.y = h2 + MARKER_MARGIN;
}
- monitor_draw->draw_string(graph_font, rect.position + text_top_left_position + Point2(0, graph_font->get_ascent(font_size)), label, HALIGN_LEFT, rect.size.x, font_size, line_color);
+ monitor_draw->draw_string(graph_font, rect.position + text_top_left_position + Point2(0, graph_font->get_ascent(font_size)), label, HORIZONTAL_ALIGNMENT_LEFT, rect.size.x, font_size, line_color);
}
prev = h2;
e = e->next();
@@ -378,8 +378,8 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() {
info_message = memnew(Label);
info_message->set_text(TTR("Pick one or more items from the list to display the graph."));
- info_message->set_valign(Label::VALIGN_CENTER);
- info_message->set_align(Label::ALIGN_CENTER);
+ info_message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ info_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
info_message->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
info_message->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index d08ae1de8a9..2bdacb51b89 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -355,7 +355,7 @@ void EditorProfiler::_update_frame() {
item->set_metadata(0, it.signature);
item->set_metadata(1, it.script);
item->set_metadata(2, it.line);
- item->set_text_align(2, TreeItem::ALIGN_RIGHT);
+ item->set_text_alignment(2, HORIZONTAL_ALIGNMENT_RIGHT);
item->set_tooltip(0, it.name + "\n" + it.script + ":" + itos(it.line));
float time = dtime == DISPLAY_SELF_TIME ? it.self : it.total;
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 4739458f8e7..a4e4ed40208 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -462,7 +462,7 @@ void EditorVisualProfiler::_graph_tex_draw() {
graph->draw_line(Vector2(0, frame_y), Vector2(half_width, frame_y), Color(1, 1, 1, 0.3));
String limit_str = String::num(graph_limit, 2);
- graph->draw_string(font, Vector2(half_width - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HALIGN_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
+ graph->draw_string(font, Vector2(half_width - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
}
if (graph_height_gpu > 0) {
@@ -473,11 +473,11 @@ void EditorVisualProfiler::_graph_tex_draw() {
graph->draw_line(Vector2(half_width, frame_y), Vector2(graph->get_size().x, frame_y), Color(1, 1, 1, 0.3));
String limit_str = String::num(graph_limit, 2);
- graph->draw_string(font, Vector2(half_width * 2 - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HALIGN_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
+ graph->draw_string(font, Vector2(half_width * 2 - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
}
- graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x, font->get_ascent(font_size) + 2), "CPU:", HALIGN_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
- graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HALIGN_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
+ graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x, font->get_ascent(font_size) + 2), "CPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
+ graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
/*
if (hover_metric != -1 && frame_metrics[hover_metric].valid) {
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index bcff9cc56a4..71e501056c7 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -499,7 +499,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
error->set_icon(0, get_theme_icon(oe.warning ? "Warning" : "Error", "EditorIcons"));
error->set_text(0, time);
- error->set_text_align(0, TreeItem::ALIGN_LEFT);
+ error->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
const Color color = get_theme_color(oe.warning ? SNAME("warning_color") : SNAME("error_color"), SNAME("Editor"));
error->set_custom_color(0, color);
@@ -524,7 +524,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
TreeItem *cpp_cond = error_tree->create_item(error);
cpp_cond->set_text(0, "<" + TTR("C++ Error") + ">");
cpp_cond->set_text(1, oe.error);
- cpp_cond->set_text_align(0, TreeItem::ALIGN_LEFT);
+ cpp_cond->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
tooltip += TTR("C++ Error:") + " " + oe.error + "\n";
if (source_is_project_file) {
cpp_cond->set_metadata(0, source_meta);
@@ -542,7 +542,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
TreeItem *cpp_source = error_tree->create_item(error);
cpp_source->set_text(0, "<" + (source_is_project_file ? TTR("Source") : TTR("C++ Source")) + ">");
cpp_source->set_text(1, source_txt);
- cpp_source->set_text_align(0, TreeItem::ALIGN_LEFT);
+ cpp_source->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
tooltip += (source_is_project_file ? TTR("Source:") : TTR("C++ Source:")) + " " + source_txt + "\n";
// Set metadata to highlight error line in scripts.
@@ -565,7 +565,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
if (i == 0) {
stack_trace->set_text(0, "<" + TTR("Stack Trace") + ">");
- stack_trace->set_text_align(0, TreeItem::ALIGN_LEFT);
+ stack_trace->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
error->set_metadata(0, meta);
tooltip += TTR("Stack Trace:") + "\n";
}
@@ -1574,7 +1574,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
editor = p_editor;
tabs = memnew(TabContainer);
- tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed));
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index 414264e6974..2de92f5184d 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -125,7 +125,7 @@ EditorAbout::EditorAbout() {
vbc->connect("theme_changed", callable_mp(this, &EditorAbout::_theme_changed));
HBoxContainer *hbc = memnew(HBoxContainer);
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->set_alignment(BoxContainer::ALIGN_CENTER);
+ hbc->set_alignment(BoxContainer::ALIGNMENT_CENTER);
hbc->add_theme_constant_override("separation", 30 * EDSCALE);
add_child(vbc);
vbc->add_child(hbc);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 656c219d1c1..81a1f268186 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -1422,7 +1422,7 @@ void EditorAudioMeterNotches::_draw_audio_notches() {
Vector2((line_length + label_space) * EDSCALE,
(1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + (font_height / 4) + top_padding),
String::num(Math::abs(n.db_value)) + "dB",
- HALIGN_LEFT, -1, font_size,
+ HORIZONTAL_ALIGNMENT_LEFT, -1, font_size,
notch_color);
}
}
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 25e76c22628..86da3f89a6d 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -838,7 +838,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
error_message = memnew(Label);
error_message->hide();
- error_message->set_align(Label::Align::ALIGN_RIGHT);
+ error_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
error_message->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("error_color"), SNAME("Editor")));
add_child(error_message);
diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp
index 52e55de84ce..1b1a7a4a097 100644
--- a/editor/editor_command_palette.cpp
+++ b/editor/editor_command_palette.cpp
@@ -128,7 +128,7 @@ void EditorCommandPalette::_update_command_search(const String &search_text) {
String shortcut_text = entries[i].shortcut_text == "None" ? "" : entries[i].shortcut_text;
ti->set_text(0, entries[i].display_name);
ti->set_metadata(0, entries[i].key_name);
- ti->set_text_align(1, TreeItem::TextAlign::ALIGN_RIGHT);
+ ti->set_text_alignment(1, HORIZONTAL_ALIGNMENT_RIGHT);
ti->set_text(1, shortcut_text);
Color c = Color(1, 1, 1, 0.5);
ti->set_custom_color(1, c);
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 2222a5e5d31..78175ff022f 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -948,7 +948,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
Ref sb = memnew(StyleBoxEmpty);
sb->set_default_margin(SIDE_TOP, 20 * EDSCALE);
no_profile_selected_help->add_theme_style_override("normal", sb);
- no_profile_selected_help->set_align(Label::ALIGN_CENTER);
+ no_profile_selected_help->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
no_profile_selected_help->set_v_size_flags(Control::SIZE_EXPAND_FILL);
h_split->add_child(no_profile_selected_help);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index c95b1c753e8..56718e40903 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -235,7 +235,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
if (p_overview) {
class_desc->push_cell();
- class_desc->push_paragraph(RichTextLabel::ALIGN_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
+ class_desc->push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
} else {
_add_bulletpoint();
}
@@ -685,7 +685,7 @@ void EditorHelp::_update_doc() {
// Property type.
class_desc->push_cell();
- class_desc->push_paragraph(RichTextLabel::ALIGN_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
+ class_desc->push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
class_desc->push_font(doc_code_font);
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->pop();
@@ -1646,7 +1646,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
tag_stack.push_front(tag);
} else if (tag == "center") {
//align to center
- p_rt->push_paragraph(RichTextLabel::ALIGN_CENTER, Control::TEXT_DIRECTION_AUTO, "");
+ p_rt->push_paragraph(HORIZONTAL_ALIGNMENT_CENTER, Control::TEXT_DIRECTION_AUTO, "");
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "br") {
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 485a093aa16..8187f982e1f 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -310,7 +310,7 @@ void EditorProperty::_notification(int p_what) {
Ref pinned_icon = get_theme_icon(SNAME("Pin"), SNAME("EditorIcons"));
int margin_w = get_theme_constant(SNAME("hseparator"), SNAME("Tree")) * 2;
int total_icon_w = margin_w + pinned_icon->get_width();
- int text_w = font->get_string_size(label, font_size, rtl ? HALIGN_RIGHT : HALIGN_LEFT, text_limit - total_icon_w).x;
+ int text_w = font->get_string_size(label, font_size, rtl ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT, text_limit - total_icon_w).x;
int y = (size.height - pinned_icon->get_height()) / 2;
if (rtl) {
draw_texture(pinned_icon, Vector2(size.width - ofs - text_w - total_icon_w, y), color);
@@ -322,9 +322,9 @@ void EditorProperty::_notification(int p_what) {
int v_ofs = (size.height - font->get_height(font_size)) / 2;
if (rtl) {
- draw_string(font, Point2(size.width - ofs - text_limit, v_ofs + font->get_ascent(font_size)), label, HALIGN_RIGHT, text_limit, font_size, color);
+ draw_string(font, Point2(size.width - ofs - text_limit, v_ofs + font->get_ascent(font_size)), label, HORIZONTAL_ALIGNMENT_RIGHT, text_limit, font_size, color);
} else {
- draw_string(font, Point2(ofs, v_ofs + font->get_ascent(font_size)), label, HALIGN_LEFT, text_limit, font_size, color);
+ draw_string(font, Point2(ofs, v_ofs + font->get_ascent(font_size)), label, HORIZONTAL_ALIGNMENT_LEFT, text_limit, font_size, color);
}
if (keying) {
@@ -1077,7 +1077,7 @@ void EditorInspectorCategory::_notification(int p_what) {
}
Color color = get_theme_color(SNAME("font_color"), SNAME("Tree"));
- draw_string(font, Point2(ofs, font->get_ascent(font_size) + (get_size().height - font->get_height(font_size)) / 2).floor(), label, HALIGN_LEFT, get_size().width, font_size, color);
+ draw_string(font, Point2(ofs, font->get_ascent(font_size) + (get_size().height - font->get_height(font_size)) / 2).floor(), label, HORIZONTAL_ALIGNMENT_LEFT, get_size().width, font_size, color);
}
}
@@ -1230,7 +1230,7 @@ void EditorInspectorSection::_notification(int p_what) {
const int arrow_width = arrow.is_valid() ? arrow->get_width() : 0;
Color color = get_theme_color(SNAME("font_color"));
float text_width = get_size().width - Math::round(arrow_width + arrow_margin * EDSCALE);
- draw_string(font, Point2(rtl ? 0 : Math::round(arrow_width + arrow_margin * EDSCALE), font->get_ascent(font_size) + (header_height - font->get_height(font_size)) / 2).floor(), label, rtl ? HALIGN_RIGHT : HALIGN_LEFT, text_width, font_size, color);
+ draw_string(font, Point2(rtl ? 0 : Math::round(arrow_width + arrow_margin * EDSCALE), font->get_ascent(font_size) + (header_height - font->get_height(font_size)) / 2).floor(), label, rtl ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT, text_width, font_size, color);
if (arrow.is_valid()) {
if (rtl) {
@@ -2083,13 +2083,13 @@ EditorInspectorArray::EditorInspectorArray() {
add_button = memnew(Button);
add_button->set_text(TTR("Add Element"));
- add_button->set_text_align(Button::ALIGN_CENTER);
+ add_button->set_text_alignment(HORIZONTAL_ALIGNMENT_CENTER);
add_button->connect("pressed", callable_mp(this, &EditorInspectorArray::_add_button_pressed));
vbox->add_child(add_button);
hbox_pagination = memnew(HBoxContainer);
hbox_pagination->set_h_size_flags(SIZE_EXPAND_FILL);
- hbox_pagination->set_alignment(HBoxContainer::ALIGN_CENTER);
+ hbox_pagination->set_alignment(BoxContainer::ALIGNMENT_CENTER);
vbox->add_child(hbox_pagination);
first_page_button = memnew(Button);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index f06ef39bc33..3f20734e3f3 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -6150,7 +6150,7 @@ EditorNode::EditorNode() {
Label *dock_label = memnew(Label);
dock_label->set_text(TTR("Dock Position"));
dock_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- dock_label->set_align(Label::ALIGN_CENTER);
+ dock_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
dock_hb->add_child(dock_label);
dock_tab_move_right = memnew(Button);
@@ -6190,7 +6190,7 @@ EditorNode::EditorNode() {
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_slot[i]->set_popup(dock_select_popup);
dock_slot[i]->connect("pre_popup_pressed", callable_mp(this, &EditorNode::_dock_pre_popup), varray(i));
- dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
+ dock_slot[i]->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
dock_slot[i]->set_drag_to_rearrange_enabled(true);
dock_slot[i]->set_tabs_rearrange_group(1);
dock_slot[i]->connect("tab_changed", callable_mp(this, &EditorNode::_dock_tab_changed));
@@ -6230,7 +6230,7 @@ EditorNode::EditorNode() {
scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles")));
scene_tabs->set_select_with_rmb(true);
scene_tabs->add_tab("unsaved");
- scene_tabs->set_tab_align(TabBar::ALIGN_LEFT);
+ scene_tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/scene_tabs/always_show_close_button", false)) ? TabBar::CLOSE_BUTTON_SHOW_ALWAYS : TabBar::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
scene_tabs->set_drag_to_rearrange_enabled(true);
diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp
index f3b3eedccc7..45c02320724 100644
--- a/editor/editor_path.cpp
+++ b/editor/editor_path.cpp
@@ -211,7 +211,7 @@ EditorPath::EditorPath(EditorHistory *p_history) {
current_object_label = memnew(Label);
current_object_label->set_clip_text(true);
- current_object_label->set_align(Label::ALIGN_LEFT);
+ current_object_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT);
current_object_label->set_h_size_flags(SIZE_EXPAND_FILL);
main_hb->add_child(current_object_label);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 24c229adfd5..8e8a290ebb0 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -891,7 +891,7 @@ public:
Vector2 offset;
offset.y = rect2.size.y * 0.75;
- draw_string(font, rect2.position + offset, itos(layer_index + 1), HALIGN_CENTER, rect2.size.x, font_size, on ? text_color_on : text_color);
+ draw_string(font, rect2.position + offset, itos(layer_index + 1), HORIZONTAL_ALIGNMENT_CENTER, rect2.size.x, font_size, on ? text_color_on : text_color);
ofs.x += bsize + 1;
@@ -1383,7 +1383,7 @@ void EditorPropertyEasing::_draw_easing() {
} else {
decimals = 1;
}
- f->draw_string(ci, Point2(10, 10 + f->get_ascent(font_size)), TS->format_number(rtos(exp).pad_decimals(decimals)), HALIGN_LEFT, -1, font_size, font_color);
+ f->draw_string(ci, Point2(10, 10 + f->get_ascent(font_size)), TS->format_number(rtos(exp).pad_decimals(decimals)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
}
void EditorPropertyEasing::update_property() {
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index f07a5ab5231..5565ec8f903 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -323,9 +323,9 @@ void EditorSpinSlider::_draw_spin_slider() {
}
if (rtl) {
- draw_string(font, Vector2(Math::round(size.width - sb->get_offset().x - label_width), vofs), label, HALIGN_RIGHT, -1, font_size, lc * Color(1, 1, 1, 0.5));
+ draw_string(font, Vector2(Math::round(size.width - sb->get_offset().x - label_width), vofs), label, HORIZONTAL_ALIGNMENT_RIGHT, -1, font_size, lc * Color(1, 1, 1, 0.5));
} else {
- draw_string(font, Vector2(Math::round(sb->get_offset().x), vofs), label, HALIGN_LEFT, -1, font_size, lc * Color(1, 1, 1, 0.5));
+ draw_string(font, Vector2(Math::round(sb->get_offset().x), vofs), label, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, lc * Color(1, 1, 1, 0.5));
}
int suffix_start = numstr.length();
diff --git a/editor/editor_zoom_widget.cpp b/editor/editor_zoom_widget.cpp
index a998ec7e5b0..5a37d882c21 100644
--- a/editor/editor_zoom_widget.cpp
+++ b/editor/editor_zoom_widget.cpp
@@ -183,7 +183,7 @@ EditorZoomWidget::EditorZoomWidget() {
zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KeyModifierMask::CMD | Key::KEY_0));
zoom_reset->set_shortcut_context(this);
zoom_reset->set_focus_mode(FOCUS_NONE);
- zoom_reset->set_text_align(Button::TextAlign::ALIGN_CENTER);
+ zoom_reset->set_text_alignment(HORIZONTAL_ALIGNMENT_CENTER);
// Prevent the button's size from changing when the text size changes
zoom_reset->set_custom_minimum_size(Size2(75 * EDSCALE, 0));
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index cb88e9d75ea..f63fcb29381 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -827,7 +827,7 @@ ExportTemplateManager::ExportTemplateManager() {
current_missing_label->set_theme_type_variation("HeaderSmall");
current_missing_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- current_missing_label->set_align(Label::ALIGN_RIGHT);
+ current_missing_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
current_missing_label->set_text(TTR("Export templates are missing. Download them or install from a file."));
current_hb->add_child(current_missing_label);
@@ -835,7 +835,7 @@ ExportTemplateManager::ExportTemplateManager() {
current_installed_label = memnew(Label);
current_installed_label->set_theme_type_variation("HeaderSmall");
current_installed_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- current_installed_label->set_align(Label::ALIGN_RIGHT);
+ current_installed_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
current_installed_label->set_text(TTR("Export templates are installed and ready to be used."));
current_hb->add_child(current_installed_label);
current_installed_label->hide();
@@ -909,7 +909,7 @@ ExportTemplateManager::ExportTemplateManager() {
}
HBoxContainer *install_file_hb = memnew(HBoxContainer);
- install_file_hb->set_alignment(BoxContainer::ALIGN_END);
+ install_file_hb->set_alignment(BoxContainer::ALIGNMENT_END);
install_options_vb->add_child(install_file_hb);
install_file_button = memnew(Button);
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 6d0b07d6013..39452b71920 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -2936,7 +2936,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
Label *slabel = memnew(Label);
slabel->set_text(TTR("Scanning Files,\nPlease Wait..."));
- slabel->set_align(Label::ALIGN_CENTER);
+ slabel->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
scanning_vb->add_child(slabel);
scanning_progress = memnew(ProgressBar);
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index f01c7f50f74..ce5e0e03fdd 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -544,8 +544,8 @@ GroupDialog::GroupDialog() {
group_empty->set_theme_type_variation("HeaderSmall");
group_empty->set_text(TTR("Empty groups will be automatically removed."));
- group_empty->set_valign(Label::VALIGN_CENTER);
- group_empty->set_align(Label::ALIGN_CENTER);
+ group_empty->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ group_empty->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
group_empty->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
nodes_to_remove->add_child(group_empty);
diff --git a/editor/import/dynamicfont_import_settings.cpp b/editor/import/dynamicfont_import_settings.cpp
index a44ee8a3f67..83c0f56d87d 100644
--- a/editor/import/dynamicfont_import_settings.cpp
+++ b/editor/import/dynamicfont_import_settings.cpp
@@ -1083,7 +1083,7 @@ void DynamicFontImportSettings::_edit_range(int32_t p_start, int32_t p_end) {
item = glyph_table->create_item(root);
ERR_FAIL_NULL(item);
item->set_text(0, _pad_zeros(String::num_int64(c, 16)));
- item->set_text_align(0, TreeItem::ALIGN_LEFT);
+ item->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
item->set_selectable(0, false);
item->set_custom_bg_color(0, glyph_table->get_theme_color("dark_color_3", "Editor"));
}
@@ -1101,7 +1101,7 @@ void DynamicFontImportSettings::_edit_range(int32_t p_start, int32_t p_end) {
item->set_custom_bg_color(col + 1, glyph_table->get_theme_color("dark_color_2", "Editor"));
}
item->set_metadata(col + 1, c);
- item->set_text_align(col + 1, TreeItem::ALIGN_CENTER);
+ item->set_text_alignment(col + 1, HORIZONTAL_ALIGNMENT_CENTER);
item->set_selectable(col + 1, true);
item->set_custom_font(col + 1, font_main);
item->set_custom_font_size(col + 1, get_theme_font_size("font_size") * 2);
@@ -1632,7 +1632,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
root_vb->add_child(main_pages);
label_warn = memnew(Label);
- label_warn->set_align(Label::ALIGN_CENTER);
+ label_warn->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_warn->set_text("");
root_vb->add_child(label_warn);
label_warn->add_theme_color_override("font_color", warn_color);
@@ -1656,8 +1656,8 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
font_preview_label = memnew(Label);
font_preview_label->add_theme_font_size_override("font_size", 200 * EDSCALE);
- font_preview_label->set_align(Label::ALIGN_CENTER);
- font_preview_label->set_valign(Label::VALIGN_CENTER);
+ font_preview_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ font_preview_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
font_preview_label->set_autowrap_mode(Label::AUTOWRAP_ARBITRARY);
font_preview_label->set_clip_text(true);
font_preview_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
@@ -1694,7 +1694,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
label_vars = memnew(Label);
page2_hb_vars->add_child(label_vars);
- label_vars->set_align(Label::ALIGN_CENTER);
+ label_vars->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_vars->set_h_size_flags(Control::SIZE_EXPAND_FILL);
label_vars->set_text(TTR("Configuration:"));
@@ -1845,7 +1845,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
page5_vb->add_child(hb_lang);
label_langs = memnew(Label);
- label_langs->set_align(Label::ALIGN_CENTER);
+ label_langs->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_langs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
label_langs->set_text(TTR("Language support overrides"));
hb_lang->add_child(label_langs);
@@ -1873,7 +1873,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
page5_vb->add_child(hb_script);
label_script = memnew(Label);
- label_script->set_align(Label::ALIGN_CENTER);
+ label_script->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_script->set_h_size_flags(Control::SIZE_EXPAND_FILL);
label_script->set_text(TTR("Script support overrides"));
hb_script->add_child(label_script);
diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp
index 7458f617c35..9d48a43d4d3 100644
--- a/editor/localization_editor.cpp
+++ b/editor/localization_editor.cpp
@@ -641,7 +641,7 @@ LocalizationEditor::LocalizationEditor() {
translation_locales_list_created = false;
TabContainer *translations = memnew(TabContainer);
- translations->set_tab_align(TabContainer::ALIGN_LEFT);
+ translations->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
translations->set_v_size_flags(Control::SIZE_EXPAND_FILL);
add_child(translations);
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index 532413897b4..c3dc7eae289 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -128,8 +128,8 @@ NodeDock::NodeDock() {
select_a_node->set_text(TTR("Select a single node to edit its signals and groups."));
select_a_node->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
select_a_node->set_v_size_flags(SIZE_EXPAND_FILL);
- select_a_node->set_valign(Label::VALIGN_CENTER);
- select_a_node->set_align(Label::ALIGN_CENTER);
+ select_a_node->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ select_a_node->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
select_a_node->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
add_child(select_a_node);
}
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 58f92a98a66..72d94e61cad 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -554,7 +554,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
String num = String::num(vertex.vertex);
Size2 num_size = font->get_string_size(num, font_size);
- p_overlay->draw_string(font, point - num_size * 0.5, num, HALIGN_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
+ p_overlay->draw_string(font, point - num_size * 0.5, num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
}
}
}
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index e8d91ed1ae9..b9ad18ef51b 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -223,7 +223,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() {
float x = point;
blend_space_draw->draw_line(Point2(x, s.height - 1), Point2(x, s.height - 5 * EDSCALE), linecolor);
- blend_space_draw->draw_string(font, Point2(x + 2 * EDSCALE, s.height - 2 * EDSCALE - font->get_height(font_size) + font->get_ascent(font_size)), "0", HALIGN_LEFT, -1, font_size, linecolor);
+ blend_space_draw->draw_string(font, Point2(x + 2 * EDSCALE, s.height - 2 * EDSCALE - font->get_height(font_size) + font->get_ascent(font_size)), "0", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, linecolor);
blend_space_draw->draw_line(Point2(x, s.height - 5 * EDSCALE), Point2(x, 0), linecolor_soft);
}
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index cb9fe102123..362b0b6cf7d 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -412,14 +412,14 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() {
if (blend_space->get_min_space().y < 0) {
int y = (blend_space->get_max_space().y / (blend_space->get_max_space().y - blend_space->get_min_space().y)) * s.height;
blend_space_draw->draw_line(Point2(0, y), Point2(5 * EDSCALE, y), linecolor);
- blend_space_draw->draw_string(font, Point2(2 * EDSCALE, y - font->get_height(font_size) + font->get_ascent(font_size)), "0", HALIGN_LEFT, -1, font_size, linecolor);
+ blend_space_draw->draw_string(font, Point2(2 * EDSCALE, y - font->get_height(font_size) + font->get_ascent(font_size)), "0", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, linecolor);
blend_space_draw->draw_line(Point2(5 * EDSCALE, y), Point2(s.width, y), linecolor_soft);
}
if (blend_space->get_min_space().x < 0) {
int x = (-blend_space->get_min_space().x / (blend_space->get_max_space().x - blend_space->get_min_space().x)) * s.width;
blend_space_draw->draw_line(Point2(x, s.height - 1), Point2(x, s.height - 5 * EDSCALE), linecolor);
- blend_space_draw->draw_string(font, Point2(x + 2 * EDSCALE, s.height - 2 * EDSCALE - font->get_height(font_size) + font->get_ascent(font_size)), "0", HALIGN_LEFT, -1, font_size, linecolor);
+ blend_space_draw->draw_string(font, Point2(x + 2 * EDSCALE, s.height - 2 * EDSCALE - font->get_height(font_size) + font->get_ascent(font_size)), "0", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, linecolor);
blend_space_draw->draw_line(Point2(x, s.height - 5 * EDSCALE), Point2(x, 0), linecolor_soft);
}
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index d3dd33e67e5..391565057c9 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -761,12 +761,12 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
bool onstart = state_machine->get_start_node() == name;
if (onstart) {
- state_machine_draw->draw_string(font, offset + Vector2(0, -font->get_height(font_size) - 3 * EDSCALE + font->get_ascent(font_size)), TTR("Start"), HALIGN_LEFT, -1, font_size, font_color);
+ state_machine_draw->draw_string(font, offset + Vector2(0, -font->get_height(font_size) - 3 * EDSCALE + font->get_ascent(font_size)), TTR("Start"), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
}
if (state_machine->get_end_node() == name) {
int endofs = nr.node.size.x - font->get_string_size(TTR("End"), font_size).x;
- state_machine_draw->draw_string(font, offset + Vector2(endofs, -font->get_height(font_size) - 3 * EDSCALE + font->get_ascent(font_size)), TTR("End"), HALIGN_LEFT, -1, font_size, font_color);
+ state_machine_draw->draw_string(font, offset + Vector2(endofs, -font->get_height(font_size) - 3 * EDSCALE + font->get_ascent(font_size)), TTR("End"), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
}
offset.x += sb->get_offset().x;
@@ -786,7 +786,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
nr.name.position = offset + Vector2(0, (h - font->get_height(font_size)) / 2).floor();
nr.name.size = Vector2(strsize, font->get_height(font_size));
- state_machine_draw->draw_string(font, nr.name.position + Vector2(0, font->get_ascent(font_size)), name, HALIGN_LEFT, -1, font_size, font_color);
+ state_machine_draw->draw_string(font, nr.name.position + Vector2(0, font->get_ascent(font_size)), name, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
offset.x += strsize + sep;
if (needs_editor) {
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 5cfd7525e5a..4f3b5db1dad 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -1452,11 +1452,11 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
library_vb_border->add_child(library_vb);
library_loading = memnew(Label(TTR("Loading...")));
- library_loading->set_align(Label::ALIGN_CENTER);
+ library_loading->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
library_vb->add_child(library_loading);
library_error = memnew(Label);
- library_error->set_align(Label::ALIGN_CENTER);
+ library_error->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
library_error->hide();
library_vb->add_child(library_error);
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
index c76713f534a..c621ade5c84 100644
--- a/editor/plugins/audio_stream_editor_plugin.cpp
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -241,7 +241,7 @@ AudioStreamEditor::AudioStreamEditor() {
_stop_button->connect("pressed", callable_mp(this, &AudioStreamEditor::_stop));
_current_label = memnew(Label);
- _current_label->set_align(Label::ALIGN_RIGHT);
+ _current_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
_current_label->set_h_size_flags(SIZE_EXPAND_FILL);
_current_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
_current_label->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 737b69b8b7e..d92564581dd 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2651,7 +2651,7 @@ void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string
p_position += Vector2(-text_size.x / 2, text_size.y + 5);
break;
}
- viewport->draw_string(font, p_position, p_string, HALIGN_LEFT, -1, font_size, color);
+ viewport->draw_string(font, p_position, p_string, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color);
}
void CanvasItemEditor::_draw_margin_at_position(int p_value, Point2 p_position, Side p_side) {
@@ -2711,7 +2711,7 @@ void CanvasItemEditor::_draw_guides() {
Ref font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
Size2 text_size = font->get_string_size(str, font_size);
- viewport->draw_string(font, Point2(dragged_guide_pos.x + 10, RULER_WIDTH + text_size.y / 2 + 10), str, HALIGN_LEFT, -1, font_size, text_color, outline_size, outline_color);
+ viewport->draw_string(font, Point2(dragged_guide_pos.x + 10, RULER_WIDTH + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color, outline_size, outline_color);
viewport->draw_line(Point2(dragged_guide_pos.x, 0), Point2(dragged_guide_pos.x, viewport->get_size().y), guide_color, Math::round(EDSCALE));
}
if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_H_GUIDE) {
@@ -2719,7 +2719,7 @@ void CanvasItemEditor::_draw_guides() {
Ref font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
Size2 text_size = font->get_string_size(str, font_size);
- viewport->draw_string(font, Point2(RULER_WIDTH + 10, dragged_guide_pos.y + text_size.y / 2 + 10), str, HALIGN_LEFT, -1, font_size, text_color, outline_size, outline_color);
+ viewport->draw_string(font, Point2(RULER_WIDTH + 10, dragged_guide_pos.y + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color, outline_size, outline_color);
viewport->draw_line(Point2(0, dragged_guide_pos.y), Point2(viewport->get_size().x, dragged_guide_pos.y), guide_color, Math::round(EDSCALE));
}
}
@@ -2791,7 +2791,7 @@ void CanvasItemEditor::_draw_rulers() {
if (i % (major_subdivision * minor_subdivision) == 0) {
viewport->draw_line(Point2(position.x, 0), Point2(position.x, RULER_WIDTH), graduation_color, Math::round(EDSCALE));
real_t val = (ruler_transform * major_subdivide * minor_subdivide).xform(Point2(i, 0)).x;
- viewport->draw_string(font, Point2(position.x + 2, font->get_height(font_size)), TS->format_number(vformat(((int)val == val) ? "%d" : "%.1f", val)), HALIGN_LEFT, -1, font_size, font_color);
+ viewport->draw_string(font, Point2(position.x + 2, font->get_height(font_size)), TS->format_number(vformat(((int)val == val) ? "%d" : "%.1f", val)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
} else {
if (i % minor_subdivision == 0) {
viewport->draw_line(Point2(position.x, RULER_WIDTH * 0.33), Point2(position.x, RULER_WIDTH), graduation_color, Math::round(EDSCALE));
@@ -2811,7 +2811,7 @@ void CanvasItemEditor::_draw_rulers() {
Transform2D text_xform = Transform2D(-Math_PI / 2.0, Point2(font->get_height(font_size), position.y - 2));
viewport->draw_set_transform_matrix(viewport->get_transform() * text_xform);
- viewport->draw_string(font, Point2(), TS->format_number(vformat(((int)val == val) ? "%d" : "%.1f", val)), HALIGN_LEFT, -1, font_size, font_color);
+ viewport->draw_string(font, Point2(), TS->format_number(vformat(((int)val == val) ? "%d" : "%.1f", val)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
viewport->draw_set_transform_matrix(viewport->get_transform());
} else {
@@ -2931,13 +2931,13 @@ void CanvasItemEditor::_draw_ruler_tool() {
text_pos.y = CLAMP(text_pos.y, text_height * 1.5, viewport->get_rect().size.y - text_height * 1.5);
if (begin.is_equal_approx(end)) {
- viewport->draw_string(font, text_pos, (String)ruler_tool_origin, HALIGN_LEFT, -1, font_size, font_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos, (String)ruler_tool_origin, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color, outline_size, outline_color);
Ref position_icon = get_theme_icon(SNAME("EditorPosition"), SNAME("EditorIcons"));
viewport->draw_texture(get_theme_icon(SNAME("EditorPosition"), SNAME("EditorIcons")), (ruler_tool_origin - view_offset) * zoom - position_icon->get_size() / 2);
return;
}
- viewport->draw_string(font, text_pos, TS->format_number(vformat("%.1f px", length_vector.length())), HALIGN_LEFT, -1, font_size, font_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos, TS->format_number(vformat("%.1f px", length_vector.length())), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color, outline_size, outline_color);
bool draw_secondary_lines = !(Math::is_equal_approx(begin.y, corner.y) || Math::is_equal_approx(end.x, corner.x));
@@ -2955,16 +2955,16 @@ void CanvasItemEditor::_draw_ruler_tool() {
Point2 text_pos2 = text_pos;
text_pos2.x = begin.x < text_pos.x ? MIN(text_pos.x - text_width, begin.x - text_width / 2) : MAX(text_pos.x + text_width, begin.x - text_width / 2);
- viewport->draw_string(font, text_pos2, TS->format_number(vformat("%.1f px", length_vector.y)), HALIGN_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos2, TS->format_number(vformat("%.1f px", length_vector.y)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
Point2 v_angle_text_pos = Point2();
v_angle_text_pos.x = CLAMP(begin.x - angle_text_width / 2, angle_text_width / 2, viewport->get_rect().size.x - angle_text_width);
v_angle_text_pos.y = begin.y < end.y ? MIN(text_pos2.y - 2 * text_height, begin.y - text_height * 0.5) : MAX(text_pos2.y + text_height * 3, begin.y + text_height * 1.5);
- viewport->draw_string(font, v_angle_text_pos, TS->format_number(vformat(String::utf8("%d°"), vertical_angle)), HALIGN_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
+ viewport->draw_string(font, v_angle_text_pos, TS->format_number(vformat(String::utf8("%d°"), vertical_angle)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
text_pos2 = text_pos;
text_pos2.y = end.y < text_pos.y ? MIN(text_pos.y - text_height * 2, end.y - text_height / 2) : MAX(text_pos.y + text_height * 2, end.y - text_height / 2);
- viewport->draw_string(font, text_pos2, TS->format_number(vformat("%.1f px", length_vector.x)), HALIGN_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos2, TS->format_number(vformat("%.1f px", length_vector.x)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
Point2 h_angle_text_pos = Point2();
h_angle_text_pos.x = CLAMP(end.x - angle_text_width / 2, angle_text_width / 2, viewport->get_rect().size.x - angle_text_width);
@@ -2981,7 +2981,7 @@ void CanvasItemEditor::_draw_ruler_tool() {
h_angle_text_pos.y = MIN(text_pos.y - height_multiplier * text_height, MIN(end.y - text_height * 0.5, text_pos2.y - height_multiplier * text_height));
}
}
- viewport->draw_string(font, h_angle_text_pos, TS->format_number(vformat(String::utf8("%d°"), horizontal_angle)), HALIGN_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
+ viewport->draw_string(font, h_angle_text_pos, TS->format_number(vformat(String::utf8("%d°"), horizontal_angle)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
// Angle arcs
int arc_point_count = 8;
@@ -3016,17 +3016,17 @@ void CanvasItemEditor::_draw_ruler_tool() {
text_pos.y = CLAMP(text_pos.y, text_height * 2.5, viewport->get_rect().size.y - text_height / 2);
if (draw_secondary_lines) {
- viewport->draw_string(font, text_pos, TS->format_number(vformat("%.2f " + TTR("units"), (length_vector / grid_step).length())), HALIGN_LEFT, -1, font_size, font_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos, TS->format_number(vformat("%.2f " + TTR("units"), (length_vector / grid_step).length())), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color, outline_size, outline_color);
Point2 text_pos2 = text_pos;
text_pos2.x = begin.x < text_pos.x ? MIN(text_pos.x - text_width, begin.x - text_width / 2) : MAX(text_pos.x + text_width, begin.x - text_width / 2);
- viewport->draw_string(font, text_pos2, TS->format_number(vformat("%d " + TTR("units"), roundf(length_vector.y / grid_step.y))), HALIGN_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos2, TS->format_number(vformat("%d " + TTR("units"), roundf(length_vector.y / grid_step.y))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
text_pos2 = text_pos;
text_pos2.y = end.y < text_pos.y ? MIN(text_pos.y - text_height * 2, end.y + text_height / 2) : MAX(text_pos.y + text_height * 2, end.y + text_height / 2);
- viewport->draw_string(font, text_pos2, TS->format_number(vformat("%d " + TTR("units"), roundf(length_vector.x / grid_step.x))), HALIGN_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos2, TS->format_number(vformat("%d " + TTR("units"), roundf(length_vector.x / grid_step.x))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_secondary_color, outline_size, outline_color);
} else {
- viewport->draw_string(font, text_pos, TS->format_number(vformat("%d " + TTR("units"), roundf((length_vector / grid_step).length()))), HALIGN_LEFT, -1, font_size, font_color, outline_size, outline_color);
+ viewport->draw_string(font, text_pos, TS->format_number(vformat("%d " + TTR("units"), roundf((length_vector / grid_step).length()))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color, outline_size, outline_color);
}
}
} else {
@@ -3589,7 +3589,7 @@ void CanvasItemEditor::_draw_hover() {
viewport->draw_texture(node_icon, pos, Color(1.0, 1.0, 1.0, 0.5));
// Draw name
- viewport->draw_string(font, pos + Point2(node_icon->get_size().x + 4, item_size.y - 3), node_name, HALIGN_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
+ viewport->draw_string(font, pos + Point2(node_icon->get_size().x + 4, item_size.y - 3), node_name, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
}
}
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 0c269e9b07e..3bb707d4158 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -675,11 +675,11 @@ void CurveEditor::_draw() {
// X axis
float y = curve.get_min_value();
Vector2 off(0, font_height - 1);
- draw_string(font, get_view_pos(Vector2(0, y)) + off, "0.0", HALIGN_LEFT, -1, font_size, text_color);
- draw_string(font, get_view_pos(Vector2(0.25, y)) + off, "0.25", HALIGN_LEFT, -1, font_size, text_color);
- draw_string(font, get_view_pos(Vector2(0.5, y)) + off, "0.5", HALIGN_LEFT, -1, font_size, text_color);
- draw_string(font, get_view_pos(Vector2(0.75, y)) + off, "0.75", HALIGN_LEFT, -1, font_size, text_color);
- draw_string(font, get_view_pos(Vector2(1, y)) + off, "1.0", HALIGN_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(0, y)) + off, "0.0", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(0.25, y)) + off, "0.25", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(0.5, y)) + off, "0.5", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(0.75, y)) + off, "0.75", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(1, y)) + off, "1.0", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
}
{
@@ -688,9 +688,9 @@ void CurveEditor::_draw() {
float m1 = 0.5 * (curve.get_min_value() + curve.get_max_value());
float m2 = curve.get_max_value();
Vector2 off(1, -1);
- draw_string(font, get_view_pos(Vector2(0, m0)) + off, String::num(m0, 2), HALIGN_LEFT, -1, font_size, text_color);
- draw_string(font, get_view_pos(Vector2(0, m1)) + off, String::num(m1, 2), HALIGN_LEFT, -1, font_size, text_color);
- draw_string(font, get_view_pos(Vector2(0, m2)) + off, String::num(m2, 3), HALIGN_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(0, m0)) + off, String::num(m0, 2), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(0, m1)) + off, String::num(m1, 2), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
+ draw_string(font, get_view_pos(Vector2(0, m2)) + off, String::num(m2, 3), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
}
// Draw tangents for current point
@@ -750,10 +750,10 @@ void CurveEditor::_draw() {
if (_selected_point > 0 && _selected_point + 1 < curve.get_point_count()) {
text_color.a *= 0.4;
- draw_string(font, Vector2(50 * EDSCALE, font_height), TTR("Hold Shift to edit tangents individually"), HALIGN_LEFT, -1, font_size, text_color);
+ draw_string(font, Vector2(50 * EDSCALE, font_height), TTR("Hold Shift to edit tangents individually"), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
} else if (curve.get_point_count() == 0) {
text_color.a *= 0.4;
- draw_string(font, Vector2(50 * EDSCALE, font_height), TTR("Right click to add point"), HALIGN_LEFT, -1, font_size, text_color);
+ draw_string(font, Vector2(50 * EDSCALE, font_height), TTR("Right click to add point"), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
}
}
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 9702c7e7347..31cb0cd18d1 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -851,7 +851,7 @@ Ref EditorFontPreviewPlugin::generate_from_path(const String &p_path,
Ref font = sampled_font;
- font->draw_string(canvas_item, pos, sample, HALIGN_LEFT, -1.f, 50, Color(1, 1, 1));
+ font->draw_string(canvas_item, pos, sample, HORIZONTAL_ALIGNMENT_LEFT, -1.f, 50, Color(1, 1, 1));
RS::get_singleton()->connect(SNAME("frame_pre_draw"), callable_mp(const_cast(this), &EditorFontPreviewPlugin::_generate_frame_started), Vector(), Object::CONNECT_ONESHOT);
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index fb469b3e007..2f14447bf9f 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2987,7 +2987,7 @@ static void draw_indicator_bar(Control &surface, real_t fill, const Ref font = get_theme_font(SNAME("font"), SNAME("Label"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
Point2 msgpos = Point2(5, get_size().y - 20);
- font->draw_string(ci, msgpos + Point2(1, 1), message, HALIGN_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
- font->draw_string(ci, msgpos + Point2(-1, -1), message, HALIGN_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
- font->draw_string(ci, msgpos, message, HALIGN_LEFT, -1, font_size, Color(1, 1, 1, 1));
+ font->draw_string(ci, msgpos + Point2(1, 1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
+ font->draw_string(ci, msgpos + Point2(-1, -1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
+ font->draw_string(ci, msgpos, message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1));
}
if (_edit.mode == TRANSFORM_ROTATE) {
@@ -4444,7 +4444,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
cinema_label = memnew(Label);
cinema_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
cinema_label->set_h_grow_direction(GROW_DIRECTION_END);
- cinema_label->set_align(Label::ALIGN_CENTER);
+ cinema_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
surface->add_child(cinema_label);
cinema_label->set_text(TTR("Cinematic Preview"));
cinema_label->hide();
@@ -4455,7 +4455,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
locked_label->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -10 * EDSCALE);
locked_label->set_h_grow_direction(GROW_DIRECTION_END);
locked_label->set_v_grow_direction(GROW_DIRECTION_BEGIN);
- locked_label->set_align(Label::ALIGN_CENTER);
+ locked_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
surface->add_child(locked_label);
locked_label->set_text(TTR("View Rotation Locked"));
locked_label->hide();
@@ -7661,7 +7661,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
sun_title->set_theme_type_variation("HeaderSmall");
sun_vb->add_child(sun_title);
sun_title->set_text(TTR("Preview Sun"));
- sun_title->set_align(Label::ALIGN_CENTER);
+ sun_title->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
CenterContainer *sun_direction_center = memnew(CenterContainer);
sun_direction = memnew(Control);
@@ -7749,8 +7749,8 @@ void fragment() {
sun_state = memnew(Label);
sun_environ_hb->add_child(sun_state);
- sun_state->set_align(Label::ALIGN_CENTER);
- sun_state->set_valign(Label::VALIGN_CENTER);
+ sun_state->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ sun_state->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
sun_state->set_h_size_flags(SIZE_EXPAND_FILL);
VSeparator *sc = memnew(VSeparator);
@@ -7768,7 +7768,7 @@ void fragment() {
environ_vb->add_child(environ_title);
environ_title->set_text(TTR("Preview Environment"));
- environ_title->set_align(Label::ALIGN_CENTER);
+ environ_title->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
environ_sky_color = memnew(ColorPickerButton);
environ_sky_color->set_edit_alpha(false);
@@ -7816,8 +7816,8 @@ void fragment() {
environ_state = memnew(Label);
sun_environ_hb->add_child(environ_state);
- environ_state->set_align(Label::ALIGN_CENTER);
- environ_state->set_valign(Label::VALIGN_CENTER);
+ environ_state->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ environ_state->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
environ_state->set_h_size_flags(SIZE_EXPAND_FILL);
preview_sun = memnew(DirectionalLight3D);
diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp
index b1e104e6801..71955cf62ca 100644
--- a/editor/plugins/physical_bone_3d_editor_plugin.cpp
+++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp
@@ -51,7 +51,7 @@ PhysicalBone3DEditor::PhysicalBone3DEditor(EditorNode *p_editor) :
editor(p_editor) {
spatial_editor_hb = memnew(HBoxContainer);
spatial_editor_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- spatial_editor_hb->set_alignment(BoxContainer::ALIGN_BEGIN);
+ spatial_editor_hb->set_alignment(BoxContainer::ALIGNMENT_BEGIN);
Node3DEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb);
spatial_editor_hb->add_child(memnew(VSeparator));
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 66b803e3ab5..36bab836309 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -90,7 +90,7 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
add_child(vbc);
method = memnew(Label);
- method->set_align(Label::ALIGN_CENTER);
+ method->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
vbc->add_child(method);
tree = memnew(Tree);
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index a13cbfa515f..89016b8758b 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -1115,7 +1115,7 @@ ThemeItemImportTree::ThemeItemImportTree() {
label_set->add_child(select_items_label);
HBoxContainer *button_set = memnew(HBoxContainer);
- button_set->set_alignment(BoxContainer::ALIGN_END);
+ button_set->set_alignment(BoxContainer::ALIGNMENT_END);
all_set->add_child(button_set);
select_all_items_button->set_flat(true);
select_all_items_button->set_tooltip(select_all_items_tooltip);
@@ -1130,7 +1130,7 @@ ThemeItemImportTree::ThemeItemImportTree() {
button_set->add_child(deselect_all_items_button);
deselect_all_items_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_deselect_all_data_type_pressed), varray(i));
- total_selected_items_label->set_align(Label::ALIGN_RIGHT);
+ total_selected_items_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
total_selected_items_label->hide();
import_bulk_vb->add_child(total_selected_items_label);
@@ -1783,7 +1783,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog() {
set_hide_on_ok(false); // Closing may require a confirmation in some cases.
tc = memnew(TabContainer);
- tc->set_tab_align(TabContainer::TabAlign::ALIGN_LEFT);
+ tc->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
add_child(tc);
// Edit Items tab.
@@ -1909,8 +1909,8 @@ ThemeItemEditorDialog::ThemeItemEditorDialog() {
edit_items_message = memnew(Label);
edit_items_message->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
edit_items_message->set_mouse_filter(Control::MOUSE_FILTER_STOP);
- edit_items_message->set_align(Label::ALIGN_CENTER);
- edit_items_message->set_valign(Label::VALIGN_CENTER);
+ edit_items_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ edit_items_message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
edit_items_message->set_autowrap_mode(Label::AUTOWRAP_WORD);
edit_items_tree->add_child(edit_items_message);
@@ -3129,7 +3129,7 @@ ThemeTypeEditor::ThemeTypeEditor() {
type_variation_locked = memnew(Label);
type_variation_vb->add_child(type_variation_locked);
- type_variation_locked->set_align(Label::ALIGN_CENTER);
+ type_variation_locked->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
type_variation_locked->set_autowrap_mode(Label::AUTOWRAP_WORD);
type_variation_locked->set_text(TTR("A type associated with a built-in class cannot be marked as a variation of another type."));
type_variation_locked->hide();
@@ -3329,7 +3329,7 @@ ThemeEditor::ThemeEditor() {
preview_tabs_vb->add_child(preview_tabs_content);
preview_tabs = memnew(TabBar);
- preview_tabs->set_tab_align(TabBar::ALIGN_LEFT);
+ preview_tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
preview_tabs->set_h_size_flags(SIZE_EXPAND_FILL);
preview_tabbar_hb->add_child(preview_tabs);
preview_tabs->connect("tab_changed", callable_mp(this, &ThemeEditor::_change_preview_tab));
diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp
index 52155a71364..9a5ecd38029 100644
--- a/editor/plugins/theme_editor_preview.cpp
+++ b/editor/plugins/theme_editor_preview.cpp
@@ -136,7 +136,7 @@ void ThemeEditorPreview::_draw_picker_overlay() {
Point2 label_pos = highlight_label_rect.position;
label_pos.y += highlight_label_rect.size.y - margin_bottom;
label_pos.x += margin_left;
- picker_overlay->draw_string(theme_cache.preview_picker_font, label_pos, highlight_name, HALIGN_LEFT, -1, theme_cache.font_size);
+ picker_overlay->draw_string(theme_cache.preview_picker_font, label_pos, highlight_name, HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size);
}
}
@@ -365,7 +365,7 @@ DefaultThemeEditorPreview::DefaultThemeEditorPreview() {
vhb->add_child(memnew(VSeparator));
VBoxContainer *hvb = memnew(VBoxContainer);
vhb->add_child(hvb);
- hvb->set_alignment(BoxContainer::ALIGN_CENTER);
+ hvb->set_alignment(BoxContainer::ALIGNMENT_CENTER);
hvb->set_h_size_flags(SIZE_EXPAND_FILL);
hvb->add_child(memnew(HSlider));
HScrollBar *hsb = memnew(HScrollBar);
diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp
index efccac7b740..e4a16274fe9 100644
--- a/editor/plugins/tiles/atlas_merging_dialog.cpp
+++ b/editor/plugins/tiles/atlas_merging_dialog.cpp
@@ -309,8 +309,8 @@ AtlasMergingDialog::AtlasMergingDialog() {
select_2_atlases_label = memnew(Label);
select_2_atlases_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
select_2_atlases_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- select_2_atlases_label->set_align(Label::ALIGN_CENTER);
- select_2_atlases_label->set_valign(Label::VALIGN_CENTER);
+ select_2_atlases_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ select_2_atlases_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
select_2_atlases_label->set_text(TTR("Please select two atlases or more."));
atlas_merging_right_panel->add_child(select_2_atlases_label);
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp
index 604143ef93e..6a3261cbee5 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -616,7 +616,7 @@ TileAtlasView::TileAtlasView() {
Label *base_tile_label = memnew(Label);
base_tile_label->set_mouse_filter(Control::MOUSE_FILTER_PASS);
base_tile_label->set_text(TTR("Base Tiles"));
- base_tile_label->set_align(Label::ALIGN_CENTER);
+ base_tile_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
left_vbox->add_child(base_tile_label);
base_tiles_root_control = memnew(Control);
@@ -660,7 +660,7 @@ TileAtlasView::TileAtlasView() {
Label *alternative_tiles_label = memnew(Label);
alternative_tiles_label->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
alternative_tiles_label->set_text(TTR("Alternative Tiles"));
- alternative_tiles_label->set_align(Label::ALIGN_CENTER);
+ alternative_tiles_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
right_vbox->add_child(alternative_tiles_label);
alternative_tiles_root_control = memnew(Control);
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index 44cf6b42bc1..5ded607ab50 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -218,7 +218,7 @@ void GenericTilePolygonEditor::_base_control_draw() {
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
String text = multiple_polygon_mode ? vformat("%d:%d", tinted_polygon_index, tinted_point_index) : vformat("%d", tinted_point_index);
Size2 text_size = font->get_string_size(text, font_size);
- base_control->draw_string(font, xform.xform(polygons[tinted_polygon_index][tinted_point_index]) - text_size * 0.5, text, HALIGN_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
+ base_control->draw_string(font, xform.xform(polygons[tinted_polygon_index][tinted_point_index]) - text_size * 0.5, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
}
if (drag_type == DRAG_TYPE_CREATE_POINT) {
@@ -1113,7 +1113,7 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2
}
Vector2 string_size = font->get_string_size(text, font_size);
- p_canvas_item->draw_string(font, p_transform.get_origin() + Vector2i(-string_size.x / 2, string_size.y / 2), text, HALIGN_CENTER, string_size.x, font_size, color, 1, Color(0, 0, 0, 1));
+ p_canvas_item->draw_string(font, p_transform.get_origin() + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color, 1, Color(0, 0, 0, 1));
}
}
@@ -1700,7 +1700,7 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas
text = "-";
}
Vector2 string_size = font->get_string_size(text, font_size);
- p_canvas_item->draw_string(font, p_transform.xform(position) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HALIGN_CENTER, string_size.x, font_size, color, 1, Color(0, 0, 0, 1));
+ p_canvas_item->draw_string(font, p_transform.xform(position) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color, 1, Color(0, 0, 0, 1));
}
}
}
@@ -1876,7 +1876,7 @@ void TileDataTerrainsEditor::forward_draw_over_alternatives(TileAtlasView *p_til
text = "-";
}
Vector2 string_size = font->get_string_size(text, font_size);
- p_canvas_item->draw_string(font, p_transform.xform(position) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HALIGN_CENTER, string_size.x, font_size, color, 1, Color(0, 0, 0, 1));
+ p_canvas_item->draw_string(font, p_transform.xform(position) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color, 1, Color(0, 0, 0, 1));
}
}
}
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index fd2648a4692..b4d6f3659d4 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -2096,8 +2096,8 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
missing_source_label->set_text(TTR("This TileMap's TileSet has no source configured. Edit the TileSet resource to add one."));
missing_source_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
missing_source_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- missing_source_label->set_align(Label::ALIGN_CENTER);
- missing_source_label->set_valign(Label::VALIGN_CENTER);
+ missing_source_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ missing_source_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
missing_source_label->hide();
tiles_bottom_panel->add_child(missing_source_label);
@@ -2155,8 +2155,8 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
invalid_source_label->set_text(TTR("Invalid source selected."));
invalid_source_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
invalid_source_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- invalid_source_label->set_align(Label::ALIGN_CENTER);
- invalid_source_label->set_valign(Label::VALIGN_CENTER);
+ invalid_source_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ invalid_source_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
invalid_source_label->hide();
atlas_sources_split_container->add_child(invalid_source_label);
@@ -3984,8 +3984,8 @@ TileMapEditor::TileMapEditor() {
missing_tileset_label->set_text(TTR("The edited TileMap node has no TileSet resource."));
missing_tileset_label->set_h_size_flags(SIZE_EXPAND_FILL);
missing_tileset_label->set_v_size_flags(SIZE_EXPAND_FILL);
- missing_tileset_label->set_align(Label::ALIGN_CENTER);
- missing_tileset_label->set_valign(Label::VALIGN_CENTER);
+ missing_tileset_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ missing_tileset_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
missing_tileset_label->hide();
add_child(missing_tileset_label);
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 436fea77d78..f194e81438a 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -2346,7 +2346,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
middle_vbox_container->add_child(tile_inspector);
tile_inspector_no_tile_selected_label = memnew(Label);
- tile_inspector_no_tile_selected_label->set_align(Label::ALIGN_CENTER);
+ tile_inspector_no_tile_selected_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
tile_inspector_no_tile_selected_label->set_text(TTR("No tile selected."));
middle_vbox_container->add_child(tile_inspector_no_tile_selected_label);
@@ -2527,8 +2527,8 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tile_atlas_view_missing_source_label = memnew(Label);
tile_atlas_view_missing_source_label->set_text(TTR("Add or select an atlas texture to the left panel."));
- tile_atlas_view_missing_source_label->set_align(Label::ALIGN_CENTER);
- tile_atlas_view_missing_source_label->set_valign(Label::VALIGN_CENTER);
+ tile_atlas_view_missing_source_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ tile_atlas_view_missing_source_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
tile_atlas_view_missing_source_label->set_h_size_flags(SIZE_EXPAND_FILL);
tile_atlas_view_missing_source_label->set_v_size_flags(SIZE_EXPAND_FILL);
tile_atlas_view_missing_source_label->hide();
diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp
index 915ce50836a..b7495dbea97 100644
--- a/editor/plugins/tiles/tile_set_editor.cpp
+++ b/editor/plugins/tiles/tile_set_editor.cpp
@@ -682,7 +682,7 @@ TileSetEditor::TileSetEditor() {
split_container_left_side->add_child(sources_list);
HBoxContainer *sources_bottom_actions = memnew(HBoxContainer);
- sources_bottom_actions->set_alignment(HBoxContainer::ALIGN_END);
+ sources_bottom_actions->set_alignment(BoxContainer::ALIGNMENT_END);
split_container_left_side->add_child(sources_bottom_actions);
sources_delete_button = memnew(Button);
@@ -722,8 +722,8 @@ TileSetEditor::TileSetEditor() {
no_source_selected_label->set_text(TTR("No TileSet source selected. Select or create a TileSet source."));
no_source_selected_label->set_h_size_flags(SIZE_EXPAND_FILL);
no_source_selected_label->set_v_size_flags(SIZE_EXPAND_FILL);
- no_source_selected_label->set_align(Label::ALIGN_CENTER);
- no_source_selected_label->set_valign(Label::VALIGN_CENTER);
+ no_source_selected_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ no_source_selected_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
split_container_right_side->add_child(no_source_selected_label);
// Atlases editor.
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index 28352d25eb8..5336788d98d 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -416,11 +416,11 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
set_up_ok_button->set_text(TTR("Close"));
set_up_vbc = memnew(VBoxContainer);
- set_up_vbc->set_alignment(VBoxContainer::ALIGN_CENTER);
+ set_up_vbc->set_alignment(BoxContainer::ALIGNMENT_CENTER);
set_up_dialog->add_child(set_up_vbc);
set_up_hbc = memnew(HBoxContainer);
- set_up_hbc->set_h_size_flags(HBoxContainer::SIZE_EXPAND_FILL);
+ set_up_hbc->set_h_size_flags(BoxContainer::SIZE_EXPAND_FILL);
set_up_vbc->add_child(set_up_hbc);
set_up_vcs_status = memnew(RichTextLabel);
@@ -447,7 +447,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
version_commit_dock->set_visible(false);
commit_box_vbc = memnew(VBoxContainer);
- commit_box_vbc->set_alignment(VBoxContainer::ALIGN_BEGIN);
+ commit_box_vbc->set_alignment(VBoxContainer::ALIGNMENT_BEGIN);
commit_box_vbc->set_h_size_flags(VBoxContainer::SIZE_EXPAND_FILL);
commit_box_vbc->set_v_size_flags(VBoxContainer::SIZE_EXPAND_FILL);
version_commit_dock->add_child(commit_box_vbc);
@@ -530,7 +530,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
commit_box_vbc->add_child(commit_button);
commit_status = memnew(Label);
- commit_status->set_align(Label::ALIGN_CENTER);
+ commit_status->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
commit_box_vbc->add_child(commit_status);
version_control_dock = memnew(PanelContainer);
@@ -555,7 +555,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
diff_file_name = memnew(Label);
diff_file_name->set_text(TTR("No file diff is active"));
diff_file_name->set_h_size_flags(Label::SIZE_EXPAND_FILL);
- diff_file_name->set_align(Label::ALIGN_RIGHT);
+ diff_file_name->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
diff_hbc->add_child(diff_file_name);
diff_refresh_button = memnew(Button);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index ca84fa1cf0c..7673c31d005 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -4247,8 +4247,8 @@ VisualShaderEditor::VisualShaderEditor() {
alert = memnew(AcceptDialog);
alert->get_label()->set_autowrap_mode(Label::AUTOWRAP_WORD);
- alert->get_label()->set_align(Label::ALIGN_CENTER);
- alert->get_label()->set_valign(Label::VALIGN_CENTER);
+ alert->get_label()->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ alert->get_label()->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
alert->get_label()->set_custom_minimum_size(Size2(400, 60) * EDSCALE);
add_child(alert);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index a97d38323e6..20990cc3013 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -1073,7 +1073,7 @@ ProjectExportDialog::ProjectExportDialog() {
// Subsections.
sections = memnew(TabContainer);
- sections->set_tab_align(TabContainer::ALIGN_LEFT);
+ sections->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
sections->set_use_hidden_tabs_for_min_size(true);
settings_vb->add_child(sections);
sections->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 341b59779d2..e6964a8337a 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -850,7 +850,7 @@ public:
iphb->add_child(install_browse);
msg = memnew(Label);
- msg->set_align(Label::ALIGN_CENTER);
+ msg->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
vb->add_child(msg);
// rasterizer selection
@@ -904,8 +904,8 @@ public:
l->set_text(TTR("The renderer can be changed later, but scenes may need to be adjusted."));
// Add some extra spacing to separate it from the list above and the buttons below.
l->set_custom_minimum_size(Size2(0, 40) * EDSCALE);
- l->set_align(Label::ALIGN_CENTER);
- l->set_valign(Label::VALIGN_CENTER);
+ l->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ l->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
l->set_modulate(Color(1, 1, 1, 0.7));
rasterizer_container->add_child(l);
@@ -1361,7 +1361,7 @@ void ProjectList::create_project_item_control(int p_index) {
favorite->set_mouse_filter(MOUSE_FILTER_PASS);
favorite->connect("pressed", callable_mp(this, &ProjectList::_favorite_pressed), varray(hb));
favorite_box->add_child(favorite);
- favorite_box->set_alignment(BoxContainer::ALIGN_CENTER);
+ favorite_box->set_alignment(BoxContainer::ALIGNMENT_CENTER);
hb->add_child(favorite_box);
hb->favorite_button = favorite;
hb->set_is_favorite(item.favorite);
@@ -1408,7 +1408,7 @@ void ProjectList::create_project_item_control(int p_index) {
unsupported_label->add_theme_font_override("font", get_theme_font(SNAME("title"), SNAME("EditorFonts")));
unsupported_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
unsupported_label->set_clip_text(true);
- unsupported_label->set_align(Label::ALIGN_RIGHT);
+ unsupported_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
title_hb->add_child(unsupported_label);
Control *spacer = memnew(Control());
spacer->set_custom_minimum_size(Size2(10, 10));
@@ -2134,7 +2134,7 @@ void ProjectManager::_open_selected_projects_ask() {
PackedStringArray unsupported_features = project.unsupported_features;
Label *ask_update_label = ask_update_settings->get_label();
- ask_update_label->set_align(Label::ALIGN_LEFT); // Reset in case of previous center align.
+ ask_update_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT); // Reset in case of previous center align.
// Check if the config_version property was empty or 0
if (config_version == 0) {
@@ -2178,7 +2178,7 @@ void ProjectManager::_open_selected_projects_ask() {
warning_message += vformat(TTR("Warning: This project uses the following features not supported by this build of Godot:\n\n%s\n\n"), unsupported_features_str);
}
warning_message += TTR("Open anyway? Project will be modified.");
- ask_update_label->set_align(Label::ALIGN_CENTER);
+ ask_update_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
ask_update_settings->set_text(warning_message);
ask_update_settings->popup_centered();
return;
@@ -2537,7 +2537,7 @@ ProjectManager::ProjectManager() {
tabs = memnew(TabContainer);
center_box->add_child(tabs);
tabs->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
- tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->connect("tab_changed", callable_mp(this, &ProjectManager::_on_tab_changed));
HBoxContainer *projects_hb = memnew(HBoxContainer);
@@ -2666,7 +2666,7 @@ ProjectManager::ProjectManager() {
{
// Version info and language options
settings_hb = memnew(HBoxContainer);
- settings_hb->set_alignment(BoxContainer::ALIGN_END);
+ settings_hb->set_alignment(BoxContainer::ALIGNMENT_END);
settings_hb->set_h_grow_direction(Control::GROW_DIRECTION_BEGIN);
settings_hb->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index db12e905406..519427787d8 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -513,13 +513,13 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
data = p_data;
tab_container = memnew(TabContainer);
- tab_container->set_tab_align(TabContainer::ALIGN_LEFT);
+ tab_container->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tab_container->set_use_hidden_tabs_for_min_size(true);
add_child(tab_container);
VBoxContainer *general_editor = memnew(VBoxContainer);
general_editor->set_name(TTR("General"));
- general_editor->set_alignment(BoxContainer::ALIGN_BEGIN);
+ general_editor->set_alignment(BoxContainer::ALIGNMENT_BEGIN);
general_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tab_container->add_child(general_editor);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 061f4d218a2..01eae1e4ec2 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1410,7 +1410,7 @@ void CustomPropertyEditor::_draw_easing() {
prev = h;
}
- f->draw_string(ci, Point2(10, 10 + f->get_ascent(font_size)), String::num(exp, 2), HALIGN_LEFT, -1, font_size, color);
+ f->draw_string(ci, Point2(10, 10 + f->get_ascent(font_size)), String::num(exp, 2), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color);
}
void CustomPropertyEditor::_text_edit_changed() {
@@ -1864,7 +1864,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
slider->connect("value_changed", callable_mp(this, &CustomPropertyEditor::_range_modified));
action_hboxes = memnew(HBoxContainer);
- action_hboxes->set_alignment(BoxContainer::ALIGN_CENTER);
+ action_hboxes->set_alignment(BoxContainer::ALIGNMENT_CENTER);
value_vbox->add_child(action_hboxes);
for (int i = 0; i < MAX_ACTION_BUTTONS; i++) {
action_buttons[i] = memnew(Button);
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index eb73f88e61f..8cf5a26c553 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -114,7 +114,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
vbc->add_child(cbut_collapse_features);
tabc_features = memnew(TabContainer);
- tabc_features->set_tab_align(TabContainer::ALIGN_LEFT);
+ tabc_features->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabc_features->set_use_hidden_tabs_for_min_size(true);
vbc->add_child(tabc_features);
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index fb1575ad8c4..afb1d5107cd 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -907,8 +907,8 @@ ScriptCreateDialog::ScriptCreateDialog() {
get_ok_button()->set_text(TTR("Create"));
alert = memnew(AcceptDialog);
alert->get_label()->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
- alert->get_label()->set_align(Label::ALIGN_CENTER);
- alert->get_label()->set_valign(Label::VALIGN_CENTER);
+ alert->get_label()->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ alert->get_label()->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
alert->get_label()->set_custom_minimum_size(Size2(325, 60) * EDSCALE);
add_child(alert);
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index e1229729ac0..a39fdb38784 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -622,7 +622,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
undo_redo = memnew(UndoRedo);
tabs = memnew(TabContainer);
- tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->connect("tab_changed", callable_mp(this, &EditorSettingsDialog::_tabs_tab_changed));
add_child(tabs);
diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp
index 1ddd79eea8c..a9582263945 100644
--- a/editor/shader_create_dialog.cpp
+++ b/editor/shader_create_dialog.cpp
@@ -630,8 +630,8 @@ ShaderCreateDialog::ShaderCreateDialog() {
alert = memnew(AcceptDialog);
alert->get_label()->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
- alert->get_label()->set_align(Label::ALIGN_CENTER);
- alert->get_label()->set_valign(Label::VALIGN_CENTER);
+ alert->get_label()->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ alert->get_label()->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
alert->get_label()->set_custom_minimum_size(Size2(325, 60) * EDSCALE);
add_child(alert);
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 9dad13a615a..df3c37f7303 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -110,7 +110,7 @@ void GDNativeLibraryEditor::_update_tree() {
TreeItem *new_arch = tree->create_item(platform);
new_arch->set_text(0, TTR("Double click to create a new entry"));
- new_arch->set_text_align(0, TreeItem::ALIGN_CENTER);
+ new_arch->set_text_alignment(0, HORIZONTAL_ALIGNMENT_CENTER);
new_arch->set_custom_color(0, get_theme_color(SNAME("accent_color"), SNAME("Editor")));
new_arch->set_expand_right(0, true);
new_arch->set_metadata(1, E->key());
@@ -335,7 +335,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
hbox->add_child(label);
filter = memnew(MenuButton);
filter->set_h_size_flags(SIZE_EXPAND_FILL);
- filter->set_text_align(filter->ALIGN_LEFT);
+ filter->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
hbox->add_child(filter);
PopupMenu *filter_list = filter->get_popup();
filter_list->set_hide_on_checkable_item_selection(false);
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index d827ce2fb03..cf37f75d053 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -1163,7 +1163,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
spatial_editor_hb = memnew(HBoxContainer);
spatial_editor_hb->set_h_size_flags(SIZE_EXPAND_FILL);
- spatial_editor_hb->set_alignment(BoxContainer::ALIGN_END);
+ spatial_editor_hb->set_alignment(BoxContainer::ALIGNMENT_END);
Node3DEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb);
spin_box_label = memnew(Label);
@@ -1280,8 +1280,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
info_message = memnew(Label);
info_message->set_text(TTR("Give a MeshLibrary resource to this GridMap to use its meshes."));
- info_message->set_valign(Label::VALIGN_CENTER);
- info_message->set_align(Label::ALIGN_CENTER);
+ info_message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
+ info_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
info_message->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART);
info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
info_message->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index f480c86088b..aa8978a4305 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -3144,7 +3144,7 @@ bool TextServerAdvanced::shaped_text_add_string(RID p_shaped, const String &p_te
return true;
}
-bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) {
+bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) {
_THREAD_SAFE_METHOD_
ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -3174,7 +3174,7 @@ bool TextServerAdvanced::shaped_text_add_object(RID p_shaped, Variant p_key, con
return true;
}
-bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) {
+bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
ShapedTextData *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -3242,56 +3242,56 @@ bool TextServerAdvanced::shaped_text_resize_object(RID p_shaped, Variant p_key,
for (KeyValue &E : sd->objects) {
if ((E.value.pos >= sd->start) && (E.value.pos < sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -3433,56 +3433,56 @@ RID TextServerAdvanced::shaped_text_substr(RID p_shaped, int p_start, int p_leng
for (KeyValue &E : new_sd->objects) {
if ((E.value.pos >= new_sd->start) && (E.value.pos < new_sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -4579,56 +4579,56 @@ bool TextServerAdvanced::shaped_text_shape(RID p_shaped) {
float full_descent = sd->descent;
for (KeyValue &E : sd->objects) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h
index 5eaff67a6e3..414db8c7ea6 100644
--- a/modules/text_server_adv/text_server_adv.h
+++ b/modules/text_server_adv/text_server_adv.h
@@ -476,8 +476,8 @@ public:
virtual bool shaped_text_get_preserve_control(RID p_shaped) const override;
virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") override;
- virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) override;
- virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) override;
+ virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override;
+ virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override;
virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override;
virtual RID shaped_text_get_parent(RID p_shaped) const override;
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index 5c060512113..97a53143cfd 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -2247,7 +2247,7 @@ bool TextServerFallback::shaped_text_add_string(RID p_shaped, const String &p_te
return true;
}
-bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) {
+bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) {
ShapedTextData *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -2278,7 +2278,7 @@ bool TextServerFallback::shaped_text_add_object(RID p_shaped, Variant p_key, con
return true;
}
-bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) {
+bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
ShapedTextData *sd = shaped_owner.get_or_null(p_shaped);
ERR_FAIL_COND_V(!sd, false);
@@ -2346,56 +2346,56 @@ bool TextServerFallback::shaped_text_resize_object(RID p_shaped, Variant p_key,
for (KeyValue &E : sd->objects) {
if ((E.value.pos >= sd->start) && (E.value.pos < sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -2498,56 +2498,56 @@ RID TextServerFallback::shaped_text_substr(RID p_shaped, int p_start, int p_leng
for (KeyValue &E : new_sd->objects) {
if ((E.value.pos >= new_sd->start) && (E.value.pos < new_sd->end)) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -new_sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-new_sd->ascent + new_sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = new_sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
@@ -3052,56 +3052,56 @@ bool TextServerFallback::shaped_text_shape(RID p_shaped) {
float full_descent = sd->descent;
for (KeyValue &E : sd->objects) {
if (sd->orientation == ORIENTATION_HORIZONTAL) {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.y = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.y = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.y = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.y = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.y -= E.value.rect.size.y;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.y -= E.value.rect.size.y / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
full_ascent = MAX(full_ascent, -E.value.rect.position.y);
full_descent = MAX(full_descent, E.value.rect.position.y + E.value.rect.size.y);
} else {
- switch (E.value.inline_align & INLINE_ALIGN_TEXT_MASK) {
- case INLINE_ALIGN_TO_TOP: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_TEXT_MASK) {
+ case INLINE_ALIGNMENT_TO_TOP: {
E.value.rect.position.x = -sd->ascent;
} break;
- case INLINE_ALIGN_TO_CENTER: {
+ case INLINE_ALIGNMENT_TO_CENTER: {
E.value.rect.position.x = (-sd->ascent + sd->descent) / 2;
} break;
- case INLINE_ALIGN_TO_BASELINE: {
+ case INLINE_ALIGNMENT_TO_BASELINE: {
E.value.rect.position.x = 0;
} break;
- case INLINE_ALIGN_TO_BOTTOM: {
+ case INLINE_ALIGNMENT_TO_BOTTOM: {
E.value.rect.position.x = sd->descent;
} break;
}
- switch (E.value.inline_align & INLINE_ALIGN_IMAGE_MASK) {
- case INLINE_ALIGN_BOTTOM_TO: {
+ switch (E.value.inline_align & INLINE_ALIGNMENT_IMAGE_MASK) {
+ case INLINE_ALIGNMENT_BOTTOM_TO: {
E.value.rect.position.x -= E.value.rect.size.x;
} break;
- case INLINE_ALIGN_CENTER_TO: {
+ case INLINE_ALIGNMENT_CENTER_TO: {
E.value.rect.position.x -= E.value.rect.size.x / 2;
} break;
- case INLINE_ALIGN_TOP_TO: {
+ case INLINE_ALIGNMENT_TOP_TO: {
// NOP
} break;
}
diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h
index 67b08d1eac7..f2b33c2afb2 100644
--- a/modules/text_server_fb/text_server_fb.h
+++ b/modules/text_server_fb/text_server_fb.h
@@ -387,8 +387,8 @@ public:
virtual bool shaped_text_get_preserve_control(RID p_shaped) const override;
virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") override;
- virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) override;
- virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) override;
+ virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override;
+ virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override;
virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override;
virtual RID shaped_text_get_parent(RID p_shaped) const override;
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp
index 349537521c1..75a1980edef 100644
--- a/modules/visual_script/editor/visual_script_editor.cpp
+++ b/modules/visual_script/editor/visual_script_editor.cpp
@@ -779,7 +779,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
for (int i = 0; i < node->get_output_sequence_port_count(); i++) {
Label *text2 = memnew(Label);
text2->set_text(node->get_output_sequence_port_text(i));
- text2->set_align(Label::ALIGN_RIGHT);
+ text2->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
gnode->add_child(text2);
gnode->set_slot(slot_idx, false, 0, Color(), true, TYPE_SEQUENCE, mono_color, seq_port, seq_port);
slot_idx++;
@@ -900,7 +900,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
if (i < mixed_seq_ports) {
Label *text2 = memnew(Label);
text2->set_text(node->get_output_sequence_port_text(i));
- text2->set_align(Label::ALIGN_RIGHT);
+ text2->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
hbc->add_child(text2);
}
@@ -4476,8 +4476,8 @@ VisualScriptEditor::VisualScriptEditor() {
select_func_text = memnew(Label);
select_func_text->set_text(TTR("Select or create a function to edit its graph."));
- select_func_text->set_align(Label::ALIGN_CENTER);
- select_func_text->set_valign(Label::VALIGN_CENTER);
+ select_func_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ select_func_text->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
select_func_text->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(select_func_text);
@@ -4485,8 +4485,8 @@ VisualScriptEditor::VisualScriptEditor() {
hint_text->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -100);
hint_text->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0);
hint_text->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0);
- hint_text->set_align(Label::ALIGN_CENTER);
- hint_text->set_valign(Label::VALIGN_CENTER);
+ hint_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ hint_text->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
graph->add_child(hint_text);
hint_text_timer = memnew(Timer);
diff --git a/scene/gui/aspect_ratio_container.cpp b/scene/gui/aspect_ratio_container.cpp
index fb6fa9dec96..9526c5e793b 100644
--- a/scene/gui/aspect_ratio_container.cpp
+++ b/scene/gui/aspect_ratio_container.cpp
@@ -60,12 +60,12 @@ void AspectRatioContainer::set_stretch_mode(StretchMode p_mode) {
queue_sort();
}
-void AspectRatioContainer::set_alignment_horizontal(AlignMode p_alignment_horizontal) {
+void AspectRatioContainer::set_alignment_horizontal(AlignmentMode p_alignment_horizontal) {
alignment_horizontal = p_alignment_horizontal;
queue_sort();
}
-void AspectRatioContainer::set_alignment_vertical(AlignMode p_alignment_vertical) {
+void AspectRatioContainer::set_alignment_vertical(AlignmentMode p_alignment_vertical) {
alignment_vertical = p_alignment_vertical;
queue_sort();
}
@@ -107,25 +107,25 @@ void AspectRatioContainer::_notification(int p_what) {
float align_x = 0.5;
switch (alignment_horizontal) {
- case ALIGN_BEGIN: {
+ case ALIGNMENT_BEGIN: {
align_x = 0.0;
} break;
- case ALIGN_CENTER: {
+ case ALIGNMENT_CENTER: {
align_x = 0.5;
} break;
- case ALIGN_END: {
+ case ALIGNMENT_END: {
align_x = 1.0;
} break;
}
float align_y = 0.5;
switch (alignment_vertical) {
- case ALIGN_BEGIN: {
+ case ALIGNMENT_BEGIN: {
align_y = 0.0;
} break;
- case ALIGN_CENTER: {
+ case ALIGNMENT_CENTER: {
align_y = 0.5;
} break;
- case ALIGN_END: {
+ case ALIGNMENT_END: {
align_y = 1.0;
} break;
}
@@ -166,7 +166,7 @@ void AspectRatioContainer::_bind_methods() {
BIND_ENUM_CONSTANT(STRETCH_FIT);
BIND_ENUM_CONSTANT(STRETCH_COVER);
- BIND_ENUM_CONSTANT(ALIGN_BEGIN);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_END);
+ BIND_ENUM_CONSTANT(ALIGNMENT_BEGIN);
+ BIND_ENUM_CONSTANT(ALIGNMENT_CENTER);
+ BIND_ENUM_CONSTANT(ALIGNMENT_END);
}
diff --git a/scene/gui/aspect_ratio_container.h b/scene/gui/aspect_ratio_container.h
index c95c6a72747..3cdfc75734e 100644
--- a/scene/gui/aspect_ratio_container.h
+++ b/scene/gui/aspect_ratio_container.h
@@ -48,17 +48,17 @@ public:
STRETCH_FIT,
STRETCH_COVER,
};
- enum AlignMode {
- ALIGN_BEGIN,
- ALIGN_CENTER,
- ALIGN_END,
+ enum AlignmentMode {
+ ALIGNMENT_BEGIN,
+ ALIGNMENT_CENTER,
+ ALIGNMENT_END,
};
private:
float ratio = 1.0;
StretchMode stretch_mode = STRETCH_FIT;
- AlignMode alignment_horizontal = ALIGN_CENTER;
- AlignMode alignment_vertical = ALIGN_CENTER;
+ AlignmentMode alignment_horizontal = ALIGNMENT_CENTER;
+ AlignmentMode alignment_vertical = ALIGNMENT_CENTER;
public:
void set_ratio(float p_ratio);
@@ -67,14 +67,14 @@ public:
void set_stretch_mode(StretchMode p_mode);
StretchMode get_stretch_mode() const { return stretch_mode; }
- void set_alignment_horizontal(AlignMode p_alignment_horizontal);
- AlignMode get_alignment_horizontal() const { return alignment_horizontal; }
+ void set_alignment_horizontal(AlignmentMode p_alignment_horizontal);
+ AlignmentMode get_alignment_horizontal() const { return alignment_horizontal; }
- void set_alignment_vertical(AlignMode p_alignment_vertical);
- AlignMode get_alignment_vertical() const { return alignment_vertical; }
+ void set_alignment_vertical(AlignmentMode p_alignment_vertical);
+ AlignmentMode get_alignment_vertical() const { return alignment_vertical; }
};
VARIANT_ENUM_CAST(AspectRatioContainer::StretchMode);
-VARIANT_ENUM_CAST(AspectRatioContainer::AlignMode);
+VARIANT_ENUM_CAST(AspectRatioContainer::AlignmentMode);
#endif // ASPECT_RATIO_CONTAINER_H
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 83c392614b6..fc05d519376 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -154,29 +154,29 @@ void BoxContainer::_resort() {
int ofs = 0;
if (!has_stretched) {
if (!vertical) {
- switch (align) {
- case ALIGN_BEGIN:
+ switch (alignment) {
+ case ALIGNMENT_BEGIN:
if (rtl) {
ofs = stretch_diff;
}
break;
- case ALIGN_CENTER:
+ case ALIGNMENT_CENTER:
ofs = stretch_diff / 2;
break;
- case ALIGN_END:
+ case ALIGNMENT_END:
if (!rtl) {
ofs = stretch_diff;
}
break;
}
} else {
- switch (align) {
- case ALIGN_BEGIN:
+ switch (alignment) {
+ case ALIGNMENT_BEGIN:
break;
- case ALIGN_CENTER:
+ case ALIGNMENT_CENTER:
ofs = stretch_diff / 2;
break;
- case ALIGN_END:
+ case ALIGNMENT_END:
ofs = stretch_diff;
break;
}
@@ -304,13 +304,13 @@ void BoxContainer::_notification(int p_what) {
}
}
-void BoxContainer::set_alignment(AlignMode p_align) {
- align = p_align;
+void BoxContainer::set_alignment(AlignmentMode p_alignment) {
+ alignment = p_alignment;
_resort();
}
-BoxContainer::AlignMode BoxContainer::get_alignment() const {
- return align;
+BoxContainer::AlignmentMode BoxContainer::get_alignment() const {
+ return alignment;
}
Control *BoxContainer::add_spacer(bool p_begin) {
@@ -340,9 +340,9 @@ void BoxContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_alignment"), &BoxContainer::get_alignment);
ClassDB::bind_method(D_METHOD("set_alignment", "alignment"), &BoxContainer::set_alignment);
- BIND_ENUM_CONSTANT(ALIGN_BEGIN);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_END);
+ BIND_ENUM_CONSTANT(ALIGNMENT_BEGIN);
+ BIND_ENUM_CONSTANT(ALIGNMENT_CENTER);
+ BIND_ENUM_CONSTANT(ALIGNMENT_END);
ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Begin,Center,End"), "set_alignment", "get_alignment");
}
diff --git a/scene/gui/box_container.h b/scene/gui/box_container.h
index 23feea565c0..9bb26ec32cd 100644
--- a/scene/gui/box_container.h
+++ b/scene/gui/box_container.h
@@ -37,15 +37,15 @@ class BoxContainer : public Container {
GDCLASS(BoxContainer, Container);
public:
- enum AlignMode {
- ALIGN_BEGIN,
- ALIGN_CENTER,
- ALIGN_END
+ enum AlignmentMode {
+ ALIGNMENT_BEGIN,
+ ALIGNMENT_CENTER,
+ ALIGNMENT_END
};
private:
bool vertical = false;
- AlignMode align = ALIGN_BEGIN;
+ AlignmentMode alignment = ALIGNMENT_BEGIN;
void _resort();
@@ -57,8 +57,8 @@ protected:
public:
Control *add_spacer(bool p_begin = false);
- void set_alignment(AlignMode p_align);
- AlignMode get_alignment() const;
+ void set_alignment(AlignmentMode p_alignment);
+ AlignmentMode get_alignment() const;
virtual Size2 get_minimum_size() const override;
@@ -84,6 +84,6 @@ public:
BoxContainer(true) {}
};
-VARIANT_ENUM_CAST(BoxContainer::AlignMode);
+VARIANT_ENUM_CAST(BoxContainer::AlignmentMode);
#endif // BOX_CONTAINER_H
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 29327074012..655fc783d78 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -50,7 +50,7 @@ Size2 Button::get_minimum_size() const {
if (!_icon.is_null()) {
minsize.height = MAX(minsize.height, _icon->get_height());
- if (icon_align != ALIGN_CENTER) {
+ if (icon_alignment != HORIZONTAL_ALIGNMENT_CENTER) {
minsize.width += _icon->get_width();
if (xl_text != "") {
minsize.width += get_theme_constant(SNAME("hseparation"));
@@ -216,19 +216,19 @@ void Button::_notification(int p_what) {
}
Rect2 icon_region = Rect2();
- TextAlign icon_align_rtl_checked = icon_align;
- TextAlign align_rtl_checked = align;
+ HorizontalAlignment icon_align_rtl_checked = icon_alignment;
+ HorizontalAlignment align_rtl_checked = alignment;
// Swap icon and text alignment sides if right-to-left layout is set.
if (rtl) {
- if (icon_align == ALIGN_RIGHT) {
- icon_align_rtl_checked = ALIGN_LEFT;
- } else if (icon_align == ALIGN_LEFT) {
- icon_align_rtl_checked = ALIGN_RIGHT;
+ if (icon_alignment == HORIZONTAL_ALIGNMENT_RIGHT) {
+ icon_align_rtl_checked = HORIZONTAL_ALIGNMENT_LEFT;
+ } else if (icon_alignment == HORIZONTAL_ALIGNMENT_LEFT) {
+ icon_align_rtl_checked = HORIZONTAL_ALIGNMENT_RIGHT;
}
- if (align == ALIGN_RIGHT) {
- align_rtl_checked = ALIGN_LEFT;
- } else if (align == ALIGN_LEFT) {
- align_rtl_checked = ALIGN_RIGHT;
+ if (alignment == HORIZONTAL_ALIGNMENT_RIGHT) {
+ align_rtl_checked = HORIZONTAL_ALIGNMENT_LEFT;
+ } else if (alignment == HORIZONTAL_ALIGNMENT_LEFT) {
+ align_rtl_checked = HORIZONTAL_ALIGNMENT_RIGHT;
}
}
if (!_icon.is_null()) {
@@ -240,14 +240,14 @@ void Button::_notification(int p_what) {
float icon_ofs_region = 0.0;
Point2 style_offset;
Size2 icon_size = _icon->get_size();
- if (icon_align_rtl_checked == ALIGN_LEFT) {
+ if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_LEFT) {
style_offset.x = style->get_margin(SIDE_LEFT);
if (_internal_margin[SIDE_LEFT] > 0) {
icon_ofs_region = _internal_margin[SIDE_LEFT] + get_theme_constant(SNAME("hseparation"));
}
- } else if (icon_align_rtl_checked == ALIGN_CENTER) {
+ } else if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_CENTER) {
style_offset.x = 0.0;
- } else if (icon_align_rtl_checked == ALIGN_RIGHT) {
+ } else if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_RIGHT) {
style_offset.x = -style->get_margin(SIDE_RIGHT);
if (_internal_margin[SIDE_RIGHT] > 0) {
icon_ofs_region = -_internal_margin[SIDE_RIGHT] - get_theme_constant(SNAME("hseparation"));
@@ -258,7 +258,7 @@ void Button::_notification(int p_what) {
if (expand_icon) {
Size2 _size = get_size() - style->get_offset() * 2;
_size.width -= get_theme_constant(SNAME("hseparation")) + icon_ofs_region;
- if (!clip_text && icon_align_rtl_checked != ALIGN_CENTER) {
+ if (!clip_text && icon_align_rtl_checked != HORIZONTAL_ALIGNMENT_CENTER) {
_size.width -= text_buf->get_size().width;
}
float icon_width = _icon->get_width() * _size.height / _icon->get_height();
@@ -272,9 +272,9 @@ void Button::_notification(int p_what) {
icon_size = Size2(icon_width, icon_height);
}
- if (icon_align_rtl_checked == ALIGN_LEFT) {
+ if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_LEFT) {
icon_region = Rect2(style_offset + Point2(icon_ofs_region, Math::floor((valign - icon_size.y) * 0.5)), icon_size);
- } else if (icon_align_rtl_checked == ALIGN_CENTER) {
+ } else if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_CENTER) {
icon_region = Rect2(style_offset + Point2(icon_ofs_region + Math::floor((size.x - icon_size.x) * 0.5), Math::floor((valign - icon_size.y) * 0.5)), icon_size);
} else {
icon_region = Rect2(style_offset + Point2(icon_ofs_region + size.x - icon_size.x, Math::floor((valign - icon_size.y) * 0.5)), icon_size);
@@ -286,7 +286,7 @@ void Button::_notification(int p_what) {
}
Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_theme_constant(SNAME("hseparation")), 0) : Point2();
- if (align_rtl_checked == ALIGN_CENTER && icon_align_rtl_checked == ALIGN_CENTER) {
+ if (align_rtl_checked == HORIZONTAL_ALIGNMENT_CENTER && icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_CENTER) {
icon_ofs.x = 0.0;
}
int text_clip = size.width - style->get_minimum_size().width - icon_ofs.width;
@@ -304,8 +304,9 @@ void Button::_notification(int p_what) {
Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - text_buf->get_size() - Point2(_internal_margin[SIDE_RIGHT] - _internal_margin[SIDE_LEFT], 0)) / 2.0;
switch (align_rtl_checked) {
- case ALIGN_LEFT: {
- if (icon_align_rtl_checked != ALIGN_LEFT) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
+ if (icon_align_rtl_checked != HORIZONTAL_ALIGNMENT_LEFT) {
icon_ofs.x = 0.0;
}
if (_internal_margin[SIDE_LEFT] > 0) {
@@ -315,23 +316,23 @@ void Button::_notification(int p_what) {
}
text_ofs.y += style->get_offset().y;
} break;
- case ALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (text_ofs.x < 0) {
text_ofs.x = 0;
}
- if (icon_align_rtl_checked == ALIGN_LEFT) {
+ if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_LEFT) {
text_ofs += icon_ofs;
}
text_ofs += style->get_offset();
} break;
- case ALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (_internal_margin[SIDE_RIGHT] > 0) {
text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width - _internal_margin[SIDE_RIGHT] - get_theme_constant(SNAME("hseparation"));
} else {
text_ofs.x = size.x - style->get_margin(SIDE_RIGHT) - text_width;
}
text_ofs.y += style->get_offset().y;
- if (icon_align_rtl_checked == ALIGN_RIGHT) {
+ if (icon_align_rtl_checked == HORIZONTAL_ALIGNMENT_RIGHT) {
text_ofs.x -= icon_ofs.x;
}
} break;
@@ -471,25 +472,25 @@ bool Button::get_clip_text() const {
return clip_text;
}
-void Button::set_text_align(TextAlign p_align) {
- if (align != p_align) {
- align = p_align;
+void Button::set_text_alignment(HorizontalAlignment p_alignment) {
+ if (alignment != p_alignment) {
+ alignment = p_alignment;
update();
}
}
-Button::TextAlign Button::get_text_align() const {
- return align;
+HorizontalAlignment Button::get_text_alignment() const {
+ return alignment;
}
-void Button::set_icon_align(TextAlign p_align) {
- icon_align = p_align;
+void Button::set_icon_alignment(HorizontalAlignment p_alignment) {
+ icon_alignment = p_alignment;
update_minimum_size();
update();
}
-Button::TextAlign Button::get_icon_align() const {
- return icon_align;
+HorizontalAlignment Button::get_icon_alignment() const {
+ return icon_alignment;
}
bool Button::_set(const StringName &p_name, const Variant &p_value) {
@@ -558,25 +559,21 @@ void Button::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_flat"), &Button::is_flat);
ClassDB::bind_method(D_METHOD("set_clip_text", "enabled"), &Button::set_clip_text);
ClassDB::bind_method(D_METHOD("get_clip_text"), &Button::get_clip_text);
- ClassDB::bind_method(D_METHOD("set_text_align", "align"), &Button::set_text_align);
- ClassDB::bind_method(D_METHOD("get_text_align"), &Button::get_text_align);
- ClassDB::bind_method(D_METHOD("set_icon_align", "icon_align"), &Button::set_icon_align);
- ClassDB::bind_method(D_METHOD("get_icon_align"), &Button::get_icon_align);
+ ClassDB::bind_method(D_METHOD("set_text_alignment", "alignment"), &Button::set_text_alignment);
+ ClassDB::bind_method(D_METHOD("get_text_alignment"), &Button::get_text_alignment);
+ ClassDB::bind_method(D_METHOD("set_icon_alignment", "icon_alignment"), &Button::set_icon_alignment);
+ ClassDB::bind_method(D_METHOD("get_icon_alignment"), &Button::get_icon_alignment);
ClassDB::bind_method(D_METHOD("set_expand_icon", "enabled"), &Button::set_expand_icon);
ClassDB::bind_method(D_METHOD("is_expand_icon"), &Button::is_expand_icon);
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
-
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text");
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::STRING, "language"), "set_language", "get_language");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_button_icon", "get_button_icon");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_text"), "set_clip_text", "get_clip_text");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_text_align", "get_text_align");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_icon_align", "get_icon_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_text_alignment", "get_text_alignment");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_icon_alignment", "get_icon_alignment");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand_icon"), "set_expand_icon", "is_expand_icon");
}
diff --git a/scene/gui/button.h b/scene/gui/button.h
index fd36cb77af2..92d86542a6f 100644
--- a/scene/gui/button.h
+++ b/scene/gui/button.h
@@ -37,13 +37,6 @@
class Button : public BaseButton {
GDCLASS(Button, BaseButton);
-public:
- enum TextAlign {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT
- };
-
private:
bool flat = false;
String text;
@@ -57,8 +50,8 @@ private:
Ref icon;
bool expand_icon = false;
bool clip_text = false;
- TextAlign align = ALIGN_CENTER;
- TextAlign icon_align = ALIGN_LEFT;
+ HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_CENTER;
+ HorizontalAlignment icon_alignment = HORIZONTAL_ALIGNMENT_LEFT;
float _internal_margin[4] = {};
void _shape();
@@ -100,16 +93,14 @@ public:
void set_clip_text(bool p_enabled);
bool get_clip_text() const;
- void set_text_align(TextAlign p_align);
- TextAlign get_text_align() const;
+ void set_text_alignment(HorizontalAlignment p_alignment);
+ HorizontalAlignment get_text_alignment() const;
- void set_icon_align(TextAlign p_align);
- TextAlign get_icon_align() const;
+ void set_icon_alignment(HorizontalAlignment p_alignment);
+ HorizontalAlignment get_icon_alignment() const;
Button(const String &p_text = String());
~Button();
};
-VARIANT_ENUM_CAST(Button::TextAlign);
-
#endif
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index 411fb2e1f06..134766b05ff 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -123,7 +123,7 @@ CheckBox::CheckBox(const String &p_text) :
Button(p_text) {
set_toggle_mode(true);
- set_text_align(ALIGN_LEFT);
+ set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
if (is_layout_rtl()) {
_set_internal_margin(SIDE_RIGHT, get_icon_size().width);
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index 162a256d230..499bedda529 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -107,7 +107,7 @@ void CheckButton::_notification(int p_what) {
CheckButton::CheckButton() {
set_toggle_mode(true);
- set_text_align(ALIGN_LEFT);
+ set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
if (is_layout_rtl()) {
_set_internal_margin(SIDE_LEFT, get_icon_size().width);
} else {
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index a8c59665690..23ac36c5eb2 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -170,12 +170,12 @@ void CodeEdit::_notification(int p_what) {
if (code_completion_options[l].default_value.get_type() == Variant::COLOR) {
draw_rect(Rect2(Point2(code_completion_rect.position.x, icon_area.position.y), icon_area_size), (Color)code_completion_options[l].default_value);
}
- tl->set_align(HALIGN_RIGHT);
+ tl->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
} else {
if (code_completion_options[l].default_value.get_type() == Variant::COLOR) {
draw_rect(Rect2(Point2(code_completion_rect.position.x + code_completion_rect.size.width - icon_area_size.x, icon_area.position.y), icon_area_size), (Color)code_completion_options[l].default_value);
}
- tl->set_align(HALIGN_LEFT);
+ tl->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT);
}
tl->draw(ci, title_pos, code_completion_options[l].font_color);
}
@@ -229,7 +229,7 @@ void CodeEdit::_notification(int p_what) {
Point2 round_ofs = hint_ofs + sb->get_offset() + Vector2(0, font->get_ascent(font_size) + font_height * i + yofs);
round_ofs = round_ofs.round();
- draw_string(font, round_ofs, line.replace(String::chr(0xFFFF), ""), HALIGN_LEFT, -1, font_size, font_color);
+ draw_string(font, round_ofs, line.replace(String::chr(0xFFFF), ""), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
if (end > 0) {
// Draw an underline for the currently edited function parameter.
const Vector2 b = hint_ofs + sb->get_offset() + Vector2(begin, font_height + font_height * i + yofs);
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 5a378554c90..63ffe7bf955 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -1274,7 +1274,7 @@ ColorPicker::ColorPicker() :
preset_container->set_columns(preset_column_count);
add_child(preset_container, false, INTERNAL_MODE_FRONT);
- btn_add_preset->set_icon_align(Button::ALIGN_CENTER);
+ btn_add_preset->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER);
btn_add_preset->set_tooltip(RTR("Add current color as a preset."));
btn_add_preset->connect("pressed", callable_mp(this, &ColorPicker::_add_preset_pressed));
preset_container->add_child(btn_add_preset);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index e3754c4d38e..08d5df3db85 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -1000,8 +1000,8 @@ FileDialog::FileDialog() {
message = memnew(Label);
message->hide();
message->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
- message->set_align(Label::ALIGN_CENTER);
- message->set_valign(Label::VALIGN_CENTER);
+ message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
tree->add_child(message);
file_box = memnew(HBoxContainer);
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index b0050f028b0..32c62b72268 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -2312,7 +2312,7 @@ GraphEdit::GraphEdit() {
zoom_hb->add_child(zoom_label);
zoom_label->set_visible(false);
zoom_label->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
- zoom_label->set_align(Label::ALIGN_CENTER);
+ zoom_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
zoom_label->set_custom_minimum_size(Size2(48, 0));
_update_zoom_label();
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 857058f94ea..a3235dd3825 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1213,7 +1213,7 @@ void ItemList::_notification(int p_what) {
text_ofs.x = size.width - text_ofs.x - max_len;
}
- items.write[i].text_buf->set_align(HALIGN_CENTER);
+ items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_CENTER);
if (outline_size > 0 && font_outline_color.a > 0) {
items[i].text_buf->draw_outline(get_canvas_item(), text_ofs, outline_size, font_outline_color);
@@ -1241,9 +1241,9 @@ void ItemList::_notification(int p_what) {
items.write[i].text_buf->set_width(max_len);
if (rtl) {
- items.write[i].text_buf->set_align(HALIGN_RIGHT);
+ items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
} else {
- items.write[i].text_buf->set_align(HALIGN_LEFT);
+ items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_LEFT);
}
if (outline_size > 0 && font_outline_color.a > 0) {
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 3e1b9c9cebd..bd3a2c2e534 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -175,7 +175,7 @@ void Label::_shape() {
if (lines_hidden) {
overrun_flags |= TextServer::OVERRUN_ENFORCE_ELLIPSIS;
}
- if (align == ALIGN_FILL) {
+ if (horizontal_alignment == HORIZONTAL_ALIGNMENT_FILL) {
for (int i = 0; i < lines_rid.size(); i++) {
if (i < visible_lines - 1 || lines_rid.size() == 1) {
TS->shaped_text_fit_to_width(lines_rid[i], width);
@@ -191,7 +191,7 @@ void Label::_shape() {
} else {
// Autowrap disabled.
for (int i = 0; i < lines_rid.size(); i++) {
- if (align == ALIGN_FILL) {
+ if (horizontal_alignment == HORIZONTAL_ALIGNMENT_FILL) {
TS->shaped_text_fit_to_width(lines_rid[i], width);
overrun_flags |= TextServer::OVERRUN_JUSTIFICATION_AWARE;
TS->shaped_text_overrun_trim_to_width(lines_rid[i], width, overrun_flags);
@@ -326,21 +326,21 @@ void Label::_notification(int p_what) {
int vbegin = 0, vsep = 0;
if (lines_visible > 0) {
- switch (valign) {
- case VALIGN_TOP: {
+ switch (vertical_alignment) {
+ case VERTICAL_ALIGNMENT_TOP: {
// Nothing.
} break;
- case VALIGN_CENTER: {
+ case VERTICAL_ALIGNMENT_CENTER: {
vbegin = (size.y - (total_h - line_spacing)) / 2;
vsep = 0;
} break;
- case VALIGN_BOTTOM: {
+ case VERTICAL_ALIGNMENT_BOTTOM: {
vbegin = size.y - (total_h - line_spacing);
vsep = 0;
} break;
- case VALIGN_FILL: {
+ case VERTICAL_ALIGNMENT_FILL: {
vbegin = 0;
if (lines_visible > 1) {
vsep = (size.y - (total_h - line_spacing)) / (lines_visible - 1);
@@ -358,25 +358,25 @@ void Label::_notification(int p_what) {
Size2 line_size = TS->shaped_text_get_size(lines_rid[i]);
ofs.x = 0;
ofs.y += TS->shaped_text_get_ascent(lines_rid[i]) + font->get_spacing(TextServer::SPACING_TOP);
- switch (align) {
- case ALIGN_FILL:
+ switch (horizontal_alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
if (rtl && autowrap_mode != AUTOWRAP_OFF) {
ofs.x = int(size.width - style->get_margin(SIDE_RIGHT) - line_size.width);
} else {
ofs.x = style->get_offset().x;
}
break;
- case ALIGN_LEFT: {
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl_layout) {
ofs.x = int(size.width - style->get_margin(SIDE_RIGHT) - line_size.width);
} else {
ofs.x = style->get_offset().x;
}
} break;
- case ALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
ofs.x = int(size.width - line_size.width) / 2;
} break;
- case ALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (rtl_layout) {
ofs.x = style->get_offset().x;
} else {
@@ -556,29 +556,29 @@ int Label::get_visible_line_count() const {
return lines_visible;
}
-void Label::set_align(Align p_align) {
- ERR_FAIL_INDEX((int)p_align, 4);
- if (align != p_align) {
- if (align == ALIGN_FILL || p_align == ALIGN_FILL) {
+void Label::set_horizontal_alignment(HorizontalAlignment p_alignment) {
+ ERR_FAIL_INDEX((int)p_alignment, 4);
+ if (horizontal_alignment != p_alignment) {
+ if (horizontal_alignment == HORIZONTAL_ALIGNMENT_FILL || p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
lines_dirty = true; // Reshape lines.
}
- align = p_align;
+ horizontal_alignment = p_alignment;
}
update();
}
-Label::Align Label::get_align() const {
- return align;
+HorizontalAlignment Label::get_horizontal_alignment() const {
+ return horizontal_alignment;
}
-void Label::set_valign(VAlign p_align) {
- ERR_FAIL_INDEX((int)p_align, 4);
- valign = p_align;
+void Label::set_vertical_alignment(VerticalAlignment p_alignment) {
+ ERR_FAIL_INDEX((int)p_alignment, 4);
+ vertical_alignment = p_alignment;
update();
}
-Label::VAlign Label::get_valign() const {
- return valign;
+VerticalAlignment Label::get_vertical_alignment() const {
+ return vertical_alignment;
}
void Label::set_text(const String &p_string) {
@@ -809,10 +809,10 @@ void Label::_get_property_list(List *p_list) const {
}
void Label::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_align", "align"), &Label::set_align);
- ClassDB::bind_method(D_METHOD("get_align"), &Label::get_align);
- ClassDB::bind_method(D_METHOD("set_valign", "valign"), &Label::set_valign);
- ClassDB::bind_method(D_METHOD("get_valign"), &Label::get_valign);
+ ClassDB::bind_method(D_METHOD("set_horizontal_alignment", "alignment"), &Label::set_horizontal_alignment);
+ ClassDB::bind_method(D_METHOD("get_horizontal_alignment"), &Label::get_horizontal_alignment);
+ ClassDB::bind_method(D_METHOD("set_vertical_alignment", "alignment"), &Label::set_vertical_alignment);
+ ClassDB::bind_method(D_METHOD("get_vertical_alignment"), &Label::get_vertical_alignment);
ClassDB::bind_method(D_METHOD("set_text", "text"), &Label::set_text);
ClassDB::bind_method(D_METHOD("get_text"), &Label::get_text);
ClassDB::bind_method(D_METHOD("set_text_direction", "direction"), &Label::set_text_direction);
@@ -847,16 +847,6 @@ void Label::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_structured_text_bidi_override_options", "args"), &Label::set_structured_text_bidi_override_options);
ClassDB::bind_method(D_METHOD("get_structured_text_bidi_override_options"), &Label::get_structured_text_bidi_override_options);
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
- BIND_ENUM_CONSTANT(ALIGN_FILL);
-
- BIND_ENUM_CONSTANT(VALIGN_TOP);
- BIND_ENUM_CONSTANT(VALIGN_CENTER);
- BIND_ENUM_CONSTANT(VALIGN_BOTTOM);
- BIND_ENUM_CONSTANT(VALIGN_FILL);
-
BIND_ENUM_CONSTANT(AUTOWRAP_OFF);
BIND_ENUM_CONSTANT(AUTOWRAP_ARBITRARY);
BIND_ENUM_CONSTANT(AUTOWRAP_WORD);
@@ -869,10 +859,11 @@ void Label::_bind_methods() {
BIND_ENUM_CONSTANT(OVERRUN_TRIM_WORD_ELLIPSIS);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text");
+ ADD_GROUP("Locale", "");
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::STRING, "language"), "set_language", "get_language");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "valign", PROPERTY_HINT_ENUM, "Top,Center,Bottom,Fill"), "set_valign", "get_valign");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "horizontal_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_horizontal_alignment", "get_horizontal_alignment");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "vertical_alignment", PROPERTY_HINT_ENUM, "Top,Center,Bottom,Fill"), "set_vertical_alignment", "get_vertical_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "autowrap_mode", PROPERTY_HINT_ENUM, "Off,Arbitrary,Word,Word (Smart)"), "set_autowrap_mode", "get_autowrap_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_text"), "set_clip_text", "is_clipping_text");
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");
diff --git a/scene/gui/label.h b/scene/gui/label.h
index 8b48eb96707..2ad8ae88185 100644
--- a/scene/gui/label.h
+++ b/scene/gui/label.h
@@ -37,20 +37,6 @@ class Label : public Control {
GDCLASS(Label, Control);
public:
- enum Align {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT,
- ALIGN_FILL
- };
-
- enum VAlign {
- VALIGN_TOP,
- VALIGN_CENTER,
- VALIGN_BOTTOM,
- VALIGN_FILL
- };
-
enum AutowrapMode {
AUTOWRAP_OFF,
AUTOWRAP_ARBITRARY,
@@ -67,8 +53,8 @@ public:
};
private:
- Align align = ALIGN_LEFT;
- VAlign valign = VALIGN_TOP;
+ HorizontalAlignment horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT;
+ VerticalAlignment vertical_alignment = VERTICAL_ALIGNMENT_TOP;
String text;
String xl_text;
AutowrapMode autowrap_mode = AUTOWRAP_OFF;
@@ -109,11 +95,11 @@ protected:
public:
virtual Size2 get_minimum_size() const override;
- void set_align(Align p_align);
- Align get_align() const;
+ void set_horizontal_alignment(HorizontalAlignment p_alignment);
+ HorizontalAlignment get_horizontal_alignment() const;
- void set_valign(VAlign p_align);
- VAlign get_valign() const;
+ void set_vertical_alignment(VerticalAlignment p_alignment);
+ VerticalAlignment get_vertical_alignment() const;
void set_text(const String &p_string);
String get_text() const;
@@ -167,8 +153,6 @@ public:
~Label();
};
-VARIANT_ENUM_CAST(Label::Align);
-VARIANT_ENUM_CAST(Label::VAlign);
VARIANT_ENUM_CAST(Label::AutowrapMode);
VARIANT_ENUM_CAST(Label::OverrunBehavior);
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 80f723de623..9df2f7309cd 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -548,17 +548,17 @@ void LineEdit::gui_input(const Ref &p_event) {
}
}
-void LineEdit::set_align(Align p_align) {
- ERR_FAIL_INDEX((int)p_align, 4);
- if (align != p_align) {
- align = p_align;
+void LineEdit::set_horizontal_alignment(HorizontalAlignment p_alignment) {
+ ERR_FAIL_INDEX((int)p_alignment, 4);
+ if (alignment != p_alignment) {
+ alignment = p_alignment;
_shape();
}
update();
}
-LineEdit::Align LineEdit::get_align() const {
- return align;
+HorizontalAlignment LineEdit::get_horizontal_alignment() const {
+ return alignment;
}
Variant LineEdit::get_drag_data(const Point2 &p_point) {
@@ -715,23 +715,23 @@ void LineEdit::_notification(int p_what) {
float text_width = TS->shaped_text_get_size(text_rid).x;
float text_height = TS->shaped_text_get_size(text_rid).y + font->get_spacing(TextServer::SPACING_TOP) + font->get_spacing(TextServer::SPACING_BOTTOM);
- switch (align) {
- case ALIGN_FILL:
- case ALIGN_LEFT: {
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(size.width - style->get_margin(SIDE_RIGHT) - (text_width)));
} else {
x_ofs = style->get_offset().x;
}
} break;
- case ALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (scroll_offset != 0) {
x_ofs = style->get_offset().x;
} else {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(size.width - (text_width)) / 2);
}
} break;
- case ALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (rtl) {
x_ofs = style->get_offset().x;
} else {
@@ -769,7 +769,7 @@ void LineEdit::_notification(int p_what) {
r_icon->draw(ci, Point2(width - r_icon->get_width() - style->get_margin(SIDE_RIGHT), height / 2 - r_icon->get_height() / 2), color_icon);
- if (align == ALIGN_CENTER) {
+ if (alignment == HORIZONTAL_ALIGNMENT_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(size.width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
}
@@ -1115,23 +1115,23 @@ void LineEdit::set_caret_at_pixel_pos(int p_x) {
int x_ofs = 0;
float text_width = TS->shaped_text_get_size(text_rid).x;
- switch (align) {
- case ALIGN_FILL:
- case ALIGN_LEFT: {
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - style->get_margin(SIDE_RIGHT) - (text_width)));
} else {
x_ofs = style->get_offset().x;
}
} break;
- case ALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (scroll_offset != 0) {
x_ofs = style->get_offset().x;
} else {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - (text_width)) / 2);
}
} break;
- case ALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (rtl) {
x_ofs = style->get_offset().x;
} else {
@@ -1144,7 +1144,7 @@ void LineEdit::set_caret_at_pixel_pos(int p_x) {
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
Ref r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
- if (align == ALIGN_CENTER) {
+ if (alignment == HORIZONTAL_ALIGNMENT_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
}
@@ -1163,23 +1163,23 @@ Vector2i LineEdit::get_caret_pixel_pos() {
int x_ofs = 0;
float text_width = TS->shaped_text_get_size(text_rid).x;
- switch (align) {
- case ALIGN_FILL:
- case ALIGN_LEFT: {
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - style->get_margin(SIDE_RIGHT) - (text_width)));
} else {
x_ofs = style->get_offset().x;
}
} break;
- case ALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (scroll_offset != 0) {
x_ofs = style->get_offset().x;
} else {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - (text_width)) / 2);
}
} break;
- case ALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (rtl) {
x_ofs = style->get_offset().x;
} else {
@@ -1192,7 +1192,7 @@ Vector2i LineEdit::get_caret_pixel_pos() {
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
Ref r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
- if (align == ALIGN_CENTER) {
+ if (alignment == HORIZONTAL_ALIGNMENT_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
}
@@ -1508,23 +1508,23 @@ void LineEdit::set_caret_column(int p_column) {
int x_ofs = 0;
float text_width = TS->shaped_text_get_size(text_rid).x;
- switch (align) {
- case ALIGN_FILL:
- case ALIGN_LEFT: {
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - style->get_margin(SIDE_RIGHT) - (text_width)));
} else {
x_ofs = style->get_offset().x;
}
} break;
- case ALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (scroll_offset != 0) {
x_ofs = style->get_offset().x;
} else {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - (text_width)) / 2);
}
} break;
- case ALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (rtl) {
x_ofs = style->get_offset().x;
} else {
@@ -1538,7 +1538,7 @@ void LineEdit::set_caret_column(int p_column) {
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
Ref r_icon = display_clear_icon ? Control::get_theme_icon(SNAME("clear")) : right_icon;
- if (align == ALIGN_CENTER) {
+ if (alignment == HORIZONTAL_ALIGNMENT_CENTER) {
if (scroll_offset == 0) {
x_ofs = MAX(style->get_margin(SIDE_LEFT), int(get_size().width - text_width - r_icon->get_width() - style->get_margin(SIDE_RIGHT) * 2) / 2);
}
@@ -2092,7 +2092,7 @@ void LineEdit::_shape() {
}
void LineEdit::_fit_to_width() {
- if (align == ALIGN_FILL) {
+ if (alignment == HORIZONTAL_ALIGNMENT_FILL) {
Ref style = get_theme_stylebox(SNAME("normal"));
int t_width = get_size().width - style->get_margin(SIDE_RIGHT) - style->get_margin(SIDE_LEFT);
bool using_placeholder = text.is_empty() && ime_text.is_empty();
@@ -2218,8 +2218,8 @@ void LineEdit::_validate_property(PropertyInfo &property) const {
void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed);
- ClassDB::bind_method(D_METHOD("set_align", "align"), &LineEdit::set_align);
- ClassDB::bind_method(D_METHOD("get_align"), &LineEdit::get_align);
+ ClassDB::bind_method(D_METHOD("set_horizontal_alignment", "alignment"), &LineEdit::set_horizontal_alignment);
+ ClassDB::bind_method(D_METHOD("get_horizontal_alignment"), &LineEdit::get_horizontal_alignment);
ClassDB::bind_method(D_METHOD("clear"), &LineEdit::clear);
ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1));
@@ -2297,11 +2297,6 @@ void LineEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("text_change_rejected", PropertyInfo(Variant::STRING, "rejected_substring")));
ADD_SIGNAL(MethodInfo("text_submitted", PropertyInfo(Variant::STRING, "new_text")));
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
- BIND_ENUM_CONSTANT(ALIGN_FILL);
-
BIND_ENUM_CONSTANT(MENU_CUT);
BIND_ENUM_CONSTANT(MENU_COPY);
BIND_ENUM_CONSTANT(MENU_PASTE);
@@ -2333,7 +2328,7 @@ void LineEdit::_bind_methods() {
BIND_ENUM_CONSTANT(MENU_MAX);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text"), "set_text", "get_text");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_horizontal_alignment", "get_horizontal_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_length", PROPERTY_HINT_RANGE, "0,1000,1,or_greater"), "set_max_length", "get_max_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "secret"), "set_secret", "is_secret");
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 221dd9eb2e1..854e54e8f12 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -38,13 +38,6 @@ class LineEdit : public Control {
GDCLASS(LineEdit, Control);
public:
- enum Align {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT,
- ALIGN_FILL
- };
-
enum MenuItems {
MENU_CUT,
MENU_COPY,
@@ -78,7 +71,7 @@ public:
};
private:
- Align align = ALIGN_LEFT;
+ HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT;
bool editable = false;
bool pass = false;
@@ -218,8 +211,8 @@ protected:
void _validate_property(PropertyInfo &property) const override;
public:
- void set_align(Align p_align);
- Align get_align() const;
+ void set_horizontal_alignment(HorizontalAlignment p_alignment);
+ HorizontalAlignment get_horizontal_alignment() const;
virtual Variant get_drag_data(const Point2 &p_point) override;
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;
@@ -347,7 +340,6 @@ public:
~LineEdit();
};
-VARIANT_ENUM_CAST(LineEdit::Align);
VARIANT_ENUM_CAST(LineEdit::MenuItems);
#endif
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index dcf3cfeb091..cbbda09261f 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -341,7 +341,7 @@ void OptionButton::_bind_methods() {
OptionButton::OptionButton() {
set_toggle_mode(true);
- set_text_align(ALIGN_LEFT);
+ set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);
if (is_layout_rtl()) {
if (has_theme_icon(SNAME("arrow"))) {
_set_internal_margin(SIDE_LEFT, Control::get_theme_icon(SNAME("arrow"))->get_width());
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 2cb6ef91b59..c69565c2f71 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -383,7 +383,7 @@ void RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref
// Add indent.
l.offset.x = _find_margin(l.from, p_base_font, p_base_font_size);
l.text_buf->set_width(p_width - l.offset.x);
- l.text_buf->set_align((HAlign)_find_align(l.from));
+ l.text_buf->set_alignment(_find_alignment(l.from));
l.text_buf->set_direction(_find_direction(l.from));
if (tab_size > 0) { // Align inline tabs.
@@ -684,13 +684,13 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
if (!lrtl && p_frame == main) { // Skip Scrollbar.
offx -= scroll_w;
}
- font->draw_string(ci, p_ofs + Vector2(p_width - l.offset.x + offx, l.text_buf->get_line_ascent(0)), " " + prefix, HALIGN_LEFT, l.offset.x, font_size, _find_color(l.from, p_base_color));
+ font->draw_string(ci, p_ofs + Vector2(p_width - l.offset.x + offx, l.text_buf->get_line_ascent(0)), " " + prefix, HORIZONTAL_ALIGNMENT_LEFT, l.offset.x, font_size, _find_color(l.from, p_base_color));
} else {
float offx = 0.0f;
if (lrtl && p_frame == main) { // Skip Scrollbar.
offx += scroll_w;
}
- font->draw_string(ci, p_ofs + Vector2(offx, l.text_buf->get_line_ascent(0)), prefix + " ", HALIGN_RIGHT, l.offset.x, font_size, _find_color(l.from, p_base_color));
+ font->draw_string(ci, p_ofs + Vector2(offx, l.text_buf->get_line_ascent(0)), prefix + " ", HORIZONTAL_ALIGNMENT_RIGHT, l.offset.x, font_size, _find_color(l.from, p_base_color));
}
}
@@ -734,17 +734,17 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
}
// Draw text.
- switch (l.text_buf->get_align()) {
- case HALIGN_FILL:
- case HALIGN_LEFT: {
+ switch (l.text_buf->get_alignment()) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl) {
off.x += width - length;
}
} break;
- case HALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
off.x += Math::floor((width - length) / 2.0);
} break;
- case HALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (!rtl) {
off.x += width - length;
}
@@ -1214,17 +1214,17 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
}
}
- switch (l.text_buf->get_align()) {
- case HALIGN_FILL:
- case HALIGN_LEFT: {
+ switch (l.text_buf->get_alignment()) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl) {
off.x += width - length;
}
} break;
- case HALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
off.x += Math::floor((width - length) / 2.0);
} break;
- case HALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (!rtl) {
off.x += width - length;
}
@@ -1950,19 +1950,19 @@ int RichTextLabel::_find_margin(Item *p_item, const Ref &p_base_font, int
return margin;
}
-RichTextLabel::Align RichTextLabel::_find_align(Item *p_item) {
+HorizontalAlignment RichTextLabel::_find_alignment(Item *p_item) {
Item *item = p_item;
while (item) {
if (item->type == ITEM_PARAGRAPH) {
ItemParagraph *p = static_cast(item);
- return p->align;
+ return p->alignment;
}
item = item->parent;
}
- return default_align;
+ return default_alignment;
}
TextServer::Direction RichTextLabel::_find_direction(Item *p_item) {
@@ -2351,7 +2351,7 @@ void RichTextLabel::_remove_item(Item *p_item, const int p_line, const int p_sub
}
}
-void RichTextLabel::add_image(const Ref &p_image, const int p_width, const int p_height, const Color &p_color, InlineAlign p_align) {
+void RichTextLabel::add_image(const Ref &p_image, const int p_width, const int p_height, const Color &p_color, InlineAlignment p_alignment) {
if (current->type == ITEM_TABLE) {
return;
}
@@ -2363,7 +2363,7 @@ void RichTextLabel::add_image(const Ref &p_image, const int p_width,
item->image = p_image;
item->color = p_color;
- item->inline_align = p_align;
+ item->inline_align = p_alignment;
if (p_width > 0) {
// custom width
@@ -2555,11 +2555,11 @@ void RichTextLabel::push_strikethrough() {
_add_item(item, true);
}
-void RichTextLabel::push_paragraph(Align p_align, Control::TextDirection p_direction, const String &p_language, Control::StructuredTextParser p_st_parser) {
+void RichTextLabel::push_paragraph(HorizontalAlignment p_alignment, Control::TextDirection p_direction, const String &p_language, Control::StructuredTextParser p_st_parser) {
ERR_FAIL_COND(current->type == ITEM_TABLE);
ItemParagraph *item = memnew(ItemParagraph);
- item->align = p_align;
+ item->alignment = p_alignment;
item->direction = p_direction;
item->language = p_language;
item->st_parser = p_st_parser;
@@ -2595,13 +2595,13 @@ void RichTextLabel::push_meta(const Variant &p_meta) {
_add_item(item, true);
}
-void RichTextLabel::push_table(int p_columns, InlineAlign p_align) {
+void RichTextLabel::push_table(int p_columns, InlineAlignment p_alignment) {
ERR_FAIL_COND(p_columns < 1);
ItemTable *item = memnew(ItemTable);
item->columns.resize(p_columns);
item->total_width = 0;
- item->inline_align = p_align;
+ item->inline_align = p_alignment;
for (int i = 0; i < item->columns.size(); i++) {
item->columns.write[i].expand = false;
item->columns.write[i].expand_ratio = 1;
@@ -2958,35 +2958,35 @@ void RichTextLabel::append_text(const String &p_bbcode) {
columns = 1;
}
- int align = INLINE_ALIGN_TOP;
+ int alignment = INLINE_ALIGNMENT_TOP;
if (subtag.size() > 2) {
if (subtag[1] == "top" || subtag[1] == "t") {
- align = INLINE_ALIGN_TOP_TO;
+ alignment = INLINE_ALIGNMENT_TOP_TO;
} else if (subtag[1] == "center" || subtag[1] == "c") {
- align = INLINE_ALIGN_CENTER_TO;
+ alignment = INLINE_ALIGNMENT_CENTER_TO;
} else if (subtag[1] == "bottom" || subtag[1] == "b") {
- align = INLINE_ALIGN_BOTTOM_TO;
+ alignment = INLINE_ALIGNMENT_BOTTOM_TO;
}
if (subtag[2] == "top" || subtag[2] == "t") {
- align |= INLINE_ALIGN_TO_TOP;
+ alignment |= INLINE_ALIGNMENT_TO_TOP;
} else if (subtag[2] == "center" || subtag[2] == "c") {
- align |= INLINE_ALIGN_TO_CENTER;
+ alignment |= INLINE_ALIGNMENT_TO_CENTER;
} else if (subtag[2] == "baseline" || subtag[2] == "l") {
- align |= INLINE_ALIGN_TO_BASELINE;
+ alignment |= INLINE_ALIGNMENT_TO_BASELINE;
} else if (subtag[2] == "bottom" || subtag[2] == "b") {
- align |= INLINE_ALIGN_TO_BOTTOM;
+ alignment |= INLINE_ALIGNMENT_TO_BOTTOM;
}
} else if (subtag.size() > 1) {
if (subtag[1] == "top" || subtag[1] == "t") {
- align = INLINE_ALIGN_TOP;
+ alignment = INLINE_ALIGNMENT_TOP;
} else if (subtag[1] == "center" || subtag[1] == "c") {
- align = INLINE_ALIGN_CENTER;
+ alignment = INLINE_ALIGNMENT_CENTER;
} else if (subtag[1] == "bottom" || subtag[1] == "b") {
- align = INLINE_ALIGN_BOTTOM;
+ alignment = INLINE_ALIGNMENT_BOTTOM;
}
}
- push_table(columns, (InlineAlign)align);
+ push_table(columns, (InlineAlignment)alignment);
pos = brk_end + 1;
tag_stack.push_front("table");
} else if (tag == "cell") {
@@ -3099,15 +3099,15 @@ void RichTextLabel::append_text(const String &p_bbcode) {
add_text(String::chr(0x00AD));
pos = brk_end + 1;
} else if (tag == "center") {
- push_paragraph(ALIGN_CENTER);
+ push_paragraph(HORIZONTAL_ALIGNMENT_CENTER);
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "fill") {
- push_paragraph(ALIGN_FILL);
+ push_paragraph(HORIZONTAL_ALIGNMENT_FILL);
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "right") {
- push_paragraph(ALIGN_RIGHT);
+ push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT);
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "ul") {
@@ -3146,12 +3146,12 @@ void RichTextLabel::append_text(const String &p_bbcode) {
pos = brk_end + 1;
tag_stack.push_front(tag);
} else if (tag == "p") {
- push_paragraph(ALIGN_LEFT);
+ push_paragraph(HORIZONTAL_ALIGNMENT_LEFT);
pos = brk_end + 1;
tag_stack.push_front("p");
} else if (tag.begins_with("p ")) {
Vector subtag = tag.substr(2, tag.length()).split(" ");
- Align align = ALIGN_LEFT;
+ HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT;
Control::TextDirection dir = Control::TEXT_DIRECTION_INHERITED;
String lang;
Control::StructuredTextParser st_parser = STRUCTURED_TEXT_DEFAULT;
@@ -3160,13 +3160,13 @@ void RichTextLabel::append_text(const String &p_bbcode) {
if (subtag_a.size() == 2) {
if (subtag_a[0] == "align") {
if (subtag_a[1] == "l" || subtag_a[1] == "left") {
- align = ALIGN_LEFT;
+ alignment = HORIZONTAL_ALIGNMENT_LEFT;
} else if (subtag_a[1] == "c" || subtag_a[1] == "center") {
- align = ALIGN_CENTER;
+ alignment = HORIZONTAL_ALIGNMENT_CENTER;
} else if (subtag_a[1] == "r" || subtag_a[1] == "right") {
- align = ALIGN_RIGHT;
+ alignment = HORIZONTAL_ALIGNMENT_RIGHT;
} else if (subtag_a[1] == "f" || subtag_a[1] == "fill") {
- align = ALIGN_FILL;
+ alignment = HORIZONTAL_ALIGNMENT_FILL;
}
} else if (subtag_a[0] == "dir" || subtag_a[0] == "direction") {
if (subtag_a[1] == "a" || subtag_a[1] == "auto") {
@@ -3197,7 +3197,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
}
}
}
- push_paragraph(align, dir, lang, st_parser);
+ push_paragraph(alignment, dir, lang, st_parser);
pos = brk_end + 1;
tag_stack.push_front("p");
} else if (tag == "url") {
@@ -3265,33 +3265,33 @@ void RichTextLabel::append_text(const String &p_bbcode) {
pos = end;
tag_stack.push_front(bbcode_name);
} else if (tag.begins_with("img")) {
- int align = INLINE_ALIGN_CENTER;
+ int alignment = INLINE_ALIGNMENT_CENTER;
if (tag.begins_with("img=")) {
Vector subtag = tag.substr(4, tag.length()).split(",");
if (subtag.size() > 1) {
if (subtag[0] == "top" || subtag[0] == "t") {
- align = INLINE_ALIGN_TOP_TO;
+ alignment = INLINE_ALIGNMENT_TOP_TO;
} else if (subtag[0] == "center" || subtag[0] == "c") {
- align = INLINE_ALIGN_CENTER_TO;
+ alignment = INLINE_ALIGNMENT_CENTER_TO;
} else if (subtag[0] == "bottom" || subtag[0] == "b") {
- align = INLINE_ALIGN_BOTTOM_TO;
+ alignment = INLINE_ALIGNMENT_BOTTOM_TO;
}
if (subtag[1] == "top" || subtag[1] == "t") {
- align |= INLINE_ALIGN_TO_TOP;
+ alignment |= INLINE_ALIGNMENT_TO_TOP;
} else if (subtag[1] == "center" || subtag[1] == "c") {
- align |= INLINE_ALIGN_TO_CENTER;
+ alignment |= INLINE_ALIGNMENT_TO_CENTER;
} else if (subtag[1] == "baseline" || subtag[1] == "l") {
- align |= INLINE_ALIGN_TO_BASELINE;
+ alignment |= INLINE_ALIGNMENT_TO_BASELINE;
} else if (subtag[1] == "bottom" || subtag[1] == "b") {
- align |= INLINE_ALIGN_TO_BOTTOM;
+ alignment |= INLINE_ALIGNMENT_TO_BOTTOM;
}
} else if (subtag.size() > 0) {
if (subtag[0] == "top" || subtag[0] == "t") {
- align = INLINE_ALIGN_TOP;
+ alignment = INLINE_ALIGNMENT_TOP;
} else if (subtag[0] == "center" || subtag[0] == "c") {
- align = INLINE_ALIGN_CENTER;
+ alignment = INLINE_ALIGNMENT_CENTER;
} else if (subtag[0] == "bottom" || subtag[0] == "b") {
- align = INLINE_ALIGN_BOTTOM;
+ alignment = INLINE_ALIGNMENT_BOTTOM;
}
}
}
@@ -3333,7 +3333,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
}
}
- add_image(texture, width, height, color, (InlineAlign)align);
+ add_image(texture, width, height, color, (InlineAlignment)alignment);
}
pos = end;
@@ -4050,7 +4050,7 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_parsed_text"), &RichTextLabel::get_parsed_text);
ClassDB::bind_method(D_METHOD("add_text", "text"), &RichTextLabel::add_text);
ClassDB::bind_method(D_METHOD("set_text", "text"), &RichTextLabel::set_text);
- ClassDB::bind_method(D_METHOD("add_image", "image", "width", "height", "color", "inline_align"), &RichTextLabel::add_image, DEFVAL(0), DEFVAL(0), DEFVAL(Color(1.0, 1.0, 1.0)), DEFVAL(INLINE_ALIGN_CENTER));
+ ClassDB::bind_method(D_METHOD("add_image", "image", "width", "height", "color", "inline_align"), &RichTextLabel::add_image, DEFVAL(0), DEFVAL(0), DEFVAL(Color(1.0, 1.0, 1.0)), DEFVAL(INLINE_ALIGNMENT_CENTER));
ClassDB::bind_method(D_METHOD("newline"), &RichTextLabel::add_newline);
ClassDB::bind_method(D_METHOD("remove_line", "line"), &RichTextLabel::remove_line);
ClassDB::bind_method(D_METHOD("push_font", "font"), &RichTextLabel::push_font);
@@ -4064,13 +4064,13 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("push_color", "color"), &RichTextLabel::push_color);
ClassDB::bind_method(D_METHOD("push_outline_size", "outline_size"), &RichTextLabel::push_outline_size);
ClassDB::bind_method(D_METHOD("push_outline_color", "color"), &RichTextLabel::push_outline_color);
- ClassDB::bind_method(D_METHOD("push_paragraph", "align", "base_direction", "language", "st_parser"), &RichTextLabel::push_paragraph, DEFVAL(TextServer::DIRECTION_AUTO), DEFVAL(""), DEFVAL(STRUCTURED_TEXT_DEFAULT));
+ ClassDB::bind_method(D_METHOD("push_paragraph", "alignment", "base_direction", "language", "st_parser"), &RichTextLabel::push_paragraph, DEFVAL(TextServer::DIRECTION_AUTO), DEFVAL(""), DEFVAL(STRUCTURED_TEXT_DEFAULT));
ClassDB::bind_method(D_METHOD("push_indent", "level"), &RichTextLabel::push_indent);
ClassDB::bind_method(D_METHOD("push_list", "level", "type", "capitalize"), &RichTextLabel::push_list);
ClassDB::bind_method(D_METHOD("push_meta", "data"), &RichTextLabel::push_meta);
ClassDB::bind_method(D_METHOD("push_underline"), &RichTextLabel::push_underline);
ClassDB::bind_method(D_METHOD("push_strikethrough"), &RichTextLabel::push_strikethrough);
- ClassDB::bind_method(D_METHOD("push_table", "columns", "inline_align"), &RichTextLabel::push_table, DEFVAL(INLINE_ALIGN_TOP));
+ ClassDB::bind_method(D_METHOD("push_table", "columns", "inline_align"), &RichTextLabel::push_table, DEFVAL(INLINE_ALIGNMENT_TOP));
ClassDB::bind_method(D_METHOD("push_dropcap", "string", "font", "size", "dropcap_margins", "color", "outline_size", "outline_color"), &RichTextLabel::push_dropcap, DEFVAL(Rect2()), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(0, 0, 0, 0)));
ClassDB::bind_method(D_METHOD("set_table_column_expand", "column", "expand", "ratio"), &RichTextLabel::set_table_column_expand);
ClassDB::bind_method(D_METHOD("set_cell_row_background_color", "odd_row_bg", "even_row_bg"), &RichTextLabel::set_cell_row_background_color);
@@ -4188,11 +4188,6 @@ void RichTextLabel::_bind_methods() {
ADD_SIGNAL(MethodInfo("meta_hover_started", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
ADD_SIGNAL(MethodInfo("meta_hover_ended", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
- BIND_ENUM_CONSTANT(ALIGN_FILL);
-
BIND_ENUM_CONSTANT(LIST_NUMBERS);
BIND_ENUM_CONSTANT(LIST_LETTERS);
BIND_ENUM_CONSTANT(LIST_ROMAN);
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 5b58f14d96e..58a531e5ad1 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -39,13 +39,6 @@ class RichTextLabel : public Control {
GDCLASS(RichTextLabel, Control);
public:
- enum Align {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT,
- ALIGN_FILL
- };
-
enum ListType {
LIST_NUMBERS,
LIST_LETTERS,
@@ -160,7 +153,7 @@ private:
struct ItemImage : public Item {
Ref image;
- InlineAlign inline_align = INLINE_ALIGN_CENTER;
+ InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER;
Size2 size;
Color color;
ItemImage() { type = ITEM_IMAGE; }
@@ -210,7 +203,7 @@ private:
};
struct ItemParagraph : public Item {
- Align align = ALIGN_LEFT;
+ HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT;
String language;
Control::TextDirection direction = Control::TEXT_DIRECTION_AUTO;
Control::StructuredTextParser st_parser = STRUCTURED_TEXT_DEFAULT;
@@ -247,7 +240,7 @@ private:
int total_width = 0;
int total_height = 0;
- InlineAlign inline_align = INLINE_ALIGN_TOP;
+ InlineAlignment inline_align = INLINE_ALIGNMENT_TOP;
ItemTable() { type = ITEM_TABLE; }
};
@@ -360,7 +353,7 @@ private:
bool underline_meta = true;
bool override_selected_font_color = false;
- Align default_align = ALIGN_LEFT;
+ HorizontalAlignment default_alignment = HORIZONTAL_ALIGNMENT_LEFT;
ItemMeta *meta_hovering = nullptr;
Variant current_meta;
@@ -428,7 +421,7 @@ private:
ItemDropcap *_find_dc_item(Item *p_item);
int _find_list(Item *p_item, Vector &r_index, Vector &r_list);
int _find_margin(Item *p_item, const Ref &p_base_font, int p_base_font_size);
- Align _find_align(Item *p_item);
+ HorizontalAlignment _find_alignment(Item *p_item);
TextServer::Direction _find_direction(Item *p_item);
Control::StructuredTextParser _find_stt(Item *p_item);
String _find_language(Item *p_item);
@@ -469,7 +462,7 @@ private:
public:
String get_parsed_text() const;
void add_text(const String &p_text);
- void add_image(const Ref &p_image, const int p_width = 0, const int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0), InlineAlign p_align = INLINE_ALIGN_CENTER);
+ void add_image(const Ref &p_image, const int p_width = 0, const int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0), InlineAlignment p_alignment = INLINE_ALIGNMENT_CENTER);
void add_newline();
bool remove_line(const int p_line);
void push_dropcap(const String &p_string, const Ref &p_font, int p_size, const Rect2 &p_dropcap_margins = Rect2(), const Color &p_color = Color(1, 1, 1), int p_ol_size = 0, const Color &p_ol_color = Color(0, 0, 0, 0));
@@ -486,11 +479,11 @@ public:
void push_outline_color(const Color &p_color);
void push_underline();
void push_strikethrough();
- void push_paragraph(Align p_align, Control::TextDirection p_direction = Control::TEXT_DIRECTION_INHERITED, const String &p_language = "", Control::StructuredTextParser p_st_parser = STRUCTURED_TEXT_DEFAULT);
+ void push_paragraph(HorizontalAlignment p_alignment, Control::TextDirection p_direction = Control::TEXT_DIRECTION_INHERITED, const String &p_language = "", Control::StructuredTextParser p_st_parser = STRUCTURED_TEXT_DEFAULT);
void push_indent(int p_level);
void push_list(int p_level, ListType p_list, bool p_capitalize);
void push_meta(const Variant &p_meta);
- void push_table(int p_columns, InlineAlign p_align = INLINE_ALIGN_TOP);
+ void push_table(int p_columns, InlineAlignment p_alignment = INLINE_ALIGNMENT_TOP);
void push_fade(int p_start_index, int p_length);
void push_shake(int p_strength, float p_rate);
void push_wave(float p_frequency, float p_amplitude);
@@ -595,7 +588,6 @@ public:
~RichTextLabel();
};
-VARIANT_ENUM_CAST(RichTextLabel::Align);
VARIANT_ENUM_CAST(RichTextLabel::ListType);
VARIANT_ENUM_CAST(RichTextLabel::ItemType);
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 94a4886fef0..c4a1d8e5a61 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -227,12 +227,12 @@ void SpinBox::_notification(int p_what) {
}
}
-void SpinBox::set_align(LineEdit::Align p_align) {
- line_edit->set_align(p_align);
+void SpinBox::set_horizontal_alignment(HorizontalAlignment p_alignment) {
+ line_edit->set_horizontal_alignment(p_alignment);
}
-LineEdit::Align SpinBox::get_align() const {
- return line_edit->get_align();
+HorizontalAlignment SpinBox::get_horizontal_alignment() const {
+ return line_edit->get_horizontal_alignment();
}
void SpinBox::set_suffix(const String &p_suffix) {
@@ -284,8 +284,8 @@ void SpinBox::apply() {
}
void SpinBox::_bind_methods() {
- 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_horizontal_alignment", "alignment"), &SpinBox::set_horizontal_alignment);
+ ClassDB::bind_method(D_METHOD("get_horizontal_alignment"), &SpinBox::get_horizontal_alignment);
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);
@@ -297,7 +297,7 @@ void SpinBox::_bind_methods() {
ClassDB::bind_method(D_METHOD("apply"), &SpinBox::apply);
ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_horizontal_alignment", "get_horizontal_alignment");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "update_on_text_changed"), "set_update_on_text_changed", "get_update_on_text_changed");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "prefix"), "set_prefix", "get_prefix");
@@ -310,7 +310,7 @@ SpinBox::SpinBox() {
line_edit->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
line_edit->set_mouse_filter(MOUSE_FILTER_PASS);
- line_edit->set_align(LineEdit::ALIGN_LEFT);
+ line_edit->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT);
line_edit->connect("text_submitted", callable_mp(this, &SpinBox::_text_submitted), Vector(), CONNECT_DEFERRED);
line_edit->connect("focus_exited", callable_mp(this, &SpinBox::_line_edit_focus_exit), Vector(), CONNECT_DEFERRED);
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index f2299ce1c28..736a5d873de 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -79,8 +79,8 @@ 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_enabled);
bool is_editable() const;
diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp
index da23b0dde84..dd410e2472b 100644
--- a/scene/gui/tab_bar.cpp
+++ b/scene/gui/tab_bar.cpp
@@ -319,9 +319,9 @@ void TabBar::_notification(int p_what) {
mw += get_tab_width(i);
}
- if (tab_align == ALIGN_CENTER) {
+ if (tab_alignment == ALIGNMENT_CENTER) {
w = (get_size().width - mw) / 2;
- } else if (tab_align == ALIGN_RIGHT) {
+ } else if (tab_alignment == ALIGNMENT_RIGHT) {
w = get_size().width - mw;
}
@@ -929,14 +929,14 @@ int TabBar::get_tab_idx_at_point(const Point2 &p_point) const {
return hover_now;
}
-void TabBar::set_tab_align(TabAlign p_align) {
- ERR_FAIL_INDEX(p_align, ALIGN_MAX);
- tab_align = p_align;
+void TabBar::set_tab_alignment(AlignmentMode p_alignment) {
+ ERR_FAIL_INDEX(p_alignment, ALIGNMENT_MAX);
+ tab_alignment = p_alignment;
update();
}
-TabBar::TabAlign TabBar::get_tab_align() const {
- return tab_align;
+TabBar::AlignmentMode TabBar::get_tab_alignment() const {
+ return tab_alignment;
}
void TabBar::set_clip_tabs(bool p_clip_tabs) {
@@ -1149,8 +1149,8 @@ void TabBar::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &TabBar::get_tab_disabled);
ClassDB::bind_method(D_METHOD("remove_tab", "tab_idx"), &TabBar::remove_tab);
ClassDB::bind_method(D_METHOD("add_tab", "title", "icon"), &TabBar::add_tab, DEFVAL(""), DEFVAL(Ref()));
- ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &TabBar::set_tab_align);
- ClassDB::bind_method(D_METHOD("get_tab_align"), &TabBar::get_tab_align);
+ ClassDB::bind_method(D_METHOD("set_tab_alignment", "alignment"), &TabBar::set_tab_alignment);
+ ClassDB::bind_method(D_METHOD("get_tab_alignment"), &TabBar::get_tab_alignment);
ClassDB::bind_method(D_METHOD("set_clip_tabs", "clip_tabs"), &TabBar::set_clip_tabs);
ClassDB::bind_method(D_METHOD("get_clip_tabs"), &TabBar::get_clip_tabs);
ClassDB::bind_method(D_METHOD("get_tab_offset"), &TabBar::get_tab_offset);
@@ -1178,16 +1178,16 @@ void TabBar::_bind_methods() {
ADD_SIGNAL(MethodInfo("tab_clicked", PropertyInfo(Variant::INT, "tab")));
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_alignment", "get_tab_alignment");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_tabs"), "set_clip_tabs", "get_clip_tabs");
ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_close_display_policy", PROPERTY_HINT_ENUM, "Show Never,Show Active Only,Show Always"), "set_tab_close_display_policy", "get_tab_close_display_policy");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scrolling_enabled"), "set_scrolling_enabled", "get_scrolling_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_to_rearrange_enabled"), "set_drag_to_rearrange_enabled", "get_drag_to_rearrange_enabled");
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
- BIND_ENUM_CONSTANT(ALIGN_MAX);
+ BIND_ENUM_CONSTANT(ALIGNMENT_LEFT);
+ BIND_ENUM_CONSTANT(ALIGNMENT_CENTER);
+ BIND_ENUM_CONSTANT(ALIGNMENT_RIGHT);
+ BIND_ENUM_CONSTANT(ALIGNMENT_MAX);
BIND_ENUM_CONSTANT(CLOSE_BUTTON_SHOW_NEVER);
BIND_ENUM_CONSTANT(CLOSE_BUTTON_SHOW_ACTIVE_ONLY);
diff --git a/scene/gui/tab_bar.h b/scene/gui/tab_bar.h
index 411a62b1d96..2d211937fcb 100644
--- a/scene/gui/tab_bar.h
+++ b/scene/gui/tab_bar.h
@@ -38,11 +38,11 @@ class TabBar : public Control {
GDCLASS(TabBar, Control);
public:
- enum TabAlign {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT,
- ALIGN_MAX
+ enum AlignmentMode {
+ ALIGNMENT_LEFT,
+ ALIGNMENT_CENTER,
+ ALIGNMENT_RIGHT,
+ ALIGNMENT_MAX,
};
enum CloseButtonDisplayPolicy {
@@ -83,7 +83,7 @@ private:
Vector tabs;
int current = 0;
int previous = 0;
- TabAlign tab_align = ALIGN_CENTER;
+ AlignmentMode tab_alignment = ALIGNMENT_CENTER;
bool clip_tabs = true;
int rb_hover = -1;
bool rb_pressing = false;
@@ -145,8 +145,8 @@ public:
void set_tab_right_button(int p_tab, const Ref &p_right_button);
Ref get_tab_right_button(int p_tab) const;
- void set_tab_align(TabAlign p_align);
- TabAlign get_tab_align() const;
+ void set_tab_alignment(AlignmentMode p_alignment);
+ AlignmentMode get_tab_alignment() const;
void set_clip_tabs(bool p_clip_tabs);
bool get_clip_tabs() const;
@@ -189,7 +189,7 @@ public:
TabBar();
};
-VARIANT_ENUM_CAST(TabBar::TabAlign);
+VARIANT_ENUM_CAST(TabBar::AlignmentMode);
VARIANT_ENUM_CAST(TabBar::CloseButtonDisplayPolicy);
#endif // TAB_BAR_H
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 562f523f53a..23e8f2bce89 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -406,14 +406,14 @@ void TabContainer::_notification(int p_what) {
}
// Find the offset at which to draw tabs, according to the alignment.
- switch (align) {
- case ALIGN_LEFT:
+ switch (alignment) {
+ case ALIGNMENT_LEFT:
tabs_ofs_cache = header_x;
break;
- case ALIGN_CENTER:
+ case ALIGNMENT_CENTER:
tabs_ofs_cache = header_x + (header_width / 2) - (all_tabs_width / 2);
break;
- case ALIGN_RIGHT:
+ case ALIGNMENT_RIGHT:
tabs_ofs_cache = header_x + header_width - all_tabs_width;
break;
}
@@ -967,14 +967,14 @@ int TabContainer::get_tab_idx_at_point(const Point2 &p_point) const {
return -1;
}
-void TabContainer::set_tab_align(TabAlign p_align) {
- ERR_FAIL_INDEX(p_align, 3);
- align = p_align;
+void TabContainer::set_tab_alignment(AlignmentMode p_alignment) {
+ ERR_FAIL_INDEX(p_alignment, 3);
+ alignment = p_alignment;
update();
}
-TabContainer::TabAlign TabContainer::get_tab_align() const {
- return align;
+TabContainer::AlignmentMode TabContainer::get_tab_alignment() const {
+ return alignment;
}
void TabContainer::set_tabs_visible(bool p_visible) {
@@ -1198,8 +1198,8 @@ void TabContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_previous_tab"), &TabContainer::get_previous_tab);
ClassDB::bind_method(D_METHOD("get_current_tab_control"), &TabContainer::get_current_tab_control);
ClassDB::bind_method(D_METHOD("get_tab_control", "tab_idx"), &TabContainer::get_tab_control);
- ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &TabContainer::set_tab_align);
- ClassDB::bind_method(D_METHOD("get_tab_align"), &TabContainer::get_tab_align);
+ ClassDB::bind_method(D_METHOD("set_tab_alignment", "alignment"), &TabContainer::set_tab_alignment);
+ ClassDB::bind_method(D_METHOD("get_tab_alignment"), &TabContainer::get_tab_alignment);
ClassDB::bind_method(D_METHOD("set_tabs_visible", "visible"), &TabContainer::set_tabs_visible);
ClassDB::bind_method(D_METHOD("are_tabs_visible"), &TabContainer::are_tabs_visible);
ClassDB::bind_method(D_METHOD("set_all_tabs_in_front", "is_front"), &TabContainer::set_all_tabs_in_front);
@@ -1230,16 +1230,16 @@ void TabContainer::_bind_methods() {
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
ADD_SIGNAL(MethodInfo("pre_popup_pressed"));
- ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_alignment", "get_tab_alignment");
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "all_tabs_in_front"), "set_all_tabs_in_front", "is_all_tabs_in_front");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_to_rearrange_enabled"), "set_drag_to_rearrange_enabled", "get_drag_to_rearrange_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_hidden_tabs_for_min_size"), "set_use_hidden_tabs_for_min_size", "get_use_hidden_tabs_for_min_size");
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
+ BIND_ENUM_CONSTANT(ALIGNMENT_LEFT);
+ BIND_ENUM_CONSTANT(ALIGNMENT_CENTER);
+ BIND_ENUM_CONSTANT(ALIGNMENT_RIGHT);
}
TabContainer::TabContainer() {
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index fe96df25e8a..6dfeb2b625f 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -39,10 +39,10 @@ class TabContainer : public Container {
GDCLASS(TabContainer, Container);
public:
- enum TabAlign {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT
+ enum AlignmentMode {
+ ALIGNMENT_LEFT,
+ ALIGNMENT_CENTER,
+ ALIGNMENT_RIGHT,
};
private:
@@ -56,7 +56,7 @@ private:
bool buttons_visible_cache = false;
bool menu_hovered = false;
int highlight_arrow = -1;
- TabAlign align = ALIGN_CENTER;
+ AlignmentMode alignment = ALIGNMENT_CENTER;
int _get_top_margin() const;
mutable ObjectID popup_obj_id;
bool drag_to_rearrange_enabled = false;
@@ -90,8 +90,8 @@ protected:
static void _bind_methods();
public:
- void set_tab_align(TabAlign p_align);
- TabAlign get_tab_align() const;
+ void set_tab_alignment(AlignmentMode p_alignment);
+ AlignmentMode get_tab_alignment() const;
void set_tabs_visible(bool p_visible);
bool are_tabs_visible() const;
@@ -136,6 +136,6 @@ public:
TabContainer();
};
-VARIANT_ENUM_CAST(TabContainer::TabAlign);
+VARIANT_ENUM_CAST(TabContainer::AlignmentMode);
#endif // TAB_CONTAINER_H
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 050ba9f5196..d2d4167a25f 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1002,18 +1002,18 @@ bool TreeItem::is_custom_set_as_button(int p_column) const {
return cells[p_column].custom_button;
}
-void TreeItem::set_text_align(int p_column, TextAlign p_align) {
+void TreeItem::set_text_alignment(int p_column, HorizontalAlignment p_alignment) {
ERR_FAIL_INDEX(p_column, cells.size());
- cells.write[p_column].text_align = p_align;
+ cells.write[p_column].text_alignment = p_alignment;
cells.write[p_column].cached_minimum_size_dirty = true;
_changed_notify(p_column);
}
-TreeItem::TextAlign TreeItem::get_text_align(int p_column) const {
- ERR_FAIL_INDEX_V(p_column, cells.size(), ALIGN_LEFT);
- return cells[p_column].text_align;
+HorizontalAlignment TreeItem::get_text_alignment(int p_column) const {
+ ERR_FAIL_INDEX_V(p_column, cells.size(), HORIZONTAL_ALIGNMENT_LEFT);
+ return cells[p_column].text_alignment;
}
void TreeItem::set_expand_right(int p_column, bool p_enable) {
@@ -1231,8 +1231,8 @@ void TreeItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_tooltip", "column", "tooltip"), &TreeItem::set_tooltip);
ClassDB::bind_method(D_METHOD("get_tooltip", "column"), &TreeItem::get_tooltip);
- ClassDB::bind_method(D_METHOD("set_text_align", "column", "text_align"), &TreeItem::set_text_align);
- ClassDB::bind_method(D_METHOD("get_text_align", "column"), &TreeItem::get_text_align);
+ ClassDB::bind_method(D_METHOD("set_text_alignment", "column", "text_alignment"), &TreeItem::set_text_alignment);
+ ClassDB::bind_method(D_METHOD("get_text_alignment", "column"), &TreeItem::get_text_alignment);
ClassDB::bind_method(D_METHOD("set_expand_right", "column", "enable"), &TreeItem::set_expand_right);
ClassDB::bind_method(D_METHOD("get_expand_right", "column"), &TreeItem::get_expand_right);
@@ -1278,10 +1278,6 @@ void TreeItem::_bind_methods() {
BIND_ENUM_CONSTANT(CELL_MODE_RANGE);
BIND_ENUM_CONSTANT(CELL_MODE_ICON);
BIND_ENUM_CONSTANT(CELL_MODE_CUSTOM);
-
- BIND_ENUM_CONSTANT(ALIGN_LEFT);
- BIND_ENUM_CONSTANT(ALIGN_CENTER);
- BIND_ENUM_CONSTANT(ALIGN_RIGHT);
}
void TreeItem::clear_children() {
@@ -1477,16 +1473,17 @@ void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Co
}
w += ts.width;
- switch (p_cell.text_align) {
- case TreeItem::ALIGN_LEFT:
+ switch (p_cell.text_alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT: {
if (rtl) {
rect.position.x += MAX(0, (rect.size.width - w));
}
- break;
- case TreeItem::ALIGN_CENTER:
+ } break;
+ case HORIZONTAL_ALIGNMENT_CENTER:
rect.position.x += MAX(0, (rect.size.width - w) / 2);
break;
- case TreeItem::ALIGN_RIGHT:
+ case HORIZONTAL_ALIGNMENT_RIGHT:
if (!rtl) {
rect.position.x += MAX(0, (rect.size.width - w));
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index d4caec614ab..a190567f0fc 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -52,12 +52,6 @@ public:
CELL_MODE_CUSTOM, ///< Contains a custom value, show a string, and an edit button
};
- enum TextAlign {
- ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT
- };
-
private:
friend class Tree;
@@ -98,7 +92,7 @@ private:
Size2i cached_minimum_size;
bool cached_minimum_size_dirty = true;
- TextAlign text_align = ALIGN_LEFT;
+ HorizontalAlignment text_alignment = HORIZONTAL_ALIGNMENT_LEFT;
Variant meta;
String tooltip;
@@ -316,8 +310,8 @@ public:
void set_tooltip(int p_column, const String &p_tooltip);
String get_tooltip(int p_column) const;
- void set_text_align(int p_column, TextAlign p_align);
- TextAlign get_text_align(int p_column) const;
+ void set_text_alignment(int p_column, HorizontalAlignment p_alignment);
+ HorizontalAlignment get_text_alignment(int p_column) const;
void set_expand_right(int p_column, bool p_enable);
bool get_expand_right(int p_column) const;
@@ -359,7 +353,6 @@ public:
};
VARIANT_ENUM_CAST(TreeItem::TreeCellMode);
-VARIANT_ENUM_CAST(TreeItem::TextAlign);
class VBoxContainer;
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 0fd3a963aee..2022a9a46e0 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -649,16 +649,16 @@ void CanvasItem::draw_multimesh(const Ref &p_multimesh, const Refcanvas_item_add_multimesh(canvas_item, p_multimesh->get_rid(), texture_rid);
}
-void CanvasItem::draw_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HAlign p_align, real_t p_width, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
+void CanvasItem::draw_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, real_t p_width, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
ERR_FAIL_COND(p_font.is_null());
- p_font->draw_string(canvas_item, p_pos, p_text, p_align, p_width, p_size, p_modulate, p_outline_size, p_outline_modulate, p_flags);
+ p_font->draw_string(canvas_item, p_pos, p_text, p_alignment, p_width, p_size, p_modulate, p_outline_size, p_outline_modulate, p_flags);
}
-void CanvasItem::draw_multiline_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HAlign p_align, real_t p_width, int p_max_lines, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
+void CanvasItem::draw_multiline_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, real_t p_width, int p_max_lines, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
ERR_FAIL_COND(p_font.is_null());
- p_font->draw_multiline_string(canvas_item, p_pos, p_text, p_align, p_width, p_max_lines, p_size, p_modulate, p_outline_size, p_outline_modulate, p_flags);
+ p_font->draw_multiline_string(canvas_item, p_pos, p_text, p_alignment, p_width, p_max_lines, p_size, p_modulate, p_outline_size, p_outline_modulate, p_flags);
}
real_t CanvasItem::draw_char(const Ref &p_font, const Point2 &p_pos, const String &p_char, const String &p_next, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate) const {
@@ -894,8 +894,8 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width"), &CanvasItem::draw_primitive, DEFVAL(Ref()), DEFVAL(1.0));
ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture"), &CanvasItem::draw_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Ref()));
ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture"), &CanvasItem::draw_colored_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Ref()));
- ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "align", "width", "size", "modulate", "outline_size", "outline_modulate", "flags"), &CanvasItem::draw_string, DEFVAL(HALIGN_LEFT), DEFVAL(-1), DEFVAL(Font::DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
- ClassDB::bind_method(D_METHOD("draw_multiline_string", "font", "pos", "text", "align", "width", "max_lines", "size", "modulate", "outline_size", "outline_modulate", "flags"), &CanvasItem::draw_multiline_string, DEFVAL(HALIGN_LEFT), DEFVAL(-1), DEFVAL(-1), DEFVAL(Font::DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
+ ClassDB::bind_method(D_METHOD("draw_string", "font", "pos", "text", "alignment", "width", "size", "modulate", "outline_size", "outline_modulate", "flags"), &CanvasItem::draw_string, DEFVAL(HORIZONTAL_ALIGNMENT_LEFT), DEFVAL(-1), DEFVAL(Font::DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
+ ClassDB::bind_method(D_METHOD("draw_multiline_string", "font", "pos", "text", "alignment", "width", "max_lines", "size", "modulate", "outline_size", "outline_modulate", "flags"), &CanvasItem::draw_multiline_string, DEFVAL(HORIZONTAL_ALIGNMENT_LEFT), DEFVAL(-1), DEFVAL(-1), DEFVAL(Font::DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
ClassDB::bind_method(D_METHOD("draw_char", "font", "pos", "char", "next", "size", "modulate", "outline_size", "outline_modulate"), &CanvasItem::draw_char, DEFVAL(""), DEFVAL(Font::DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)));
ClassDB::bind_method(D_METHOD("draw_mesh", "mesh", "texture", "transform", "modulate"), &CanvasItem::draw_mesh, DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1, 1)));
ClassDB::bind_method(D_METHOD("draw_multimesh", "multimesh", "texture"), &CanvasItem::draw_multimesh);
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index 04376ad8097..26a7068e68d 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -235,8 +235,8 @@ public:
void draw_mesh(const Ref &p_mesh, const Ref &p_texture, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1));
void draw_multimesh(const Ref &p_multimesh, const Ref &p_texture);
- void draw_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HAlign p_align = HALIGN_LEFT, real_t p_width = -1, int p_size = Font::DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
- void draw_multiline_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HAlign p_align = HALIGN_LEFT, real_t p_width = -1, int p_max_lines = -1, int p_size = Font::DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
+ void draw_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, real_t p_width = -1, int p_size = Font::DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
+ void draw_multiline_string(const Ref &p_font, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, real_t p_width = -1, int p_max_lines = -1, int p_size = Font::DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
real_t draw_char(const Ref &p_font, const Point2 &p_pos, const String &p_char, const String &p_next = "", int p_size = Font::DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0)) const;
void draw_set_transform(const Point2 &p_offset, real_t p_rot = 0.0, const Size2 &p_scale = Size2(1.0, 1.0));
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index d88a2c557be..63c0635aaf0 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -1152,11 +1152,11 @@ void Font::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_underline_position", "size"), &Font::get_underline_position, DEFVAL(DEFAULT_FONT_SIZE));
ClassDB::bind_method(D_METHOD("get_underline_thickness", "size"), &Font::get_underline_thickness, DEFVAL(DEFAULT_FONT_SIZE));
- ClassDB::bind_method(D_METHOD("get_string_size", "text", "size", "align", "width", "flags"), &Font::get_string_size, DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(HALIGN_LEFT), DEFVAL(-1), DEFVAL(TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
+ ClassDB::bind_method(D_METHOD("get_string_size", "text", "size", "alignment", "width", "flags"), &Font::get_string_size, DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(HORIZONTAL_ALIGNMENT_LEFT), DEFVAL(-1), DEFVAL(TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
ClassDB::bind_method(D_METHOD("get_multiline_string_size", "text", "width", "size", "flags"), &Font::get_multiline_string_size, DEFVAL(-1), DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND));
- ClassDB::bind_method(D_METHOD("draw_string", "canvas_item", "pos", "text", "align", "width", "size", "modulate", "outline_size", "outline_modulate", "flags"), &Font::draw_string, DEFVAL(HALIGN_LEFT), DEFVAL(-1), DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
- ClassDB::bind_method(D_METHOD("draw_multiline_string", "canvas_item", "pos", "text", "align", "width", "max_lines", "size", "modulate", "outline_size", "outline_modulate", "flags"), &Font::draw_multiline_string, DEFVAL(HALIGN_LEFT), DEFVAL(-1), DEFVAL(-1), DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
+ ClassDB::bind_method(D_METHOD("draw_string", "canvas_item", "pos", "text", "alignment", "width", "size", "modulate", "outline_size", "outline_modulate", "flags"), &Font::draw_string, DEFVAL(HORIZONTAL_ALIGNMENT_LEFT), DEFVAL(-1), DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
+ ClassDB::bind_method(D_METHOD("draw_multiline_string", "canvas_item", "pos", "text", "alignment", "width", "max_lines", "size", "modulate", "outline_size", "outline_modulate", "flags"), &Font::draw_multiline_string, DEFVAL(HORIZONTAL_ALIGNMENT_LEFT), DEFVAL(-1), DEFVAL(-1), DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)), DEFVAL(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND));
ClassDB::bind_method(D_METHOD("get_char_size", "char", "next", "size"), &Font::get_char_size, DEFVAL(0), DEFVAL(DEFAULT_FONT_SIZE));
ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "pos", "char", "next", "size", "modulate", "outline_size", "outline_modulate"), &Font::draw_char, DEFVAL(0), DEFVAL(DEFAULT_FONT_SIZE), DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(Color(1, 1, 1, 0)));
@@ -1449,7 +1449,7 @@ real_t Font::get_underline_thickness(int p_size) const {
return ret;
}
-Size2 Font::get_string_size(const String &p_text, int p_size, HAlign p_align, real_t p_width, uint16_t p_flags) const {
+Size2 Font::get_string_size(const String &p_text, int p_size, HorizontalAlignment p_alignment, real_t p_width, uint16_t p_flags) const {
ERR_FAIL_COND_V(data.is_empty(), Size2());
for (int i = 0; i < data.size(); i++) {
@@ -1457,7 +1457,7 @@ Size2 Font::get_string_size(const String &p_text, int p_size, HAlign p_align, re
}
uint64_t hash = p_text.hash64();
- if (p_align == HALIGN_FILL) {
+ if (p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
hash = hash_djb2_one_64(hash_djb2_one_float(p_width), hash);
hash = hash_djb2_one_64(p_flags, hash);
}
@@ -1511,7 +1511,7 @@ Size2 Font::get_multiline_string_size(const String &p_text, real_t p_width, int
return ret;
}
-void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align, real_t p_width, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
+void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, real_t p_width, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
ERR_FAIL_COND(data.is_empty());
for (int i = 0; i < data.size(); i++) {
@@ -1519,7 +1519,7 @@ void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_t
}
uint64_t hash = p_text.hash64();
- if (p_align == HALIGN_FILL) {
+ if (p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
hash = hash_djb2_one_64(hash_djb2_one_float(p_width), hash);
hash = hash_djb2_one_64(p_flags, hash);
}
@@ -1542,7 +1542,7 @@ void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_t
}
buffer->set_width(p_width);
- buffer->set_align(p_align);
+ buffer->set_horizontal_alignment(p_alignment);
buffer->set_flags(p_flags);
if (p_outline_size > 0 && p_outline_modulate.a != 0.0f) {
@@ -1551,7 +1551,7 @@ void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_t
buffer->draw(p_canvas_item, ofs, p_modulate);
}
-void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align, float p_width, int p_max_lines, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
+void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment, float p_width, int p_max_lines, int p_size, const Color &p_modulate, int p_outline_size, const Color &p_outline_modulate, uint16_t p_flags) const {
ERR_FAIL_COND(data.is_empty());
for (int i = 0; i < data.size(); i++) {
@@ -1574,7 +1574,7 @@ void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const S
cache_wrap.insert(wrp_hash, lines_buffer);
}
- lines_buffer->set_align(p_align);
+ lines_buffer->set_alignment(p_alignment);
Vector2 lofs = p_pos;
for (int i = 0; i < lines_buffer->get_line_count(); i++) {
@@ -1588,7 +1588,7 @@ void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const S
}
}
if (p_width > 0) {
- lines_buffer->set_align(p_align);
+ lines_buffer->set_alignment(p_alignment);
}
if (p_outline_size > 0 && p_outline_modulate.a != 0.0f) {
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 4d9ee72c84e..fde4502977e 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -273,11 +273,11 @@ public:
virtual real_t get_underline_thickness(int p_size = DEFAULT_FONT_SIZE) const;
// Drawing string.
- virtual Size2 get_string_size(const String &p_text, int p_size = DEFAULT_FONT_SIZE, HAlign p_align = HALIGN_LEFT, real_t p_width = -1, uint16_t p_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
+ virtual Size2 get_string_size(const String &p_text, int p_size = DEFAULT_FONT_SIZE, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, real_t p_width = -1, uint16_t p_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
virtual Size2 get_multiline_string_size(const String &p_text, real_t p_width = -1, int p_size = DEFAULT_FONT_SIZE, uint16_t p_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND) const;
- virtual void draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align = HALIGN_LEFT, real_t p_width = -1, int p_size = DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
- virtual void draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HAlign p_align = HALIGN_LEFT, real_t p_width = -1, int p_max_lines = -1, int p_size = DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
+ virtual void draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, real_t p_width = -1, int p_size = DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
+ virtual void draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const String &p_text, HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, real_t p_width = -1, int p_max_lines = -1, int p_size = DEFAULT_FONT_SIZE, const Color &p_modulate = Color(1, 1, 1), int p_outline_size = 0, const Color &p_outline_modulate = Color(1, 1, 1, 0), uint16_t p_flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_WORD_BOUND) const;
// Helper functions.
virtual bool has_char(char32_t p_char) const;
diff --git a/scene/resources/text_line.cpp b/scene/resources/text_line.cpp
index 00945189670..cfd7e1d8766 100644
--- a/scene/resources/text_line.cpp
+++ b/scene/resources/text_line.cpp
@@ -56,18 +56,18 @@ void TextLine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bidi_override", "override"), &TextLine::set_bidi_override);
ClassDB::bind_method(D_METHOD("add_string", "text", "fonts", "size", "opentype_features", "language"), &TextLine::add_string, DEFVAL(Dictionary()), DEFVAL(""));
- ClassDB::bind_method(D_METHOD("add_object", "key", "size", "inline_align", "length"), &TextLine::add_object, DEFVAL(INLINE_ALIGN_CENTER), DEFVAL(1));
- ClassDB::bind_method(D_METHOD("resize_object", "key", "size", "inline_align"), &TextLine::resize_object, DEFVAL(INLINE_ALIGN_CENTER));
+ ClassDB::bind_method(D_METHOD("add_object", "key", "size", "inline_align", "length"), &TextLine::add_object, DEFVAL(INLINE_ALIGNMENT_CENTER), DEFVAL(1));
+ ClassDB::bind_method(D_METHOD("resize_object", "key", "size", "inline_align"), &TextLine::resize_object, DEFVAL(INLINE_ALIGNMENT_CENTER));
ClassDB::bind_method(D_METHOD("set_width", "width"), &TextLine::set_width);
ClassDB::bind_method(D_METHOD("get_width"), &TextLine::get_width);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "width"), "set_width", "get_width");
- ClassDB::bind_method(D_METHOD("set_align", "align"), &TextLine::set_align);
- ClassDB::bind_method(D_METHOD("get_align"), &TextLine::get_align);
+ ClassDB::bind_method(D_METHOD("set_horizontal_alignment", "alignment"), &TextLine::set_horizontal_alignment);
+ ClassDB::bind_method(D_METHOD("get_horizontal_alignment"), &TextLine::get_horizontal_alignment);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_horizontal_alignment", "get_horizontal_alignment");
ClassDB::bind_method(D_METHOD("tab_align", "tab_stops"), &TextLine::tab_align);
@@ -135,14 +135,14 @@ void TextLine::_shape() {
break;
}
- if (align == HALIGN_FILL) {
+ if (alignment == HORIZONTAL_ALIGNMENT_FILL) {
TS->shaped_text_fit_to_width(rid, width, flags);
overrun_flags |= TextServer::OVERRUN_JUSTIFICATION_AWARE;
TS->shaped_text_overrun_trim_to_width(rid, width, overrun_flags);
} else {
TS->shaped_text_overrun_trim_to_width(rid, width, overrun_flags);
}
- } else if (align == HALIGN_FILL) {
+ } else if (alignment == HORIZONTAL_ALIGNMENT_FILL) {
TS->shaped_text_fit_to_width(rid, width, flags);
}
dirty = false;
@@ -209,13 +209,13 @@ bool TextLine::add_string(const String &p_text, const Ref &p_fonts, int p_
return res;
}
-bool TextLine::add_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) {
+bool TextLine::add_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) {
bool res = TS->shaped_text_add_object(rid, p_key, p_size, p_inline_align, p_length);
dirty = true;
return res;
}
-bool TextLine::resize_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) {
+bool TextLine::resize_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
const_cast(this)->_shape();
return TS->shaped_text_resize_object(rid, p_key, p_size, p_inline_align);
}
@@ -228,19 +228,19 @@ Rect2 TextLine::get_object_rect(Variant p_key) const {
return TS->shaped_text_get_object_rect(rid, p_key);
}
-void TextLine::set_align(HAlign p_align) {
- if (align != p_align) {
- if (align == HALIGN_FILL || p_align == HALIGN_FILL) {
- align = p_align;
+void TextLine::set_horizontal_alignment(HorizontalAlignment p_alignment) {
+ if (alignment != p_alignment) {
+ if (alignment == HORIZONTAL_ALIGNMENT_FILL || p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
+ alignment = p_alignment;
dirty = true;
} else {
- align = p_align;
+ alignment = p_alignment;
}
}
}
-HAlign TextLine::get_align() const {
- return align;
+HorizontalAlignment TextLine::get_horizontal_alignment() const {
+ return alignment;
}
void TextLine::tab_align(const Vector &p_tab_stops) {
@@ -272,7 +272,7 @@ TextLine::OverrunBehavior TextLine::get_text_overrun_behavior() const {
void TextLine::set_width(float p_width) {
width = p_width;
- if (align == HALIGN_FILL || overrun_behavior != OVERRUN_NO_TRIMMING) {
+ if (alignment == HORIZONTAL_ALIGNMENT_FILL || overrun_behavior != OVERRUN_NO_TRIMMING) {
dirty = true;
}
}
@@ -322,18 +322,18 @@ void TextLine::draw(RID p_canvas, const Vector2 &p_pos, const Color &p_color) co
float length = TS->shaped_text_get_width(rid);
if (width > 0) {
- switch (align) {
- case HALIGN_FILL:
- case HALIGN_LEFT:
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT:
break;
- case HALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += Math::floor((width - length) / 2.0);
} else {
ofs.y += Math::floor((width - length) / 2.0);
}
} break;
- case HALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += width - length;
} else {
@@ -361,18 +361,18 @@ void TextLine::draw_outline(RID p_canvas, const Vector2 &p_pos, int p_outline_si
float length = TS->shaped_text_get_width(rid);
if (width > 0) {
- switch (align) {
- case HALIGN_FILL:
- case HALIGN_LEFT:
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
+ case HORIZONTAL_ALIGNMENT_LEFT:
break;
- case HALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += Math::floor((width - length) / 2.0);
} else {
ofs.y += Math::floor((width - length) / 2.0);
}
} break;
- case HALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += width - length;
} else {
diff --git a/scene/resources/text_line.h b/scene/resources/text_line.h
index 43739f27ec3..bab17a3024b 100644
--- a/scene/resources/text_line.h
+++ b/scene/resources/text_line.h
@@ -57,7 +57,7 @@ private:
float width = -1.0;
uint16_t flags = TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA;
- HAlign align = HALIGN_LEFT;
+ HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT;
OverrunBehavior overrun_behavior = OVERRUN_TRIM_ELLIPSIS;
Vector tab_stops;
@@ -87,11 +87,11 @@ public:
bool get_preserve_control() const;
bool add_string(const String &p_text, const Ref &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "");
- bool add_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1);
- bool resize_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER);
+ bool add_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1);
+ bool resize_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER);
- void set_align(HAlign p_align);
- HAlign get_align() const;
+ void set_horizontal_alignment(HorizontalAlignment p_alignment);
+ HorizontalAlignment get_horizontal_alignment() const;
void tab_align(const Vector &p_tab_stops);
diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp
index 1b7fc642677..130b83ea998 100644
--- a/scene/resources/text_paragraph.cpp
+++ b/scene/resources/text_paragraph.cpp
@@ -64,13 +64,13 @@ void TextParagraph::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_dropcap"), &TextParagraph::clear_dropcap);
ClassDB::bind_method(D_METHOD("add_string", "text", "fonts", "size", "opentype_features", "language"), &TextParagraph::add_string, DEFVAL(Dictionary()), DEFVAL(""));
- ClassDB::bind_method(D_METHOD("add_object", "key", "size", "inline_align", "length"), &TextParagraph::add_object, DEFVAL(INLINE_ALIGN_CENTER), DEFVAL(1));
- ClassDB::bind_method(D_METHOD("resize_object", "key", "size", "inline_align"), &TextParagraph::resize_object, DEFVAL(INLINE_ALIGN_CENTER));
+ ClassDB::bind_method(D_METHOD("add_object", "key", "size", "inline_align", "length"), &TextParagraph::add_object, DEFVAL(INLINE_ALIGNMENT_CENTER), DEFVAL(1));
+ ClassDB::bind_method(D_METHOD("resize_object", "key", "size", "inline_align"), &TextParagraph::resize_object, DEFVAL(INLINE_ALIGNMENT_CENTER));
- ClassDB::bind_method(D_METHOD("set_align", "align"), &TextParagraph::set_align);
- ClassDB::bind_method(D_METHOD("get_align"), &TextParagraph::get_align);
+ ClassDB::bind_method(D_METHOD("set_alignment", "alignment"), &TextParagraph::set_alignment);
+ ClassDB::bind_method(D_METHOD("get_alignment"), &TextParagraph::get_alignment);
- ADD_PROPERTY(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_alignment", "get_alignment");
ClassDB::bind_method(D_METHOD("tab_align", "tab_stops"), &TextParagraph::tab_align);
@@ -223,7 +223,7 @@ void TextParagraph::_shape_lines() {
if (lines_hidden) {
overrun_flags |= TextServer::OVERRUN_ENFORCE_ELLIPSIS;
}
- if (align == HALIGN_FILL) {
+ if (alignment == HORIZONTAL_ALIGNMENT_FILL) {
for (int i = 0; i < lines_rid.size(); i++) {
if (i < visible_lines - 1 || lines_rid.size() == 1) {
TS->shaped_text_fit_to_width(lines_rid[i], width, flags);
@@ -239,7 +239,7 @@ void TextParagraph::_shape_lines() {
} else {
// Autowrap disabled.
for (int i = 0; i < lines_rid.size(); i++) {
- if (align == HALIGN_FILL) {
+ if (alignment == HORIZONTAL_ALIGNMENT_FILL) {
TS->shaped_text_fit_to_width(lines_rid[i], width, flags);
overrun_flags |= TextServer::OVERRUN_JUSTIFICATION_AWARE;
TS->shaped_text_overrun_trim_to_width(lines_rid[i], width, overrun_flags);
@@ -366,31 +366,31 @@ void TextParagraph::set_bidi_override(const Array &p_override) {
lines_dirty = true;
}
-bool TextParagraph::add_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) {
+bool TextParagraph::add_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) {
bool res = TS->shaped_text_add_object(rid, p_key, p_size, p_inline_align, p_length);
lines_dirty = true;
return res;
}
-bool TextParagraph::resize_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) {
+bool TextParagraph::resize_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
bool res = TS->shaped_text_resize_object(rid, p_key, p_size, p_inline_align);
lines_dirty = true;
return res;
}
-void TextParagraph::set_align(HAlign p_align) {
- if (align != p_align) {
- if (align == HALIGN_FILL || p_align == HALIGN_FILL) {
- align = p_align;
+void TextParagraph::set_alignment(HorizontalAlignment p_alignment) {
+ if (alignment != p_alignment) {
+ if (alignment == HORIZONTAL_ALIGNMENT_FILL || p_alignment == HORIZONTAL_ALIGNMENT_FILL) {
+ alignment = p_alignment;
lines_dirty = true;
} else {
- align = p_align;
+ alignment = p_alignment;
}
}
}
-HAlign TextParagraph::get_align() const {
- return align;
+HorizontalAlignment TextParagraph::get_alignment() const {
+ return alignment;
}
void TextParagraph::tab_align(const Vector &p_tab_stops) {
@@ -596,8 +596,8 @@ void TextParagraph::draw(RID p_canvas, const Vector2 &p_pos, const Color &p_colo
}
float line_width = TS->shaped_text_get_width(lines_rid[i]);
if (width > 0) {
- switch (align) {
- case HALIGN_FILL:
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
if (TS->shaped_text_get_direction(lines_rid[i]) == TextServer::DIRECTION_RTL) {
if (TS->shaped_text_get_orientation(lines_rid[i]) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += l_width - line_width;
@@ -606,16 +606,16 @@ void TextParagraph::draw(RID p_canvas, const Vector2 &p_pos, const Color &p_colo
}
}
break;
- case HALIGN_LEFT:
+ case HORIZONTAL_ALIGNMENT_LEFT:
break;
- case HALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (TS->shaped_text_get_orientation(lines_rid[i]) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += Math::floor((l_width - line_width) / 2.0);
} else {
ofs.y += Math::floor((l_width - line_width) / 2.0);
}
} break;
- case HALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (TS->shaped_text_get_orientation(lines_rid[i]) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += l_width - line_width;
} else {
@@ -688,8 +688,8 @@ void TextParagraph::draw_outline(RID p_canvas, const Vector2 &p_pos, int p_outli
}
float length = TS->shaped_text_get_width(lines_rid[i]);
if (width > 0) {
- switch (align) {
- case HALIGN_FILL:
+ switch (alignment) {
+ case HORIZONTAL_ALIGNMENT_FILL:
if (TS->shaped_text_get_direction(lines_rid[i]) == TextServer::DIRECTION_RTL) {
if (TS->shaped_text_get_orientation(lines_rid[i]) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += l_width - length;
@@ -698,16 +698,16 @@ void TextParagraph::draw_outline(RID p_canvas, const Vector2 &p_pos, int p_outli
}
}
break;
- case HALIGN_LEFT:
+ case HORIZONTAL_ALIGNMENT_LEFT:
break;
- case HALIGN_CENTER: {
+ case HORIZONTAL_ALIGNMENT_CENTER: {
if (TS->shaped_text_get_orientation(lines_rid[i]) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += Math::floor((l_width - length) / 2.0);
} else {
ofs.y += Math::floor((l_width - length) / 2.0);
}
} break;
- case HALIGN_RIGHT: {
+ case HORIZONTAL_ALIGNMENT_RIGHT: {
if (TS->shaped_text_get_orientation(lines_rid[i]) == TextServer::ORIENTATION_HORIZONTAL) {
ofs.x += l_width - length;
} else {
diff --git a/scene/resources/text_paragraph.h b/scene/resources/text_paragraph.h
index 4c4af43d141..1faa3f3a7bc 100644
--- a/scene/resources/text_paragraph.h
+++ b/scene/resources/text_paragraph.h
@@ -66,7 +66,7 @@ private:
uint16_t flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA;
OverrunBehavior overrun_behavior = OVERRUN_NO_TRIMMING;
- HAlign align = HALIGN_LEFT;
+ HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT;
Vector tab_stops;
@@ -103,11 +103,11 @@ public:
void clear_dropcap();
bool add_string(const String &p_text, const Ref &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "");
- bool add_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1);
- bool resize_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER);
+ bool add_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1);
+ bool resize_object(Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER);
- void set_align(HAlign p_align);
- HAlign get_align() const;
+ void set_alignment(HorizontalAlignment p_alignment);
+ HorizontalAlignment get_alignment() const;
void tab_align(const Vector &p_tab_stops);
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp
index d6d98b4f8f5..5f83fc42064 100644
--- a/servers/text/text_server_extension.cpp
+++ b/servers/text/text_server_extension.cpp
@@ -1003,7 +1003,7 @@ bool TextServerExtension::shaped_text_add_string(RID p_shaped, const String &p_t
return false;
}
-bool TextServerExtension::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) {
+bool TextServerExtension::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align, int p_length) {
bool ret;
if (GDVIRTUAL_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, ret)) {
return ret;
@@ -1011,7 +1011,7 @@ bool TextServerExtension::shaped_text_add_object(RID p_shaped, Variant p_key, co
return false;
}
-bool TextServerExtension::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) {
+bool TextServerExtension::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
bool ret;
if (GDVIRTUAL_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, ret)) {
return ret;
diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h
index a2dbd25e053..91d1a6b97ec 100644
--- a/servers/text/text_server_extension.h
+++ b/servers/text/text_server_extension.h
@@ -337,11 +337,11 @@ public:
GDVIRTUAL1RC(bool, _shaped_text_get_preserve_control, RID);
virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") override;
- virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) override;
- virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) override;
+ virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) override;
+ virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override;
GDVIRTUAL6R(bool, _shaped_text_add_string, RID, const String &, const Array &, int, const Dictionary &, const String &);
- GDVIRTUAL5R(bool, _shaped_text_add_object, RID, Variant, const Size2 &, InlineAlign, int);
- GDVIRTUAL4R(bool, _shaped_text_resize_object, RID, Variant, const Size2 &, InlineAlign);
+ GDVIRTUAL5R(bool, _shaped_text_add_object, RID, Variant, const Size2 &, InlineAlignment, int);
+ GDVIRTUAL4R(bool, _shaped_text_resize_object, RID, Variant, const Size2 &, InlineAlignment);
virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override;
virtual RID shaped_text_get_parent(RID p_shaped) const override;
diff --git a/servers/text_server.cpp b/servers/text_server.cpp
index 3b71dc1d92e..edc6e660422 100644
--- a/servers/text_server.cpp
+++ b/servers/text_server.cpp
@@ -360,8 +360,8 @@ void TextServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("shaped_text_get_preserve_control", "shaped"), &TextServer::shaped_text_get_preserve_control);
ClassDB::bind_method(D_METHOD("shaped_text_add_string", "shaped", "text", "fonts", "size", "opentype_features", "language"), &TextServer::shaped_text_add_string, DEFVAL(Dictionary()), DEFVAL(""));
- ClassDB::bind_method(D_METHOD("shaped_text_add_object", "shaped", "key", "size", "inline_align", "length"), &TextServer::shaped_text_add_object, DEFVAL(INLINE_ALIGN_CENTER), DEFVAL(1));
- ClassDB::bind_method(D_METHOD("shaped_text_resize_object", "shaped", "key", "size", "inline_align"), &TextServer::shaped_text_resize_object, DEFVAL(INLINE_ALIGN_CENTER));
+ ClassDB::bind_method(D_METHOD("shaped_text_add_object", "shaped", "key", "size", "inline_align", "length"), &TextServer::shaped_text_add_object, DEFVAL(INLINE_ALIGNMENT_CENTER), DEFVAL(1));
+ ClassDB::bind_method(D_METHOD("shaped_text_resize_object", "shaped", "key", "size", "inline_align"), &TextServer::shaped_text_resize_object, DEFVAL(INLINE_ALIGNMENT_CENTER));
ClassDB::bind_method(D_METHOD("shaped_text_substr", "shaped", "start", "length"), &TextServer::shaped_text_substr);
ClassDB::bind_method(D_METHOD("shaped_text_get_parent", "shaped"), &TextServer::shaped_text_get_parent);
diff --git a/servers/text_server.h b/servers/text_server.h
index 5c994feaaee..56b1919c519 100644
--- a/servers/text_server.h
+++ b/servers/text_server.h
@@ -170,7 +170,7 @@ protected:
struct EmbeddedObject {
int pos = 0;
- InlineAlign inline_align = INLINE_ALIGN_CENTER;
+ InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER;
Rect2 rect;
};
Map objects;
@@ -383,8 +383,8 @@ public:
virtual bool shaped_text_get_preserve_control(RID p_shaped) const = 0;
virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") = 0;
- virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) = 0;
- virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) = 0;
+ virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int p_length = 1) = 0;
+ virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) = 0;
virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const = 0; // Copy shaped substring (e.g. line break) without reshaping, but correctly reordered, preservers range.
virtual RID shaped_text_get_parent(RID p_shaped) const = 0;
diff --git a/tests/scene/test_gui.cpp b/tests/scene/test_gui.cpp
index 5bd9390cb71..086943838c0 100644
--- a/tests/scene/test_gui.cpp
+++ b/tests/scene/test_gui.cpp
@@ -69,7 +69,7 @@ public:
label->set_position(Point2(80, 90));
label->set_size(Point2(170, 80));
- label->set_align(Label::ALIGN_FILL);
+ label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_FILL);
label->set_text("There was once upon a time a beautiful unicorn that loved to play with little girls...");
frame->add_child(label);