class_colorpickerbutton.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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 ColorPickerButton.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ColorPickerButton:
  6. ColorPickerButton
  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. Button that pops out a :ref:`ColorPicker<class_ColorPicker>`.
  10. Description
  11. -----------
  12. Encapsulates a :ref:`ColorPicker<class_ColorPicker>` making it accessible by pressing a button. Pressing the button will toggle the :ref:`ColorPicker<class_ColorPicker>` visibility.
  13. See also :ref:`BaseButton<class_BaseButton>` which contains common properties and methods associated with this node.
  14. **Note:** By default, the button may not be wide enough for the color preview swatch to be visible. Make sure to set :ref:`Control.rect_min_size<class_Control_property_rect_min_size>` to a big enough value to give the button enough space.
  15. Tutorials
  16. ---------
  17. - `GUI Drag And Drop Demo <https://godotengine.org/asset-library/asset/133>`__
  18. - `2D GD Paint Demo <https://godotengine.org/asset-library/asset/517>`__
  19. Properties
  20. ----------
  21. +---------------------------+----------------------------------------------------------------+------------------------------+
  22. | :ref:`Color<class_Color>` | :ref:`color<class_ColorPickerButton_property_color>` | ``Color( 0, 0, 0, 1 )`` |
  23. +---------------------------+----------------------------------------------------------------+------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`edit_alpha<class_ColorPickerButton_property_edit_alpha>` | ``true`` |
  25. +---------------------------+----------------------------------------------------------------+------------------------------+
  26. | :ref:`bool<class_bool>` | toggle_mode | ``true`` *(parent override)* |
  27. +---------------------------+----------------------------------------------------------------+------------------------------+
  28. Methods
  29. -------
  30. +---------------------------------------+--------------------------------------------------------------------------+
  31. | :ref:`ColorPicker<class_ColorPicker>` | :ref:`get_picker<class_ColorPickerButton_method_get_picker>` **(** **)** |
  32. +---------------------------------------+--------------------------------------------------------------------------+
  33. | :ref:`PopupPanel<class_PopupPanel>` | :ref:`get_popup<class_ColorPickerButton_method_get_popup>` **(** **)** |
  34. +---------------------------------------+--------------------------------------------------------------------------+
  35. Theme Properties
  36. ----------------
  37. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  38. | :ref:`Color<class_Color>` | :ref:`font_color<class_ColorPickerButton_theme_color_font_color>` | ``Color( 1, 1, 1, 1 )`` |
  39. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  40. | :ref:`Color<class_Color>` | :ref:`font_color_disabled<class_ColorPickerButton_theme_color_font_color_disabled>` | ``Color( 0.9, 0.9, 0.9, 0.3 )`` |
  41. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  42. | :ref:`Color<class_Color>` | :ref:`font_color_focus<class_ColorPickerButton_theme_color_font_color_focus>` | ``Color( 1, 1, 1, 1 )`` |
  43. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  44. | :ref:`Color<class_Color>` | :ref:`font_color_hover<class_ColorPickerButton_theme_color_font_color_hover>` | ``Color( 1, 1, 1, 1 )`` |
  45. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  46. | :ref:`Color<class_Color>` | :ref:`font_color_pressed<class_ColorPickerButton_theme_color_font_color_pressed>` | ``Color( 0.8, 0.8, 0.8, 1 )`` |
  47. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  48. | :ref:`int<class_int>` | :ref:`hseparation<class_ColorPickerButton_theme_constant_hseparation>` | ``2`` |
  49. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  50. | :ref:`Font<class_Font>` | :ref:`font<class_ColorPickerButton_theme_font_font>` | |
  51. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  52. | :ref:`Texture<class_Texture>` | :ref:`bg<class_ColorPickerButton_theme_icon_bg>` | |
  53. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  54. | :ref:`StyleBox<class_StyleBox>` | :ref:`disabled<class_ColorPickerButton_theme_style_disabled>` | |
  55. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  56. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_ColorPickerButton_theme_style_focus>` | |
  57. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  58. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_ColorPickerButton_theme_style_hover>` | |
  59. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  60. | :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_ColorPickerButton_theme_style_normal>` | |
  61. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  62. | :ref:`StyleBox<class_StyleBox>` | :ref:`pressed<class_ColorPickerButton_theme_style_pressed>` | |
  63. +---------------------------------+-------------------------------------------------------------------------------------+---------------------------------+
  64. Signals
  65. -------
  66. .. _class_ColorPickerButton_signal_color_changed:
  67. - **color_changed** **(** :ref:`Color<class_Color>` color **)**
  68. Emitted when the color changes.
  69. ----
  70. .. _class_ColorPickerButton_signal_picker_created:
  71. - **picker_created** **(** **)**
  72. Emitted when the :ref:`ColorPicker<class_ColorPicker>` is created (the button is pressed for the first time).
  73. ----
  74. .. _class_ColorPickerButton_signal_popup_closed:
  75. - **popup_closed** **(** **)**
  76. Emitted when the :ref:`ColorPicker<class_ColorPicker>` is closed.
  77. Property Descriptions
  78. ---------------------
  79. .. _class_ColorPickerButton_property_color:
  80. - :ref:`Color<class_Color>` **color**
  81. +-----------+-------------------------+
  82. | *Default* | ``Color( 0, 0, 0, 1 )`` |
  83. +-----------+-------------------------+
  84. | *Setter* | set_pick_color(value) |
  85. +-----------+-------------------------+
  86. | *Getter* | get_pick_color() |
  87. +-----------+-------------------------+
  88. The currently selected color.
  89. ----
  90. .. _class_ColorPickerButton_property_edit_alpha:
  91. - :ref:`bool<class_bool>` **edit_alpha**
  92. +-----------+-----------------------+
  93. | *Default* | ``true`` |
  94. +-----------+-----------------------+
  95. | *Setter* | set_edit_alpha(value) |
  96. +-----------+-----------------------+
  97. | *Getter* | is_editing_alpha() |
  98. +-----------+-----------------------+
  99. If ``true``, the alpha channel in the displayed :ref:`ColorPicker<class_ColorPicker>` will be visible.
  100. Method Descriptions
  101. -------------------
  102. .. _class_ColorPickerButton_method_get_picker:
  103. - :ref:`ColorPicker<class_ColorPicker>` **get_picker** **(** **)**
  104. Returns the :ref:`ColorPicker<class_ColorPicker>` that this node toggles.
  105. **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  106. ----
  107. .. _class_ColorPickerButton_method_get_popup:
  108. - :ref:`PopupPanel<class_PopupPanel>` **get_popup** **(** **)**
  109. Returns the control's :ref:`PopupPanel<class_PopupPanel>` which allows you to connect to popup signals. This allows you to handle events when the ColorPicker is shown or hidden.
  110. **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  111. Theme Property Descriptions
  112. ---------------------------
  113. .. _class_ColorPickerButton_theme_color_font_color:
  114. - :ref:`Color<class_Color>` **font_color**
  115. +-----------+-------------------------+
  116. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  117. +-----------+-------------------------+
  118. Default text :ref:`Color<class_Color>` of the ``ColorPickerButton``.
  119. ----
  120. .. _class_ColorPickerButton_theme_color_font_color_disabled:
  121. - :ref:`Color<class_Color>` **font_color_disabled**
  122. +-----------+---------------------------------+
  123. | *Default* | ``Color( 0.9, 0.9, 0.9, 0.3 )`` |
  124. +-----------+---------------------------------+
  125. Text :ref:`Color<class_Color>` used when the ``ColorPickerButton`` is disabled.
  126. ----
  127. .. _class_ColorPickerButton_theme_color_font_color_focus:
  128. - :ref:`Color<class_Color>` **font_color_focus**
  129. +-----------+-------------------------+
  130. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  131. +-----------+-------------------------+
  132. Text :ref:`Color<class_Color>` used when the ``ColorPickerButton`` is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
  133. ----
  134. .. _class_ColorPickerButton_theme_color_font_color_hover:
  135. - :ref:`Color<class_Color>` **font_color_hover**
  136. +-----------+-------------------------+
  137. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  138. +-----------+-------------------------+
  139. Text :ref:`Color<class_Color>` used when the ``ColorPickerButton`` is being hovered.
  140. ----
  141. .. _class_ColorPickerButton_theme_color_font_color_pressed:
  142. - :ref:`Color<class_Color>` **font_color_pressed**
  143. +-----------+-------------------------------+
  144. | *Default* | ``Color( 0.8, 0.8, 0.8, 1 )`` |
  145. +-----------+-------------------------------+
  146. Text :ref:`Color<class_Color>` used when the ``ColorPickerButton`` is being pressed.
  147. ----
  148. .. _class_ColorPickerButton_theme_constant_hseparation:
  149. - :ref:`int<class_int>` **hseparation**
  150. +-----------+-------+
  151. | *Default* | ``2`` |
  152. +-----------+-------+
  153. The horizontal space between ``ColorPickerButton``'s icon and text.
  154. ----
  155. .. _class_ColorPickerButton_theme_font_font:
  156. - :ref:`Font<class_Font>` **font**
  157. :ref:`Font<class_Font>` of the ``ColorPickerButton``'s text.
  158. ----
  159. .. _class_ColorPickerButton_theme_icon_bg:
  160. - :ref:`Texture<class_Texture>` **bg**
  161. The background of the color preview rect on the button.
  162. ----
  163. .. _class_ColorPickerButton_theme_style_disabled:
  164. - :ref:`StyleBox<class_StyleBox>` **disabled**
  165. :ref:`StyleBox<class_StyleBox>` used when the ``ColorPickerButton`` is disabled.
  166. ----
  167. .. _class_ColorPickerButton_theme_style_focus:
  168. - :ref:`StyleBox<class_StyleBox>` **focus**
  169. :ref:`StyleBox<class_StyleBox>` used when the ``ColorPickerButton`` is focused. It is displayed over the current :ref:`StyleBox<class_StyleBox>`, so using :ref:`StyleBoxEmpty<class_StyleBoxEmpty>` will just disable the focus visual effect.
  170. ----
  171. .. _class_ColorPickerButton_theme_style_hover:
  172. - :ref:`StyleBox<class_StyleBox>` **hover**
  173. :ref:`StyleBox<class_StyleBox>` used when the ``ColorPickerButton`` is being hovered.
  174. ----
  175. .. _class_ColorPickerButton_theme_style_normal:
  176. - :ref:`StyleBox<class_StyleBox>` **normal**
  177. Default :ref:`StyleBox<class_StyleBox>` for the ``ColorPickerButton``.
  178. ----
  179. .. _class_ColorPickerButton_theme_style_pressed:
  180. - :ref:`StyleBox<class_StyleBox>` **pressed**
  181. :ref:`StyleBox<class_StyleBox>` used when the ``ColorPickerButton`` is being pressed.
  182. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  183. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  184. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`