2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 10:08:05 +02:00
<class name= "ScrollContainer" inherits= "Container" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 22:42:36 +02:00
<brief_description >
2023-04-30 16:26:09 +02:00
A container used to provide scrollbars to a child control when needed.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2023-04-30 16:26:09 +02:00
A container used to provide a child control with scrollbars when needed. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the [member Control.custom_minimum_size] of the Control relative to the ScrollContainer.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
2023-04-30 16:26:09 +02:00
<link title= "Using Containers" > $DOCS_URL/tutorials/ui/gui_containers.html</link>
2017-09-12 22:42:36 +02:00
</tutorials>
<methods >
2021-05-15 05:19:23 +02:00
<method name= "ensure_control_visible" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "control" type= "Control" />
2021-05-15 05:19:23 +02:00
<description >
2022-08-10 04:00:19 +02:00
Ensures the given [param control] is visible (must be a direct or indirect child of the ScrollContainer). Used by [member follow_focus].
2021-12-04 01:07:01 +01:00
[b]Note:[/b] This will not work on a node that was just added during the same frame. If you want to scroll to a newly added child, you must wait until the next frame using [signal SceneTree.process_frame]:
[codeblock]
add_child(child_node)
await get_tree().process_frame
ensure_control_visible(child_node)
[/codeblock]
2021-05-15 05:19:23 +02:00
</description>
</method>
2021-11-30 17:46:36 +01:00
<method name= "get_h_scroll_bar" >
2021-07-30 15:28:05 +02:00
<return type= "HScrollBar" />
2018-06-11 18:41:16 +02:00
<description >
2020-01-24 17:21:53 +01:00
Returns the horizontal scrollbar [HScrollBar] of this [ScrollContainer].
2021-12-07 17:15:18 +01:00
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to disable or hide a scrollbar, you can use [member horizontal_scroll_mode].
2018-06-11 18:41:16 +02:00
</description>
</method>
2021-11-30 17:46:36 +01:00
<method name= "get_v_scroll_bar" >
2021-07-30 15:28:05 +02:00
<return type= "VScrollBar" />
2018-06-11 18:41:16 +02:00
<description >
2020-01-24 17:21:53 +01:00
Returns the vertical scrollbar [VScrollBar] of this [ScrollContainer].
2021-12-07 17:15:18 +01:00
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to disable or hide a scrollbar, you can use [member vertical_scroll_mode].
2018-06-11 18:41:16 +02:00
</description>
</method>
2017-09-12 22:42:36 +02:00
</methods>
<members >
2022-01-23 18:14:31 +01:00
<member name= "clip_contents" type= "bool" setter= "set_clip_contents" getter= "is_clipping_contents" overrides= "Control" default= "true" />
2019-12-24 00:03:24 +01:00
<member name= "follow_focus" type= "bool" setter= "set_follow_focus" getter= "is_following_focus" default= "false" >
If [code]true[/code], the ScrollContainer will automatically scroll to focused children (including indirect children) to make sure they are fully visible.
</member>
2021-12-07 17:15:18 +01:00
<member name= "horizontal_scroll_mode" type= "int" setter= "set_horizontal_scroll_mode" getter= "get_horizontal_scroll_mode" enum= "ScrollContainer.ScrollMode" default= "1" >
Controls whether horizontal scrollbar can be used and when it should be visible. See [enum ScrollMode] for options.
</member>
2019-06-29 12:38:01 +02:00
<member name= "scroll_deadzone" type= "int" setter= "set_deadzone" getter= "get_deadzone" default= "0" >
2022-11-21 03:48:36 +01:00
Deadzone for touch scrolling. Lower deadzone makes the scrolling more sensitive.
2018-04-10 10:12:42 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "scroll_horizontal" type= "int" setter= "set_h_scroll" getter= "get_h_scroll" default= "0" >
2023-04-29 18:46:38 +02:00
The current horizontal scroll value.
[b]Note:[/b] If you are setting this value in the [method Node._ready] function or earlier, it needs to be wrapped with [method Object.set_deferred], since scroll bar's [member Range.max_value] is not initialized yet.
[codeblock]
func _ready():
set_deferred("scroll_horizontal", 600)
[/codeblock]
2017-09-12 22:42:36 +02:00
</member>
2023-01-03 10:36:44 +01:00
<member name= "scroll_horizontal_custom_step" type= "float" setter= "set_horizontal_custom_step" getter= "get_horizontal_custom_step" default= "-1.0" >
Overrides the [member ScrollBar.custom_step] used when clicking the internal scroll bar's horizontal increment and decrement buttons or when using arrow keys when the [ScrollBar] is focused.
</member>
2019-06-29 12:38:01 +02:00
<member name= "scroll_vertical" type= "int" setter= "set_v_scroll" getter= "get_v_scroll" default= "0" >
2018-05-12 10:45:56 +02:00
The current vertical scroll value.
2023-04-29 18:46:38 +02:00
[b]Note:[/b] Setting it early needs to be deferred, just like in [member scroll_horizontal].
[codeblock]
func _ready():
set_deferred("scroll_vertical", 600)
[/codeblock]
2018-01-11 23:38:35 +01:00
</member>
2023-01-03 10:36:44 +01:00
<member name= "scroll_vertical_custom_step" type= "float" setter= "set_vertical_custom_step" getter= "get_vertical_custom_step" default= "-1.0" >
Overrides the [member ScrollBar.custom_step] used when clicking the internal scroll bar's vertical increment and decrement buttons or when using arrow keys when the [ScrollBar] is focused.
</member>
2021-12-07 17:15:18 +01:00
<member name= "vertical_scroll_mode" type= "int" setter= "set_vertical_scroll_mode" getter= "get_vertical_scroll_mode" enum= "ScrollContainer.ScrollMode" default= "1" >
Controls whether vertical scrollbar can be used and when it should be visible. See [enum ScrollMode] for options.
2021-04-18 22:38:44 +02:00
</member>
2017-09-12 22:42:36 +02:00
</members>
2018-04-10 10:12:42 +02:00
<signals >
<signal name= "scroll_ended" >
<description >
2019-06-22 01:04:47 +02:00
Emitted when scrolling stops.
2018-04-10 10:12:42 +02:00
</description>
</signal>
<signal name= "scroll_started" >
<description >
2019-06-22 01:04:47 +02:00
Emitted when scrolling is started.
2018-04-10 10:12:42 +02:00
</description>
</signal>
</signals>
2021-12-07 17:15:18 +01:00
<constants >
<constant name= "SCROLL_MODE_DISABLED" value= "0" enum= "ScrollMode" >
Scrolling disabled, scrollbar will be invisible.
</constant>
<constant name= "SCROLL_MODE_AUTO" value= "1" enum= "ScrollMode" >
Scrolling enabled, scrollbar will be visible only if necessary, i.e. container's content is bigger than the container.
</constant>
<constant name= "SCROLL_MODE_SHOW_ALWAYS" value= "2" enum= "ScrollMode" >
Scrolling enabled, scrollbar will be always visible.
</constant>
<constant name= "SCROLL_MODE_SHOW_NEVER" value= "3" enum= "ScrollMode" >
Scrolling enabled, scrollbar will be hidden.
</constant>
</constants>
2018-05-28 14:53:15 +02:00
<theme_items >
2022-09-06 19:09:32 +02:00
<theme_item name= "panel" data_type= "style" type= "StyleBox" >
2020-01-27 02:15:37 +01:00
The background [StyleBox] of the [ScrollContainer].
2018-05-28 14:53:15 +02:00
</theme_item>
</theme_items>
2017-09-12 22:42:36 +02:00
</class>