SplitContainer.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 splits two child controls horizontally or vertically and provides a grabber for adjusting the split ratio.
  5. </brief_description>
  6. <description>
  7. 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.
  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. <description>
  16. Clamps the [member split_offset] value to not go outside the currently possible minimal and maximum values.
  17. </description>
  18. </method>
  19. <method name="get_drag_area_control">
  20. <return type="Control" />
  21. <description>
  22. 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.
  23. [codeblock]
  24. $BarnacleButton.reparent($SplitContainer.get_drag_area_control())
  25. [/codeblock]
  26. [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.
  27. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash.
  28. </description>
  29. </method>
  30. </methods>
  31. <members>
  32. <member name="collapsed" type="bool" setter="set_collapsed" getter="is_collapsed" default="false">
  33. If [code]true[/code], the dragger will be disabled and the children will be sized as if the [member split_offset] was [code]0[/code].
  34. </member>
  35. <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">
  36. 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].
  37. </member>
  38. <member name="drag_area_margin_begin" type="int" setter="set_drag_area_margin_begin" getter="get_drag_area_margin_begin" default="0">
  39. Reduces the size of the drag area and split bar [theme_item split_bar_background] at the beginning of the container.
  40. </member>
  41. <member name="drag_area_margin_end" type="int" setter="set_drag_area_margin_end" getter="get_drag_area_margin_end" default="0">
  42. Reduces the size of the drag area and split bar [theme_item split_bar_background] at the end of the container.
  43. </member>
  44. <member name="drag_area_offset" type="int" setter="set_drag_area_offset" getter="get_drag_area_offset" default="0">
  45. 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.
  46. </member>
  47. <member name="dragger_visibility" type="int" setter="set_dragger_visibility" getter="get_dragger_visibility" enum="SplitContainer.DraggerVisibility" default="0">
  48. Determines the dragger's visibility. See [enum DraggerVisibility] for details. This property does not determine whether dragging is enabled or not. Use [member dragging_enabled] for that.
  49. </member>
  50. <member name="dragging_enabled" type="bool" setter="set_dragging_enabled" getter="is_dragging_enabled" default="true">
  51. Enables or disables split dragging.
  52. </member>
  53. <member name="split_offset" type="int" setter="set_split_offset" getter="get_split_offset" default="0">
  54. The initial offset of the splitting between the two [Control]s, with [code]0[/code] being at the end of the first [Control].
  55. </member>
  56. <member name="touch_dragger_enabled" type="bool" setter="set_touch_dragger_enabled" getter="is_touch_dragger_enabled" default="false">
  57. 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.
  58. </member>
  59. <member name="vertical" type="bool" setter="set_vertical" getter="is_vertical" default="false">
  60. If [code]true[/code], the [SplitContainer] will arrange its children vertically, rather than horizontally.
  61. Can't be changed when using [HSplitContainer] and [VSplitContainer].
  62. </member>
  63. </members>
  64. <signals>
  65. <signal name="drag_ended">
  66. <description>
  67. Emitted when the user ends dragging.
  68. </description>
  69. </signal>
  70. <signal name="drag_started">
  71. <description>
  72. Emitted when the user starts dragging.
  73. </description>
  74. </signal>
  75. <signal name="dragged">
  76. <param index="0" name="offset" type="int" />
  77. <description>
  78. Emitted when the dragger is dragged by user.
  79. </description>
  80. </signal>
  81. </signals>
  82. <constants>
  83. <constant name="DRAGGER_VISIBLE" value="0" enum="DraggerVisibility">
  84. The split dragger icon is always visible when [theme_item autohide] is [code]false[/code], otherwise visible only when the cursor hovers it.
  85. The size of the grabber icon determines the minimum [theme_item separation].
  86. The dragger icon is automatically hidden if the length of the grabber icon is longer than the split bar.
  87. </constant>
  88. <constant name="DRAGGER_HIDDEN" value="1" enum="DraggerVisibility">
  89. The split dragger icon is never visible regardless of the value of [theme_item autohide].
  90. The size of the grabber icon determines the minimum [theme_item separation].
  91. </constant>
  92. <constant name="DRAGGER_HIDDEN_COLLAPSED" value="2" enum="DraggerVisibility">
  93. The split dragger icon is not visible, and the split bar is collapsed to zero thickness.
  94. </constant>
  95. </constants>
  96. <theme_items>
  97. <theme_item name="autohide" data_type="constant" type="int" default="1">
  98. Boolean value. If [code]1[/code] ([code]true[/code]), the grabber will hide automatically when it isn't under the cursor. If [code]0[/code] ([code]false[/code]), it's always visible. The [member dragger_visibility] must be [constant DRAGGER_VISIBLE].
  99. </theme_item>
  100. <theme_item name="minimum_grab_thickness" data_type="constant" type="int" default="6">
  101. 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 [theme_item separation] or [theme_item h_grabber] / [theme_item v_grabber]'s size is too narrow to easily select.
  102. </theme_item>
  103. <theme_item name="separation" data_type="constant" type="int" default="12">
  104. 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 [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.
  105. [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].
  106. </theme_item>
  107. <theme_item name="grabber" data_type="icon" type="Texture2D">
  108. The icon used for the grabber drawn in the middle area. This is only used in [HSplitContainer] and [VSplitContainer]. For [SplitContainer], see [theme_item h_grabber] and [theme_item v_grabber] instead.
  109. </theme_item>
  110. <theme_item name="h_grabber" data_type="icon" type="Texture2D">
  111. The icon used for the grabber drawn in the middle area when [member vertical] is [code]false[/code].
  112. </theme_item>
  113. <theme_item name="h_touch_dragger" data_type="icon" type="Texture2D">
  114. The icon used for the drag handle when [member touch_dragger_enabled] is [code]true[/code] and [member vertical] is [code]false[/code].
  115. </theme_item>
  116. <theme_item name="touch_dragger" data_type="icon" type="Texture2D">
  117. 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.
  118. </theme_item>
  119. <theme_item name="v_grabber" data_type="icon" type="Texture2D">
  120. The icon used for the grabber drawn in the middle area when [member vertical] is [code]true[/code].
  121. </theme_item>
  122. <theme_item name="v_touch_dragger" data_type="icon" type="Texture2D">
  123. The icon used for the drag handle when [member touch_dragger_enabled] is [code]true[/code] and [member vertical] is [code]true[/code].
  124. </theme_item>
  125. <theme_item name="split_bar_background" data_type="style" type="StyleBox">
  126. Determines the background of the split bar if its thickness is greater than zero.
  127. </theme_item>
  128. </theme_items>
  129. </class>