diff options
Diffstat (limited to 'scene/resources/text_line.h')
-rw-r--r-- | scene/resources/text_line.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/scene/resources/text_line.h b/scene/resources/text_line.h index 74d4f2c32c..9ed9c2f177 100644 --- a/scene/resources/text_line.h +++ b/scene/resources/text_line.h @@ -36,9 +36,19 @@ /*************************************************************************/ -class TextLine : public Reference { - GDCLASS(TextLine, Reference); +class TextLine : public RefCounted { + GDCLASS(TextLine, RefCounted); +public: + enum OverrunBehavior { + OVERRUN_NO_TRIMMING, + OVERRUN_TRIM_CHAR, + OVERRUN_TRIM_WORD, + OVERRUN_TRIM_ELLIPSIS, + OVERRUN_TRIM_WORD_ELLIPSIS, + }; + +private: RID rid; int spacing_top = 0; int spacing_bottom = 0; @@ -48,6 +58,7 @@ class TextLine : public Reference { float width = -1.0; uint8_t flags = TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA; HAlign align = HALIGN_LEFT; + OverrunBehavior overrun_behavior = OVERRUN_TRIM_ELLIPSIS; Vector<float> tab_stops; @@ -76,8 +87,8 @@ public: bool get_preserve_control() const; bool add_string(const String &p_text, const Ref<Font> &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, VAlign p_inline_align = VALIGN_CENTER, int p_length = 1); - bool resize_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align = VALIGN_CENTER); + 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); void set_align(HAlign p_align); HAlign get_align() const; @@ -87,6 +98,9 @@ public: void set_flags(uint8_t p_flags); uint8_t get_flags() const; + void set_text_overrun_behavior(OverrunBehavior p_behavior); + OverrunBehavior get_text_overrun_behavior() const; + void set_width(float p_width); float get_width() const; @@ -113,4 +127,6 @@ public: ~TextLine(); }; +VARIANT_ENUM_CAST(TextLine::OverrunBehavior); + #endif // TEXT_LINE_H |