| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="SplitContainer" inherits="Container" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A container that arranges child controls horizontally or vertically and provides grabbers for adjusting the split ratios between them. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | A container that arranges child controls horizontally or vertically and creates grabbers between them. The grabbers can be dragged around to change the size relations between the child controls. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | <link title="Using Containers">$DOCS_URL/tutorials/ui/gui_containers.html</link> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="clamp_split_offset"> |
| 14 | <return type="void" /> |
| 15 | <param index="0" name="priority_index" type="int" default="0" /> |
| 16 | <description> |
| 17 | Clamps the [member split_offsets] values to ensure they are within valid ranges and do not overlap with each other. When overlaps occur, this method prioritizes one split offset (at index [param priority_index]) by clamping any overlapping split offsets to it. |
| 18 | </description> |
| 19 | </method> |
| 20 | <method name="get_drag_area_control" deprecated="Use the first element of [method get_drag_area_controls] instead."> |
| 21 | <return type="Control" /> |
| 22 | <description> |
| 23 | Returns the drag area [Control]. For example, you can move a pre-configured button into the drag area [Control] so that it rides along with the split bar. Try setting the [Button] anchors to [code]center[/code] prior to the [code]reparent()[/code] call. |
| 24 | [codeblock] |
| 25 | $BarnacleButton.reparent($SplitContainer.get_drag_area_control()) |
| 26 | [/codeblock] |
| 27 | [b]Note:[/b] The drag area [Control] is drawn over the [SplitContainer]'s children, so [CanvasItem] draw objects called from the [Control] and children added to the [Control] will also appear over the [SplitContainer]'s children. Try setting [member Control.mouse_filter] of custom children to [constant Control.MOUSE_FILTER_IGNORE] to prevent blocking the mouse from dragging if desired. |
| 28 | [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. |
| 29 | </description> |
| 30 | </method> |
| 31 | <method name="get_drag_area_controls"> |
| 32 | <return type="Control[]" /> |
| 33 | <description> |
| 34 | Returns an [Array] of the drag area [Control]s. These are the interactable [Control] nodes between each child. For example, this can be used to add a pre-configured button to a drag area [Control] so that it rides along with the split bar. Try setting the [Button] anchors to [code]center[/code] prior to the [method Node.reparent] call. |
| 35 | [codeblock] |
| 36 | $BarnacleButton.reparent($SplitContainer.get_drag_area_controls()[0]) |
| 37 | [/codeblock] |
| 38 | [b]Note:[/b] The drag area [Control]s are drawn over the [SplitContainer]'s children, so [CanvasItem] draw objects called from a drag area and children added to it will also appear over the [SplitContainer]'s children. Try setting [member Control.mouse_filter] of custom children to [constant Control.MOUSE_FILTER_IGNORE] to prevent blocking the mouse from dragging if desired. |
| 39 | [b]Warning:[/b] These are required internal nodes, removing or freeing them may cause a crash. |
| 40 | </description> |
| 41 | </method> |
| 42 | </methods> |
| 43 | <members> |
| 44 | <member name="collapsed" type="bool" setter="set_collapsed" getter="is_collapsed" default="false"> |
| 45 | If [code]true[/code], the draggers will be disabled and the children will be sized as if all [member split_offsets] were [code]0[/code]. |
| 46 | </member> |
| 47 | <member name="drag_area_highlight_in_editor" type="bool" setter="set_drag_area_highlight_in_editor" getter="is_drag_area_highlight_in_editor_enabled" default="false"> |
| 48 | Highlights the drag area [Rect2] so you can see where it is during development. The drag area is gold if [member dragging_enabled] is [code]true[/code], and red if [code]false[/code]. |
| 49 | </member> |
| 50 | <member name="drag_area_margin_begin" type="int" setter="set_drag_area_margin_begin" getter="get_drag_area_margin_begin" default="0"> |
| 51 | Reduces the size of the drag area and split bar [theme_item split_bar_background] at the beginning of the container. |
| 52 | </member> |
| 53 | <member name="drag_area_margin_end" type="int" setter="set_drag_area_margin_end" getter="get_drag_area_margin_end" default="0"> |
| 54 | Reduces the size of the drag area and split bar [theme_item split_bar_background] at the end of the container. |
| 55 | </member> |
| 56 | <member name="drag_area_offset" type="int" setter="set_drag_area_offset" getter="get_drag_area_offset" default="0"> |
| 57 | Shifts the drag area in the axis of the container to prevent the drag area from overlapping the [ScrollBar] or other selectable [Control] of a child node. |
| 58 | </member> |
| 59 | <member name="dragger_visibility" type="int" setter="set_dragger_visibility" getter="get_dragger_visibility" enum="SplitContainer.DraggerVisibility" default="0"> |
| 60 | Determines the dragger's visibility. This property does not determine whether dragging is enabled or not. Use [member dragging_enabled] for that. |
| 61 | </member> |
| 62 | <member name="dragging_enabled" type="bool" setter="set_dragging_enabled" getter="is_dragging_enabled" default="true"> |
| 63 | Enables or disables split dragging. |
| 64 | </member> |
| 65 | <member name="split_offset" type="int" setter="set_split_offset" getter="get_split_offset" default="0" deprecated="Use [member split_offsets] instead. The first element of the array is the split offset between the first two children."> |
| 66 | The first element of [member split_offsets]. |
| 67 | </member> |
| 68 | <member name="split_offsets" type="PackedInt32Array" setter="set_split_offsets" getter="get_split_offsets" default="PackedInt32Array(0)"> |
| 69 | Offsets for each dragger in pixels. Each one is the offset of the split between the [Control] nodes before and after the dragger, with [code]0[/code] being the default position. The default position is based on the [Control] nodes expand flags and minimum sizes. See [member Control.size_flags_horizontal], [member Control.size_flags_vertical], and [member Control.size_flags_stretch_ratio]. |
| 70 | If none of the [Control] nodes before the dragger are expanded, the default position will be at the start of the [SplitContainer]. If none of the [Control] nodes after the dragger are expanded, the default position will be at the end of the [SplitContainer]. If the dragger is in between expanded [Control] nodes, the default position will be in the middle, based on the [member Control.size_flags_stretch_ratio]s and minimum sizes. |
| 71 | [b]Note:[/b] If the split offsets cause [Control] nodes to overlap, the first split will take priority when resolving the positions. |
| 72 | </member> |
| 73 | <member name="touch_dragger_enabled" type="bool" setter="set_touch_dragger_enabled" getter="is_touch_dragger_enabled" default="false"> |
| 74 | If [code]true[/code], a touch-friendly drag handle will be enabled for better usability on smaller screens. Unlike the standard grabber, this drag handle overlaps the [SplitContainer]'s children and does not affect their minimum separation. The standard grabber will no longer be drawn when this option is enabled. |
| 75 | </member> |
| 76 | <member name="vertical" type="bool" setter="set_vertical" getter="is_vertical" default="false"> |
| 77 | If [code]true[/code], the [SplitContainer] will arrange its children vertically, rather than horizontally. |
| 78 | Can't be changed when using [HSplitContainer] and [VSplitContainer]. |
| 79 | </member> |
| 80 | </members> |
| 81 | <signals> |
| 82 | <signal name="drag_ended"> |
| 83 | <description> |
| 84 | Emitted when the user ends dragging. |
| 85 | </description> |
| 86 | </signal> |
| 87 | <signal name="drag_started"> |
| 88 | <description> |
| 89 | Emitted when the user starts dragging. |
| 90 | </description> |
| 91 | </signal> |
| 92 | <signal name="dragged"> |
| 93 | <param index="0" name="offset" type="int" /> |
| 94 | <description> |
| 95 | Emitted when any dragger is dragged by user. |
| 96 | </description> |
| 97 | </signal> |
| 98 | </signals> |
| 99 | <constants> |
| 100 | <constant name="DRAGGER_VISIBLE" value="0" enum="DraggerVisibility"> |
| 101 | The split dragger icon is always visible when [theme_item autohide] is [code]false[/code], otherwise visible only when the cursor hovers it. |
| 102 | The size of the grabber icon determines the minimum [theme_item separation]. |
| 103 | The dragger icon is automatically hidden if the length of the grabber icon is longer than the split bar. |
| 104 | </constant> |
| 105 | <constant name="DRAGGER_HIDDEN" value="1" enum="DraggerVisibility"> |
| 106 | The split dragger icon is never visible regardless of the value of [theme_item autohide]. |
| 107 | The size of the grabber icon determines the minimum [theme_item separation]. |
| 108 | </constant> |
| 109 | <constant name="DRAGGER_HIDDEN_COLLAPSED" value="2" enum="DraggerVisibility"> |
| 110 | The split dragger icon is not visible, and the split bar is collapsed to zero thickness. |
| 111 | </constant> |
| 112 | </constants> |
| 113 | <theme_items> |
| 114 | <theme_item name="touch_dragger_color" data_type="color" type="Color" default="Color(1, 1, 1, 0.3)"> |
| 115 | The color of the touch dragger. |
| 116 | </theme_item> |
| 117 | <theme_item name="touch_dragger_hover_color" data_type="color" type="Color" default="Color(1, 1, 1, 0.6)"> |
| 118 | The color of the touch dragger when hovered. |
| 119 | </theme_item> |
| 120 | <theme_item name="touch_dragger_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)"> |
| 121 | The color of the touch dragger when pressed. |
| 122 | </theme_item> |
| 123 | <theme_item name="autohide" data_type="constant" type="int" default="1"> |
| 124 | Boolean value. If [code]1[/code] ([code]true[/code]), the grabbers will hide automatically when they aren't under the cursor. If [code]0[/code] ([code]false[/code]), the grabbers are always visible. The [member dragger_visibility] must be [constant DRAGGER_VISIBLE]. |
| 125 | </theme_item> |
| 126 | <theme_item name="minimum_grab_thickness" data_type="constant" type="int" default="6"> |
| 127 | The minimum thickness of the area users can click on to grab a split bar. This ensures that the split bar can still be dragged if [theme_item separation] or [theme_item h_grabber] / [theme_item v_grabber]'s size is too narrow to easily select. |
| 128 | </theme_item> |
| 129 | <theme_item name="separation" data_type="constant" type="int" default="12"> |
| 130 | The split bar thickness, i.e., the gap between each child of the container. This is overridden by the size of the grabber icon if [member dragger_visibility] is set to [constant DRAGGER_VISIBLE], or [constant DRAGGER_HIDDEN], and [theme_item separation] is smaller than the size of the grabber icon in the same axis. |
| 131 | [b]Note:[/b] To obtain [theme_item separation] values less than the size of the grabber icon, for example a [code]1 px[/code] hairline, set [theme_item h_grabber] or [theme_item v_grabber] to a new [ImageTexture], which effectively sets the grabber icon size to [code]0 px[/code]. |
| 132 | </theme_item> |
| 133 | <theme_item name="grabber" data_type="icon" type="Texture2D"> |
| 134 | The icon used for the grabbers drawn in the separations. This is only used in [HSplitContainer] and [VSplitContainer]. For [SplitContainer], see [theme_item h_grabber] and [theme_item v_grabber] instead. |
| 135 | </theme_item> |
| 136 | <theme_item name="h_grabber" data_type="icon" type="Texture2D"> |
| 137 | The icon used for the grabbers drawn in the separations when [member vertical] is [code]false[/code]. |
| 138 | </theme_item> |
| 139 | <theme_item name="h_touch_dragger" data_type="icon" type="Texture2D"> |
| 140 | The icon used for the drag handle when [member touch_dragger_enabled] is [code]true[/code] and [member vertical] is [code]false[/code]. |
| 141 | </theme_item> |
| 142 | <theme_item name="touch_dragger" data_type="icon" type="Texture2D"> |
| 143 | The icon used for the drag handle when [member touch_dragger_enabled] is [code]true[/code]. This is only used in [HSplitContainer] and [VSplitContainer]. For [SplitContainer], see [theme_item h_touch_dragger] and [theme_item v_touch_dragger] instead. |
| 144 | </theme_item> |
| 145 | <theme_item name="v_grabber" data_type="icon" type="Texture2D"> |
| 146 | The icon used for the grabbers drawn in the separations when [member vertical] is [code]true[/code]. |
| 147 | </theme_item> |
| 148 | <theme_item name="v_touch_dragger" data_type="icon" type="Texture2D"> |
| 149 | The icon used for the drag handle when [member touch_dragger_enabled] is [code]true[/code] and [member vertical] is [code]true[/code]. |
| 150 | </theme_item> |
| 151 | <theme_item name="split_bar_background" data_type="style" type="StyleBox"> |
| 152 | Determines the background of the split bar if its thickness is greater than zero. |
| 153 | </theme_item> |
| 154 | </theme_items> |
| 155 | </class> |