29 #ifndef RICH_TEXT_LABEL_H 30 #define RICH_TEXT_LABEL_H 33 #include "scene/gui/scroll_bar.h" 73 static void _bind_methods();
85 int height_accum_cache;
89 Line() { from=NULL; char_count=0; }
103 void _clear_children() {
while (subitems.size()) { memdelete(subitems.
front()->get()); subitems.pop_front(); } }
105 Item() { parent=NULL; E=NULL; line=0;}
106 virtual ~Item() { _clear_children(); }
109 struct ItemFrame :
public Item{
114 int first_invalid_line;
115 ItemFrame *parent_frame;
117 ItemFrame() { type=ITEM_FRAME; parent_frame=NULL; cell=
false; parent_line=0; }
121 struct ItemText :
public Item {
124 ItemText() { type=ITEM_TEXT; }
127 struct ItemImage :
public Item {
130 ItemImage() { type=ITEM_IMAGE; }
133 struct ItemFont :
public Item {
136 ItemFont() { type=ITEM_FONT; }
139 struct ItemColor :
public Item {
142 ItemColor() { type=ITEM_COLOR; }
145 struct ItemUnderline :
public Item {
147 ItemUnderline() { type=ITEM_UNDERLINE; }
150 struct ItemMeta :
public Item {
153 ItemMeta() { type=ITEM_META; }
156 struct ItemAlign :
public Item {
159 ItemAlign() { type=ITEM_ALIGN; }
162 struct ItemIndent :
public Item {
165 ItemIndent() { type=ITEM_INDENT; }
168 struct ItemList :
public Item {
171 ItemList() { type=ITEM_LIST; }
174 struct ItemNewline :
public Item {
177 ItemNewline() { type=ITEM_NEWLINE; }
181 struct ItemTable :
public Item{
192 ItemTable() { type=ITEM_TABLE; }
197 ItemFrame *current_frame;
204 bool scroll_following;
207 bool updating_scroll;
216 void _invalidate_current_line(ItemFrame *p_frame);
217 void _validate_line_caches(ItemFrame *p_frame);
219 void _add_item(Item *p_item,
bool p_enter=
false,
bool p_ensure_newline=
false);
224 struct ProcessState {
253 int visible_characters;
256 void _process_line(ItemFrame *p_frame,
const Vector2& p_ofs,
int &y,
int p_width,
int p_line, ProcessMode p_mode,
const Ref<Font> &p_base_font,
const Color &p_base_color,
const Point2i& p_click_pos=
Point2i(),Item **r_click_item=NULL,
int *r_click_char=NULL,
bool *r_outside=NULL,
int p_char_count=0);
257 void _find_click(ItemFrame *p_frame,
const Point2i& p_click,Item **r_click_item=NULL,
int *r_click_char=NULL,
bool *r_outside=NULL);
261 int _find_margin(Item *p_item,
const Ref<Font>& p_base_font);
262 Align _find_align(Item *p_item);
263 Color _find_color(Item *p_item,
const Color& p_default_color);
264 bool _find_underline(Item *p_item);
265 bool _find_meta(Item *p_item,
Variant *r_meta);
267 void _update_scroll();
268 void _scroll_changed(
double);
271 Item *_get_next_item(Item* p_item,
bool p_free=
false);
276 void _update_all_lines();
279 void _notification(
int p_what);
283 void add_text(
const String& p_text);
287 void push_color(
const Color& p_color);
288 void push_underline();
289 void push_align(Align p_align);
290 void push_indent(
int p_level);
291 void push_list(ListType p_list);
292 void push_meta(
const Variant& p_data);
293 void push_table(
int p_columns);
294 void set_table_column_expand(
int p_column,
bool p_expand,
int p_ratio=1);
295 int get_current_table_column()
const;
301 void set_offset(
int p_pixel);
303 void set_meta_underline(
bool p_underline);
304 bool is_meta_underlined()
const;
306 void set_scroll_active(
bool p_active);
307 bool is_scroll_active()
const;
309 void set_scroll_follow(
bool p_follow);
310 bool is_scroll_following()
const;
312 void set_tab_size(
int p_spaces);
313 int get_tab_size()
const;
317 bool search(
const String& p_string,
bool p_from_selection=
false);
319 void scroll_to_line(
int p_line);
320 int get_line_count()
const;
322 VScrollBar *get_v_scroll() {
return vscroll; }
324 virtual CursorShape get_cursor_shape(
const Point2& p_pos)
const;
326 void set_selection_enabled(
bool p_enabled);
327 bool is_selection_enabled()
const;
328 void selection_copy();
331 Error parse_bbcode(
const String& p_bbcode);
332 Error append_bbcode(
const String& p_bbcode);
334 void set_use_bbcode(
bool p_enable);
335 bool is_using_bbcode()
const;
337 void set_bbcode(
const String& p_bbcode);
338 String get_bbcode()
const;
340 void set_visible_characters(
int p_visible);
341 int get_visible_characters()
const;
342 int get_total_character_count()
const;
348 VARIANT_ENUM_CAST( RichTextLabel::Align );
349 VARIANT_ENUM_CAST( RichTextLabel::ListType );
350 VARIANT_ENUM_CAST( RichTextLabel::ItemType );
352 #endif // RICH_TEXT_LABEL_H
Definition: math_2d.h:369
_FORCE_INLINE_ const Element * front() const
Definition: list.h:189
Definition: rich_text_label.h:35
Definition: rich_text_label.h:183