123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- :github_url: hide
- .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the Range.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _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:`TextureProgress<class_TextureProgress>`
- Abstract base class for range-based controls.
- Description
- -----------
- Range is a base class for :ref:`Control<class_Control>` nodes that change a floating-point *value* between a *minimum* and a *maximum*, using *step* and *page*, for example a :ref:`ScrollBar<class_ScrollBar>`.
- Properties
- ----------
- +---------------------------+----------------------------------------------------------+-----------+
- | :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`` |
- +---------------------------+----------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`step<class_Range_property_step>` | ``1.0`` |
- +---------------------------+----------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`value<class_Range_property_value>` | ``0.0`` |
- +---------------------------+----------------------------------------------------------+-----------+
- Methods
- -------
- +------+---------------------------------------------------------------------------------+
- | void | :ref:`share<class_Range_method_share>` **(** :ref:`Node<class_Node>` with **)** |
- +------+---------------------------------------------------------------------------------+
- | void | :ref:`unshare<class_Range_method_unshare>` **(** **)** |
- +------+---------------------------------------------------------------------------------+
- Signals
- -------
- .. _class_Range_signal_changed:
- - **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.
- ----
- .. _class_Range_signal_value_changed:
- - **value_changed** **(** :ref:`float<class_float>` value **)**
- 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.
- Property Descriptions
- ---------------------
- .. _class_Range_property_allow_greater:
- - :ref:`bool<class_bool>` **allow_greater**
- +-----------+--------------------------+
- | *Default* | ``false`` |
- +-----------+--------------------------+
- | *Setter* | set_allow_greater(value) |
- +-----------+--------------------------+
- | *Getter* | is_greater_allowed() |
- +-----------+--------------------------+
- If ``true``, :ref:`value<class_Range_property_value>` may be greater than :ref:`max_value<class_Range_property_max_value>`.
- ----
- .. _class_Range_property_allow_lesser:
- - :ref:`bool<class_bool>` **allow_lesser**
- +-----------+-------------------------+
- | *Default* | ``false`` |
- +-----------+-------------------------+
- | *Setter* | set_allow_lesser(value) |
- +-----------+-------------------------+
- | *Getter* | is_lesser_allowed() |
- +-----------+-------------------------+
- If ``true``, :ref:`value<class_Range_property_value>` may be less than :ref:`min_value<class_Range_property_min_value>`.
- ----
- .. _class_Range_property_exp_edit:
- - :ref:`bool<class_bool>` **exp_edit**
- +-----------+----------------------+
- | *Default* | ``false`` |
- +-----------+----------------------+
- | *Setter* | set_exp_ratio(value) |
- +-----------+----------------------+
- | *Getter* | is_ratio_exp() |
- +-----------+----------------------+
- If ``true``, and ``min_value`` is greater than 0, ``value`` will be represented exponentially rather than linearly.
- ----
- .. _class_Range_property_max_value:
- - :ref:`float<class_float>` **max_value**
- +-----------+----------------+
- | *Default* | ``100.0`` |
- +-----------+----------------+
- | *Setter* | set_max(value) |
- +-----------+----------------+
- | *Getter* | get_max() |
- +-----------+----------------+
- Maximum value. Range is clamped if ``value`` is greater than ``max_value``.
- ----
- .. _class_Range_property_min_value:
- - :ref:`float<class_float>` **min_value**
- +-----------+----------------+
- | *Default* | ``0.0`` |
- +-----------+----------------+
- | *Setter* | set_min(value) |
- +-----------+----------------+
- | *Getter* | get_min() |
- +-----------+----------------+
- Minimum value. Range is clamped if ``value`` is less than ``min_value``.
- ----
- .. _class_Range_property_page:
- - :ref:`float<class_float>` **page**
- +-----------+-----------------+
- | *Default* | ``0.0`` |
- +-----------+-----------------+
- | *Setter* | set_page(value) |
- +-----------+-----------------+
- | *Getter* | get_page() |
- +-----------+-----------------+
- Page size. Used mainly for :ref:`ScrollBar<class_ScrollBar>`. ScrollBar's length is its size multiplied by ``page`` over the difference between ``min_value`` and ``max_value``.
- ----
- .. _class_Range_property_ratio:
- - :ref:`float<class_float>` **ratio**
- +----------+---------------------+
- | *Setter* | set_as_ratio(value) |
- +----------+---------------------+
- | *Getter* | get_as_ratio() |
- +----------+---------------------+
- The value mapped between 0 and 1.
- ----
- .. _class_Range_property_rounded:
- - :ref:`bool<class_bool>` **rounded**
- +-----------+-------------------------------+
- | *Default* | ``false`` |
- +-----------+-------------------------------+
- | *Setter* | set_use_rounded_values(value) |
- +-----------+-------------------------------+
- | *Getter* | is_using_rounded_values() |
- +-----------+-------------------------------+
- If ``true``, ``value`` will always be rounded to the nearest integer.
- ----
- .. _class_Range_property_step:
- - :ref:`float<class_float>` **step**
- +-----------+-----------------+
- | *Default* | ``1.0`` |
- +-----------+-----------------+
- | *Setter* | set_step(value) |
- +-----------+-----------------+
- | *Getter* | get_step() |
- +-----------+-----------------+
- If greater than 0, ``value`` will always be rounded to a multiple of ``step``. If ``rounded`` is also ``true``, ``value`` will first be rounded to a multiple of ``step`` then rounded to the nearest integer.
- ----
- .. _class_Range_property_value:
- - :ref:`float<class_float>` **value**
- +-----------+------------------+
- | *Default* | ``0.0`` |
- +-----------+------------------+
- | *Setter* | set_value(value) |
- +-----------+------------------+
- | *Getter* | get_value() |
- +-----------+------------------+
- Range's current value.
- Method Descriptions
- -------------------
- .. _class_Range_method_share:
- - void **share** **(** :ref:`Node<class_Node>` with **)**
- 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.
- ----
- .. _class_Range_method_unshare:
- - void **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.)`
|