2
0

class_checkbox.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/CheckBox.xml.
  6. .. _class_CheckBox:
  7. CheckBox
  8. ========
  9. **Inherits:** :ref:`Button<class_Button>` **<** :ref:`BaseButton<class_BaseButton>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Binary choice user interface widget. See also :ref:`CheckButton<class_CheckButton>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A checkbox allows the user to make a binary choice (choosing only one of two possible options). It's similar to :ref:`CheckButton<class_CheckButton>` in functionality, but it has a different appearance. To follow established UX patterns, it's recommended to use CheckBox when toggling it has **no** immediate effect on something. For instance, it should be used when toggling it will only do something once a confirmation button is pressed.
  15. See also :ref:`BaseButton<class_BaseButton>` which contains common properties and methods associated with this node.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-----------------------------------------+-------------+-------------------------------------------------------------------------------+
  22. | :ref:`TextAlign<enum_Button_TextAlign>` | align | ``0`` (overrides :ref:`Button<class_Button_property_align>`) |
  23. +-----------------------------------------+-------------+-------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | toggle_mode | ``true`` (overrides :ref:`BaseButton<class_BaseButton_property_toggle_mode>`) |
  25. +-----------------------------------------+-------------+-------------------------------------------------------------------------------+
  26. .. rst-class:: classref-reftable-group
  27. Theme Properties
  28. ----------------
  29. .. table::
  30. :widths: auto
  31. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  32. | :ref:`Color<class_Color>` | :ref:`font_color<class_CheckBox_theme_color_font_color>` | ``Color( 0.88, 0.88, 0.88, 1 )`` |
  33. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  34. | :ref:`Color<class_Color>` | :ref:`font_color_disabled<class_CheckBox_theme_color_font_color_disabled>` | ``Color( 0.9, 0.9, 0.9, 0.2 )`` |
  35. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  36. | :ref:`Color<class_Color>` | :ref:`font_color_focus<class_CheckBox_theme_color_font_color_focus>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  37. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  38. | :ref:`Color<class_Color>` | :ref:`font_color_hover<class_CheckBox_theme_color_font_color_hover>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  39. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  40. | :ref:`Color<class_Color>` | :ref:`font_color_hover_pressed<class_CheckBox_theme_color_font_color_hover_pressed>` | ``Color( 1, 1, 1, 1 )`` |
  41. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  42. | :ref:`Color<class_Color>` | :ref:`font_color_pressed<class_CheckBox_theme_color_font_color_pressed>` | ``Color( 1, 1, 1, 1 )`` |
  43. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  44. | :ref:`int<class_int>` | :ref:`check_vadjust<class_CheckBox_theme_constant_check_vadjust>` | ``0`` |
  45. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  46. | :ref:`int<class_int>` | :ref:`hseparation<class_CheckBox_theme_constant_hseparation>` | ``4`` |
  47. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  48. | :ref:`Font<class_Font>` | :ref:`font<class_CheckBox_theme_font_font>` | |
  49. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  50. | :ref:`Texture<class_Texture>` | :ref:`checked<class_CheckBox_theme_icon_checked>` | |
  51. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  52. | :ref:`Texture<class_Texture>` | :ref:`checked_disabled<class_CheckBox_theme_icon_checked_disabled>` | |
  53. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  54. | :ref:`Texture<class_Texture>` | :ref:`radio_checked<class_CheckBox_theme_icon_radio_checked>` | |
  55. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  56. | :ref:`Texture<class_Texture>` | :ref:`radio_checked_disabled<class_CheckBox_theme_icon_radio_checked_disabled>` | |
  57. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  58. | :ref:`Texture<class_Texture>` | :ref:`radio_unchecked<class_CheckBox_theme_icon_radio_unchecked>` | |
  59. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  60. | :ref:`Texture<class_Texture>` | :ref:`radio_unchecked_disabled<class_CheckBox_theme_icon_radio_unchecked_disabled>` | |
  61. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  62. | :ref:`Texture<class_Texture>` | :ref:`unchecked<class_CheckBox_theme_icon_unchecked>` | |
  63. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  64. | :ref:`Texture<class_Texture>` | :ref:`unchecked_disabled<class_CheckBox_theme_icon_unchecked_disabled>` | |
  65. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  66. | :ref:`StyleBox<class_StyleBox>` | :ref:`disabled<class_CheckBox_theme_style_disabled>` | |
  67. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  68. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_CheckBox_theme_style_focus>` | |
  69. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  70. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_CheckBox_theme_style_hover>` | |
  71. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  72. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover_pressed<class_CheckBox_theme_style_hover_pressed>` | |
  73. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  74. | :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_CheckBox_theme_style_normal>` | |
  75. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  76. | :ref:`StyleBox<class_StyleBox>` | :ref:`pressed<class_CheckBox_theme_style_pressed>` | |
  77. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  78. .. rst-class:: classref-section-separator
  79. ----
  80. .. rst-class:: classref-descriptions-group
  81. Theme Property Descriptions
  82. ---------------------------
  83. .. _class_CheckBox_theme_color_font_color:
  84. .. rst-class:: classref-themeproperty
  85. :ref:`Color<class_Color>` **font_color** = ``Color( 0.88, 0.88, 0.88, 1 )``
  86. The **CheckBox** text's font color.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_CheckBox_theme_color_font_color_disabled:
  90. .. rst-class:: classref-themeproperty
  91. :ref:`Color<class_Color>` **font_color_disabled** = ``Color( 0.9, 0.9, 0.9, 0.2 )``
  92. The **CheckBox** text's font color when it's disabled.
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_CheckBox_theme_color_font_color_focus:
  96. .. rst-class:: classref-themeproperty
  97. :ref:`Color<class_Color>` **font_color_focus** = ``Color( 0.94, 0.94, 0.94, 1 )``
  98. The **CheckBox** text's font color when it's focused. Only replaces the normal text color of the checkbox. Disabled, hovered, and pressed states take precedence over this color.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_CheckBox_theme_color_font_color_hover:
  102. .. rst-class:: classref-themeproperty
  103. :ref:`Color<class_Color>` **font_color_hover** = ``Color( 0.94, 0.94, 0.94, 1 )``
  104. The **CheckBox** text's font color when it's hovered.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_CheckBox_theme_color_font_color_hover_pressed:
  108. .. rst-class:: classref-themeproperty
  109. :ref:`Color<class_Color>` **font_color_hover_pressed** = ``Color( 1, 1, 1, 1 )``
  110. The **CheckBox** text's font color when it's hovered and pressed.
  111. .. rst-class:: classref-item-separator
  112. ----
  113. .. _class_CheckBox_theme_color_font_color_pressed:
  114. .. rst-class:: classref-themeproperty
  115. :ref:`Color<class_Color>` **font_color_pressed** = ``Color( 1, 1, 1, 1 )``
  116. The **CheckBox** text's font color when it's pressed.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_CheckBox_theme_constant_check_vadjust:
  120. .. rst-class:: classref-themeproperty
  121. :ref:`int<class_int>` **check_vadjust** = ``0``
  122. The vertical offset used when rendering the check icons (in pixels).
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_CheckBox_theme_constant_hseparation:
  126. .. rst-class:: classref-themeproperty
  127. :ref:`int<class_int>` **hseparation** = ``4``
  128. The separation between the check icon and the text (in pixels).
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_CheckBox_theme_font_font:
  132. .. rst-class:: classref-themeproperty
  133. :ref:`Font<class_Font>` **font**
  134. The :ref:`Font<class_Font>` to use for the **CheckBox** text.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_CheckBox_theme_icon_checked:
  138. .. rst-class:: classref-themeproperty
  139. :ref:`Texture<class_Texture>` **checked**
  140. The check icon to display when the **CheckBox** is checked.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_CheckBox_theme_icon_checked_disabled:
  144. .. rst-class:: classref-themeproperty
  145. :ref:`Texture<class_Texture>` **checked_disabled**
  146. The check icon to display when the **CheckBox** is checked and disabled.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_CheckBox_theme_icon_radio_checked:
  150. .. rst-class:: classref-themeproperty
  151. :ref:`Texture<class_Texture>` **radio_checked**
  152. If the **CheckBox** is configured as a radio button, the icon to display when the **CheckBox** is checked.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_CheckBox_theme_icon_radio_checked_disabled:
  156. .. rst-class:: classref-themeproperty
  157. :ref:`Texture<class_Texture>` **radio_checked_disabled**
  158. .. container:: contribute
  159. There is currently no description for this theme property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_CheckBox_theme_icon_radio_unchecked:
  163. .. rst-class:: classref-themeproperty
  164. :ref:`Texture<class_Texture>` **radio_unchecked**
  165. If the **CheckBox** is configured as a radio button, the icon to display when the **CheckBox** is unchecked.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_CheckBox_theme_icon_radio_unchecked_disabled:
  169. .. rst-class:: classref-themeproperty
  170. :ref:`Texture<class_Texture>` **radio_unchecked_disabled**
  171. .. container:: contribute
  172. There is currently no description for this theme property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_CheckBox_theme_icon_unchecked:
  176. .. rst-class:: classref-themeproperty
  177. :ref:`Texture<class_Texture>` **unchecked**
  178. The check icon to display when the **CheckBox** is unchecked.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_CheckBox_theme_icon_unchecked_disabled:
  182. .. rst-class:: classref-themeproperty
  183. :ref:`Texture<class_Texture>` **unchecked_disabled**
  184. The check icon to display when the **CheckBox** is unchecked and disabled.
  185. .. rst-class:: classref-item-separator
  186. ----
  187. .. _class_CheckBox_theme_style_disabled:
  188. .. rst-class:: classref-themeproperty
  189. :ref:`StyleBox<class_StyleBox>` **disabled**
  190. The :ref:`StyleBox<class_StyleBox>` to display as a background when the **CheckBox** is disabled.
  191. .. rst-class:: classref-item-separator
  192. ----
  193. .. _class_CheckBox_theme_style_focus:
  194. .. rst-class:: classref-themeproperty
  195. :ref:`StyleBox<class_StyleBox>` **focus**
  196. The :ref:`StyleBox<class_StyleBox>` to display as a background when the **CheckBox** is focused.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_CheckBox_theme_style_hover:
  200. .. rst-class:: classref-themeproperty
  201. :ref:`StyleBox<class_StyleBox>` **hover**
  202. The :ref:`StyleBox<class_StyleBox>` to display as a background when the **CheckBox** is hovered.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _class_CheckBox_theme_style_hover_pressed:
  206. .. rst-class:: classref-themeproperty
  207. :ref:`StyleBox<class_StyleBox>` **hover_pressed**
  208. The :ref:`StyleBox<class_StyleBox>` to display as a background when the **CheckBox** is hovered and pressed.
  209. .. rst-class:: classref-item-separator
  210. ----
  211. .. _class_CheckBox_theme_style_normal:
  212. .. rst-class:: classref-themeproperty
  213. :ref:`StyleBox<class_StyleBox>` **normal**
  214. The :ref:`StyleBox<class_StyleBox>` to display as a background.
  215. .. rst-class:: classref-item-separator
  216. ----
  217. .. _class_CheckBox_theme_style_pressed:
  218. .. rst-class:: classref-themeproperty
  219. :ref:`StyleBox<class_StyleBox>` **pressed**
  220. The :ref:`StyleBox<class_StyleBox>` to display as a background when the **CheckBox** is pressed.
  221. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  222. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  223. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  224. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`