class_range.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Range.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Range:
  5. Range
  6. =====
  7. **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`SpinBox<class_spinbox>`, :ref:`ScrollBar<class_scrollbar>`, :ref:`ProgressBar<class_progressbar>`, :ref:`TextureProgress<class_textureprogress>`, :ref:`Slider<class_slider>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Abstract base class for range-based controls.
  13. Member Functions
  14. ----------------
  15. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`get_as_ratio<class_Range_get_as_ratio>` **(** **)** const |
  17. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  18. | :ref:`float<class_float>` | :ref:`get_max<class_Range_get_max>` **(** **)** const |
  19. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`get_min<class_Range_get_min>` **(** **)** const |
  21. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`get_page<class_Range_get_page>` **(** **)** const |
  23. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  24. | :ref:`float<class_float>` | :ref:`get_step<class_Range_get_step>` **(** **)** const |
  25. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  26. | :ref:`float<class_float>` | :ref:`get_value<class_Range_get_value>` **(** **)** const |
  27. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`is_ratio_exp<class_Range_is_ratio_exp>` **(** **)** const |
  29. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`is_using_rounded_values<class_Range_is_using_rounded_values>` **(** **)** const |
  31. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`set_as_ratio<class_Range_set_as_ratio>` **(** :ref:`float<class_float>` value **)** |
  33. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_exp_ratio<class_Range_set_exp_ratio>` **(** :ref:`bool<class_bool>` enabled **)** |
  35. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`set_max<class_Range_set_max>` **(** :ref:`float<class_float>` maximum **)** |
  37. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set_min<class_Range_set_min>` **(** :ref:`float<class_float>` minimum **)** |
  39. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_page<class_Range_set_page>` **(** :ref:`float<class_float>` pagesize **)** |
  41. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`set_step<class_Range_set_step>` **(** :ref:`float<class_float>` step **)** |
  43. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_use_rounded_values<class_Range_set_use_rounded_values>` **(** :ref:`bool<class_bool>` enabled **)** |
  45. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_value<class_Range_set_value>` **(** :ref:`float<class_float>` value **)** |
  47. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`share<class_Range_share>` **(** :ref:`Node<class_node>` with **)** |
  49. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`unshare<class_Range_unshare>` **(** **)** |
  51. +----------------------------+-----------------------------------------------------------------------------------------------------------------+
  52. Signals
  53. -------
  54. - **changed** **(** **)**
  55. This signal is emitted when min, max, range or step change.
  56. - **value_changed** **(** :ref:`float<class_float>` value **)**
  57. This signal is emitted when value changes.
  58. Member Variables
  59. ----------------
  60. - :ref:`bool<class_bool>` **exp_edit** - If [code]true[/code] and [code]min_value[/code] is greater than 0, [code]value[/code] will be represented exponentially rather than linearly.
  61. - :ref:`float<class_float>` **max_value** - Maximum value. Range is clamped if [code]value[/code] is greater than [code]max_value[/code]. Default value: 100.
  62. - :ref:`float<class_float>` **min_value** - Minimum value. Range is clamped if [code]value[/code] is less than [code]min_value[/code]. Default value: 0.
  63. - :ref:`float<class_float>` **page** - Page size. Used mainly for [ScrollBar]. ScrollBar's length is its size multiplied by [code]page[/code] over the difference between [code]min_value[/code] and [code]max_value[/code].
  64. - :ref:`bool<class_bool>` **rounded** - If [code]true[/code], [code]value[/code] will always be rounded to the nearest integer.
  65. - :ref:`float<class_float>` **step** - If greater than 0, [code]value[/code] will always be rounded to a multiple of [code]step[/code]. If [code]rounded[/code] is also [code]true[/code], [code]value[/code] will first be rounded to a multiple of [code]step[/code] then rounded to the nearest integer.
  66. - :ref:`float<class_float>` **value** - Range's current value.
  67. Description
  68. -----------
  69. 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>`.
  70. Member Function Description
  71. ---------------------------
  72. .. _class_Range_get_as_ratio:
  73. - :ref:`float<class_float>` **get_as_ratio** **(** **)** const
  74. Return value mapped to 0 to 1 range.
  75. .. _class_Range_get_max:
  76. - :ref:`float<class_float>` **get_max** **(** **)** const
  77. Return the maximum value.
  78. .. _class_Range_get_min:
  79. - :ref:`float<class_float>` **get_min** **(** **)** const
  80. Return the minimum value.
  81. .. _class_Range_get_page:
  82. - :ref:`float<class_float>` **get_page** **(** **)** const
  83. Return the page size, if page is 0, paging is disabled.
  84. .. _class_Range_get_step:
  85. - :ref:`float<class_float>` **get_step** **(** **)** const
  86. Return the stepping, if step is 0, stepping is disabled.
  87. .. _class_Range_get_value:
  88. - :ref:`float<class_float>` **get_value** **(** **)** const
  89. .. _class_Range_is_ratio_exp:
  90. - :ref:`bool<class_bool>` **is_ratio_exp** **(** **)** const
  91. .. _class_Range_is_using_rounded_values:
  92. - :ref:`bool<class_bool>` **is_using_rounded_values** **(** **)** const
  93. .. _class_Range_set_as_ratio:
  94. - void **set_as_ratio** **(** :ref:`float<class_float>` value **)**
  95. Set value mapped to 0 to 1 (unit) range, it will then be converted to the actual value within min and max.
  96. .. _class_Range_set_exp_ratio:
  97. - void **set_exp_ratio** **(** :ref:`bool<class_bool>` enabled **)**
  98. .. _class_Range_set_max:
  99. - void **set_max** **(** :ref:`float<class_float>` maximum **)**
  100. .. _class_Range_set_min:
  101. - void **set_min** **(** :ref:`float<class_float>` minimum **)**
  102. Set minimum value, clamped range value to it if it's less.
  103. .. _class_Range_set_page:
  104. - void **set_page** **(** :ref:`float<class_float>` pagesize **)**
  105. Set page size. Page is mainly used for scrollbars or anything that controls text scrolling.
  106. .. _class_Range_set_step:
  107. - void **set_step** **(** :ref:`float<class_float>` step **)**
  108. Set step value. If step is 0, stepping will be disabled.
  109. .. _class_Range_set_use_rounded_values:
  110. - void **set_use_rounded_values** **(** :ref:`bool<class_bool>` enabled **)**
  111. .. _class_Range_set_value:
  112. - void **set_value** **(** :ref:`float<class_float>` value **)**
  113. .. _class_Range_share:
  114. - void **share** **(** :ref:`Node<class_node>` with **)**
  115. 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.
  116. .. _class_Range_unshare:
  117. - void **unshare** **(** **)**
  118. Stop Range from sharing its member variables with any other Range.