123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- :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/Range.xml.
- .. _class_Range:
- Range
- =====
- **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- **Inherited By:** :ref:`EditorSpinSlider<class_EditorSpinSlider>`, :ref:`ProgressBar<class_ProgressBar>`, :ref:`ScrollBar<class_ScrollBar>`, :ref:`Slider<class_Slider>`, :ref:`SpinBox<class_SpinBox>`, :ref:`TextureProgressBar<class_TextureProgressBar>`
- Abstract base class for controls that represent a number within a range.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- Range is an abstract base class for controls that represent a number within a range, using a configured :ref:`step<class_Range_property_step>` and :ref:`page<class_Range_property_page>` size. See e.g. :ref:`ScrollBar<class_ScrollBar>` and :ref:`Slider<class_Slider>` for examples of higher-level nodes using Range.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`allow_greater<class_Range_property_allow_greater>` | ``false`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`allow_lesser<class_Range_property_allow_lesser>` | ``false`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`exp_edit<class_Range_property_exp_edit>` | ``false`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`max_value<class_Range_property_max_value>` | ``100.0`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`min_value<class_Range_property_min_value>` | ``0.0`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`page<class_Range_property_page>` | ``0.0`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`ratio<class_Range_property_ratio>` | |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`rounded<class_Range_property_rounded>` | ``false`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | |bitfield|\[:ref:`SizeFlags<enum_Control_SizeFlags>`\] | size_flags_vertical | ``0`` (overrides :ref:`Control<class_Control_property_size_flags_vertical>`) |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`step<class_Range_property_step>` | ``0.01`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`value<class_Range_property_value>` | ``0.0`` |
- +--------------------------------------------------------+----------------------------------------------------------+------------------------------------------------------------------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +--------+-------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`_value_changed<class_Range_private_method__value_changed>`\ (\ new_value\: :ref:`float<class_float>`\ ) |virtual| |
- +--------+-------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_value_no_signal<class_Range_method_set_value_no_signal>`\ (\ value\: :ref:`float<class_float>`\ ) |
- +--------+-------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`share<class_Range_method_share>`\ (\ with\: :ref:`Node<class_Node>`\ ) |
- +--------+-------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`unshare<class_Range_method_unshare>`\ (\ ) |
- +--------+-------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Signals
- -------
- .. _class_Range_signal_changed:
- .. rst-class:: classref-signal
- **changed**\ (\ ) :ref:`🔗<class_Range_signal_changed>`
- Emitted when :ref:`min_value<class_Range_property_min_value>`, :ref:`max_value<class_Range_property_max_value>`, :ref:`page<class_Range_property_page>`, or :ref:`step<class_Range_property_step>` change.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_signal_value_changed:
- .. rst-class:: classref-signal
- **value_changed**\ (\ value\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Range_signal_value_changed>`
- Emitted when :ref:`value<class_Range_property_value>` changes. When used on a :ref:`Slider<class_Slider>`, this is called continuously while dragging (potentially every frame). If you are performing an expensive operation in a function connected to :ref:`value_changed<class_Range_signal_value_changed>`, consider using a *debouncing* :ref:`Timer<class_Timer>` to call the function less often.
- \ **Note:** Unlike signals such as :ref:`LineEdit.text_changed<class_LineEdit_signal_text_changed>`, :ref:`value_changed<class_Range_signal_value_changed>` is also emitted when ``value`` is set directly via code.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_Range_property_allow_greater:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **allow_greater** = ``false`` :ref:`🔗<class_Range_property_allow_greater>`
- .. rst-class:: classref-property-setget
- - |void| **set_allow_greater**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_greater_allowed**\ (\ )
- If ``true``, :ref:`value<class_Range_property_value>` may be greater than :ref:`max_value<class_Range_property_max_value>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_allow_lesser:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **allow_lesser** = ``false`` :ref:`🔗<class_Range_property_allow_lesser>`
- .. rst-class:: classref-property-setget
- - |void| **set_allow_lesser**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_lesser_allowed**\ (\ )
- If ``true``, :ref:`value<class_Range_property_value>` may be less than :ref:`min_value<class_Range_property_min_value>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_exp_edit:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **exp_edit** = ``false`` :ref:`🔗<class_Range_property_exp_edit>`
- .. rst-class:: classref-property-setget
- - |void| **set_exp_ratio**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_ratio_exp**\ (\ )
- If ``true``, and :ref:`min_value<class_Range_property_min_value>` is greater than 0, :ref:`value<class_Range_property_value>` will be represented exponentially rather than linearly.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_max_value:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **max_value** = ``100.0`` :ref:`🔗<class_Range_property_max_value>`
- .. rst-class:: classref-property-setget
- - |void| **set_max**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_max**\ (\ )
- Maximum value. Range is clamped if :ref:`value<class_Range_property_value>` is greater than :ref:`max_value<class_Range_property_max_value>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_min_value:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **min_value** = ``0.0`` :ref:`🔗<class_Range_property_min_value>`
- .. rst-class:: classref-property-setget
- - |void| **set_min**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_min**\ (\ )
- Minimum value. Range is clamped if :ref:`value<class_Range_property_value>` is less than :ref:`min_value<class_Range_property_min_value>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_page:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **page** = ``0.0`` :ref:`🔗<class_Range_property_page>`
- .. rst-class:: classref-property-setget
- - |void| **set_page**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_page**\ (\ )
- Page size. Used mainly for :ref:`ScrollBar<class_ScrollBar>`. A :ref:`ScrollBar<class_ScrollBar>`'s grabber length is the :ref:`ScrollBar<class_ScrollBar>`'s size multiplied by :ref:`page<class_Range_property_page>` over the difference between :ref:`min_value<class_Range_property_min_value>` and :ref:`max_value<class_Range_property_max_value>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_ratio:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **ratio** :ref:`🔗<class_Range_property_ratio>`
- .. rst-class:: classref-property-setget
- - |void| **set_as_ratio**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_as_ratio**\ (\ )
- The value mapped between 0 and 1.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_rounded:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **rounded** = ``false`` :ref:`🔗<class_Range_property_rounded>`
- .. rst-class:: classref-property-setget
- - |void| **set_use_rounded_values**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_using_rounded_values**\ (\ )
- If ``true``, :ref:`value<class_Range_property_value>` will always be rounded to the nearest integer.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_step:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **step** = ``0.01`` :ref:`🔗<class_Range_property_step>`
- .. rst-class:: classref-property-setget
- - |void| **set_step**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_step**\ (\ )
- If greater than 0, :ref:`value<class_Range_property_value>` will always be rounded to a multiple of this property's value. If :ref:`rounded<class_Range_property_rounded>` is also ``true``, :ref:`value<class_Range_property_value>` will first be rounded to a multiple of this property's value, then rounded to the nearest integer.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_property_value:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **value** = ``0.0`` :ref:`🔗<class_Range_property_value>`
- .. rst-class:: classref-property-setget
- - |void| **set_value**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_value**\ (\ )
- Range's current value. Changing this property (even via code) will trigger :ref:`value_changed<class_Range_signal_value_changed>` signal. Use :ref:`set_value_no_signal<class_Range_method_set_value_no_signal>` if you want to avoid it.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_Range_private_method__value_changed:
- .. rst-class:: classref-method
- |void| **_value_changed**\ (\ new_value\: :ref:`float<class_float>`\ ) |virtual| :ref:`🔗<class_Range_private_method__value_changed>`
- Called when the **Range**'s value is changed (following the same conditions as :ref:`value_changed<class_Range_signal_value_changed>`).
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_method_set_value_no_signal:
- .. rst-class:: classref-method
- |void| **set_value_no_signal**\ (\ value\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Range_method_set_value_no_signal>`
- Sets the **Range**'s current value to the specified ``value``, without emitting the :ref:`value_changed<class_Range_signal_value_changed>` signal.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_method_share:
- .. rst-class:: classref-method
- |void| **share**\ (\ with\: :ref:`Node<class_Node>`\ ) :ref:`🔗<class_Range_method_share>`
- Binds two **Range**\ s together along with any ranges previously grouped with either of them. When any of range's member variables change, it will share the new value with all other ranges in its group.
- .. rst-class:: classref-item-separator
- ----
- .. _class_Range_method_unshare:
- .. rst-class:: classref-method
- |void| **unshare**\ (\ ) :ref:`🔗<class_Range_method_unshare>`
- Stops the **Range** from sharing its member variables with any other.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |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.)`
|