:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SplitContainer.xml. .. _class_SplitContainer: SplitContainer ============== **Inherits:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`HSplitContainer`, :ref:`VSplitContainer` A container that splits two child controls horizontally or vertically and provides a grabber for adjusting the split ratio. .. rst-class:: classref-introduction-group Description ----------- A container that accepts only two child controls, then arranges them horizontally or vertically and creates a divisor between them. The divisor can be dragged around to change the size relation between the child controls. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Using Containers <../tutorials/ui/gui_containers>` .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`collapsed` | ``false`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`drag_area_highlight_in_editor` | ``false`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`drag_area_margin_begin` | ``0`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`drag_area_margin_end` | ``0`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`drag_area_offset` | ``0`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`DraggerVisibility` | :ref:`dragger_visibility` | ``0`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`dragging_enabled` | ``true`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`split_offset` | ``0`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`vertical` | ``false`` | +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------+---------------------------------------------------------------------------------------+ | |void| | :ref:`clamp_split_offset`\ (\ ) | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Control` | :ref:`get_drag_area_control`\ (\ ) | +-------------------------------+---------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Theme Properties ---------------- .. table:: :widths: auto +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ | :ref:`int` | :ref:`autohide` | ``1`` | +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ | :ref:`int` | :ref:`minimum_grab_thickness` | ``6`` | +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ | :ref:`int` | :ref:`separation` | ``12`` | +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ | :ref:`Texture2D` | :ref:`grabber` | | +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ | :ref:`Texture2D` | :ref:`h_grabber` | | +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ | :ref:`Texture2D` | :ref:`v_grabber` | | +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ | :ref:`StyleBox` | :ref:`split_bar_background` | | +-----------------------------------+-------------------------------------------------------------------------------------------+--------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_SplitContainer_signal_drag_ended: .. rst-class:: classref-signal **drag_ended**\ (\ ) :ref:`🔗` Emitted when the user ends dragging. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_signal_drag_started: .. rst-class:: classref-signal **drag_started**\ (\ ) :ref:`🔗` Emitted when the user starts dragging. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_signal_dragged: .. rst-class:: classref-signal **dragged**\ (\ offset\: :ref:`int`\ ) :ref:`🔗` Emitted when the dragger is dragged by user. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_SplitContainer_DraggerVisibility: .. rst-class:: classref-enumeration enum **DraggerVisibility**: :ref:`🔗` .. _class_SplitContainer_constant_DRAGGER_VISIBLE: .. rst-class:: classref-enumeration-constant :ref:`DraggerVisibility` **DRAGGER_VISIBLE** = ``0`` The split dragger icon is always visible when :ref:`autohide` is ``false``, otherwise visible only when the cursor hovers it. The size of the grabber icon determines the minimum :ref:`separation`. The dragger icon is automatically hidden if the length of the grabber icon is longer than the split bar. .. _class_SplitContainer_constant_DRAGGER_HIDDEN: .. rst-class:: classref-enumeration-constant :ref:`DraggerVisibility` **DRAGGER_HIDDEN** = ``1`` The split dragger icon is never visible regardless of the value of :ref:`autohide`. The size of the grabber icon determines the minimum :ref:`separation`. .. _class_SplitContainer_constant_DRAGGER_HIDDEN_COLLAPSED: .. rst-class:: classref-enumeration-constant :ref:`DraggerVisibility` **DRAGGER_HIDDEN_COLLAPSED** = ``2`` The split dragger icon is not visible, and the split bar is collapsed to zero thickness. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_SplitContainer_property_collapsed: .. rst-class:: classref-property :ref:`bool` **collapsed** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_collapsed**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_collapsed**\ (\ ) If ``true``, the dragger will be disabled and the children will be sized as if the :ref:`split_offset` was ``0``. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_drag_area_highlight_in_editor: .. rst-class:: classref-property :ref:`bool` **drag_area_highlight_in_editor** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_drag_area_highlight_in_editor**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_drag_area_highlight_in_editor_enabled**\ (\ ) Highlights the drag area :ref:`Rect2` so you can see where it is during development. The drag area is gold if :ref:`dragging_enabled` is ``true``, and red if ``false``. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_drag_area_margin_begin: .. rst-class:: classref-property :ref:`int` **drag_area_margin_begin** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_drag_area_margin_begin**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_drag_area_margin_begin**\ (\ ) Reduces the size of the drag area and split bar :ref:`split_bar_background` at the beginning of the container. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_drag_area_margin_end: .. rst-class:: classref-property :ref:`int` **drag_area_margin_end** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_drag_area_margin_end**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_drag_area_margin_end**\ (\ ) Reduces the size of the drag area and split bar :ref:`split_bar_background` at the end of the container. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_drag_area_offset: .. rst-class:: classref-property :ref:`int` **drag_area_offset** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_drag_area_offset**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_drag_area_offset**\ (\ ) Shifts the drag area in the axis of the container to prevent the drag area from overlapping the :ref:`ScrollBar` or other selectable :ref:`Control` of a child node. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_dragger_visibility: .. rst-class:: classref-property :ref:`DraggerVisibility` **dragger_visibility** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_dragger_visibility**\ (\ value\: :ref:`DraggerVisibility`\ ) - :ref:`DraggerVisibility` **get_dragger_visibility**\ (\ ) Determines the dragger's visibility. See :ref:`DraggerVisibility` for details. This property does not determine whether dragging is enabled or not. Use :ref:`dragging_enabled` for that. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_dragging_enabled: .. rst-class:: classref-property :ref:`bool` **dragging_enabled** = ``true`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_dragging_enabled**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_dragging_enabled**\ (\ ) Enables or disables split dragging. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_split_offset: .. rst-class:: classref-property :ref:`int` **split_offset** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_split_offset**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_split_offset**\ (\ ) The initial offset of the splitting between the two :ref:`Control`\ s, with ``0`` being at the end of the first :ref:`Control`. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_property_vertical: .. rst-class:: classref-property :ref:`bool` **vertical** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_vertical**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_vertical**\ (\ ) If ``true``, the **SplitContainer** will arrange its children vertically, rather than horizontally. Can't be changed when using :ref:`HSplitContainer` and :ref:`VSplitContainer`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_SplitContainer_method_clamp_split_offset: .. rst-class:: classref-method |void| **clamp_split_offset**\ (\ ) :ref:`🔗` Clamps the :ref:`split_offset` value to not go outside the currently possible minimal and maximum values. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_method_get_drag_area_control: .. rst-class:: classref-method :ref:`Control` **get_drag_area_control**\ (\ ) :ref:`🔗` Returns the drag area :ref:`Control`. For example, you can move a pre-configured button into the drag area :ref:`Control` so that it rides along with the split bar. Try setting the :ref:`Button` anchors to ``center`` prior to the ``reparent()`` call. :: $BarnacleButton.reparent($SplitContainer.get_drag_area_control()) \ **Note:** The drag area :ref:`Control` is drawn over the **SplitContainer**'s children, so :ref:`CanvasItem` draw objects called from the :ref:`Control` and children added to the :ref:`Control` will also appear over the **SplitContainer**'s children. Try setting :ref:`Control.mouse_filter` of custom children to :ref:`Control.MOUSE_FILTER_IGNORE` to prevent blocking the mouse from dragging if desired. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Theme Property Descriptions --------------------------- .. _class_SplitContainer_theme_constant_autohide: .. rst-class:: classref-themeproperty :ref:`int` **autohide** = ``1`` :ref:`🔗` Boolean value. If ``1`` (``true``), the grabber will hide automatically when it isn't under the cursor. If ``0`` (``false``), it's always visible. The :ref:`dragger_visibility` must be :ref:`DRAGGER_VISIBLE`. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_theme_constant_minimum_grab_thickness: .. rst-class:: classref-themeproperty :ref:`int` **minimum_grab_thickness** = ``6`` :ref:`🔗` The minimum thickness of the area users can click on to grab the split bar. This ensures that the split bar can still be dragged if :ref:`separation` or :ref:`h_grabber` / :ref:`v_grabber`'s size is too narrow to easily select. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_theme_constant_separation: .. rst-class:: classref-themeproperty :ref:`int` **separation** = ``12`` :ref:`🔗` The split bar thickness, i.e., the gap between the two children of the container. This is overridden by the size of the grabber icon if :ref:`dragger_visibility` is set to :ref:`DRAGGER_VISIBLE`, or :ref:`DRAGGER_HIDDEN`, and :ref:`separation` is smaller than the size of the grabber icon in the same axis. \ **Note:** To obtain :ref:`separation` values less than the size of the grabber icon, for example a ``1 px`` hairline, set :ref:`h_grabber` or :ref:`v_grabber` to a new :ref:`ImageTexture`, which effectively sets the grabber icon size to ``0 px``. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_theme_icon_grabber: .. rst-class:: classref-themeproperty :ref:`Texture2D` **grabber** :ref:`🔗` The icon used for the grabber drawn in the middle area. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_theme_icon_h_grabber: .. rst-class:: classref-themeproperty :ref:`Texture2D` **h_grabber** :ref:`🔗` The icon used for the grabber drawn in the middle area when :ref:`vertical` is ``false``. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_theme_icon_v_grabber: .. rst-class:: classref-themeproperty :ref:`Texture2D` **v_grabber** :ref:`🔗` The icon used for the grabber drawn in the middle area when :ref:`vertical` is ``true``. .. rst-class:: classref-item-separator ---- .. _class_SplitContainer_theme_style_split_bar_background: .. rst-class:: classref-themeproperty :ref:`StyleBox` **split_bar_background** :ref:`🔗` Determines the background of the split bar if its thickness is greater than zero. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`