mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
380 lines
15 KiB
ReStructuredText
380 lines
15 KiB
ReStructuredText
: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/Slider.xml.
|
|
|
|
.. _class_Slider:
|
|
|
|
Slider
|
|
======
|
|
|
|
**Inherits:** :ref:`Range<class_Range>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
**Inherited By:** :ref:`HSlider<class_HSlider>`, :ref:`VSlider<class_VSlider>`
|
|
|
|
Abstract base class for sliders.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`editable<class_Slider_property_editable>` | ``true`` |
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
| :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`scrollable<class_Slider_property_scrollable>` | ``true`` |
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | step | ``1.0`` (overrides :ref:`Range<class_Range_property_step>`) |
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`tick_count<class_Slider_property_tick_count>` | ``0`` |
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`ticks_on_borders<class_Slider_property_ticks_on_borders>` | ``false`` |
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
| :ref:`TickPosition<enum_Slider_TickPosition>` | :ref:`ticks_position<class_Slider_property_ticks_position>` | ``0`` |
|
|
+-----------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Theme Properties
|
|
----------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`int<class_int>` | :ref:`center_grabber<class_Slider_theme_constant_center_grabber>` | ``0`` |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`int<class_int>` | :ref:`grabber_offset<class_Slider_theme_constant_grabber_offset>` | ``0`` |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`int<class_int>` | :ref:`tick_offset<class_Slider_theme_constant_tick_offset>` | ``0`` |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`grabber<class_Slider_theme_icon_grabber>` | |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`grabber_disabled<class_Slider_theme_icon_grabber_disabled>` | |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`grabber_highlight<class_Slider_theme_icon_grabber_highlight>` | |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`tick<class_Slider_theme_icon_tick>` | |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`StyleBox<class_StyleBox>` | :ref:`grabber_area<class_Slider_theme_style_grabber_area>` | |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`StyleBox<class_StyleBox>` | :ref:`grabber_area_highlight<class_Slider_theme_style_grabber_area_highlight>` | |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
| :ref:`StyleBox<class_StyleBox>` | :ref:`slider<class_Slider_theme_style_slider>` | |
|
|
+-----------------------------------+--------------------------------------------------------------------------------+-------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Signals
|
|
-------
|
|
|
|
.. _class_Slider_signal_drag_ended:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**drag_ended**\ (\ value_changed\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Slider_signal_drag_ended>`
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_signal_drag_started:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**drag_started**\ (\ ) :ref:`🔗<class_Slider_signal_drag_started>`
|
|
|
|
Emitted when the grabber starts being dragged. This is emitted before the corresponding :ref:`Range.value_changed<class_Range_signal_value_changed>` signal.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_Slider_TickPosition:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **TickPosition**: :ref:`🔗<enum_Slider_TickPosition>`
|
|
|
|
.. _class_Slider_constant_TICK_POSITION_BOTTOM_RIGHT:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_BOTTOM_RIGHT** = ``0``
|
|
|
|
Places the ticks at the bottom of the :ref:`HSlider<class_HSlider>`, or right of the :ref:`VSlider<class_VSlider>`.
|
|
|
|
.. _class_Slider_constant_TICK_POSITION_TOP_LEFT:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_TOP_LEFT** = ``1``
|
|
|
|
Places the ticks at the top of the :ref:`HSlider<class_HSlider>`, or left of the :ref:`VSlider<class_VSlider>`.
|
|
|
|
.. _class_Slider_constant_TICK_POSITION_BOTH:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_BOTH** = ``2``
|
|
|
|
Places the ticks at the both sides of the slider.
|
|
|
|
.. _class_Slider_constant_TICK_POSITION_CENTER:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`TickPosition<enum_Slider_TickPosition>` **TICK_POSITION_CENTER** = ``3``
|
|
|
|
Places the ticks at the center of the slider.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_Slider_property_editable:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **editable** = ``true`` :ref:`🔗<class_Slider_property_editable>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_editable**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **is_editable**\ (\ )
|
|
|
|
If ``true``, the slider can be interacted with. If ``false``, the value can be changed only by code.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_property_scrollable:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **scrollable** = ``true`` :ref:`🔗<class_Slider_property_scrollable>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_scrollable**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **is_scrollable**\ (\ )
|
|
|
|
If ``true``, the value can be changed using the mouse wheel.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_property_tick_count:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **tick_count** = ``0`` :ref:`🔗<class_Slider_property_tick_count>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_ticks**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_ticks**\ (\ )
|
|
|
|
Number of ticks displayed on the slider, including border ticks. Ticks are uniformly-distributed value markers.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_property_ticks_on_borders:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **ticks_on_borders** = ``false`` :ref:`🔗<class_Slider_property_ticks_on_borders>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_ticks_on_borders**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **get_ticks_on_borders**\ (\ )
|
|
|
|
If ``true``, the slider will display ticks for minimum and maximum values.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_property_ticks_position:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`TickPosition<enum_Slider_TickPosition>` **ticks_position** = ``0`` :ref:`🔗<class_Slider_property_ticks_position>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_ticks_position**\ (\ value\: :ref:`TickPosition<enum_Slider_TickPosition>`\ )
|
|
- :ref:`TickPosition<enum_Slider_TickPosition>` **get_ticks_position**\ (\ )
|
|
|
|
Sets the position of the ticks. See :ref:`TickPosition<enum_Slider_TickPosition>` for details.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Theme Property Descriptions
|
|
---------------------------
|
|
|
|
.. _class_Slider_theme_constant_center_grabber:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`int<class_int>` **center_grabber** = ``0`` :ref:`🔗<class_Slider_theme_constant_center_grabber>`
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_constant_grabber_offset:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`int<class_int>` **grabber_offset** = ``0`` :ref:`🔗<class_Slider_theme_constant_grabber_offset>`
|
|
|
|
Vertical or horizontal offset of the grabber.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_constant_tick_offset:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`int<class_int>` **tick_offset** = ``0`` :ref:`🔗<class_Slider_theme_constant_tick_offset>`
|
|
|
|
Vertical or horizontal offset of the ticks. The offset is reversed for top or left ticks.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_icon_grabber:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **grabber** :ref:`🔗<class_Slider_theme_icon_grabber>`
|
|
|
|
The texture for the grabber (the draggable element).
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_icon_grabber_disabled:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **grabber_disabled** :ref:`🔗<class_Slider_theme_icon_grabber_disabled>`
|
|
|
|
The texture for the grabber when it's disabled.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_icon_grabber_highlight:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **grabber_highlight** :ref:`🔗<class_Slider_theme_icon_grabber_highlight>`
|
|
|
|
The texture for the grabber when it's focused.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_icon_tick:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **tick** :ref:`🔗<class_Slider_theme_icon_tick>`
|
|
|
|
The texture for the ticks, visible when :ref:`tick_count<class_Slider_property_tick_count>` is greater than 0.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_style_grabber_area:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`StyleBox<class_StyleBox>` **grabber_area** :ref:`🔗<class_Slider_theme_style_grabber_area>`
|
|
|
|
The background of the area to the left or bottom of the grabber.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_style_grabber_area_highlight:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`StyleBox<class_StyleBox>` **grabber_area_highlight** :ref:`🔗<class_Slider_theme_style_grabber_area_highlight>`
|
|
|
|
The background of the area to the left or bottom of the grabber that displays when it's being hovered or focused.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Slider_theme_style_slider:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`StyleBox<class_StyleBox>` **slider** :ref:`🔗<class_Slider_theme_style_slider>`
|
|
|
|
The background for the whole slider. Affects the height or width of the :ref:`grabber_area<class_Slider_theme_style_grabber_area>`.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |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.)`
|