class_theme.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Theme.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Theme:
  5. Theme
  6. =====
  7. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Theme for controls.
  12. Properties
  13. ----------
  14. +-------------------------+--------------------------------------------------------+
  15. | :ref:`Font<class_Font>` | :ref:`default_font<class_Theme_property_default_font>` |
  16. +-------------------------+--------------------------------------------------------+
  17. Methods
  18. -------
  19. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`clear<class_Theme_method_clear>` **(** **)** |
  21. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`clear_color<class_Theme_method_clear_color>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** |
  23. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`clear_constant<class_Theme_method_clear_constant>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** |
  25. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`clear_font<class_Theme_method_clear_font>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** |
  27. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`clear_icon<class_Theme_method_clear_icon>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** |
  29. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`clear_stylebox<class_Theme_method_clear_stylebox>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** |
  31. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`copy_default_theme<class_Theme_method_copy_default_theme>` **(** **)** |
  33. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`copy_theme<class_Theme_method_copy_theme>` **(** :ref:`Theme<class_Theme>` other **)** |
  35. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Color<class_Color>` | :ref:`get_color<class_Theme_method_get_color>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  37. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_color_list<class_Theme_method_get_color_list>` **(** :ref:`String<class_String>` type **)** const |
  39. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_constant<class_Theme_method_get_constant>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  41. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_constant_list<class_Theme_method_get_constant_list>` **(** :ref:`String<class_String>` type **)** const |
  43. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Font<class_Font>` | :ref:`get_font<class_Theme_method_get_font>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  45. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_font_list<class_Theme_method_get_font_list>` **(** :ref:`String<class_String>` type **)** const |
  47. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Texture<class_Texture>` | :ref:`get_icon<class_Theme_method_get_icon>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  49. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_icon_list<class_Theme_method_get_icon_list>` **(** :ref:`String<class_String>` type **)** const |
  51. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`StyleBox<class_StyleBox>` | :ref:`get_stylebox<class_Theme_method_get_stylebox>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  53. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_stylebox_list<class_Theme_method_get_stylebox_list>` **(** :ref:`String<class_String>` type **)** const |
  55. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_stylebox_types<class_Theme_method_get_stylebox_types>` **(** **)** const |
  57. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_type_list<class_Theme_method_get_type_list>` **(** :ref:`String<class_String>` type **)** const |
  59. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`has_color<class_Theme_method_has_color>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  61. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`bool<class_bool>` | :ref:`has_constant<class_Theme_method_has_constant>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  63. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`bool<class_bool>` | :ref:`has_font<class_Theme_method_has_font>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  65. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`has_icon<class_Theme_method_has_icon>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  67. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`bool<class_bool>` | :ref:`has_stylebox<class_Theme_method_has_stylebox>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const |
  69. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | void | :ref:`set_color<class_Theme_method_set_color>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`Color<class_Color>` color **)** |
  71. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`set_constant<class_Theme_method_set_constant>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`int<class_int>` constant **)** |
  73. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`set_font<class_Theme_method_set_font>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`Font<class_Font>` font **)** |
  75. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`set_icon<class_Theme_method_set_icon>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`Texture<class_Texture>` texture **)** |
  77. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`set_stylebox<class_Theme_method_set_stylebox>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`StyleBox<class_StyleBox>` texture **)** |
  79. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. Description
  81. -----------
  82. Theme for skinning controls. Controls can be skinned individually, but for complex applications it's more efficient to just create a global theme that defines everything. This theme can be applied to any :ref:`Control<class_Control>`, and it and its children will automatically use it.
  83. Theme resources can be alternatively loaded by writing them in a .theme file, see docs for more info.
  84. Tutorials
  85. ---------
  86. - :doc:`../tutorials/gui/gui_skinning`
  87. Property Descriptions
  88. ---------------------
  89. .. _class_Theme_property_default_font:
  90. - :ref:`Font<class_Font>` **default_font**
  91. +----------+-------------------------+
  92. | *Setter* | set_default_font(value) |
  93. +----------+-------------------------+
  94. | *Getter* | get_default_font() |
  95. +----------+-------------------------+
  96. The theme's default font.
  97. Method Descriptions
  98. -------------------
  99. .. _class_Theme_method_clear:
  100. - void **clear** **(** **)**
  101. .. _class_Theme_method_clear_color:
  102. - void **clear_color** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)**
  103. Clears theme :ref:`Color<class_Color>` at ``name`` if Theme has ``type``.
  104. .. _class_Theme_method_clear_constant:
  105. - void **clear_constant** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)**
  106. Clears theme constant at ``name`` if Theme has ``type``.
  107. .. _class_Theme_method_clear_font:
  108. - void **clear_font** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)**
  109. Clears :ref:`Font<class_Font>` at ``name`` if Theme has ``type``.
  110. .. _class_Theme_method_clear_icon:
  111. - void **clear_icon** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)**
  112. Clears icon at ``name`` if Theme has ``type``.
  113. .. _class_Theme_method_clear_stylebox:
  114. - void **clear_stylebox** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)**
  115. Clears :ref:`StyleBox<class_StyleBox>` at ``name`` if Theme has ``type``.
  116. .. _class_Theme_method_copy_default_theme:
  117. - void **copy_default_theme** **(** **)**
  118. Sets theme values to a copy of the default theme values.
  119. .. _class_Theme_method_copy_theme:
  120. - void **copy_theme** **(** :ref:`Theme<class_Theme>` other **)**
  121. .. _class_Theme_method_get_color:
  122. - :ref:`Color<class_Color>` **get_color** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  123. Returns the :ref:`Color<class_Color>` at ``name`` if Theme has ``type``.
  124. .. _class_Theme_method_get_color_list:
  125. - :ref:`PoolStringArray<class_PoolStringArray>` **get_color_list** **(** :ref:`String<class_String>` type **)** const
  126. Returns all of the :ref:`Color<class_Color>`\ s as a :ref:`PoolStringArray<class_PoolStringArray>` filled with each :ref:`Color<class_Color>`'s name, for use in :ref:`get_color<class_Theme_method_get_color>`, if Theme has ``type``.
  127. .. _class_Theme_method_get_constant:
  128. - :ref:`int<class_int>` **get_constant** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  129. Returns the constant at ``name`` if Theme has ``type``.
  130. .. _class_Theme_method_get_constant_list:
  131. - :ref:`PoolStringArray<class_PoolStringArray>` **get_constant_list** **(** :ref:`String<class_String>` type **)** const
  132. Returns all of the constants as a :ref:`PoolStringArray<class_PoolStringArray>` filled with each constant's name, for use in :ref:`get_constant<class_Theme_method_get_constant>`, if Theme has ``type``.
  133. .. _class_Theme_method_get_font:
  134. - :ref:`Font<class_Font>` **get_font** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  135. Returns the :ref:`Font<class_Font>` at ``name`` if Theme has ``type``.
  136. .. _class_Theme_method_get_font_list:
  137. - :ref:`PoolStringArray<class_PoolStringArray>` **get_font_list** **(** :ref:`String<class_String>` type **)** const
  138. Returns all of the :ref:`Font<class_Font>`\ s as a :ref:`PoolStringArray<class_PoolStringArray>` filled with each :ref:`Font<class_Font>`'s name, for use in :ref:`get_font<class_Theme_method_get_font>`, if Theme has ``type``.
  139. .. _class_Theme_method_get_icon:
  140. - :ref:`Texture<class_Texture>` **get_icon** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  141. Returns the icon :ref:`Texture<class_Texture>` at ``name`` if Theme has ``type``.
  142. .. _class_Theme_method_get_icon_list:
  143. - :ref:`PoolStringArray<class_PoolStringArray>` **get_icon_list** **(** :ref:`String<class_String>` type **)** const
  144. Returns all of the icons as a :ref:`PoolStringArray<class_PoolStringArray>` filled with each :ref:`Texture<class_Texture>`'s name, for use in :ref:`get_icon<class_Theme_method_get_icon>`, if Theme has ``type``.
  145. .. _class_Theme_method_get_stylebox:
  146. - :ref:`StyleBox<class_StyleBox>` **get_stylebox** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  147. Returns the icon :ref:`StyleBox<class_StyleBox>` at ``name`` if Theme has ``type``.
  148. .. _class_Theme_method_get_stylebox_list:
  149. - :ref:`PoolStringArray<class_PoolStringArray>` **get_stylebox_list** **(** :ref:`String<class_String>` type **)** const
  150. Returns all of the :ref:`StyleBox<class_StyleBox>`\ s as a :ref:`PoolStringArray<class_PoolStringArray>` filled with each :ref:`StyleBox<class_StyleBox>`'s name, for use in :ref:`get_stylebox<class_Theme_method_get_stylebox>`, if Theme has ``type``.
  151. .. _class_Theme_method_get_stylebox_types:
  152. - :ref:`PoolStringArray<class_PoolStringArray>` **get_stylebox_types** **(** **)** const
  153. Returns all of the :ref:`StyleBox<class_StyleBox>` types as a :ref:`PoolStringArray<class_PoolStringArray>` filled with each :ref:`StyleBox<class_StyleBox>`'s type, for use in :ref:`get_stylebox<class_Theme_method_get_stylebox>` and/or :ref:`get_stylebox_list<class_Theme_method_get_stylebox_list>`, if Theme has ``type``.
  154. .. _class_Theme_method_get_type_list:
  155. - :ref:`PoolStringArray<class_PoolStringArray>` **get_type_list** **(** :ref:`String<class_String>` type **)** const
  156. Returns all of the types in ``type`` as a :ref:`PoolStringArray<class_PoolStringArray>` for use in any of the get\_\* functions, if Theme has ``type``.
  157. .. _class_Theme_method_has_color:
  158. - :ref:`bool<class_bool>` **has_color** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  159. Returns ``true`` if :ref:`Color<class_Color>` with ``name`` is in ``type``.
  160. Returns ``false`` if Theme does not have ``type``.
  161. .. _class_Theme_method_has_constant:
  162. - :ref:`bool<class_bool>` **has_constant** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  163. Returns ``true`` if constant with ``name`` is in ``type``.
  164. Returns ``false`` if Theme does not have ``type``.
  165. .. _class_Theme_method_has_font:
  166. - :ref:`bool<class_bool>` **has_font** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  167. Returns ``true`` if :ref:`Font<class_Font>` with ``name`` is in ``type``.
  168. Returns ``false`` if Theme does not have ``type``.
  169. .. _class_Theme_method_has_icon:
  170. - :ref:`bool<class_bool>` **has_icon** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  171. Returns ``true`` if icon :ref:`Texture<class_Texture>` with ``name`` is in ``type``.
  172. Returns ``false`` if Theme does not have ``type``.
  173. .. _class_Theme_method_has_stylebox:
  174. - :ref:`bool<class_bool>` **has_stylebox** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type **)** const
  175. Returns ``true`` if :ref:`StyleBox<class_StyleBox>` with ``name`` is in ``type``.
  176. Returns ``false`` if Theme does not have ``type``.
  177. .. _class_Theme_method_set_color:
  178. - void **set_color** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`Color<class_Color>` color **)**
  179. Sets Theme's :ref:`Color<class_Color>` to ``color`` at ``name`` in ``type``.
  180. Does nothing if Theme does not have ``type``.
  181. .. _class_Theme_method_set_constant:
  182. - void **set_constant** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`int<class_int>` constant **)**
  183. Sets Theme's constant to ``constant`` at ``name`` in ``type``.
  184. Does nothing if Theme does not have ``type``.
  185. .. _class_Theme_method_set_font:
  186. - void **set_font** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`Font<class_Font>` font **)**
  187. Sets Theme's :ref:`Font<class_Font>` to ``font`` at ``name`` in ``type``.
  188. Does nothing if Theme does not have ``type``.
  189. .. _class_Theme_method_set_icon:
  190. - void **set_icon** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`Texture<class_Texture>` texture **)**
  191. Sets Theme's icon :ref:`Texture<class_Texture>` to ``texture`` at ``name`` in ``type``.
  192. Does nothing if Theme does not have ``type``.
  193. .. _class_Theme_method_set_stylebox:
  194. - void **set_stylebox** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` type, :ref:`StyleBox<class_StyleBox>` texture **)**
  195. Sets Theme's :ref:`StyleBox<class_StyleBox>` to ``stylebox`` at ``name`` in ``type``.
  196. Does nothing if Theme does not have ``type``.