class_range.rst 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Range.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Range:
  6. Range
  7. =====
  8. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`ProgressBar<class_ProgressBar>`, :ref:`ScrollBar<class_ScrollBar>`, :ref:`Slider<class_Slider>`, :ref:`SpinBox<class_SpinBox>`, :ref:`TextureProgress<class_TextureProgress>`
  10. **Category:** Core
  11. Brief Description
  12. -----------------
  13. Abstract base class for range-based controls.
  14. Properties
  15. ----------
  16. +---------------------------+----------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`allow_greater<class_Range_property_allow_greater>` |
  18. +---------------------------+----------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`allow_lesser<class_Range_property_allow_lesser>` |
  20. +---------------------------+----------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`exp_edit<class_Range_property_exp_edit>` |
  22. +---------------------------+----------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`max_value<class_Range_property_max_value>` |
  24. +---------------------------+----------------------------------------------------------+
  25. | :ref:`float<class_float>` | :ref:`min_value<class_Range_property_min_value>` |
  26. +---------------------------+----------------------------------------------------------+
  27. | :ref:`float<class_float>` | :ref:`page<class_Range_property_page>` |
  28. +---------------------------+----------------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`ratio<class_Range_property_ratio>` |
  30. +---------------------------+----------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`rounded<class_Range_property_rounded>` |
  32. +---------------------------+----------------------------------------------------------+
  33. | :ref:`float<class_float>` | :ref:`step<class_Range_property_step>` |
  34. +---------------------------+----------------------------------------------------------+
  35. | :ref:`float<class_float>` | :ref:`value<class_Range_property_value>` |
  36. +---------------------------+----------------------------------------------------------+
  37. Methods
  38. -------
  39. +------+---------------------------------------------------------------------------------+
  40. | void | :ref:`share<class_Range_method_share>` **(** :ref:`Node<class_Node>` with **)** |
  41. +------+---------------------------------------------------------------------------------+
  42. | void | :ref:`unshare<class_Range_method_unshare>` **(** **)** |
  43. +------+---------------------------------------------------------------------------------+
  44. Signals
  45. -------
  46. .. _class_Range_signal_changed:
  47. - **changed** **(** :ref:`float<class_float>` value **)**
  48. 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.
  49. ----
  50. .. _class_Range_signal_value_changed:
  51. - **value_changed** **(** :ref:`float<class_float>` value **)**
  52. Emitted when :ref:`value<class_Range_property_value>` changes.
  53. Description
  54. -----------
  55. 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>`.
  56. Property Descriptions
  57. ---------------------
  58. .. _class_Range_property_allow_greater:
  59. - :ref:`bool<class_bool>` **allow_greater**
  60. +----------+--------------------------+
  61. | *Setter* | set_allow_greater(value) |
  62. +----------+--------------------------+
  63. | *Getter* | is_greater_allowed() |
  64. +----------+--------------------------+
  65. If ``true``, :ref:`value<class_Range_property_value>` may be greater than :ref:`max_value<class_Range_property_max_value>`. Default value: ``false``.
  66. ----
  67. .. _class_Range_property_allow_lesser:
  68. - :ref:`bool<class_bool>` **allow_lesser**
  69. +----------+-------------------------+
  70. | *Setter* | set_allow_lesser(value) |
  71. +----------+-------------------------+
  72. | *Getter* | is_lesser_allowed() |
  73. +----------+-------------------------+
  74. If ``true``, :ref:`value<class_Range_property_value>` may be less than :ref:`min_value<class_Range_property_min_value>`. Default value: ``false``.
  75. ----
  76. .. _class_Range_property_exp_edit:
  77. - :ref:`bool<class_bool>` **exp_edit**
  78. +----------+----------------------+
  79. | *Setter* | set_exp_ratio(value) |
  80. +----------+----------------------+
  81. | *Getter* | is_ratio_exp() |
  82. +----------+----------------------+
  83. If ``true``, and ``min_value`` is greater than 0, ``value`` will be represented exponentially rather than linearly.
  84. ----
  85. .. _class_Range_property_max_value:
  86. - :ref:`float<class_float>` **max_value**
  87. +----------+----------------+
  88. | *Setter* | set_max(value) |
  89. +----------+----------------+
  90. | *Getter* | get_max() |
  91. +----------+----------------+
  92. Maximum value. Range is clamped if ``value`` is greater than ``max_value``. Default value: ``100``.
  93. ----
  94. .. _class_Range_property_min_value:
  95. - :ref:`float<class_float>` **min_value**
  96. +----------+----------------+
  97. | *Setter* | set_min(value) |
  98. +----------+----------------+
  99. | *Getter* | get_min() |
  100. +----------+----------------+
  101. Minimum value. Range is clamped if ``value`` is less than ``min_value``. Default value: ``0``.
  102. ----
  103. .. _class_Range_property_page:
  104. - :ref:`float<class_float>` **page**
  105. +----------+-----------------+
  106. | *Setter* | set_page(value) |
  107. +----------+-----------------+
  108. | *Getter* | get_page() |
  109. +----------+-----------------+
  110. 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``.
  111. ----
  112. .. _class_Range_property_ratio:
  113. - :ref:`float<class_float>` **ratio**
  114. +----------+---------------------+
  115. | *Setter* | set_as_ratio(value) |
  116. +----------+---------------------+
  117. | *Getter* | get_as_ratio() |
  118. +----------+---------------------+
  119. The value mapped between 0 and 1.
  120. ----
  121. .. _class_Range_property_rounded:
  122. - :ref:`bool<class_bool>` **rounded**
  123. +----------+-------------------------------+
  124. | *Setter* | set_use_rounded_values(value) |
  125. +----------+-------------------------------+
  126. | *Getter* | is_using_rounded_values() |
  127. +----------+-------------------------------+
  128. If ``true``, ``value`` will always be rounded to the nearest integer. Default value: ``false``.
  129. ----
  130. .. _class_Range_property_step:
  131. - :ref:`float<class_float>` **step**
  132. +----------+-----------------+
  133. | *Setter* | set_step(value) |
  134. +----------+-----------------+
  135. | *Getter* | get_step() |
  136. +----------+-----------------+
  137. 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.
  138. ----
  139. .. _class_Range_property_value:
  140. - :ref:`float<class_float>` **value**
  141. +----------+------------------+
  142. | *Setter* | set_value(value) |
  143. +----------+------------------+
  144. | *Getter* | get_value() |
  145. +----------+------------------+
  146. Range's current value.
  147. Method Descriptions
  148. -------------------
  149. .. _class_Range_method_share:
  150. - void **share** **(** :ref:`Node<class_Node>` with **)**
  151. Binds two ranges 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.
  152. ----
  153. .. _class_Range_method_unshare:
  154. - void **unshare** **(** **)**
  155. Stop range from sharing its member variables with any other.