class_scrollcontainer.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ScrollContainer.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ScrollContainer:
  6. ScrollContainer
  7. ===============
  8. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`EditorInspector<class_EditorInspector>`
  10. A helper node for displaying scrollable elements such as lists.
  11. Description
  12. -----------
  13. A ScrollContainer node meant to contain a :ref:`Control<class_Control>` child.
  14. ScrollContainers will automatically create a scrollbar child (:ref:`HScrollBar<class_HScrollBar>`, :ref:`VScrollBar<class_VScrollBar>`, or both) when needed and will only draw the Control within the ScrollContainer area. 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 :ref:`Control.rect_min_size<class_Control_property_rect_min_size>` of the Control relative to the ScrollContainer.
  15. Works great with a :ref:`Panel<class_Panel>` control. You can set ``EXPAND`` on the children's size flags, so they will upscale to the ScrollContainer's size if it's larger (scroll is invisible for the chosen dimension).
  16. Properties
  17. ----------
  18. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`follow_focus<class_ScrollContainer_property_follow_focus>` | ``false`` |
  20. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  21. | :ref:`bool<class_bool>` | rect_clip_content | ``true`` *(parent override)* |
  22. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  23. | :ref:`int<class_int>` | :ref:`scroll_deadzone<class_ScrollContainer_property_scroll_deadzone>` | ``0`` |
  24. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  25. | :ref:`int<class_int>` | :ref:`scroll_horizontal<class_ScrollContainer_property_scroll_horizontal>` | ``0`` |
  26. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`scroll_horizontal_enabled<class_ScrollContainer_property_scroll_horizontal_enabled>` | ``true`` |
  28. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`scroll_horizontal_visible<class_ScrollContainer_property_scroll_horizontal_visible>` | ``true`` |
  30. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  31. | :ref:`int<class_int>` | :ref:`scroll_vertical<class_ScrollContainer_property_scroll_vertical>` | ``0`` |
  32. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`scroll_vertical_enabled<class_ScrollContainer_property_scroll_vertical_enabled>` | ``true`` |
  34. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`scroll_vertical_visible<class_ScrollContainer_property_scroll_vertical_visible>` | ``true`` |
  36. +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  37. Methods
  38. -------
  39. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`ensure_control_visible<class_ScrollContainer_method_ensure_control_visible>` **(** :ref:`Control<class_Control>` control **)** |
  41. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`HScrollBar<class_HScrollBar>` | :ref:`get_h_scrollbar<class_ScrollContainer_method_get_h_scrollbar>` **(** **)** |
  43. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`VScrollBar<class_VScrollBar>` | :ref:`get_v_scrollbar<class_ScrollContainer_method_get_v_scrollbar>` **(** **)** |
  45. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  46. Theme Properties
  47. ----------------
  48. +---------------------------------+-------------------------------------------------+
  49. | :ref:`StyleBox<class_StyleBox>` | :ref:`bg<class_ScrollContainer_theme_style_bg>` |
  50. +---------------------------------+-------------------------------------------------+
  51. Signals
  52. -------
  53. .. _class_ScrollContainer_signal_scroll_ended:
  54. - **scroll_ended** **(** **)**
  55. Emitted when scrolling stops.
  56. ----
  57. .. _class_ScrollContainer_signal_scroll_started:
  58. - **scroll_started** **(** **)**
  59. Emitted when scrolling is started.
  60. Property Descriptions
  61. ---------------------
  62. .. _class_ScrollContainer_property_follow_focus:
  63. - :ref:`bool<class_bool>` **follow_focus**
  64. +-----------+-------------------------+
  65. | *Default* | ``false`` |
  66. +-----------+-------------------------+
  67. | *Setter* | set_follow_focus(value) |
  68. +-----------+-------------------------+
  69. | *Getter* | is_following_focus() |
  70. +-----------+-------------------------+
  71. If ``true``, the ScrollContainer will automatically scroll to focused children (including indirect children) to make sure they are fully visible.
  72. ----
  73. .. _class_ScrollContainer_property_scroll_deadzone:
  74. - :ref:`int<class_int>` **scroll_deadzone**
  75. +-----------+---------------------+
  76. | *Default* | ``0`` |
  77. +-----------+---------------------+
  78. | *Setter* | set_deadzone(value) |
  79. +-----------+---------------------+
  80. | *Getter* | get_deadzone() |
  81. +-----------+---------------------+
  82. ----
  83. .. _class_ScrollContainer_property_scroll_horizontal:
  84. - :ref:`int<class_int>` **scroll_horizontal**
  85. +-----------+---------------------+
  86. | *Default* | ``0`` |
  87. +-----------+---------------------+
  88. | *Setter* | set_h_scroll(value) |
  89. +-----------+---------------------+
  90. | *Getter* | get_h_scroll() |
  91. +-----------+---------------------+
  92. The current horizontal scroll value.
  93. ----
  94. .. _class_ScrollContainer_property_scroll_horizontal_enabled:
  95. - :ref:`bool<class_bool>` **scroll_horizontal_enabled**
  96. +-----------+----------------------------+
  97. | *Default* | ``true`` |
  98. +-----------+----------------------------+
  99. | *Setter* | set_enable_h_scroll(value) |
  100. +-----------+----------------------------+
  101. | *Getter* | is_h_scroll_enabled() |
  102. +-----------+----------------------------+
  103. If ``true``, enables horizontal scrolling.
  104. ----
  105. .. _class_ScrollContainer_property_scroll_horizontal_visible:
  106. - :ref:`bool<class_bool>` **scroll_horizontal_visible**
  107. +-----------+-----------------------------+
  108. | *Default* | ``true`` |
  109. +-----------+-----------------------------+
  110. | *Setter* | set_h_scroll_visible(value) |
  111. +-----------+-----------------------------+
  112. | *Getter* | is_h_scroll_visible() |
  113. +-----------+-----------------------------+
  114. If ``false``, hides the horizontal scrollbar.
  115. ----
  116. .. _class_ScrollContainer_property_scroll_vertical:
  117. - :ref:`int<class_int>` **scroll_vertical**
  118. +-----------+---------------------+
  119. | *Default* | ``0`` |
  120. +-----------+---------------------+
  121. | *Setter* | set_v_scroll(value) |
  122. +-----------+---------------------+
  123. | *Getter* | get_v_scroll() |
  124. +-----------+---------------------+
  125. The current vertical scroll value.
  126. ----
  127. .. _class_ScrollContainer_property_scroll_vertical_enabled:
  128. - :ref:`bool<class_bool>` **scroll_vertical_enabled**
  129. +-----------+----------------------------+
  130. | *Default* | ``true`` |
  131. +-----------+----------------------------+
  132. | *Setter* | set_enable_v_scroll(value) |
  133. +-----------+----------------------------+
  134. | *Getter* | is_v_scroll_enabled() |
  135. +-----------+----------------------------+
  136. If ``true``, enables vertical scrolling.
  137. ----
  138. .. _class_ScrollContainer_property_scroll_vertical_visible:
  139. - :ref:`bool<class_bool>` **scroll_vertical_visible**
  140. +-----------+-----------------------------+
  141. | *Default* | ``true`` |
  142. +-----------+-----------------------------+
  143. | *Setter* | set_v_scroll_visible(value) |
  144. +-----------+-----------------------------+
  145. | *Getter* | is_v_scroll_visible() |
  146. +-----------+-----------------------------+
  147. If ``false``, hides the vertical scrollbar.
  148. Method Descriptions
  149. -------------------
  150. .. _class_ScrollContainer_method_ensure_control_visible:
  151. - void **ensure_control_visible** **(** :ref:`Control<class_Control>` control **)**
  152. Ensures the given ``control`` is visible (must be a direct or indirect child of the ScrollContainer). Used by :ref:`follow_focus<class_ScrollContainer_property_follow_focus>`.
  153. ----
  154. .. _class_ScrollContainer_method_get_h_scrollbar:
  155. - :ref:`HScrollBar<class_HScrollBar>` **get_h_scrollbar** **(** **)**
  156. Returns the horizontal scrollbar :ref:`HScrollBar<class_HScrollBar>` of this ``ScrollContainer``.
  157. **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to disable the horizontal scrollbar, use :ref:`scroll_horizontal_enabled<class_ScrollContainer_property_scroll_horizontal_enabled>`. If you want to only hide it instead, use :ref:`scroll_horizontal_visible<class_ScrollContainer_property_scroll_horizontal_visible>`.
  158. ----
  159. .. _class_ScrollContainer_method_get_v_scrollbar:
  160. - :ref:`VScrollBar<class_VScrollBar>` **get_v_scrollbar** **(** **)**
  161. Returns the vertical scrollbar :ref:`VScrollBar<class_VScrollBar>` of this ``ScrollContainer``.
  162. **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to disable the vertical scrollbar, use :ref:`scroll_vertical_enabled<class_ScrollContainer_property_scroll_vertical_enabled>`. If you want to only hide it instead, use :ref:`scroll_vertical_visible<class_ScrollContainer_property_scroll_vertical_visible>`.
  163. Theme Property Descriptions
  164. ---------------------------
  165. .. _class_ScrollContainer_theme_style_bg:
  166. - :ref:`StyleBox<class_StyleBox>` **bg**
  167. The background :ref:`StyleBox<class_StyleBox>` of the ``ScrollContainer``.
  168. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  169. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  170. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  171. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  172. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  173. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`