class_splitcontainer.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SplitContainer.xml.
  6. .. _class_SplitContainer:
  7. SplitContainer
  8. ==============
  9. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`HSplitContainer<class_HSplitContainer>`, :ref:`VSplitContainer<class_VSplitContainer>`
  11. A container that splits two child controls horizontally or vertically and provides a grabber for adjusting the split ratio.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. 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.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Using Containers <../tutorials/ui/gui_containers>`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  26. | :ref:`bool<class_bool>` | :ref:`collapsed<class_SplitContainer_property_collapsed>` | ``false`` |
  27. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`drag_area_highlight_in_editor<class_SplitContainer_property_drag_area_highlight_in_editor>` | ``false`` |
  29. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  30. | :ref:`int<class_int>` | :ref:`drag_area_margin_begin<class_SplitContainer_property_drag_area_margin_begin>` | ``0`` |
  31. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  32. | :ref:`int<class_int>` | :ref:`drag_area_margin_end<class_SplitContainer_property_drag_area_margin_end>` | ``0`` |
  33. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  34. | :ref:`int<class_int>` | :ref:`drag_area_offset<class_SplitContainer_property_drag_area_offset>` | ``0`` |
  35. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  36. | :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>` | :ref:`dragger_visibility<class_SplitContainer_property_dragger_visibility>` | ``0`` |
  37. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  38. | :ref:`bool<class_bool>` | :ref:`dragging_enabled<class_SplitContainer_property_dragging_enabled>` | ``true`` |
  39. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  40. | :ref:`int<class_int>` | :ref:`split_offset<class_SplitContainer_property_split_offset>` | ``0`` |
  41. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  42. | :ref:`bool<class_bool>` | :ref:`vertical<class_SplitContainer_property_vertical>` | ``false`` |
  43. +-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------+-----------+
  44. .. rst-class:: classref-reftable-group
  45. Methods
  46. -------
  47. .. table::
  48. :widths: auto
  49. +-------------------------------+---------------------------------------------------------------------------------------+
  50. | |void| | :ref:`clamp_split_offset<class_SplitContainer_method_clamp_split_offset>`\ (\ ) |
  51. +-------------------------------+---------------------------------------------------------------------------------------+
  52. | :ref:`Control<class_Control>` | :ref:`get_drag_area_control<class_SplitContainer_method_get_drag_area_control>`\ (\ ) |
  53. +-------------------------------+---------------------------------------------------------------------------------------+
  54. .. rst-class:: classref-reftable-group
  55. Theme Properties
  56. ----------------
  57. .. table::
  58. :widths: auto
  59. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  60. | :ref:`int<class_int>` | :ref:`autohide<class_SplitContainer_theme_constant_autohide>` | ``1`` |
  61. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  62. | :ref:`int<class_int>` | :ref:`minimum_grab_thickness<class_SplitContainer_theme_constant_minimum_grab_thickness>` | ``6`` |
  63. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  64. | :ref:`int<class_int>` | :ref:`separation<class_SplitContainer_theme_constant_separation>` | ``12`` |
  65. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  66. | :ref:`Texture2D<class_Texture2D>` | :ref:`grabber<class_SplitContainer_theme_icon_grabber>` | |
  67. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  68. | :ref:`Texture2D<class_Texture2D>` | :ref:`h_grabber<class_SplitContainer_theme_icon_h_grabber>` | |
  69. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  70. | :ref:`Texture2D<class_Texture2D>` | :ref:`v_grabber<class_SplitContainer_theme_icon_v_grabber>` | |
  71. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  72. | :ref:`StyleBox<class_StyleBox>` | :ref:`split_bar_background<class_SplitContainer_theme_style_split_bar_background>` | |
  73. +-----------------------------------+-------------------------------------------------------------------------------------------+--------+
  74. .. rst-class:: classref-section-separator
  75. ----
  76. .. rst-class:: classref-descriptions-group
  77. Signals
  78. -------
  79. .. _class_SplitContainer_signal_drag_ended:
  80. .. rst-class:: classref-signal
  81. **drag_ended**\ (\ ) :ref:`🔗<class_SplitContainer_signal_drag_ended>`
  82. Emitted when the user ends dragging.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_SplitContainer_signal_drag_started:
  86. .. rst-class:: classref-signal
  87. **drag_started**\ (\ ) :ref:`🔗<class_SplitContainer_signal_drag_started>`
  88. Emitted when the user starts dragging.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_SplitContainer_signal_dragged:
  92. .. rst-class:: classref-signal
  93. **dragged**\ (\ offset\: :ref:`int<class_int>`\ ) :ref:`🔗<class_SplitContainer_signal_dragged>`
  94. Emitted when the dragger is dragged by user.
  95. .. rst-class:: classref-section-separator
  96. ----
  97. .. rst-class:: classref-descriptions-group
  98. Enumerations
  99. ------------
  100. .. _enum_SplitContainer_DraggerVisibility:
  101. .. rst-class:: classref-enumeration
  102. enum **DraggerVisibility**: :ref:`🔗<enum_SplitContainer_DraggerVisibility>`
  103. .. _class_SplitContainer_constant_DRAGGER_VISIBLE:
  104. .. rst-class:: classref-enumeration-constant
  105. :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>` **DRAGGER_VISIBLE** = ``0``
  106. The split dragger icon is always visible when :ref:`autohide<class_SplitContainer_theme_constant_autohide>` is ``false``, otherwise visible only when the cursor hovers it.
  107. The size of the grabber icon determines the minimum :ref:`separation<class_SplitContainer_theme_constant_separation>`.
  108. The dragger icon is automatically hidden if the length of the grabber icon is longer than the split bar.
  109. .. _class_SplitContainer_constant_DRAGGER_HIDDEN:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>` **DRAGGER_HIDDEN** = ``1``
  112. The split dragger icon is never visible regardless of the value of :ref:`autohide<class_SplitContainer_theme_constant_autohide>`.
  113. The size of the grabber icon determines the minimum :ref:`separation<class_SplitContainer_theme_constant_separation>`.
  114. .. _class_SplitContainer_constant_DRAGGER_HIDDEN_COLLAPSED:
  115. .. rst-class:: classref-enumeration-constant
  116. :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>` **DRAGGER_HIDDEN_COLLAPSED** = ``2``
  117. The split dragger icon is not visible, and the split bar is collapsed to zero thickness.
  118. .. rst-class:: classref-section-separator
  119. ----
  120. .. rst-class:: classref-descriptions-group
  121. Property Descriptions
  122. ---------------------
  123. .. _class_SplitContainer_property_collapsed:
  124. .. rst-class:: classref-property
  125. :ref:`bool<class_bool>` **collapsed** = ``false`` :ref:`🔗<class_SplitContainer_property_collapsed>`
  126. .. rst-class:: classref-property-setget
  127. - |void| **set_collapsed**\ (\ value\: :ref:`bool<class_bool>`\ )
  128. - :ref:`bool<class_bool>` **is_collapsed**\ (\ )
  129. If ``true``, the dragger will be disabled and the children will be sized as if the :ref:`split_offset<class_SplitContainer_property_split_offset>` was ``0``.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_SplitContainer_property_drag_area_highlight_in_editor:
  133. .. rst-class:: classref-property
  134. :ref:`bool<class_bool>` **drag_area_highlight_in_editor** = ``false`` :ref:`🔗<class_SplitContainer_property_drag_area_highlight_in_editor>`
  135. .. rst-class:: classref-property-setget
  136. - |void| **set_drag_area_highlight_in_editor**\ (\ value\: :ref:`bool<class_bool>`\ )
  137. - :ref:`bool<class_bool>` **is_drag_area_highlight_in_editor_enabled**\ (\ )
  138. Highlights the drag area :ref:`Rect2<class_Rect2>` so you can see where it is during development. The drag area is gold if :ref:`dragging_enabled<class_SplitContainer_property_dragging_enabled>` is ``true``, and red if ``false``.
  139. .. rst-class:: classref-item-separator
  140. ----
  141. .. _class_SplitContainer_property_drag_area_margin_begin:
  142. .. rst-class:: classref-property
  143. :ref:`int<class_int>` **drag_area_margin_begin** = ``0`` :ref:`🔗<class_SplitContainer_property_drag_area_margin_begin>`
  144. .. rst-class:: classref-property-setget
  145. - |void| **set_drag_area_margin_begin**\ (\ value\: :ref:`int<class_int>`\ )
  146. - :ref:`int<class_int>` **get_drag_area_margin_begin**\ (\ )
  147. Reduces the size of the drag area and split bar :ref:`split_bar_background<class_SplitContainer_theme_style_split_bar_background>` at the beginning of the container.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_SplitContainer_property_drag_area_margin_end:
  151. .. rst-class:: classref-property
  152. :ref:`int<class_int>` **drag_area_margin_end** = ``0`` :ref:`🔗<class_SplitContainer_property_drag_area_margin_end>`
  153. .. rst-class:: classref-property-setget
  154. - |void| **set_drag_area_margin_end**\ (\ value\: :ref:`int<class_int>`\ )
  155. - :ref:`int<class_int>` **get_drag_area_margin_end**\ (\ )
  156. Reduces the size of the drag area and split bar :ref:`split_bar_background<class_SplitContainer_theme_style_split_bar_background>` at the end of the container.
  157. .. rst-class:: classref-item-separator
  158. ----
  159. .. _class_SplitContainer_property_drag_area_offset:
  160. .. rst-class:: classref-property
  161. :ref:`int<class_int>` **drag_area_offset** = ``0`` :ref:`🔗<class_SplitContainer_property_drag_area_offset>`
  162. .. rst-class:: classref-property-setget
  163. - |void| **set_drag_area_offset**\ (\ value\: :ref:`int<class_int>`\ )
  164. - :ref:`int<class_int>` **get_drag_area_offset**\ (\ )
  165. Shifts the drag area in the axis of the container to prevent the drag area from overlapping the :ref:`ScrollBar<class_ScrollBar>` or other selectable :ref:`Control<class_Control>` of a child node.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_SplitContainer_property_dragger_visibility:
  169. .. rst-class:: classref-property
  170. :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>` **dragger_visibility** = ``0`` :ref:`🔗<class_SplitContainer_property_dragger_visibility>`
  171. .. rst-class:: classref-property-setget
  172. - |void| **set_dragger_visibility**\ (\ value\: :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>`\ )
  173. - :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>` **get_dragger_visibility**\ (\ )
  174. Determines the dragger's visibility. See :ref:`DraggerVisibility<enum_SplitContainer_DraggerVisibility>` for details. This property does not determine whether dragging is enabled or not. Use :ref:`dragging_enabled<class_SplitContainer_property_dragging_enabled>` for that.
  175. .. rst-class:: classref-item-separator
  176. ----
  177. .. _class_SplitContainer_property_dragging_enabled:
  178. .. rst-class:: classref-property
  179. :ref:`bool<class_bool>` **dragging_enabled** = ``true`` :ref:`🔗<class_SplitContainer_property_dragging_enabled>`
  180. .. rst-class:: classref-property-setget
  181. - |void| **set_dragging_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  182. - :ref:`bool<class_bool>` **is_dragging_enabled**\ (\ )
  183. Enables or disables split dragging.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_SplitContainer_property_split_offset:
  187. .. rst-class:: classref-property
  188. :ref:`int<class_int>` **split_offset** = ``0`` :ref:`🔗<class_SplitContainer_property_split_offset>`
  189. .. rst-class:: classref-property-setget
  190. - |void| **set_split_offset**\ (\ value\: :ref:`int<class_int>`\ )
  191. - :ref:`int<class_int>` **get_split_offset**\ (\ )
  192. The initial offset of the splitting between the two :ref:`Control<class_Control>`\ s, with ``0`` being at the end of the first :ref:`Control<class_Control>`.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_SplitContainer_property_vertical:
  196. .. rst-class:: classref-property
  197. :ref:`bool<class_bool>` **vertical** = ``false`` :ref:`🔗<class_SplitContainer_property_vertical>`
  198. .. rst-class:: classref-property-setget
  199. - |void| **set_vertical**\ (\ value\: :ref:`bool<class_bool>`\ )
  200. - :ref:`bool<class_bool>` **is_vertical**\ (\ )
  201. If ``true``, the **SplitContainer** will arrange its children vertically, rather than horizontally.
  202. Can't be changed when using :ref:`HSplitContainer<class_HSplitContainer>` and :ref:`VSplitContainer<class_VSplitContainer>`.
  203. .. rst-class:: classref-section-separator
  204. ----
  205. .. rst-class:: classref-descriptions-group
  206. Method Descriptions
  207. -------------------
  208. .. _class_SplitContainer_method_clamp_split_offset:
  209. .. rst-class:: classref-method
  210. |void| **clamp_split_offset**\ (\ ) :ref:`🔗<class_SplitContainer_method_clamp_split_offset>`
  211. Clamps the :ref:`split_offset<class_SplitContainer_property_split_offset>` value to not go outside the currently possible minimal and maximum values.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_SplitContainer_method_get_drag_area_control:
  215. .. rst-class:: classref-method
  216. :ref:`Control<class_Control>` **get_drag_area_control**\ (\ ) :ref:`🔗<class_SplitContainer_method_get_drag_area_control>`
  217. Returns the drag area :ref:`Control<class_Control>`. For example, you can move a pre-configured button into the drag area :ref:`Control<class_Control>` so that it rides along with the split bar. Try setting the :ref:`Button<class_Button>` anchors to ``center`` prior to the ``reparent()`` call.
  218. ::
  219. $BarnacleButton.reparent($SplitContainer.get_drag_area_control())
  220. \ **Note:** The drag area :ref:`Control<class_Control>` is drawn over the **SplitContainer**'s children, so :ref:`CanvasItem<class_CanvasItem>` draw objects called from the :ref:`Control<class_Control>` and children added to the :ref:`Control<class_Control>` will also appear over the **SplitContainer**'s children. Try setting :ref:`Control.mouse_filter<class_Control_property_mouse_filter>` of custom children to :ref:`Control.MOUSE_FILTER_IGNORE<class_Control_constant_MOUSE_FILTER_IGNORE>` to prevent blocking the mouse from dragging if desired.
  221. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash.
  222. .. rst-class:: classref-section-separator
  223. ----
  224. .. rst-class:: classref-descriptions-group
  225. Theme Property Descriptions
  226. ---------------------------
  227. .. _class_SplitContainer_theme_constant_autohide:
  228. .. rst-class:: classref-themeproperty
  229. :ref:`int<class_int>` **autohide** = ``1`` :ref:`🔗<class_SplitContainer_theme_constant_autohide>`
  230. 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<class_SplitContainer_property_dragger_visibility>` must be :ref:`DRAGGER_VISIBLE<class_SplitContainer_constant_DRAGGER_VISIBLE>`.
  231. .. rst-class:: classref-item-separator
  232. ----
  233. .. _class_SplitContainer_theme_constant_minimum_grab_thickness:
  234. .. rst-class:: classref-themeproperty
  235. :ref:`int<class_int>` **minimum_grab_thickness** = ``6`` :ref:`🔗<class_SplitContainer_theme_constant_minimum_grab_thickness>`
  236. 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<class_SplitContainer_theme_constant_separation>` or :ref:`h_grabber<class_SplitContainer_theme_icon_h_grabber>` / :ref:`v_grabber<class_SplitContainer_theme_icon_v_grabber>`'s size is too narrow to easily select.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_SplitContainer_theme_constant_separation:
  240. .. rst-class:: classref-themeproperty
  241. :ref:`int<class_int>` **separation** = ``12`` :ref:`🔗<class_SplitContainer_theme_constant_separation>`
  242. 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<class_SplitContainer_property_dragger_visibility>` is set to :ref:`DRAGGER_VISIBLE<class_SplitContainer_constant_DRAGGER_VISIBLE>`, or :ref:`DRAGGER_HIDDEN<class_SplitContainer_constant_DRAGGER_HIDDEN>`, and :ref:`separation<class_SplitContainer_theme_constant_separation>` is smaller than the size of the grabber icon in the same axis.
  243. \ **Note:** To obtain :ref:`separation<class_SplitContainer_theme_constant_separation>` values less than the size of the grabber icon, for example a ``1 px`` hairline, set :ref:`h_grabber<class_SplitContainer_theme_icon_h_grabber>` or :ref:`v_grabber<class_SplitContainer_theme_icon_v_grabber>` to a new :ref:`ImageTexture<class_ImageTexture>`, which effectively sets the grabber icon size to ``0 px``.
  244. .. rst-class:: classref-item-separator
  245. ----
  246. .. _class_SplitContainer_theme_icon_grabber:
  247. .. rst-class:: classref-themeproperty
  248. :ref:`Texture2D<class_Texture2D>` **grabber** :ref:`🔗<class_SplitContainer_theme_icon_grabber>`
  249. The icon used for the grabber drawn in the middle area.
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_SplitContainer_theme_icon_h_grabber:
  253. .. rst-class:: classref-themeproperty
  254. :ref:`Texture2D<class_Texture2D>` **h_grabber** :ref:`🔗<class_SplitContainer_theme_icon_h_grabber>`
  255. The icon used for the grabber drawn in the middle area when :ref:`vertical<class_SplitContainer_property_vertical>` is ``false``.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_SplitContainer_theme_icon_v_grabber:
  259. .. rst-class:: classref-themeproperty
  260. :ref:`Texture2D<class_Texture2D>` **v_grabber** :ref:`🔗<class_SplitContainer_theme_icon_v_grabber>`
  261. The icon used for the grabber drawn in the middle area when :ref:`vertical<class_SplitContainer_property_vertical>` is ``true``.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_SplitContainer_theme_style_split_bar_background:
  265. .. rst-class:: classref-themeproperty
  266. :ref:`StyleBox<class_StyleBox>` **split_bar_background** :ref:`🔗<class_SplitContainer_theme_style_split_bar_background>`
  267. Determines the background of the split bar if its thickness is greater than zero.
  268. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  269. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  270. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  271. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  272. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  273. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  274. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  275. .. |void| replace:: :abbr:`void (No return value.)`