class_checkbox.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the CheckBox.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_CheckBox:
  6. CheckBox
  7. ========
  8. **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>`
  9. Binary choice user interface widget. See also :ref:`CheckButton<class_CheckButton>`.
  10. Description
  11. -----------
  12. 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.
  13. See also :ref:`BaseButton<class_BaseButton>` which contains common properties and methods associated with this node.
  14. Properties
  15. ----------
  16. +-----------------------------------------+-------------+------------------------------+
  17. | :ref:`TextAlign<enum_Button_TextAlign>` | align | ``0`` *(parent override)* |
  18. +-----------------------------------------+-------------+------------------------------+
  19. | :ref:`bool<class_bool>` | toggle_mode | ``true`` *(parent override)* |
  20. +-----------------------------------------+-------------+------------------------------+
  21. Theme Properties
  22. ----------------
  23. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  24. | :ref:`Color<class_Color>` | :ref:`font_color<class_CheckBox_theme_color_font_color>` | ``Color( 0.88, 0.88, 0.88, 1 )`` |
  25. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  26. | :ref:`Color<class_Color>` | :ref:`font_color_disabled<class_CheckBox_theme_color_font_color_disabled>` | ``Color( 0.9, 0.9, 0.9, 0.2 )`` |
  27. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  28. | :ref:`Color<class_Color>` | :ref:`font_color_focus<class_CheckBox_theme_color_font_color_focus>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  29. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  30. | :ref:`Color<class_Color>` | :ref:`font_color_hover<class_CheckBox_theme_color_font_color_hover>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  31. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  32. | :ref:`Color<class_Color>` | :ref:`font_color_hover_pressed<class_CheckBox_theme_color_font_color_hover_pressed>` | ``Color( 1, 1, 1, 1 )`` |
  33. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  34. | :ref:`Color<class_Color>` | :ref:`font_color_pressed<class_CheckBox_theme_color_font_color_pressed>` | ``Color( 1, 1, 1, 1 )`` |
  35. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  36. | :ref:`int<class_int>` | :ref:`check_vadjust<class_CheckBox_theme_constant_check_vadjust>` | ``0`` |
  37. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  38. | :ref:`int<class_int>` | :ref:`hseparation<class_CheckBox_theme_constant_hseparation>` | ``4`` |
  39. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  40. | :ref:`Font<class_Font>` | :ref:`font<class_CheckBox_theme_font_font>` | |
  41. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  42. | :ref:`Texture<class_Texture>` | :ref:`checked<class_CheckBox_theme_icon_checked>` | |
  43. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  44. | :ref:`Texture<class_Texture>` | :ref:`checked_disabled<class_CheckBox_theme_icon_checked_disabled>` | |
  45. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  46. | :ref:`Texture<class_Texture>` | :ref:`radio_checked<class_CheckBox_theme_icon_radio_checked>` | |
  47. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  48. | :ref:`Texture<class_Texture>` | :ref:`radio_checked_disabled<class_CheckBox_theme_icon_radio_checked_disabled>` | |
  49. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  50. | :ref:`Texture<class_Texture>` | :ref:`radio_unchecked<class_CheckBox_theme_icon_radio_unchecked>` | |
  51. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  52. | :ref:`Texture<class_Texture>` | :ref:`radio_unchecked_disabled<class_CheckBox_theme_icon_radio_unchecked_disabled>` | |
  53. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  54. | :ref:`Texture<class_Texture>` | :ref:`unchecked<class_CheckBox_theme_icon_unchecked>` | |
  55. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  56. | :ref:`Texture<class_Texture>` | :ref:`unchecked_disabled<class_CheckBox_theme_icon_unchecked_disabled>` | |
  57. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  58. | :ref:`StyleBox<class_StyleBox>` | :ref:`disabled<class_CheckBox_theme_style_disabled>` | |
  59. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  60. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_CheckBox_theme_style_focus>` | |
  61. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  62. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_CheckBox_theme_style_hover>` | |
  63. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  64. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover_pressed<class_CheckBox_theme_style_hover_pressed>` | |
  65. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  66. | :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_CheckBox_theme_style_normal>` | |
  67. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  68. | :ref:`StyleBox<class_StyleBox>` | :ref:`pressed<class_CheckBox_theme_style_pressed>` | |
  69. +---------------------------------+--------------------------------------------------------------------------------------+----------------------------------+
  70. Theme Property Descriptions
  71. ---------------------------
  72. .. _class_CheckBox_theme_color_font_color:
  73. - :ref:`Color<class_Color>` **font_color**
  74. +-----------+----------------------------------+
  75. | *Default* | ``Color( 0.88, 0.88, 0.88, 1 )`` |
  76. +-----------+----------------------------------+
  77. The ``CheckBox`` text's font color.
  78. ----
  79. .. _class_CheckBox_theme_color_font_color_disabled:
  80. - :ref:`Color<class_Color>` **font_color_disabled**
  81. +-----------+---------------------------------+
  82. | *Default* | ``Color( 0.9, 0.9, 0.9, 0.2 )`` |
  83. +-----------+---------------------------------+
  84. The ``CheckBox`` text's font color when it's disabled.
  85. ----
  86. .. _class_CheckBox_theme_color_font_color_focus:
  87. - :ref:`Color<class_Color>` **font_color_focus**
  88. +-----------+----------------------------------+
  89. | *Default* | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  90. +-----------+----------------------------------+
  91. 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.
  92. ----
  93. .. _class_CheckBox_theme_color_font_color_hover:
  94. - :ref:`Color<class_Color>` **font_color_hover**
  95. +-----------+----------------------------------+
  96. | *Default* | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  97. +-----------+----------------------------------+
  98. The ``CheckBox`` text's font color when it's hovered.
  99. ----
  100. .. _class_CheckBox_theme_color_font_color_hover_pressed:
  101. - :ref:`Color<class_Color>` **font_color_hover_pressed**
  102. +-----------+-------------------------+
  103. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  104. +-----------+-------------------------+
  105. The ``CheckBox`` text's font color when it's hovered and pressed.
  106. ----
  107. .. _class_CheckBox_theme_color_font_color_pressed:
  108. - :ref:`Color<class_Color>` **font_color_pressed**
  109. +-----------+-------------------------+
  110. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  111. +-----------+-------------------------+
  112. The ``CheckBox`` text's font color when it's pressed.
  113. ----
  114. .. _class_CheckBox_theme_constant_check_vadjust:
  115. - :ref:`int<class_int>` **check_vadjust**
  116. +-----------+-------+
  117. | *Default* | ``0`` |
  118. +-----------+-------+
  119. The vertical offset used when rendering the check icons (in pixels).
  120. ----
  121. .. _class_CheckBox_theme_constant_hseparation:
  122. - :ref:`int<class_int>` **hseparation**
  123. +-----------+-------+
  124. | *Default* | ``4`` |
  125. +-----------+-------+
  126. The separation between the check icon and the text (in pixels).
  127. ----
  128. .. _class_CheckBox_theme_font_font:
  129. - :ref:`Font<class_Font>` **font**
  130. The :ref:`Font<class_Font>` to use for the ``CheckBox`` text.
  131. ----
  132. .. _class_CheckBox_theme_icon_checked:
  133. - :ref:`Texture<class_Texture>` **checked**
  134. The check icon to display when the ``CheckBox`` is checked.
  135. ----
  136. .. _class_CheckBox_theme_icon_checked_disabled:
  137. - :ref:`Texture<class_Texture>` **checked_disabled**
  138. The check icon to display when the ``CheckBox`` is checked and disabled.
  139. ----
  140. .. _class_CheckBox_theme_icon_radio_checked:
  141. - :ref:`Texture<class_Texture>` **radio_checked**
  142. If the ``CheckBox`` is configured as a radio button, the icon to display when the ``CheckBox`` is checked.
  143. ----
  144. .. _class_CheckBox_theme_icon_radio_checked_disabled:
  145. - :ref:`Texture<class_Texture>` **radio_checked_disabled**
  146. ----
  147. .. _class_CheckBox_theme_icon_radio_unchecked:
  148. - :ref:`Texture<class_Texture>` **radio_unchecked**
  149. If the ``CheckBox`` is configured as a radio button, the icon to display when the ``CheckBox`` is unchecked.
  150. ----
  151. .. _class_CheckBox_theme_icon_radio_unchecked_disabled:
  152. - :ref:`Texture<class_Texture>` **radio_unchecked_disabled**
  153. ----
  154. .. _class_CheckBox_theme_icon_unchecked:
  155. - :ref:`Texture<class_Texture>` **unchecked**
  156. The check icon to display when the ``CheckBox`` is unchecked.
  157. ----
  158. .. _class_CheckBox_theme_icon_unchecked_disabled:
  159. - :ref:`Texture<class_Texture>` **unchecked_disabled**
  160. The check icon to display when the ``CheckBox`` is unchecked and disabled.
  161. ----
  162. .. _class_CheckBox_theme_style_disabled:
  163. - :ref:`StyleBox<class_StyleBox>` **disabled**
  164. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckBox`` is disabled.
  165. ----
  166. .. _class_CheckBox_theme_style_focus:
  167. - :ref:`StyleBox<class_StyleBox>` **focus**
  168. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckBox`` is focused.
  169. ----
  170. .. _class_CheckBox_theme_style_hover:
  171. - :ref:`StyleBox<class_StyleBox>` **hover**
  172. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckBox`` is hovered.
  173. ----
  174. .. _class_CheckBox_theme_style_hover_pressed:
  175. - :ref:`StyleBox<class_StyleBox>` **hover_pressed**
  176. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckBox`` is hovered and pressed.
  177. ----
  178. .. _class_CheckBox_theme_style_normal:
  179. - :ref:`StyleBox<class_StyleBox>` **normal**
  180. The :ref:`StyleBox<class_StyleBox>` to display as a background.
  181. ----
  182. .. _class_CheckBox_theme_style_pressed:
  183. - :ref:`StyleBox<class_StyleBox>` **pressed**
  184. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckBox`` is pressed.
  185. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  186. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  187. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`