2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2019-04-01 10:33:56 +00:00
<class name= "RichTextLabel" inherits= "Control" category= "Core" version= "3.2" >
2017-09-12 20:42:36 +00:00
<brief_description >
Label that displays rich text.
</brief_description>
<description >
2017-11-13 03:05:28 +00:00
Rich text can contain custom text, fonts, images and some basic formatting. The label manages these as an internal tag stack. It also adapts itself to given width/heights.
2019-06-21 23:04:47 +00:00
[b]Note:[/b] Assignments to [member bbcode_text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member bbcode_text] will erase previous edits made from other manual sources such as [method append_bbcode] and the [code]push_*[/code] / [method pop] methods.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
2018-11-05 07:46:27 +00:00
<link > https://docs.godotengine.org/en/latest/tutorials/gui/bbcode_in_richtextlabel.html</link>
2017-09-12 20:42:36 +00:00
</tutorials>
<methods >
<method name= "add_image" >
<return type= "void" >
</return>
<argument index= "0" name= "image" type= "Texture" >
</argument>
<description >
2017-11-13 03:05:28 +00:00
Adds an image's opening and closing tags to the tag stack.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "add_text" >
<return type= "void" >
</return>
<argument index= "0" name= "text" type= "String" >
</argument>
<description >
2019-06-21 23:04:47 +00:00
Adds raw non-BBCode-parsed text to the tag stack.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "append_bbcode" >
<return type= "int" enum= "Error" >
</return>
<argument index= "0" name= "bbcode" type= "String" >
</argument>
<description >
2019-06-27 10:34:26 +00:00
Parses [code]bbcode[/code] and adds tags to the tag stack as needed. Returns the result of the parsing, [constant OK] if successful.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "clear" >
<return type= "void" >
</return>
<description >
2017-11-13 03:05:28 +00:00
Clears the tag stack and sets [member bbcode_text] to an empty string.
2017-09-12 20:42:36 +00:00
</description>
</method>
2018-05-12 07:38:00 +00:00
<method name= "get_content_height" >
<return type= "int" >
</return>
<description >
Returns the height of the content.
</description>
</method>
2017-09-23 08:59:35 +00:00
<method name= "get_line_count" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2017-11-13 03:05:28 +00:00
Returns the total number of newlines in the tag stack's text tags. Considers wrapped text as one line.
2017-09-23 08:59:35 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_total_character_count" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2019-06-21 23:04:47 +00:00
Returns the total number of characters from text tags. Does not include BBCodes.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_v_scroll" >
<return type= "VScrollBar" >
</return>
<description >
2017-11-13 03:05:28 +00:00
Returns the vertical scrollbar.
2017-09-12 20:42:36 +00:00
</description>
</method>
2017-09-23 08:59:35 +00:00
<method name= "get_visible_line_count" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2017-10-25 18:15:39 +00:00
Returns the number of visible lines.
2017-09-23 08:59:35 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "newline" >
<return type= "void" >
</return>
<description >
2017-11-13 03:05:28 +00:00
Adds a newline tag to the tag stack.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "parse_bbcode" >
<return type= "int" enum= "Error" >
</return>
<argument index= "0" name= "bbcode" type= "String" >
</argument>
<description >
2019-06-27 10:34:26 +00:00
The assignment version of [method append_bbcode]. Clears the tag stack and inserts the new content. Returns [constant OK] if parses [code]bbcode[/code] successfully.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "pop" >
<return type= "void" >
</return>
<description >
2019-06-21 23:04:47 +00:00
Terminates the current tag. Use after [code]push_*[/code] methods to close BBCodes manually. Does not need to follow [code]add_*[/code] methods.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_align" >
<return type= "void" >
</return>
<argument index= "0" name= "align" type= "int" enum= "RichTextLabel.Align" >
</argument>
<description >
2019-06-21 23:04:47 +00:00
Adds an [code][align][/code] tag based on the given [code]align[/code] value. See [enum Align] for possible values.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_cell" >
<return type= "void" >
</return>
<description >
2019-01-07 09:02:04 +00:00
Adds a [code][cell][/code] tag to the tag stack. Must be inside a [code][table][/code] tag. See [method push_table] for details.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_color" >
<return type= "void" >
</return>
<argument index= "0" name= "color" type= "Color" >
</argument>
<description >
2017-11-13 03:05:28 +00:00
Adds a [code][color][/code] tag to the tag stack.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_font" >
<return type= "void" >
</return>
<argument index= "0" name= "font" type= "Font" >
</argument>
<description >
2017-11-13 03:05:28 +00:00
Adds a [code][font][/code] tag to the tag stack. Overrides default fonts for its duration.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_indent" >
<return type= "void" >
</return>
<argument index= "0" name= "level" type= "int" >
</argument>
<description >
2017-11-13 03:05:28 +00:00
Adds an [code][indent][/code] tag to the tag stack. Multiplies "level" by current tab_size to determine new margin length.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_list" >
<return type= "void" >
</return>
<argument index= "0" name= "type" type= "int" enum= "RichTextLabel.ListType" >
</argument>
<description >
2019-06-21 23:04:47 +00:00
Adds a [code][list][/code] tag to the tag stack. Similar to the BBCodes [code][ol][/code] or [code][ul][/code], but supports more list types. Not fully implemented!
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_meta" >
<return type= "void" >
</return>
<argument index= "0" name= "data" type= "Variant" >
</argument>
<description >
2019-06-21 23:04:47 +00:00
Adds a [code][meta][/code] tag to the tag stack. Similar to the BBCode [code][url=something]{text}[/url][/code], but supports non-[String] metadata types.
2017-09-12 20:42:36 +00:00
</description>
</method>
2018-10-07 13:52:07 +00:00
<method name= "push_strikethrough" >
<return type= "void" >
</return>
<description >
2018-10-12 14:43:03 +00:00
Adds a [code][s][/code] tag to the tag stack.
2018-10-07 13:52:07 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "push_table" >
<return type= "void" >
</return>
<argument index= "0" name= "columns" type= "int" >
</argument>
<description >
2017-11-13 03:05:28 +00:00
Adds a [code][table=columns][/code] tag to the tag stack.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "push_underline" >
<return type= "void" >
</return>
<description >
2017-11-13 03:05:28 +00:00
Adds a [code][u][/code] tag to the tag stack.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "remove_line" >
<return type= "bool" >
</return>
<argument index= "0" name= "line" type= "int" >
</argument>
<description >
2017-11-13 03:05:28 +00:00
Removes a line of content from the label. Returns [code]true[/code] if the line exists.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "scroll_to_line" >
<return type= "void" >
</return>
<argument index= "0" name= "line" type= "int" >
</argument>
<description >
2017-11-13 03:05:28 +00:00
Scrolls the window's top line to match [code]line[/code].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_table_column_expand" >
<return type= "void" >
</return>
<argument index= "0" name= "column" type= "int" >
</argument>
<argument index= "1" name= "expand" type= "bool" >
</argument>
<argument index= "2" name= "ratio" type= "int" >
</argument>
<description >
2019-06-21 23:04:47 +00:00
Edits the selected column's expansion options. If [code]expand[/code] is [code]true[/code], the column expands in proportion to its expansion ratio versus the other columns' ratios.
2017-11-13 03:05:28 +00:00
For example, 2 columns with ratios 3 and 4 plus 70 pixels in available width would expand 30 and 40 pixels, respectively.
2019-06-21 23:04:47 +00:00
If [code]expand[/code] is [code]false[/code], the column will not contribute to the total ratio.
2017-09-12 20:42:36 +00:00
</description>
</method>
</methods>
<members >
2019-06-29 10:38:01 +00:00
<member name= "bbcode_enabled" type= "bool" setter= "set_use_bbcode" getter= "is_using_bbcode" default= "false" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], the label uses BBCode formatting.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "bbcode_text" type= "String" setter= "set_bbcode" getter= "get_bbcode" default= """" >
2017-11-13 03:05:28 +00:00
The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "meta_underlined" type= "bool" setter= "set_meta_underline" getter= "is_meta_underlined" default= "true" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], the label underlines meta tags such as [code][url]{text}[/url][/code].
2018-01-11 22:38:35 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "override_selected_font_color" type= "bool" setter= "set_override_selected_font_color" getter= "is_overriding_selected_font_color" default= "false" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], the label uses the custom font color.
2017-10-21 10:02:08 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "percent_visible" type= "float" setter= "set_percent_visible" getter= "get_percent_visible" default= "1.0" >
2017-10-25 18:15:39 +00:00
The text's visibility, as a [float] between 0.0 and 1.0.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "scroll_active" type= "bool" setter= "set_scroll_active" getter= "is_scroll_active" default= "true" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], the scrollbar is visible. Does not block scrolling completely. See [method scroll_to_line].
2018-01-11 22:38:35 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "scroll_following" type= "bool" setter= "set_scroll_follow" getter= "is_scroll_following" default= "false" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], the window scrolls down to display new content automatically.
2018-01-11 22:38:35 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "selection_enabled" type= "bool" setter= "set_selection_enabled" getter= "is_selection_enabled" default= "false" >
2018-01-11 22:38:35 +00:00
If [code]true[/code], the label allows text selection.
</member>
2019-06-29 10:38:01 +00:00
<member name= "tab_size" type= "int" setter= "set_tab_size" getter= "get_tab_size" default= "4" >
2019-06-21 23:04:47 +00:00
The number of spaces associated with a single tab length. Does not affect [code]\t[/code] in text tags, only indent tags.
2018-01-11 22:38:35 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "text" type= "String" setter= "set_text" getter= "get_text" default= """" >
2018-01-11 22:38:35 +00:00
The raw text of the label.
2019-06-21 23:04:47 +00:00
When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse BBCodes. Does not modify [member bbcode_text].
2018-01-11 22:38:35 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "visible_characters" type= "int" setter= "set_visible_characters" getter= "get_visible_characters" default= "-1" >
2019-06-21 23:04:47 +00:00
The restricted number of characters to display in the label. If [code]-1[/code], all characters will be displayed.
2017-09-12 20:42:36 +00:00
</member>
</members>
<signals >
<signal name= "meta_clicked" >
<argument index= "0" name= "meta" type= "Nil" >
</argument>
<description >
2019-01-07 09:02:04 +00:00
Triggered when the user clicks on content between [code][url][/code] tags. If the meta is defined in text, e.g. [code][url={"data"="hi"}]hi[/url][/code], then the parameter for this signal will be a [String] type. If a particular type or an object is desired, the [method push_meta] method must be used to manually insert the data into the tag stack.
2017-09-12 20:42:36 +00:00
</description>
</signal>
2017-11-24 08:16:27 +00:00
<signal name= "meta_hover_ended" >
2017-11-17 05:49:39 +00:00
<argument index= "0" name= "meta" type= "Nil" >
</argument>
<description >
2017-11-24 08:16:27 +00:00
Triggers when the mouse exits a meta tag.
2017-11-17 05:49:39 +00:00
</description>
</signal>
2017-11-24 08:16:27 +00:00
<signal name= "meta_hover_started" >
2017-11-17 05:49:39 +00:00
<argument index= "0" name= "meta" type= "Nil" >
</argument>
<description >
2017-11-24 08:16:27 +00:00
Triggers when the mouse enters a meta tag.
2017-11-17 05:49:39 +00:00
</description>
</signal>
2017-09-12 20:42:36 +00:00
</signals>
<constants >
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_LEFT" value= "0" enum= "Align" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_CENTER" value= "1" enum= "Align" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_RIGHT" value= "2" enum= "Align" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_FILL" value= "3" enum= "Align" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "LIST_NUMBERS" value= "0" enum= "ListType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "LIST_LETTERS" value= "1" enum= "ListType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "LIST_DOTS" value= "2" enum= "ListType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ITEM_FRAME" value= "0" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ITEM_TEXT" value= "1" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ITEM_IMAGE" value= "2" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ITEM_NEWLINE" value= "3" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ITEM_FONT" value= "4" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ITEM_COLOR" value= "5" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ITEM_UNDERLINE" value= "6" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2018-10-07 13:52:07 +00:00
<constant name= "ITEM_STRIKETHROUGH" value= "7" enum= "ItemType" >
</constant>
<constant name= "ITEM_ALIGN" value= "8" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2018-10-07 13:52:07 +00:00
<constant name= "ITEM_INDENT" value= "9" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2018-10-07 13:52:07 +00:00
<constant name= "ITEM_LIST" value= "10" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
2018-10-07 13:52:07 +00:00
<constant name= "ITEM_TABLE" value= "11" enum= "ItemType" >
2017-10-22 10:56:11 +00:00
</constant>
2018-10-07 13:52:07 +00:00
<constant name= "ITEM_META" value= "12" enum= "ItemType" >
2017-09-12 20:42:36 +00:00
</constant>
</constants>
<theme_items >
<theme_item name= "bold_font" type= "Font" >
</theme_item>
<theme_item name= "bold_italics_font" type= "Font" >
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "default_color" type= "Color" default= "Color( 1, 1, 1, 1 )" >
2017-09-12 20:42:36 +00:00
</theme_item>
<theme_item name= "focus" type= "StyleBox" >
</theme_item>
2019-07-09 07:13:00 +00:00
<theme_item name= "font_color_selected" type= "Color" default= "Color( 0.49, 0.49, 0.49, 1 )" >
2017-09-12 20:42:36 +00:00
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "font_color_shadow" type= "Color" default= "Color( 0, 0, 0, 0 )" >
2018-04-11 13:08:56 +00:00
</theme_item>
2017-09-12 20:42:36 +00:00
<theme_item name= "italics_font" type= "Font" >
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "line_separation" type= "int" default= "1" >
2017-09-12 20:42:36 +00:00
</theme_item>
<theme_item name= "mono_font" type= "Font" >
</theme_item>
<theme_item name= "normal" type= "StyleBox" >
</theme_item>
<theme_item name= "normal_font" type= "Font" >
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "selection_color" type= "Color" default= "Color( 0.1, 0.1, 1, 0.8 )" >
2017-09-12 20:42:36 +00:00
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "shadow_as_outline" type= "int" default= "0" >
2018-05-12 07:38:00 +00:00
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "shadow_offset_x" type= "int" default= "1" >
2018-05-12 07:38:00 +00:00
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "shadow_offset_y" type= "int" default= "1" >
2018-05-12 07:38:00 +00:00
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "table_hseparation" type= "int" default= "3" >
2017-09-12 20:42:36 +00:00
</theme_item>
2019-06-29 10:38:01 +00:00
<theme_item name= "table_vseparation" type= "int" default= "3" >
2017-09-12 20:42:36 +00:00
</theme_item>
</theme_items>
</class>