class_slider.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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/Slider.xml.
  6. .. _class_Slider:
  7. Slider
  8. ======
  9. **Inherits:** :ref:`Range<class_Range>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`HSlider<class_HSlider>`, :ref:`VSlider<class_VSlider>`
  11. Abstract base class for sliders.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Abstract base class for sliders, used to adjust a value by moving a grabber along a horizontal or vertical axis. Sliders are :ref:`Range<class_Range>`-based controls.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`editable<class_Slider_property_editable>` | ``true`` |
  23. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  24. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
  25. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`scrollable<class_Slider_property_scrollable>` | ``true`` |
  27. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | step | ``1.0`` (overrides :ref:`Range<class_Range_property_step>`) |
  29. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`tick_count<class_Slider_property_tick_count>` | ``0`` |
  31. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`ticks_on_borders<class_Slider_property_ticks_on_borders>` | ``false`` |
  33. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  34. | :ref:`TickPosition<enum_Slider_TickPosition>` | :ref:`ticks_position<class_Slider_property_ticks_position>` | ``0`` |
  35. +-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
  36. .. rst-class:: classref-reftable-group
  37. Theme Properties
  38. ----------------
  39. .. table::
  40. :widths: auto
  41. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  42. | :ref:`int<class_int>` | :ref:`center_grabber<class_Slider_theme_constant_center_grabber>` | ``0`` |
  43. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  44. | :ref:`int<class_int>` | :ref:`grabber_offset<class_Slider_theme_constant_grabber_offset>` | ``0`` |
  45. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  46. | :ref:`int<class_int>` | :ref:`tick_offset<class_Slider_theme_constant_tick_offset>` | ``0`` |
  47. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  48. | :ref:`Texture2D<class_Texture2D>` | :ref:`grabber<class_Slider_theme_icon_grabber>` | |
  49. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  50. | :ref:`Texture2D<class_Texture2D>` | :ref:`grabber_disabled<class_Slider_theme_icon_grabber_disabled>` | |
  51. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  52. | :ref:`Texture2D<class_Texture2D>` | :ref:`grabber_highlight<class_Slider_theme_icon_grabber_highlight>` | |
  53. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  54. | :ref:`Texture2D<class_Texture2D>` | :ref:`tick<class_Slider_theme_icon_tick>` | |
  55. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  56. | :ref:`StyleBox<class_StyleBox>` | :ref:`grabber_area<class_Slider_theme_style_grabber_area>` | |
  57. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  58. | :ref:`StyleBox<class_StyleBox>` | :ref:`grabber_area_highlight<class_Slider_theme_style_grabber_area_highlight>` | |
  59. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  60. | :ref:`StyleBox<class_StyleBox>` | :ref:`slider<class_Slider_theme_style_slider>` | |
  61. +-----------------------------------+--------------------------------------------------------------------------------+-------+
  62. .. rst-class:: classref-section-separator
  63. ----
  64. .. rst-class:: classref-descriptions-group
  65. Signals
  66. -------
  67. .. _class_Slider_signal_drag_ended:
  68. .. rst-class:: classref-signal
  69. **drag_ended**\ (\ value_changed\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Slider_signal_drag_ended>`
  70. Emitted when the grabber stops being dragged. If ``value_changed`` is ``true``, :ref:`Range.value<class_Range_property_value>` is different from the value when the dragging was started.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_Slider_signal_drag_started:
  74. .. rst-class:: classref-signal
  75. **drag_started**\ (\ ) :ref:`🔗<class_Slider_signal_drag_started>`
  76. Emitted when the grabber starts being dragged. This is emitted before the corresponding :ref:`Range.value_changed<class_Range_signal_value_changed>` signal.
  77. .. rst-class:: classref-section-separator
  78. ----
  79. .. rst-class:: classref-descriptions-group
  80. Enumerations
  81. ------------
  82. .. _enum_Slider_TickPosition:
  83. .. rst-class:: classref-enumeration
  84. enum **TickPosition**: :ref:`🔗<enum_Slider_TickPosition>`
  85. .. _class_Slider_constant_TICK_POSITION_BOTTOM_RIGHT:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_BOTTOM_RIGHT** = ``0``
  88. Places the ticks at the bottom of the :ref:`HSlider<class_HSlider>`, or right of the :ref:`VSlider<class_VSlider>`.
  89. .. _class_Slider_constant_TICK_POSITION_TOP_LEFT:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_TOP_LEFT** = ``1``
  92. Places the ticks at the top of the :ref:`HSlider<class_HSlider>`, or left of the :ref:`VSlider<class_VSlider>`.
  93. .. _class_Slider_constant_TICK_POSITION_BOTH:
  94. .. rst-class:: classref-enumeration-constant
  95. :ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_BOTH** = ``2``
  96. Places the ticks at the both sides of the slider.
  97. .. _class_Slider_constant_TICK_POSITION_CENTER:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_CENTER** = ``3``
  100. Places the ticks at the center of the slider.
  101. .. rst-class:: classref-section-separator
  102. ----
  103. .. rst-class:: classref-descriptions-group
  104. Property Descriptions
  105. ---------------------
  106. .. _class_Slider_property_editable:
  107. .. rst-class:: classref-property
  108. :ref:`bool<class_bool>` **editable** = ``true`` :ref:`🔗<class_Slider_property_editable>`
  109. .. rst-class:: classref-property-setget
  110. - |void| **set_editable**\ (\ value\: :ref:`bool<class_bool>`\ )
  111. - :ref:`bool<class_bool>` **is_editable**\ (\ )
  112. If ``true``, the slider can be interacted with. If ``false``, the value can be changed only by code.
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_Slider_property_scrollable:
  116. .. rst-class:: classref-property
  117. :ref:`bool<class_bool>` **scrollable** = ``true`` :ref:`🔗<class_Slider_property_scrollable>`
  118. .. rst-class:: classref-property-setget
  119. - |void| **set_scrollable**\ (\ value\: :ref:`bool<class_bool>`\ )
  120. - :ref:`bool<class_bool>` **is_scrollable**\ (\ )
  121. If ``true``, the value can be changed using the mouse wheel.
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_Slider_property_tick_count:
  125. .. rst-class:: classref-property
  126. :ref:`int<class_int>` **tick_count** = ``0`` :ref:`🔗<class_Slider_property_tick_count>`
  127. .. rst-class:: classref-property-setget
  128. - |void| **set_ticks**\ (\ value\: :ref:`int<class_int>`\ )
  129. - :ref:`int<class_int>` **get_ticks**\ (\ )
  130. Number of ticks displayed on the slider, including border ticks. Ticks are uniformly-distributed value markers.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_Slider_property_ticks_on_borders:
  134. .. rst-class:: classref-property
  135. :ref:`bool<class_bool>` **ticks_on_borders** = ``false`` :ref:`🔗<class_Slider_property_ticks_on_borders>`
  136. .. rst-class:: classref-property-setget
  137. - |void| **set_ticks_on_borders**\ (\ value\: :ref:`bool<class_bool>`\ )
  138. - :ref:`bool<class_bool>` **get_ticks_on_borders**\ (\ )
  139. If ``true``, the slider will display ticks for minimum and maximum values.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_Slider_property_ticks_position:
  143. .. rst-class:: classref-property
  144. :ref:`TickPosition<enum_Slider_TickPosition>` **ticks_position** = ``0`` :ref:`🔗<class_Slider_property_ticks_position>`
  145. .. rst-class:: classref-property-setget
  146. - |void| **set_ticks_position**\ (\ value\: :ref:`TickPosition<enum_Slider_TickPosition>`\ )
  147. - :ref:`TickPosition<enum_Slider_TickPosition>` **get_ticks_position**\ (\ )
  148. Sets the position of the ticks. See :ref:`TickPosition<enum_Slider_TickPosition>` for details.
  149. .. rst-class:: classref-section-separator
  150. ----
  151. .. rst-class:: classref-descriptions-group
  152. Theme Property Descriptions
  153. ---------------------------
  154. .. _class_Slider_theme_constant_center_grabber:
  155. .. rst-class:: classref-themeproperty
  156. :ref:`int<class_int>` **center_grabber** = ``0`` :ref:`🔗<class_Slider_theme_constant_center_grabber>`
  157. Boolean constant. If ``1``, the grabber texture size will be ignored and it will fit within slider's bounds based only on its center position.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_Slider_theme_constant_grabber_offset:
  161. .. rst-class:: classref-themeproperty
  162. :ref:`int<class_int>` **grabber_offset** = ``0`` :ref:`🔗<class_Slider_theme_constant_grabber_offset>`
  163. Vertical or horizontal offset of the grabber.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_Slider_theme_constant_tick_offset:
  167. .. rst-class:: classref-themeproperty
  168. :ref:`int<class_int>` **tick_offset** = ``0`` :ref:`🔗<class_Slider_theme_constant_tick_offset>`
  169. Vertical or horizontal offset of the ticks. The offset is reversed for top or left ticks.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_Slider_theme_icon_grabber:
  173. .. rst-class:: classref-themeproperty
  174. :ref:`Texture2D<class_Texture2D>` **grabber** :ref:`🔗<class_Slider_theme_icon_grabber>`
  175. The texture for the grabber (the draggable element).
  176. .. rst-class:: classref-item-separator
  177. ----
  178. .. _class_Slider_theme_icon_grabber_disabled:
  179. .. rst-class:: classref-themeproperty
  180. :ref:`Texture2D<class_Texture2D>` **grabber_disabled** :ref:`🔗<class_Slider_theme_icon_grabber_disabled>`
  181. The texture for the grabber when it's disabled.
  182. .. rst-class:: classref-item-separator
  183. ----
  184. .. _class_Slider_theme_icon_grabber_highlight:
  185. .. rst-class:: classref-themeproperty
  186. :ref:`Texture2D<class_Texture2D>` **grabber_highlight** :ref:`🔗<class_Slider_theme_icon_grabber_highlight>`
  187. The texture for the grabber when it's focused.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_Slider_theme_icon_tick:
  191. .. rst-class:: classref-themeproperty
  192. :ref:`Texture2D<class_Texture2D>` **tick** :ref:`🔗<class_Slider_theme_icon_tick>`
  193. The texture for the ticks, visible when :ref:`tick_count<class_Slider_property_tick_count>` is greater than 0.
  194. .. rst-class:: classref-item-separator
  195. ----
  196. .. _class_Slider_theme_style_grabber_area:
  197. .. rst-class:: classref-themeproperty
  198. :ref:`StyleBox<class_StyleBox>` **grabber_area** :ref:`🔗<class_Slider_theme_style_grabber_area>`
  199. The background of the area to the left or bottom of the grabber.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_Slider_theme_style_grabber_area_highlight:
  203. .. rst-class:: classref-themeproperty
  204. :ref:`StyleBox<class_StyleBox>` **grabber_area_highlight** :ref:`🔗<class_Slider_theme_style_grabber_area_highlight>`
  205. The background of the area to the left or bottom of the grabber that displays when it's being hovered or focused.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_Slider_theme_style_slider:
  209. .. rst-class:: classref-themeproperty
  210. :ref:`StyleBox<class_StyleBox>` **slider** :ref:`🔗<class_Slider_theme_style_slider>`
  211. The background for the whole slider. Affects the height or width of the :ref:`grabber_area<class_Slider_theme_style_grabber_area>`.
  212. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  213. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  214. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  215. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  216. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  217. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  218. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  219. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  220. .. |void| replace:: :abbr:`void (No return value.)`