summaryrefslogtreecommitdiff
path: root/doc/classes/RichTextLabel.xml
blob: 1eaa9dbc8c25822304a3ea54ba27acb0002dcbae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RichTextLabel" inherits="Control" category="Core" version="3.0-rc1">
	<brief_description>
		Label that displays rich text.
	</brief_description>
	<description>
		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.
		Note that 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.
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="add_image">
			<return type="void">
			</return>
			<argument index="0" name="image" type="Texture">
			</argument>
			<description>
				Adds an image's opening and closing tags to the tag stack.
			</description>
		</method>
		<method name="add_text">
			<return type="void">
			</return>
			<argument index="0" name="text" type="String">
			</argument>
			<description>
				Adds raw non-bbcode-parsed text to the tag stack.
			</description>
		</method>
		<method name="append_bbcode">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="bbcode" type="String">
			</argument>
			<description>
				Parses [code]bbcode[/code] and adds tags to the tag stack as needed. Returns the result of the parsing, [code]OK[/code] if successful.
			</description>
		</method>
		<method name="clear">
			<return type="void">
			</return>
			<description>
				Clears the tag stack and sets [member bbcode_text] to an empty string.
			</description>
		</method>
		<method name="get_line_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the total number of newlines in the tag stack's text tags. Considers wrapped text as one line.
			</description>
		</method>
		<method name="get_total_character_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the total number of characters from text tags. Does not include bbcodes.
			</description>
		</method>
		<method name="get_v_scroll">
			<return type="VScrollBar">
			</return>
			<description>
				Returns the vertical scrollbar.
			</description>
		</method>
		<method name="get_visible_line_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the number of visible lines.
			</description>
		</method>
		<method name="newline">
			<return type="void">
			</return>
			<description>
				Adds a newline tag to the tag stack.
			</description>
		</method>
		<method name="parse_bbcode">
			<return type="int" enum="Error">
			</return>
			<argument index="0" name="bbcode" type="String">
			</argument>
			<description>
				The assignment version of [method append_bbcode]. Clears the tag stack and inserts the new content. Returns [code]OK[/code] if parses [code]bbcode[/code] successfully.
			</description>
		</method>
		<method name="pop">
			<return type="void">
			</return>
			<description>
				Terminates the current tag. Use after [code]push_*[/code] methods to close bbcodes manually. Does not need to follow [code]add_*[/code] methods.
			</description>
		</method>
		<method name="push_align">
			<return type="void">
			</return>
			<argument index="0" name="align" type="int" enum="RichTextLabel.Align">
			</argument>
			<description>
				Adds a [code][right][/code] tag to the tag stack.
			</description>
		</method>
		<method name="push_cell">
			<return type="void">
			</return>
			<description>
				Adds a [code][cell][/code] tag to the tag stack. Must be inside a [table] tag. See [method push_table] for details.
			</description>
		</method>
		<method name="push_color">
			<return type="void">
			</return>
			<argument index="0" name="color" type="Color">
			</argument>
			<description>
				Adds a [code][color][/code] tag to the tag stack.
			</description>
		</method>
		<method name="push_font">
			<return type="void">
			</return>
			<argument index="0" name="font" type="Font">
			</argument>
			<description>
				Adds a [code][font][/code] tag to the tag stack. Overrides default fonts for its duration.
			</description>
		</method>
		<method name="push_indent">
			<return type="void">
			</return>
			<argument index="0" name="level" type="int">
			</argument>
			<description>
				Adds an [code][indent][/code] tag to the tag stack. Multiplies "level" by current tab_size to determine new margin length.
			</description>
		</method>
		<method name="push_list">
			<return type="void">
			</return>
			<argument index="0" name="type" type="int" enum="RichTextLabel.ListType">
			</argument>
			<description>
				Adds a list tag to the tag stack. Similar to the bbcodes [code][ol][/code] or [code][ul][/code], but supports more list types. Not fully implemented!
			</description>
		</method>
		<method name="push_meta">
			<return type="void">
			</return>
			<argument index="0" name="data" type="Variant">
			</argument>
			<description>
				Adds a meta tag to the tag stack. Similar to the bbcode [code][url=something]{text}[/url][/code], but supports non-[String] metadata types.
			</description>
		</method>
		<method name="push_table">
			<return type="void">
			</return>
			<argument index="0" name="columns" type="int">
			</argument>
			<description>
				Adds a [code][table=columns][/code] tag to the tag stack.
			</description>
		</method>
		<method name="push_underline">
			<return type="void">
			</return>
			<description>
				Adds a [code][u][/code] tag to the tag stack.
			</description>
		</method>
		<method name="remove_line">
			<return type="bool">
			</return>
			<argument index="0" name="line" type="int">
			</argument>
			<description>
				Removes a line of content from the label. Returns [code]true[/code] if the line exists.
			</description>
		</method>
		<method name="scroll_to_line">
			<return type="void">
			</return>
			<argument index="0" name="line" type="int">
			</argument>
			<description>
				Scrolls the window's top line to match [code]line[/code].
			</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>
				Edits the selected columns expansion options. If [code]expand[/code] is [code]true[/code], the column expands in proportion to its expansion ratio versus the other columns' ratios.
				For example, 2 columns with ratios 3 and 4 plus 70 pixels in available width would expand 30 and 40 pixels, respectively.
				Columns with a [code]false[/code] expand will not contribute to the total ratio.
			</description>
		</method>
	</methods>
	<members>
		<member name="bbcode_enabled" type="bool" setter="set_use_bbcode" getter="is_using_bbcode">
			If [code]true[/code] the label uses BBCode formatting. Default value: [code]false[/code].
		</member>
		<member name="bbcode_text" type="String" setter="set_bbcode" getter="get_bbcode">
			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.
		</member>
		<member name="meta_underlined" type="bool" setter="set_meta_underline" getter="is_meta_underlined">
			If [code]true[/code], the label underlines meta tags such as [url]{text}[/url]. Default value: [code]true[/code].
		</member>
		<member name="override_selected_font_color" type="bool" setter="set_override_selected_font_color" getter="is_overriding_selected_font_color">
			If [code]true[/code] the label uses the custom font color. Default value: [code]false[/code].
		</member>
		<member name="percent_visible" type="float" setter="set_percent_visible" getter="get_percent_visible">
			The text's visibility, as a [float] between 0.0 and 1.0.
		</member>
		<member name="scroll_active" type="bool" setter="set_scroll_active" getter="is_scroll_active">
			If [code]true[/code], the scrollbar is visible. Does not block scrolling completely. See [method scroll_to_line]. Default value: [code]true[/code].
		</member>
		<member name="scroll_following" type="bool" setter="set_scroll_follow" getter="is_scroll_following">
			If [code]true[/code], the window scrolls down to display new content automatically. Default value: [code]false[/code].
		</member>
		<member name="selection_enabled" type="bool" setter="set_selection_enabled" getter="is_selection_enabled">
			If [code]true[/code], the label allows text selection.
		</member>
		<member name="tab_size" type="int" setter="set_tab_size" getter="get_tab_size">
			The number of spaces associated with a single tab length. Does not affect "\t" in text tags, only indent tags.
		</member>
		<member name="text" type="String" setter="set_text" getter="get_text">
			The raw text of the label.
			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].
		</member>
		<member name="visible_characters" type="int" setter="set_visible_characters" getter="get_visible_characters">
			The restricted number of characters to display in the label.
		</member>
	</members>
	<signals>
		<signal name="meta_clicked">
			<argument index="0" name="meta" type="Nil">
			</argument>
			<description>
				Triggered when the user clicks on content between [url] 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.
			</description>
		</signal>
		<signal name="meta_hover_ended">
			<argument index="0" name="meta" type="Nil">
			</argument>
			<description>
				Triggers when the mouse exits a meta tag.
			</description>
		</signal>
		<signal name="meta_hover_started">
			<argument index="0" name="meta" type="Nil">
			</argument>
			<description>
				Triggers when the mouse enters a meta tag.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="ALIGN_LEFT" value="0" enum="Align">
		</constant>
		<constant name="ALIGN_CENTER" value="1" enum="Align">
		</constant>
		<constant name="ALIGN_RIGHT" value="2" enum="Align">
		</constant>
		<constant name="ALIGN_FILL" value="3" enum="Align">
		</constant>
		<constant name="LIST_NUMBERS" value="0" enum="ListType">
		</constant>
		<constant name="LIST_LETTERS" value="1" enum="ListType">
		</constant>
		<constant name="LIST_DOTS" value="2" enum="ListType">
		</constant>
		<constant name="ITEM_FRAME" value="0" enum="ItemType">
		</constant>
		<constant name="ITEM_TEXT" value="1" enum="ItemType">
		</constant>
		<constant name="ITEM_IMAGE" value="2" enum="ItemType">
		</constant>
		<constant name="ITEM_NEWLINE" value="3" enum="ItemType">
		</constant>
		<constant name="ITEM_FONT" value="4" enum="ItemType">
		</constant>
		<constant name="ITEM_COLOR" value="5" enum="ItemType">
		</constant>
		<constant name="ITEM_UNDERLINE" value="6" enum="ItemType">
		</constant>
		<constant name="ITEM_ALIGN" value="7" enum="ItemType">
		</constant>
		<constant name="ITEM_INDENT" value="8" enum="ItemType">
		</constant>
		<constant name="ITEM_LIST" value="9" enum="ItemType">
		</constant>
		<constant name="ITEM_TABLE" value="10" enum="ItemType">
		</constant>
		<constant name="ITEM_META" value="11" enum="ItemType">
		</constant>
	</constants>
	<theme_items>
		<theme_item name="bold_font" type="Font">
		</theme_item>
		<theme_item name="bold_italics_font" type="Font">
		</theme_item>
		<theme_item name="default_color" type="Color">
		</theme_item>
		<theme_item name="focus" type="StyleBox">
		</theme_item>
		<theme_item name="font_color_selected" type="Color">
		</theme_item>
		<theme_item name="italics_font" type="Font">
		</theme_item>
		<theme_item name="line_separation" type="int">
		</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>
		<theme_item name="selection_color" type="Color">
		</theme_item>
		<theme_item name="table_hseparation" type="int">
		</theme_item>
		<theme_item name="table_vseparation" type="int">
		</theme_item>
	</theme_items>
</class>