Theme.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Theme" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Theme for controls.
  5. </brief_description>
  6. <description>
  7. A theme for skinning controls. Controls can be skinned individually, but for complex applications, it's more practical to just create a global theme that defines everything. This theme can be applied to any [Control]; the Control and its children will automatically use it.
  8. Theme resources can alternatively be loaded by writing them in a [code].theme[/code] file, see the documentation for more information.
  9. </description>
  10. <tutorials>
  11. <link>$DOCS_URL/tutorials/ui/gui_skinning.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="add_type">
  15. <return type="void" />
  16. <argument index="0" name="theme_type" type="String" />
  17. <description>
  18. Adds an empty theme type for every valid data type.
  19. [b]Note:[/b] Empty types are not saved with the theme. This method only exists to perform in-memory changes to the resource. Use available [code]set_*[/code] methods to add theme items.
  20. </description>
  21. </method>
  22. <method name="clear">
  23. <return type="void" />
  24. <description>
  25. Clears all values on the theme.
  26. </description>
  27. </method>
  28. <method name="clear_color">
  29. <return type="void" />
  30. <argument index="0" name="name" type="String" />
  31. <argument index="1" name="theme_type" type="String" />
  32. <description>
  33. Clears the [Color] at [code]name[/code] if the theme has [code]theme_type[/code].
  34. </description>
  35. </method>
  36. <method name="clear_constant">
  37. <return type="void" />
  38. <argument index="0" name="name" type="String" />
  39. <argument index="1" name="theme_type" type="String" />
  40. <description>
  41. Clears the constant at [code]name[/code] if the theme has [code]theme_type[/code].
  42. </description>
  43. </method>
  44. <method name="clear_font">
  45. <return type="void" />
  46. <argument index="0" name="name" type="String" />
  47. <argument index="1" name="theme_type" type="String" />
  48. <description>
  49. Clears the [Font] at [code]name[/code] if the theme has [code]theme_type[/code].
  50. </description>
  51. </method>
  52. <method name="clear_icon">
  53. <return type="void" />
  54. <argument index="0" name="name" type="String" />
  55. <argument index="1" name="theme_type" type="String" />
  56. <description>
  57. Clears the icon at [code]name[/code] if the theme has [code]theme_type[/code].
  58. </description>
  59. </method>
  60. <method name="clear_stylebox">
  61. <return type="void" />
  62. <argument index="0" name="name" type="String" />
  63. <argument index="1" name="theme_type" type="String" />
  64. <description>
  65. Clears [StyleBox] at [code]name[/code] if the theme has [code]theme_type[/code].
  66. </description>
  67. </method>
  68. <method name="clear_theme_item">
  69. <return type="void" />
  70. <argument index="0" name="data_type" type="int" enum="Theme.DataType" />
  71. <argument index="1" name="name" type="String" />
  72. <argument index="2" name="theme_type" type="String" />
  73. <description>
  74. Clears the theme item of [code]data_type[/code] at [code]name[/code] if the theme has [code]theme_type[/code].
  75. </description>
  76. </method>
  77. <method name="clear_type_variation">
  78. <return type="void" />
  79. <argument index="0" name="theme_type" type="String" />
  80. <description>
  81. Unmarks [code]theme_type[/code] as being a variation of another theme type. See [method set_type_variation].
  82. </description>
  83. </method>
  84. <method name="copy_default_theme">
  85. <return type="void" />
  86. <description>
  87. Sets the theme's values to a copy of the default theme values.
  88. </description>
  89. </method>
  90. <method name="copy_theme">
  91. <return type="void" />
  92. <argument index="0" name="other" type="Theme" />
  93. <description>
  94. Sets the theme's values to a copy of a given theme.
  95. </description>
  96. </method>
  97. <method name="get_color" qualifiers="const">
  98. <return type="Color" />
  99. <argument index="0" name="name" type="String" />
  100. <argument index="1" name="theme_type" type="String" />
  101. <description>
  102. Returns the [Color] at [code]name[/code] if the theme has [code]theme_type[/code].
  103. </description>
  104. </method>
  105. <method name="get_color_list" qualifiers="const">
  106. <return type="PoolStringArray" />
  107. <argument index="0" name="theme_type" type="String" />
  108. <description>
  109. Returns all the [Color]s as a [PoolStringArray] filled with each [Color]'s name, for use in [method get_color], if the theme has [code]theme_type[/code].
  110. </description>
  111. </method>
  112. <method name="get_color_types" qualifiers="const">
  113. <return type="PoolStringArray" />
  114. <description>
  115. Returns all the [Color] types as a [PoolStringArray] filled with unique type names, for use in [method get_color] and/or [method get_color_list].
  116. </description>
  117. </method>
  118. <method name="get_constant" qualifiers="const">
  119. <return type="int" />
  120. <argument index="0" name="name" type="String" />
  121. <argument index="1" name="theme_type" type="String" />
  122. <description>
  123. Returns the constant at [code]name[/code] if the theme has [code]theme_type[/code].
  124. </description>
  125. </method>
  126. <method name="get_constant_list" qualifiers="const">
  127. <return type="PoolStringArray" />
  128. <argument index="0" name="theme_type" type="String" />
  129. <description>
  130. Returns all the constants as a [PoolStringArray] filled with each constant's name, for use in [method get_constant], if the theme has [code]theme_type[/code].
  131. </description>
  132. </method>
  133. <method name="get_constant_types" qualifiers="const">
  134. <return type="PoolStringArray" />
  135. <description>
  136. Returns all the constant types as a [PoolStringArray] filled with unique type names, for use in [method get_constant] and/or [method get_constant_list].
  137. </description>
  138. </method>
  139. <method name="get_font" qualifiers="const">
  140. <return type="Font" />
  141. <argument index="0" name="name" type="String" />
  142. <argument index="1" name="theme_type" type="String" />
  143. <description>
  144. Returns the [Font] at [code]name[/code] if the theme has [code]theme_type[/code]. If such item does not exist and [member default_font] is set on the theme, the default font will be returned.
  145. </description>
  146. </method>
  147. <method name="get_font_list" qualifiers="const">
  148. <return type="PoolStringArray" />
  149. <argument index="0" name="theme_type" type="String" />
  150. <description>
  151. Returns all the [Font]s as a [PoolStringArray] filled with each [Font]'s name, for use in [method get_font], if the theme has [code]theme_type[/code].
  152. </description>
  153. </method>
  154. <method name="get_font_types" qualifiers="const">
  155. <return type="PoolStringArray" />
  156. <description>
  157. Returns all the [Font] types as a [PoolStringArray] filled with unique type names, for use in [method get_font] and/or [method get_font_list].
  158. </description>
  159. </method>
  160. <method name="get_icon" qualifiers="const">
  161. <return type="Texture" />
  162. <argument index="0" name="name" type="String" />
  163. <argument index="1" name="theme_type" type="String" />
  164. <description>
  165. Returns the icon [Texture] at [code]name[/code] if the theme has [code]theme_type[/code].
  166. </description>
  167. </method>
  168. <method name="get_icon_list" qualifiers="const">
  169. <return type="PoolStringArray" />
  170. <argument index="0" name="theme_type" type="String" />
  171. <description>
  172. Returns all the icons as a [PoolStringArray] filled with each [Texture]'s name, for use in [method get_icon], if the theme has [code]theme_type[/code].
  173. </description>
  174. </method>
  175. <method name="get_icon_types" qualifiers="const">
  176. <return type="PoolStringArray" />
  177. <description>
  178. Returns all the icon types as a [PoolStringArray] filled with unique type names, for use in [method get_icon] and/or [method get_icon_list].
  179. </description>
  180. </method>
  181. <method name="get_stylebox" qualifiers="const">
  182. <return type="StyleBox" />
  183. <argument index="0" name="name" type="String" />
  184. <argument index="1" name="theme_type" type="String" />
  185. <description>
  186. Returns the [StyleBox] at [code]name[/code] if the theme has [code]theme_type[/code].
  187. Valid [code]name[/code]s may be found using [method get_stylebox_list]. Valid [code]theme_type[/code]s may be found using [method get_stylebox_types].
  188. </description>
  189. </method>
  190. <method name="get_stylebox_list" qualifiers="const">
  191. <return type="PoolStringArray" />
  192. <argument index="0" name="theme_type" type="String" />
  193. <description>
  194. Returns all the [StyleBox]s as a [PoolStringArray] filled with each [StyleBox]'s name, for use in [method get_stylebox], if the theme has [code]theme_type[/code].
  195. Valid [code]theme_type[/code]s may be found using [method get_stylebox_types].
  196. </description>
  197. </method>
  198. <method name="get_stylebox_types" qualifiers="const">
  199. <return type="PoolStringArray" />
  200. <description>
  201. Returns all the [StyleBox] types as a [PoolStringArray] filled with unique type names, for use in [method get_stylebox] and/or [method get_stylebox_list].
  202. </description>
  203. </method>
  204. <method name="get_theme_item" qualifiers="const">
  205. <return type="Variant" />
  206. <argument index="0" name="data_type" type="int" enum="Theme.DataType" />
  207. <argument index="1" name="name" type="String" />
  208. <argument index="2" name="theme_type" type="String" />
  209. <description>
  210. Returns the theme item of [code]data_type[/code] at [code]name[/code] if the theme has [code]theme_type[/code].
  211. Valid [code]name[/code]s may be found using [method get_theme_item_list] or a data type specific method. Valid [code]theme_type[/code]s may be found using [method get_theme_item_types] or a data type specific method.
  212. </description>
  213. </method>
  214. <method name="get_theme_item_list" qualifiers="const">
  215. <return type="PoolStringArray" />
  216. <argument index="0" name="data_type" type="int" enum="Theme.DataType" />
  217. <argument index="1" name="theme_type" type="String" />
  218. <description>
  219. Returns all the theme items of [code]data_type[/code] as a [PoolStringArray] filled with each theme items's name, for use in [method get_theme_item] or a data type specific method, if the theme has [code]theme_type[/code].
  220. Valid [code]theme_type[/code]s may be found using [method get_theme_item_types] or a data type specific method.
  221. </description>
  222. </method>
  223. <method name="get_theme_item_types" qualifiers="const">
  224. <return type="PoolStringArray" />
  225. <argument index="0" name="data_type" type="int" enum="Theme.DataType" />
  226. <description>
  227. Returns all the theme items of [code]data_type[/code] types as a [PoolStringArray] filled with unique type names, for use in [method get_theme_item], [method get_theme_item_list] or data type specific methods.
  228. </description>
  229. </method>
  230. <method name="get_type_list" qualifiers="const">
  231. <return type="PoolStringArray" />
  232. <argument index="0" name="theme_type" type="String" />
  233. <description>
  234. Returns all the theme types as a [PoolStringArray] filled with unique type names, for use in other [code]get_*[/code] functions of this theme.
  235. [b]Note:[/b] [code]theme_type[/code] has no effect and will be removed in future version.
  236. </description>
  237. </method>
  238. <method name="get_type_variation_base" qualifiers="const">
  239. <return type="String" />
  240. <argument index="0" name="theme_type" type="String" />
  241. <description>
  242. Returns the name of the base theme type if [code]theme_type[/code] is a valid variation type. Returns an empty string otherwise.
  243. </description>
  244. </method>
  245. <method name="get_type_variation_list" qualifiers="const">
  246. <return type="PoolStringArray" />
  247. <argument index="0" name="base_type" type="String" />
  248. <description>
  249. Returns a list of all type variations for the given [code]base_type[/code].
  250. </description>
  251. </method>
  252. <method name="has_color" qualifiers="const">
  253. <return type="bool" />
  254. <argument index="0" name="name" type="String" />
  255. <argument index="1" name="theme_type" type="String" />
  256. <description>
  257. Returns [code]true[/code] if [Color] with [code]name[/code] is in [code]theme_type[/code].
  258. Returns [code]false[/code] if the theme does not have [code]theme_type[/code].
  259. </description>
  260. </method>
  261. <method name="has_constant" qualifiers="const">
  262. <return type="bool" />
  263. <argument index="0" name="name" type="String" />
  264. <argument index="1" name="theme_type" type="String" />
  265. <description>
  266. Returns [code]true[/code] if constant with [code]name[/code] is in [code]theme_type[/code].
  267. Returns [code]false[/code] if the theme does not have [code]theme_type[/code].
  268. </description>
  269. </method>
  270. <method name="has_default_font" qualifiers="const">
  271. <return type="bool" />
  272. <description>
  273. Returns [code]true[/code] if this theme has a valid [member default_font] value.
  274. </description>
  275. </method>
  276. <method name="has_font" qualifiers="const">
  277. <return type="bool" />
  278. <argument index="0" name="name" type="String" />
  279. <argument index="1" name="theme_type" type="String" />
  280. <description>
  281. Returns [code]true[/code] if [Font] with [code]name[/code] is in [code]theme_type[/code].
  282. Returns [code]false[/code] if the theme does not have [code]theme_type[/code].
  283. </description>
  284. </method>
  285. <method name="has_icon" qualifiers="const">
  286. <return type="bool" />
  287. <argument index="0" name="name" type="String" />
  288. <argument index="1" name="theme_type" type="String" />
  289. <description>
  290. Returns [code]true[/code] if icon [Texture] with [code]name[/code] is in [code]theme_type[/code].
  291. Returns [code]false[/code] if the theme does not have [code]theme_type[/code].
  292. </description>
  293. </method>
  294. <method name="has_stylebox" qualifiers="const">
  295. <return type="bool" />
  296. <argument index="0" name="name" type="String" />
  297. <argument index="1" name="theme_type" type="String" />
  298. <description>
  299. Returns [code]true[/code] if [StyleBox] with [code]name[/code] is in [code]theme_type[/code].
  300. Returns [code]false[/code] if the theme does not have [code]theme_type[/code].
  301. </description>
  302. </method>
  303. <method name="has_theme_item" qualifiers="const">
  304. <return type="bool" />
  305. <argument index="0" name="data_type" type="int" enum="Theme.DataType" />
  306. <argument index="1" name="name" type="String" />
  307. <argument index="2" name="theme_type" type="String" />
  308. <description>
  309. Returns [code]true[/code] if a theme item of [code]data_type[/code] with [code]name[/code] is in [code]theme_type[/code].
  310. Returns [code]false[/code] if the theme does not have [code]theme_type[/code].
  311. </description>
  312. </method>
  313. <method name="is_type_variation" qualifiers="const">
  314. <return type="bool" />
  315. <argument index="0" name="theme_type" type="String" />
  316. <argument index="1" name="base_type" type="String" />
  317. <description>
  318. Returns [code]true[/code] if [code]theme_type[/code] is marked as a variation of [code]base_type[/code].
  319. </description>
  320. </method>
  321. <method name="merge_with">
  322. <return type="void" />
  323. <argument index="0" name="other" type="Theme" />
  324. <description>
  325. Adds missing and overrides existing definitions with values from the [code]other[/code] [Theme].
  326. [b]Note:[/b] This modifies the current theme. If you want to merge two themes together without modifying either one, create a new empty theme and merge the other two into it one after another.
  327. </description>
  328. </method>
  329. <method name="remove_type">
  330. <return type="void" />
  331. <argument index="0" name="theme_type" type="String" />
  332. <description>
  333. Removes the theme type, gracefully discarding defined theme items. If the type is a variation, this information is also erased. If the type is a base for type variations, those variations lose their base.
  334. </description>
  335. </method>
  336. <method name="rename_color">
  337. <return type="void" />
  338. <argument index="0" name="old_name" type="String" />
  339. <argument index="1" name="name" type="String" />
  340. <argument index="2" name="theme_type" type="String" />
  341. <description>
  342. Renames the [Color] at [code]old_name[/code] to [code]name[/code] if the theme has [code]theme_type[/code]. If [code]name[/code] is already taken, this method fails.
  343. </description>
  344. </method>
  345. <method name="rename_constant">
  346. <return type="void" />
  347. <argument index="0" name="old_name" type="String" />
  348. <argument index="1" name="name" type="String" />
  349. <argument index="2" name="theme_type" type="String" />
  350. <description>
  351. Renames the constant at [code]old_name[/code] to [code]name[/code] if the theme has [code]theme_type[/code]. If [code]name[/code] is already taken, this method fails.
  352. </description>
  353. </method>
  354. <method name="rename_font">
  355. <return type="void" />
  356. <argument index="0" name="old_name" type="String" />
  357. <argument index="1" name="name" type="String" />
  358. <argument index="2" name="theme_type" type="String" />
  359. <description>
  360. Renames the [Font] at [code]old_name[/code] to [code]name[/code] if the theme has [code]theme_type[/code]. If [code]name[/code] is already taken, this method fails.
  361. </description>
  362. </method>
  363. <method name="rename_icon">
  364. <return type="void" />
  365. <argument index="0" name="old_name" type="String" />
  366. <argument index="1" name="name" type="String" />
  367. <argument index="2" name="theme_type" type="String" />
  368. <description>
  369. Renames the icon at [code]old_name[/code] to [code]name[/code] if the theme has [code]theme_type[/code]. If [code]name[/code] is already taken, this method fails.
  370. </description>
  371. </method>
  372. <method name="rename_stylebox">
  373. <return type="void" />
  374. <argument index="0" name="old_name" type="String" />
  375. <argument index="1" name="name" type="String" />
  376. <argument index="2" name="theme_type" type="String" />
  377. <description>
  378. Renames [StyleBox] at [code]old_name[/code] to [code]name[/code] if the theme has [code]theme_type[/code]. If [code]name[/code] is already taken, this method fails.
  379. </description>
  380. </method>
  381. <method name="rename_theme_item">
  382. <return type="void" />
  383. <argument index="0" name="data_type" type="int" enum="Theme.DataType" />
  384. <argument index="1" name="old_name" type="String" />
  385. <argument index="2" name="name" type="String" />
  386. <argument index="3" name="theme_type" type="String" />
  387. <description>
  388. Renames the theme item of [code]data_type[/code] at [code]old_name[/code] to [code]name[/code] if the theme has [code]theme_type[/code]. If [code]name[/code] is already taken, this method fails.
  389. </description>
  390. </method>
  391. <method name="set_color">
  392. <return type="void" />
  393. <argument index="0" name="name" type="String" />
  394. <argument index="1" name="theme_type" type="String" />
  395. <argument index="2" name="color" type="Color" />
  396. <description>
  397. Sets the theme's [Color] to [code]color[/code] at [code]name[/code] in [code]theme_type[/code].
  398. Creates [code]theme_type[/code] if the theme does not have it.
  399. </description>
  400. </method>
  401. <method name="set_constant">
  402. <return type="void" />
  403. <argument index="0" name="name" type="String" />
  404. <argument index="1" name="theme_type" type="String" />
  405. <argument index="2" name="constant" type="int" />
  406. <description>
  407. Sets the theme's constant to [code]constant[/code] at [code]name[/code] in [code]theme_type[/code].
  408. Creates [code]theme_type[/code] if the theme does not have it.
  409. </description>
  410. </method>
  411. <method name="set_font">
  412. <return type="void" />
  413. <argument index="0" name="name" type="String" />
  414. <argument index="1" name="theme_type" type="String" />
  415. <argument index="2" name="font" type="Font" />
  416. <description>
  417. Sets the theme's [Font] to [code]font[/code] at [code]name[/code] in [code]theme_type[/code].
  418. Creates [code]theme_type[/code] if the theme does not have it.
  419. </description>
  420. </method>
  421. <method name="set_icon">
  422. <return type="void" />
  423. <argument index="0" name="name" type="String" />
  424. <argument index="1" name="theme_type" type="String" />
  425. <argument index="2" name="texture" type="Texture" />
  426. <description>
  427. Sets the theme's icon [Texture] to [code]texture[/code] at [code]name[/code] in [code]theme_type[/code].
  428. Creates [code]theme_type[/code] if the theme does not have it.
  429. </description>
  430. </method>
  431. <method name="set_stylebox">
  432. <return type="void" />
  433. <argument index="0" name="name" type="String" />
  434. <argument index="1" name="theme_type" type="String" />
  435. <argument index="2" name="texture" type="StyleBox" />
  436. <description>
  437. Sets theme's [StyleBox] to [code]stylebox[/code] at [code]name[/code] in [code]theme_type[/code].
  438. Creates [code]theme_type[/code] if the theme does not have it.
  439. </description>
  440. </method>
  441. <method name="set_theme_item">
  442. <return type="void" />
  443. <argument index="0" name="data_type" type="int" enum="Theme.DataType" />
  444. <argument index="1" name="name" type="String" />
  445. <argument index="2" name="theme_type" type="String" />
  446. <argument index="3" name="value" type="Variant" />
  447. <description>
  448. Sets the theme item of [code]data_type[/code] to [code]value[/code] at [code]name[/code] in [code]theme_type[/code].
  449. Does nothing if the [code]value[/code] type does not match [code]data_type[/code].
  450. Creates [code]theme_type[/code] if the theme does not have it.
  451. </description>
  452. </method>
  453. <method name="set_type_variation">
  454. <return type="void" />
  455. <argument index="0" name="theme_type" type="String" />
  456. <argument index="1" name="base_type" type="String" />
  457. <description>
  458. Marks [code]theme_type[/code] as a variation of [code]base_type[/code].
  459. This adds [code]theme_type[/code] as a suggested option for [member Control.theme_type_variation] on a [Control] that is of the [code]base_type[/code] class.
  460. Variations can also be nested, i.e. [code]base_type[/code] can be another variation. If a chain of variations ends with a [code]base_type[/code] matching the class of the [Control], the whole chain is going to be suggested as options.
  461. [b]Note:[/b] Suggestions only show up if this theme resource is set as the project default theme. See [member ProjectSettings.gui/theme/custom].
  462. </description>
  463. </method>
  464. </methods>
  465. <members>
  466. <member name="default_font" type="Font" setter="set_default_font" getter="get_default_font">
  467. The default font of this [Theme] resource. Used as a fallback value for font items defined in this theme, but having invalid values. If this value is also invalid, the global default value is used.
  468. Use [method has_default_font] to check if this value is valid.
  469. </member>
  470. </members>
  471. <constants>
  472. <constant name="DATA_TYPE_COLOR" value="0" enum="DataType">
  473. Theme's [Color] item type.
  474. </constant>
  475. <constant name="DATA_TYPE_CONSTANT" value="1" enum="DataType">
  476. Theme's constant item type.
  477. </constant>
  478. <constant name="DATA_TYPE_FONT" value="2" enum="DataType">
  479. Theme's [Font] item type.
  480. </constant>
  481. <constant name="DATA_TYPE_ICON" value="3" enum="DataType">
  482. Theme's icon [Texture] item type.
  483. </constant>
  484. <constant name="DATA_TYPE_STYLEBOX" value="4" enum="DataType">
  485. Theme's [StyleBox] item type.
  486. </constant>
  487. <constant name="DATA_TYPE_MAX" value="5" enum="DataType">
  488. Maximum value for the DataType enum.
  489. </constant>
  490. </constants>
  491. </class>