Debian Codegraph @

doc/classes/TabContainer.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="TabContainer" inherits="Container" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A container that creates a tab for each child control, displaying only the active tab's control.
5 </brief_description>
6 <description>
7 Arranges child controls into a tabbed view, creating a tab for each one. The active tab's corresponding control is made visible, while all other child controls are hidden. Ignores non-control children.
8 [b]Note:[/b] The drawing of the clickable tabs is handled by this node; [TabBar] is not needed.
9 </description>
10 <tutorials>
11 <link title="Using Containers">$DOCS_URL/tutorials/ui/gui_containers.html</link>
12 </tutorials>
13 <methods>
14 <method name="get_current_tab_control" qualifiers="const">
15 <return type="Control" />
16 <description>
17 Returns the child [Control] node located at the active tab index.
18 </description>
19 </method>
20 <method name="get_popup" qualifiers="const">
21 <return type="Popup" />
22 <description>
23 Returns the [Popup] node instance if one has been set already with [method set_popup].
24 [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property.
25 </description>
26 </method>
27 <method name="get_previous_tab" qualifiers="const">
28 <return type="int" />
29 <description>
30 Returns the previously active tab index.
31 </description>
32 </method>
33 <method name="get_tab_bar" qualifiers="const">
34 <return type="TabBar" />
35 <description>
36 Returns the [TabBar] contained in this container.
37 [b]Warning:[/b] This is a required internal node, removing and freeing it or editing its tabs may cause a crash. If you wish to edit the tabs, use the methods provided in [TabContainer].
38 </description>
39 </method>
40 <method name="get_tab_button_icon" qualifiers="const">
41 <return type="Texture2D" />
42 <param index="0" name="tab_idx" type="int" />
43 <description>
44 Returns the button icon from the tab at index [param tab_idx].
45 </description>
46 </method>
47 <method name="get_tab_control" qualifiers="const">
48 <return type="Control" />
49 <param index="0" name="tab_idx" type="int" />
50 <description>
51 Returns the [Control] node from the tab at index [param tab_idx].
52 </description>
53 </method>
54 <method name="get_tab_count" qualifiers="const">
55 <return type="int" />
56 <description>
57 Returns the number of tabs.
58 </description>
59 </method>
60 <method name="get_tab_icon" qualifiers="const">
61 <return type="Texture2D" />
62 <param index="0" name="tab_idx" type="int" />
63 <description>
64 Returns the [Texture2D] for the tab at index [param tab_idx] or [code]null[/code] if the tab has no [Texture2D].
65 </description>
66 </method>
67 <method name="get_tab_icon_max_width" qualifiers="const">
68 <return type="int" />
69 <param index="0" name="tab_idx" type="int" />
70 <description>
71 Returns the maximum allowed width of the icon for the tab at index [param tab_idx].
72 </description>
73 </method>
74 <method name="get_tab_idx_at_point" qualifiers="const">
75 <return type="int" />
76 <param index="0" name="point" type="Vector2" />
77 <description>
78 Returns the index of the tab at local coordinates [param point]. Returns [code]-1[/code] if the point is outside the control boundaries or if there's no tab at the queried position.
79 </description>
80 </method>
81 <method name="get_tab_idx_from_control" qualifiers="const">
82 <return type="int" />
83 <param index="0" name="control" type="Control" />
84 <description>
85 Returns the index of the tab tied to the given [param control]. The control must be a child of the [TabContainer].
86 </description>
87 </method>
88 <method name="get_tab_metadata" qualifiers="const">
89 <return type="Variant" />
90 <param index="0" name="tab_idx" type="int" />
91 <description>
92 Returns the metadata value set to the tab at index [param tab_idx] using [method set_tab_metadata]. If no metadata was previously set, returns [code]null[/code] by default.
93 </description>
94 </method>
95 <method name="get_tab_title" qualifiers="const">
96 <return type="String" />
97 <param index="0" name="tab_idx" type="int" />
98 <description>
99 Returns the title of the tab at index [param tab_idx]. Tab titles default to the name of the indexed child node, but this can be overridden with [method set_tab_title].
100 </description>
101 </method>
102 <method name="get_tab_tooltip" qualifiers="const">
103 <return type="String" />
104 <param index="0" name="tab_idx" type="int" />
105 <description>
106 Returns the tooltip text of the tab at index [param tab_idx].
107 </description>
108 </method>
109 <method name="is_tab_disabled" qualifiers="const">
110 <return type="bool" />
111 <param index="0" name="tab_idx" type="int" />
112 <description>
113 Returns [code]true[/code] if the tab at index [param tab_idx] is disabled.
114 </description>
115 </method>
116 <method name="is_tab_hidden" qualifiers="const">
117 <return type="bool" />
118 <param index="0" name="tab_idx" type="int" />
119 <description>
120 Returns [code]true[/code] if the tab at index [param tab_idx] is hidden.
121 </description>
122 </method>
123 <method name="select_next_available">
124 <return type="bool" />
125 <description>
126 Selects the first available tab with greater index than the currently selected. Returns [code]true[/code] if tab selection changed.
127 </description>
128 </method>
129 <method name="select_previous_available">
130 <return type="bool" />
131 <description>
132 Selects the first available tab with lower index than the currently selected. Returns [code]true[/code] if tab selection changed.
133 </description>
134 </method>
135 <method name="set_popup">
136 <return type="void" />
137 <param index="0" name="popup" type="Node" />
138 <description>
139 If set on a [Popup] node instance, a popup menu icon appears in the top-right corner of the [TabContainer] (setting it to [code]null[/code] will make it go away). Clicking it will expand the [Popup] node.
140 </description>
141 </method>
142 <method name="set_tab_button_icon">
143 <return type="void" />
144 <param index="0" name="tab_idx" type="int" />
145 <param index="1" name="icon" type="Texture2D" />
146 <description>
147 Sets the button icon from the tab at index [param tab_idx].
148 </description>
149 </method>
150 <method name="set_tab_disabled">
151 <return type="void" />
152 <param index="0" name="tab_idx" type="int" />
153 <param index="1" name="disabled" type="bool" />
154 <description>
155 If [param disabled] is [code]true[/code], disables the tab at index [param tab_idx], making it non-interactable.
156 </description>
157 </method>
158 <method name="set_tab_hidden">
159 <return type="void" />
160 <param index="0" name="tab_idx" type="int" />
161 <param index="1" name="hidden" type="bool" />
162 <description>
163 If [param hidden] is [code]true[/code], hides the tab at index [param tab_idx], making it disappear from the tab area.
164 </description>
165 </method>
166 <method name="set_tab_icon">
167 <return type="void" />
168 <param index="0" name="tab_idx" type="int" />
169 <param index="1" name="icon" type="Texture2D" />
170 <description>
171 Sets an icon for the tab at index [param tab_idx].
172 </description>
173 </method>
174 <method name="set_tab_icon_max_width">
175 <return type="void" />
176 <param index="0" name="tab_idx" type="int" />
177 <param index="1" name="width" type="int" />
178 <description>
179 Sets the maximum allowed width of the icon for the tab at index [param tab_idx]. This limit is applied on top of the default size of the icon and on top of [theme_item icon_max_width]. The height is adjusted according to the icon's ratio.
180 </description>
181 </method>
182 <method name="set_tab_metadata">
183 <return type="void" />
184 <param index="0" name="tab_idx" type="int" />
185 <param index="1" name="metadata" type="Variant" />
186 <description>
187 Sets the metadata value for the tab at index [param tab_idx], which can be retrieved later using [method get_tab_metadata].
188 </description>
189 </method>
190 <method name="set_tab_title">
191 <return type="void" />
192 <param index="0" name="tab_idx" type="int" />
193 <param index="1" name="title" type="String" />
194 <description>
195 Sets a custom title for the tab at index [param tab_idx] (tab titles default to the name of the indexed child node). Set it back to the child's name to make the tab default to it again.
196 </description>
197 </method>
198 <method name="set_tab_tooltip">
199 <return type="void" />
200 <param index="0" name="tab_idx" type="int" />
201 <param index="1" name="tooltip" type="String" />
202 <description>
203 Sets a custom tooltip text for tab at index [param tab_idx].
204 [b]Note:[/b] By default, if the [param tooltip] is empty and the tab text is truncated (not all characters fit into the tab), the title will be displayed as a tooltip. To hide the tooltip, assign [code]" "[/code] as the [param tooltip] text.
205 </description>
206 </method>
207 </methods>
208 <members>
209 <member name="all_tabs_in_front" type="bool" setter="set_all_tabs_in_front" getter="is_all_tabs_in_front" default="false">
210 If [code]true[/code], all tabs are drawn in front of the panel. If [code]false[/code], inactive tabs are drawn behind the panel.
211 </member>
212 <member name="clip_tabs" type="bool" setter="set_clip_tabs" getter="get_clip_tabs" default="true">
213 If [code]true[/code], tabs overflowing this node's width will be hidden, displaying two navigation buttons instead. Otherwise, this node's minimum size is updated so that all tabs are visible.
214 </member>
215 <member name="current_tab" type="int" setter="set_current_tab" getter="get_current_tab" default="-1">
216 The current tab index. When set, this index's [Control] node's [code]visible[/code] property is set to [code]true[/code] and all others are set to [code]false[/code].
217 A value of [code]-1[/code] means that no tab is selected.
218 </member>
219 <member name="deselect_enabled" type="bool" setter="set_deselect_enabled" getter="get_deselect_enabled" default="false">
220 If [code]true[/code], all tabs can be deselected so that no tab is selected. Click on the [member current_tab] to deselect it.
221 Only the tab header will be shown if no tabs are selected.
222 </member>
223 <member name="drag_to_rearrange_enabled" type="bool" setter="set_drag_to_rearrange_enabled" getter="get_drag_to_rearrange_enabled" default="false">
224 If [code]true[/code], tabs can be rearranged with mouse drag.
225 </member>
226 <member name="switch_on_drag_hover" type="bool" setter="set_switch_on_drag_hover" getter="get_switch_on_drag_hover" default="true">
227 If [code]true[/code], hovering over a tab while dragging something will switch to that tab. Does not have effect when hovering another tab to rearrange.
228 </member>
229 <member name="tab_alignment" type="int" setter="set_tab_alignment" getter="get_tab_alignment" enum="TabBar.AlignmentMode" default="0">
230 The position at which tabs will be placed.
231 </member>
232 <member name="tab_focus_mode" type="int" setter="set_tab_focus_mode" getter="get_tab_focus_mode" enum="Control.FocusMode" default="2">
233 The focus access mode for the internal [TabBar] node.
234 </member>
235 <member name="tabs_position" type="int" setter="set_tabs_position" getter="get_tabs_position" enum="TabContainer.TabPosition" default="0">
236 The horizontal alignment of the tabs.
237 </member>
238 <member name="tabs_rearrange_group" type="int" setter="set_tabs_rearrange_group" getter="get_tabs_rearrange_group" default="-1">
239 [TabContainer]s with the same rearrange group ID will allow dragging the tabs between them. Enable drag with [member drag_to_rearrange_enabled].
240 Setting this to [code]-1[/code] will disable rearranging between [TabContainer]s.
241 </member>
242 <member name="tabs_visible" type="bool" setter="set_tabs_visible" getter="are_tabs_visible" default="true">
243 If [code]true[/code], tabs are visible. If [code]false[/code], tabs' content and titles are hidden.
244 </member>
245 <member name="use_hidden_tabs_for_min_size" type="bool" setter="set_use_hidden_tabs_for_min_size" getter="get_use_hidden_tabs_for_min_size" default="false">
246 If [code]true[/code], child [Control] nodes that are hidden have their minimum size take into account in the total, instead of only the currently visible one.
247 </member>
248 </members>
249 <signals>
250 <signal name="active_tab_rearranged">
251 <param index="0" name="idx_to" type="int" />
252 <description>
253 Emitted when the active tab is rearranged via mouse drag. See [member drag_to_rearrange_enabled].
254 </description>
255 </signal>
256 <signal name="pre_popup_pressed">
257 <description>
258 Emitted when the [TabContainer]'s [Popup] button is clicked. See [method set_popup] for details.
259 </description>
260 </signal>
261 <signal name="tab_button_pressed">
262 <param index="0" name="tab" type="int" />
263 <description>
264 Emitted when the user clicks on the button icon on this tab.
265 </description>
266 </signal>
267 <signal name="tab_changed">
268 <param index="0" name="tab" type="int" />
269 <description>
270 Emitted when switching to another tab.
271 </description>
272 </signal>
273 <signal name="tab_clicked">
274 <param index="0" name="tab" type="int" />
275 <description>
276 Emitted when a tab is clicked, even if it is the current tab.
277 </description>
278 </signal>
279 <signal name="tab_hovered">
280 <param index="0" name="tab" type="int" />
281 <description>
282 Emitted when a tab is hovered by the mouse.
283 </description>
284 </signal>
285 <signal name="tab_selected">
286 <param index="0" name="tab" type="int" />
287 <description>
288 Emitted when a tab is selected via click, directional input, or script, even if it is the current tab.
289 </description>
290 </signal>
291 </signals>
292 <constants>
293 <constant name="POSITION_TOP" value="0" enum="TabPosition">
294 Places the tab bar at the top.
295 </constant>
296 <constant name="POSITION_BOTTOM" value="1" enum="TabPosition">
297 Places the tab bar at the bottom. The tab bar's [StyleBox] will be flipped vertically.
298 </constant>
299 <constant name="POSITION_MAX" value="2" enum="TabPosition">
300 Represents the size of the [enum TabPosition] enum.
301 </constant>
302 </constants>
303 <theme_items>
304 <theme_item name="drop_mark_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
305 Modulation color for the [theme_item drop_mark] icon.
306 </theme_item>
307 <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.875, 0.875, 0.875, 0.5)">
308 Font color of disabled tabs.
309 </theme_item>
310 <theme_item name="font_hovered_color" data_type="color" type="Color" default="Color(0.95, 0.95, 0.95, 1)">
311 Font color of the currently hovered tab. Does not apply to the selected tab.
312 </theme_item>
313 <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
314 The tint of text outline of the tab name.
315 </theme_item>
316 <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0.95, 0.95, 0.95, 1)">
317 Font color of the currently selected tab.
318 </theme_item>
319 <theme_item name="font_unselected_color" data_type="color" type="Color" default="Color(0.7, 0.7, 0.7, 1)">
320 Font color of the other, unselected tabs.
321 </theme_item>
322 <theme_item name="icon_disabled_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
323 Icon color of disabled tabs.
324 </theme_item>
325 <theme_item name="icon_hovered_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
326 Icon color of the currently hovered tab. Does not apply to the selected tab.
327 </theme_item>
328 <theme_item name="icon_selected_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
329 Icon color of the currently selected tab.
330 </theme_item>
331 <theme_item name="icon_unselected_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
332 Icon color of the other, unselected tabs.
333 </theme_item>
334 <theme_item name="icon_max_width" data_type="constant" type="int" default="0">
335 The maximum allowed width of the tab's icon. This limit is applied on top of the default size of the icon, but before the value set with [method TabBar.set_tab_icon_max_width]. The height is adjusted according to the icon's ratio.
336 </theme_item>
337 <theme_item name="icon_separation" data_type="constant" type="int" default="4">
338 Space between tab's name and its icon.
339 </theme_item>
340 <theme_item name="outline_size" data_type="constant" type="int" default="0">
341 The size of the tab text outline.
342 [b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
343 </theme_item>
344 <theme_item name="side_margin" data_type="constant" type="int" default="8">
345 The space at the left or right edges of the tab bar, accordingly with the current [member tab_alignment].
346 The margin is ignored with [constant TabBar.ALIGNMENT_RIGHT] if the tabs are clipped (see [member clip_tabs]) or a popup has been set (see [method set_popup]). The margin is always ignored with [constant TabBar.ALIGNMENT_CENTER].
347 </theme_item>
348 <theme_item name="tab_separation" data_type="constant" type="int" default="0">
349 The space between tabs in the tab bar.
350 </theme_item>
351 <theme_item name="font" data_type="font" type="Font">
352 The font used to draw tab names.
353 </theme_item>
354 <theme_item name="font_size" data_type="font_size" type="int">
355 Font size of the tab names.
356 </theme_item>
357 <theme_item name="decrement" data_type="icon" type="Texture2D">
358 Icon for the left arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the first tab is visible), it appears semi-transparent.
359 </theme_item>
360 <theme_item name="decrement_highlight" data_type="icon" type="Texture2D">
361 Icon for the left arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
362 </theme_item>
363 <theme_item name="drop_mark" data_type="icon" type="Texture2D">
364 Icon shown to indicate where a dragged tab is gonna be dropped (see [member drag_to_rearrange_enabled]).
365 </theme_item>
366 <theme_item name="increment" data_type="icon" type="Texture2D">
367 Icon for the right arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the last tab is visible) it appears semi-transparent.
368 </theme_item>
369 <theme_item name="increment_highlight" data_type="icon" type="Texture2D">
370 Icon for the right arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
371 </theme_item>
372 <theme_item name="menu" data_type="icon" type="Texture2D">
373 The icon for the menu button (see [method set_popup]).
374 </theme_item>
375 <theme_item name="menu_highlight" data_type="icon" type="Texture2D">
376 The icon for the menu button (see [method set_popup]) when it's being hovered with the cursor.
377 </theme_item>
378 <theme_item name="panel" data_type="style" type="StyleBox">
379 The style for the background fill.
380 </theme_item>
381 <theme_item name="tab_disabled" data_type="style" type="StyleBox">
382 The style of disabled tabs.
383 </theme_item>
384 <theme_item name="tab_focus" data_type="style" type="StyleBox">
385 [StyleBox] used when the [TabBar] is focused. The [theme_item tab_focus] [StyleBox] is displayed [i]over[/i] the base [StyleBox] of the selected tab, so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
386 </theme_item>
387 <theme_item name="tab_hovered" data_type="style" type="StyleBox">
388 The style of the currently hovered tab.
389 [b]Note:[/b] This style will be drawn with the same width as [theme_item tab_unselected] at minimum.
390 </theme_item>
391 <theme_item name="tab_selected" data_type="style" type="StyleBox">
392 The style of the currently selected tab.
393 </theme_item>
394 <theme_item name="tab_unselected" data_type="style" type="StyleBox">
395 The style of the other, unselected tabs.
396 </theme_item>
397 <theme_item name="tabbar_background" data_type="style" type="StyleBox">
398 The style for the background fill of the [TabBar] area.
399 </theme_item>
400 </theme_items>
401 </class>