class_theme.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. Member Functions
  13. ----------------
  14. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`clear_color<class_Theme_clear_color>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** |
  16. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`clear_constant<class_Theme_clear_constant>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** |
  18. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`clear_font<class_Theme_clear_font>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** |
  20. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`clear_icon<class_Theme_clear_icon>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** |
  22. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`clear_stylebox<class_Theme_clear_stylebox>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** |
  24. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`copy_default_theme<class_Theme_copy_default_theme>` **(** **)** |
  26. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Color<class_color>` | :ref:`get_color<class_Theme_get_color>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  28. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`PoolStringArray<class_poolstringarray>` | :ref:`get_color_list<class_Theme_get_color_list>` **(** :ref:`String<class_string>` type **)** const |
  30. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`get_constant<class_Theme_get_constant>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  32. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`PoolStringArray<class_poolstringarray>` | :ref:`get_constant_list<class_Theme_get_constant_list>` **(** :ref:`String<class_string>` type **)** const |
  34. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Font<class_font>` | :ref:`get_font<class_Theme_get_font>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  36. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`PoolStringArray<class_poolstringarray>` | :ref:`get_font_list<class_Theme_get_font_list>` **(** :ref:`String<class_string>` type **)** const |
  38. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Texture<class_texture>` | :ref:`get_icon<class_Theme_get_icon>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  40. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`PoolStringArray<class_poolstringarray>` | :ref:`get_icon_list<class_Theme_get_icon_list>` **(** :ref:`String<class_string>` type **)** const |
  42. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`StyleBox<class_stylebox>` | :ref:`get_stylebox<class_Theme_get_stylebox>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  44. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`PoolStringArray<class_poolstringarray>` | :ref:`get_stylebox_list<class_Theme_get_stylebox_list>` **(** :ref:`String<class_string>` type **)** const |
  46. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`PoolStringArray<class_poolstringarray>` | :ref:`get_stylebox_types<class_Theme_get_stylebox_types>` **(** **)** const |
  48. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`PoolStringArray<class_poolstringarray>` | :ref:`get_type_list<class_Theme_get_type_list>` **(** :ref:`String<class_string>` type **)** const |
  50. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`has_color<class_Theme_has_color>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  52. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`has_constant<class_Theme_has_constant>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  54. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`bool<class_bool>` | :ref:`has_font<class_Theme_has_font>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  56. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`bool<class_bool>` | :ref:`has_icon<class_Theme_has_icon>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  58. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`has_stylebox<class_Theme_has_stylebox>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const |
  60. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`set_color<class_Theme_set_color>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`Color<class_color>` color **)** |
  62. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`set_constant<class_Theme_set_constant>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`int<class_int>` constant **)** |
  64. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`set_font<class_Theme_set_font>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`Font<class_font>` font **)** |
  66. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`set_icon<class_Theme_set_icon>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`Texture<class_texture>` texture **)** |
  68. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`set_stylebox<class_Theme_set_stylebox>` **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`StyleBox<class_stylebox>` texture **)** |
  70. +------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. Member Variables
  72. ----------------
  73. .. _class_Theme_default_font:
  74. - :ref:`Font<class_font>` **default_font** - The theme's default font.
  75. Description
  76. -----------
  77. 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.
  78. Theme resources can be alternatively loaded by writing them in a .theme file, see docs for more info.
  79. Member Function Description
  80. ---------------------------
  81. .. _class_Theme_clear_color:
  82. - void **clear_color** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)**
  83. Clears theme :ref:`Color<class_color>` at ``name`` if Theme has ``type``.
  84. .. _class_Theme_clear_constant:
  85. - void **clear_constant** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)**
  86. Clears theme constant at ``name`` if Theme has ``type``.
  87. .. _class_Theme_clear_font:
  88. - void **clear_font** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)**
  89. Clears :ref:`Font<class_font>` at ``name`` if Theme has ``type``.
  90. .. _class_Theme_clear_icon:
  91. - void **clear_icon** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)**
  92. Clears icon at ``name`` if Theme has ``type``.
  93. .. _class_Theme_clear_stylebox:
  94. - void **clear_stylebox** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)**
  95. Clears :ref:`StyleBox<class_stylebox>` at ``name`` if Theme has ``type``.
  96. .. _class_Theme_copy_default_theme:
  97. - void **copy_default_theme** **(** **)**
  98. Sets theme values to a copy of the default theme values.
  99. .. _class_Theme_get_color:
  100. - :ref:`Color<class_color>` **get_color** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  101. Returns the :ref:`Color<class_color>` at ``name`` if Theme has ``type``.
  102. .. _class_Theme_get_color_list:
  103. - :ref:`PoolStringArray<class_poolstringarray>` **get_color_list** **(** :ref:`String<class_string>` type **)** const
  104. 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_get_color>`, if Theme has ``type``.
  105. .. _class_Theme_get_constant:
  106. - :ref:`int<class_int>` **get_constant** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  107. Returns the constant at ``name`` if Theme has ``type``.
  108. .. _class_Theme_get_constant_list:
  109. - :ref:`PoolStringArray<class_poolstringarray>` **get_constant_list** **(** :ref:`String<class_string>` type **)** const
  110. 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_get_constant>`, if Theme has ``type``.
  111. .. _class_Theme_get_font:
  112. - :ref:`Font<class_font>` **get_font** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  113. Returns the :ref:`Font<class_font>` at ``name`` if Theme has ``type``.
  114. .. _class_Theme_get_font_list:
  115. - :ref:`PoolStringArray<class_poolstringarray>` **get_font_list** **(** :ref:`String<class_string>` type **)** const
  116. 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_get_font>`, if Theme has ``type``.
  117. .. _class_Theme_get_icon:
  118. - :ref:`Texture<class_texture>` **get_icon** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  119. Returns the icon :ref:`Texture<class_texture>` at ``name`` if Theme has ``type``.
  120. .. _class_Theme_get_icon_list:
  121. - :ref:`PoolStringArray<class_poolstringarray>` **get_icon_list** **(** :ref:`String<class_string>` type **)** const
  122. 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_get_icon>`, if Theme has ``type``.
  123. .. _class_Theme_get_stylebox:
  124. - :ref:`StyleBox<class_stylebox>` **get_stylebox** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  125. Returns the icon :ref:`StyleBox<class_stylebox>` at ``name`` if Theme has ``type``.
  126. .. _class_Theme_get_stylebox_list:
  127. - :ref:`PoolStringArray<class_poolstringarray>` **get_stylebox_list** **(** :ref:`String<class_string>` type **)** const
  128. 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_get_stylebox>`, if Theme has ``type``.
  129. .. _class_Theme_get_stylebox_types:
  130. - :ref:`PoolStringArray<class_poolstringarray>` **get_stylebox_types** **(** **)** const
  131. 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_get_stylebox>` and/or :ref:`get_stylebox_list<class_Theme_get_stylebox_list>`, if Theme has ``type``.
  132. .. _class_Theme_get_type_list:
  133. - :ref:`PoolStringArray<class_poolstringarray>` **get_type_list** **(** :ref:`String<class_string>` type **)** const
  134. 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``.
  135. .. _class_Theme_has_color:
  136. - :ref:`bool<class_bool>` **has_color** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  137. Returns ``true`` if :ref:`Color<class_color>` with ``name`` is in ``type``.
  138. Returns ``false`` if Theme does not have ``type``.
  139. .. _class_Theme_has_constant:
  140. - :ref:`bool<class_bool>` **has_constant** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  141. Returns ``true`` if constant with ``name`` is in ``type``.
  142. Returns ``false`` if Theme does not have ``type``.
  143. .. _class_Theme_has_font:
  144. - :ref:`bool<class_bool>` **has_font** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  145. Returns ``true`` if :ref:`Font<class_font>` with ``name`` is in ``type``.
  146. Returns ``false`` if Theme does not have ``type``.
  147. .. _class_Theme_has_icon:
  148. - :ref:`bool<class_bool>` **has_icon** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  149. Returns ``true`` if icon :ref:`Texture<class_texture>` with ``name`` is in ``type``.
  150. Returns ``false`` if Theme does not have ``type``.
  151. .. _class_Theme_has_stylebox:
  152. - :ref:`bool<class_bool>` **has_stylebox** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type **)** const
  153. Returns ``true`` if :ref:`StyleBox<class_stylebox>` with ``name`` is in ``type``.
  154. Returns ``false`` if Theme does not have ``type``.
  155. .. _class_Theme_set_color:
  156. - void **set_color** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`Color<class_color>` color **)**
  157. Sets Theme's :ref:`Color<class_color>` to ``color`` at ``name`` in ``type``.
  158. Does nothing if Theme does not have ``type``.
  159. .. _class_Theme_set_constant:
  160. - void **set_constant** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`int<class_int>` constant **)**
  161. Sets Theme's constant to ``constant`` at ``name`` in ``type``.
  162. Does nothing if Theme does not have ``type``.
  163. .. _class_Theme_set_font:
  164. - void **set_font** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`Font<class_font>` font **)**
  165. Sets Theme's :ref:`Font<class_font>` to ``font`` at ``name`` in ``type``.
  166. Does nothing if Theme does not have ``type``.
  167. .. _class_Theme_set_icon:
  168. - void **set_icon** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`Texture<class_texture>` texture **)**
  169. Sets Theme's icon :ref:`Texture<class_texture>` to ``texture`` at ``name`` in ``type``.
  170. Does nothing if Theme does not have ``type``.
  171. .. _class_Theme_set_stylebox:
  172. - void **set_stylebox** **(** :ref:`String<class_string>` name, :ref:`String<class_string>` type, :ref:`StyleBox<class_stylebox>` texture **)**
  173. Sets Theme's :ref:`StyleBox<class_stylebox>` to ``stylebox`` at ``name`` in ``type``.
  174. Does nothing if Theme does not have ``type``.