diff options
Diffstat (limited to 'scene/gui/rich_text_label.h')
-rw-r--r-- | scene/gui/rich_text_label.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 7f2b5facb9..67a3f466a6 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -35,12 +35,10 @@ #include "scene/gui/scroll_bar.h" class RichTextLabel : public Control { - GDCLASS(RichTextLabel, Control); public: enum Align { - ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, @@ -48,14 +46,12 @@ public: }; enum ListType { - LIST_NUMBERS, LIST_LETTERS, LIST_DOTS }; enum ItemType { - ITEM_FRAME, ITEM_TEXT, ITEM_IMAGE, @@ -84,7 +80,6 @@ private: struct Item; struct Line { - Item *from; Vector<int> offset_caches; Vector<int> height_caches; @@ -151,6 +146,7 @@ private: struct ItemImage : public Item { Ref<Texture2D> image; Size2 size; + Color color; ItemImage() { type = ITEM_IMAGE; } }; @@ -345,14 +341,12 @@ private: }; enum ProcessMode { - PROCESS_CACHE, PROCESS_DRAW, PROCESS_POINTER }; struct Selection { - Item *click; int click_char; @@ -384,6 +378,8 @@ private: bool _find_by_type(Item *p_item, ItemType p_type); void _fetch_item_fx_stack(Item *p_item, Vector<ItemFX *> &r_stack); + static Color _get_color_from_string(const String &p_color_str, const Color &p_default_color); + void _update_scroll(); void _update_fx(ItemFrame *p_frame, float p_delta_time); void _scroll_changed(double); @@ -403,13 +399,15 @@ private: int fixed_width; + bool fit_content_height; + protected: void _notification(int p_what); public: String get_text(); void add_text(const String &p_text); - void add_image(const Ref<Texture2D> &p_image, const int p_width = 0, const int p_height = 0); + void add_image(const Ref<Texture2D> &p_image, const int p_width = 0, const int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0)); void add_newline(); bool remove_line(const int p_line); void push_font(const Ref<Font> &p_font); @@ -456,20 +454,24 @@ public: void set_tab_size(int p_spaces); int get_tab_size() const; + void set_fit_content_height(bool p_enabled); + bool is_fit_content_height_enabled() const; + bool search(const String &p_string, bool p_from_selection = false, bool p_search_previous = false); void scroll_to_line(int p_line); int get_line_count() const; int get_visible_line_count() const; - int get_content_height(); + int get_content_height() const; VScrollBar *get_v_scroll() { return vscroll; } - virtual CursorShape get_cursor_shape(const Point2 &p_pos) const; + virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override; void set_selection_enabled(bool p_enabled); bool is_selection_enabled() const; + String get_selected_text(); void selection_copy(); Error parse_bbcode(const String &p_bbcode); @@ -496,7 +498,7 @@ public: void install_effect(const Variant effect); void set_fixed_size_to_width(int p_width); - virtual Size2 get_minimum_size() const; + virtual Size2 get_minimum_size() const override; RichTextLabel(); ~RichTextLabel(); |