Add auto-wrap mode property to the RichTextLabel, set default auto-wrap mode to AUTOWRAP_WORD_SMART to match 3.x behavior.

This commit is contained in:
bruvzg 2022-02-03 15:56:44 +02:00
parent 7f93eb34cf
commit ead6f67670
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
3 changed files with 67 additions and 1 deletions

View file

@ -39,6 +39,13 @@ class RichTextLabel : public Control {
GDCLASS(RichTextLabel, Control);
public:
enum AutowrapMode {
AUTOWRAP_OFF,
AUTOWRAP_ARBITRARY,
AUTOWRAP_WORD,
AUTOWRAP_WORD_SMART
};
enum ListType {
LIST_NUMBERS,
LIST_LETTERS,
@ -346,6 +353,8 @@ private:
VScrollBar *vscroll = nullptr;
AutowrapMode autowrap_mode = AUTOWRAP_WORD_SMART;
bool scroll_visible = false;
bool scroll_follow = false;
bool scroll_following = false;
@ -574,6 +583,9 @@ public:
void set_language(const String &p_language);
String get_language() const;
void set_autowrap_mode(AutowrapMode p_mode);
AutowrapMode get_autowrap_mode() const;
void set_structured_text_bidi_override(Control::StructuredTextParser p_parser);
Control::StructuredTextParser get_structured_text_bidi_override() const;
@ -603,6 +615,7 @@ public:
~RichTextLabel();
};
VARIANT_ENUM_CAST(RichTextLabel::AutowrapMode);
VARIANT_ENUM_CAST(RichTextLabel::ListType);
VARIANT_ENUM_CAST(RichTextLabel::ItemType);
VARIANT_ENUM_CAST(RichTextLabel::VisibleCharactersBehavior);