class_checkbutton.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 CheckButton.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_CheckButton:
  6. CheckButton
  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. Checkable button. See also :ref:`CheckBox<class_CheckBox>`.
  10. Description
  11. -----------
  12. CheckButton is a toggle button displayed as a check field. It's similar to :ref:`CheckBox<class_CheckBox>` in functionality, but it has a different appearance. To follow established UX patterns, it's recommended to use CheckButton when toggling it has an **immediate** effect on something. For instance, it should be used if toggling it enables/disables a setting without requiring the user to press a confirmation button.
  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_CheckButton_theme_color_font_color>` | ``Color( 0.88, 0.88, 0.88, 1 )`` |
  25. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  26. | :ref:`Color<class_Color>` | :ref:`font_color_disabled<class_CheckButton_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_CheckButton_theme_color_font_color_focus>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  29. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  30. | :ref:`Color<class_Color>` | :ref:`font_color_hover<class_CheckButton_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_CheckButton_theme_color_font_color_hover_pressed>` | ``Color( 1, 1, 1, 1 )`` |
  33. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  34. | :ref:`Color<class_Color>` | :ref:`font_color_pressed<class_CheckButton_theme_color_font_color_pressed>` | ``Color( 1, 1, 1, 1 )`` |
  35. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  36. | :ref:`int<class_int>` | :ref:`check_vadjust<class_CheckButton_theme_constant_check_vadjust>` | ``0`` |
  37. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  38. | :ref:`int<class_int>` | :ref:`hseparation<class_CheckButton_theme_constant_hseparation>` | ``4`` |
  39. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  40. | :ref:`Font<class_Font>` | :ref:`font<class_CheckButton_theme_font_font>` | |
  41. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  42. | :ref:`Texture<class_Texture>` | :ref:`off<class_CheckButton_theme_icon_off>` | |
  43. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  44. | :ref:`Texture<class_Texture>` | :ref:`off_disabled<class_CheckButton_theme_icon_off_disabled>` | |
  45. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  46. | :ref:`Texture<class_Texture>` | :ref:`on<class_CheckButton_theme_icon_on>` | |
  47. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  48. | :ref:`Texture<class_Texture>` | :ref:`on_disabled<class_CheckButton_theme_icon_on_disabled>` | |
  49. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  50. | :ref:`StyleBox<class_StyleBox>` | :ref:`disabled<class_CheckButton_theme_style_disabled>` | |
  51. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  52. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_CheckButton_theme_style_focus>` | |
  53. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  54. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_CheckButton_theme_style_hover>` | |
  55. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  56. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover_pressed<class_CheckButton_theme_style_hover_pressed>` | |
  57. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  58. | :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_CheckButton_theme_style_normal>` | |
  59. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  60. | :ref:`StyleBox<class_StyleBox>` | :ref:`pressed<class_CheckButton_theme_style_pressed>` | |
  61. +---------------------------------+-----------------------------------------------------------------------------------------+----------------------------------+
  62. Theme Property Descriptions
  63. ---------------------------
  64. .. _class_CheckButton_theme_color_font_color:
  65. - :ref:`Color<class_Color>` **font_color**
  66. +-----------+----------------------------------+
  67. | *Default* | ``Color( 0.88, 0.88, 0.88, 1 )`` |
  68. +-----------+----------------------------------+
  69. The ``CheckButton`` text's font color.
  70. ----
  71. .. _class_CheckButton_theme_color_font_color_disabled:
  72. - :ref:`Color<class_Color>` **font_color_disabled**
  73. +-----------+---------------------------------+
  74. | *Default* | ``Color( 0.9, 0.9, 0.9, 0.2 )`` |
  75. +-----------+---------------------------------+
  76. The ``CheckButton`` text's font color when it's disabled.
  77. ----
  78. .. _class_CheckButton_theme_color_font_color_focus:
  79. - :ref:`Color<class_Color>` **font_color_focus**
  80. +-----------+----------------------------------+
  81. | *Default* | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  82. +-----------+----------------------------------+
  83. The ``CheckButton`` text's font color when it's focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
  84. ----
  85. .. _class_CheckButton_theme_color_font_color_hover:
  86. - :ref:`Color<class_Color>` **font_color_hover**
  87. +-----------+----------------------------------+
  88. | *Default* | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  89. +-----------+----------------------------------+
  90. The ``CheckButton`` text's font color when it's hovered.
  91. ----
  92. .. _class_CheckButton_theme_color_font_color_hover_pressed:
  93. - :ref:`Color<class_Color>` **font_color_hover_pressed**
  94. +-----------+-------------------------+
  95. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  96. +-----------+-------------------------+
  97. The ``CheckButton`` text's font color when it's hovered and pressed.
  98. ----
  99. .. _class_CheckButton_theme_color_font_color_pressed:
  100. - :ref:`Color<class_Color>` **font_color_pressed**
  101. +-----------+-------------------------+
  102. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  103. +-----------+-------------------------+
  104. The ``CheckButton`` text's font color when it's pressed.
  105. ----
  106. .. _class_CheckButton_theme_constant_check_vadjust:
  107. - :ref:`int<class_int>` **check_vadjust**
  108. +-----------+-------+
  109. | *Default* | ``0`` |
  110. +-----------+-------+
  111. The vertical offset used when rendering the toggle icons (in pixels).
  112. ----
  113. .. _class_CheckButton_theme_constant_hseparation:
  114. - :ref:`int<class_int>` **hseparation**
  115. +-----------+-------+
  116. | *Default* | ``4`` |
  117. +-----------+-------+
  118. The separation between the toggle icon and the text (in pixels).
  119. ----
  120. .. _class_CheckButton_theme_font_font:
  121. - :ref:`Font<class_Font>` **font**
  122. The :ref:`Font<class_Font>` to use for the ``CheckButton`` text.
  123. ----
  124. .. _class_CheckButton_theme_icon_off:
  125. - :ref:`Texture<class_Texture>` **off**
  126. The icon to display when the ``CheckButton`` is unchecked.
  127. ----
  128. .. _class_CheckButton_theme_icon_off_disabled:
  129. - :ref:`Texture<class_Texture>` **off_disabled**
  130. The icon to display when the ``CheckButton`` is unchecked and disabled.
  131. ----
  132. .. _class_CheckButton_theme_icon_on:
  133. - :ref:`Texture<class_Texture>` **on**
  134. The icon to display when the ``CheckButton`` is checked.
  135. ----
  136. .. _class_CheckButton_theme_icon_on_disabled:
  137. - :ref:`Texture<class_Texture>` **on_disabled**
  138. The icon to display when the ``CheckButton`` is checked and disabled.
  139. ----
  140. .. _class_CheckButton_theme_style_disabled:
  141. - :ref:`StyleBox<class_StyleBox>` **disabled**
  142. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckButton`` is disabled.
  143. ----
  144. .. _class_CheckButton_theme_style_focus:
  145. - :ref:`StyleBox<class_StyleBox>` **focus**
  146. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckButton`` is focused.
  147. ----
  148. .. _class_CheckButton_theme_style_hover:
  149. - :ref:`StyleBox<class_StyleBox>` **hover**
  150. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckButton`` is hovered.
  151. ----
  152. .. _class_CheckButton_theme_style_hover_pressed:
  153. - :ref:`StyleBox<class_StyleBox>` **hover_pressed**
  154. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckButton`` is hovered and pressed.
  155. ----
  156. .. _class_CheckButton_theme_style_normal:
  157. - :ref:`StyleBox<class_StyleBox>` **normal**
  158. The :ref:`StyleBox<class_StyleBox>` to display as a background.
  159. ----
  160. .. _class_CheckButton_theme_style_pressed:
  161. - :ref:`StyleBox<class_StyleBox>` **pressed**
  162. The :ref:`StyleBox<class_StyleBox>` to display as a background when the ``CheckButton`` is pressed.
  163. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  164. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  165. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`