OptionButton.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="OptionButton" inherits="Button" category="Core" version="3.1.2">
  3. <brief_description>
  4. Button control that provides selectable options when pressed.
  5. </brief_description>
  6. <description>
  7. OptionButton is a type button that provides a selectable list of items when pressed. The item selected becomes the "current" item and is displayed as the button text.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_icon_item">
  13. <return type="void">
  14. </return>
  15. <argument index="0" name="texture" type="Texture">
  16. </argument>
  17. <argument index="1" name="label" type="String">
  18. </argument>
  19. <argument index="2" name="id" type="int" default="-1">
  20. </argument>
  21. <description>
  22. Add an item, with a "texture" icon, text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end.
  23. </description>
  24. </method>
  25. <method name="add_item">
  26. <return type="void">
  27. </return>
  28. <argument index="0" name="label" type="String">
  29. </argument>
  30. <argument index="1" name="id" type="int" default="-1">
  31. </argument>
  32. <description>
  33. Add an item, with text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end.
  34. </description>
  35. </method>
  36. <method name="add_separator">
  37. <return type="void">
  38. </return>
  39. <description>
  40. Add a separator to the list of items. Separators help to group items. Separator also takes up an index and is appended at the end.
  41. </description>
  42. </method>
  43. <method name="clear">
  44. <return type="void">
  45. </return>
  46. <description>
  47. Clear all the items in the [code]OptionButton[/code].
  48. </description>
  49. </method>
  50. <method name="get_item_count" qualifiers="const">
  51. <return type="int">
  52. </return>
  53. <description>
  54. Returns the amount of items in the OptionButton.
  55. </description>
  56. </method>
  57. <method name="get_item_icon" qualifiers="const">
  58. <return type="Texture">
  59. </return>
  60. <argument index="0" name="idx" type="int">
  61. </argument>
  62. <description>
  63. Returns the icon of the item at index "idx".
  64. </description>
  65. </method>
  66. <method name="get_item_id" qualifiers="const">
  67. <return type="int">
  68. </return>
  69. <argument index="0" name="idx" type="int">
  70. </argument>
  71. <description>
  72. Returns the ID of the item at index [code]idx[/code].
  73. </description>
  74. </method>
  75. <method name="get_item_index" qualifiers="const">
  76. <return type="int">
  77. </return>
  78. <argument index="0" name="id" type="int">
  79. </argument>
  80. <description>
  81. Returns the index of the item with the given [code]id[/code].
  82. </description>
  83. </method>
  84. <method name="get_item_metadata" qualifiers="const">
  85. <return type="Variant">
  86. </return>
  87. <argument index="0" name="idx" type="int">
  88. </argument>
  89. <description>
  90. </description>
  91. </method>
  92. <method name="get_item_text" qualifiers="const">
  93. <return type="String">
  94. </return>
  95. <argument index="0" name="idx" type="int">
  96. </argument>
  97. <description>
  98. Returns the text of the item at index "idx".
  99. </description>
  100. </method>
  101. <method name="get_popup" qualifiers="const">
  102. <return type="PopupMenu">
  103. </return>
  104. <description>
  105. Returns the [PopupMenu] contained in this button.
  106. </description>
  107. </method>
  108. <method name="get_selected_id" qualifiers="const">
  109. <return type="int">
  110. </return>
  111. <description>
  112. </description>
  113. </method>
  114. <method name="get_selected_metadata" qualifiers="const">
  115. <return type="Variant">
  116. </return>
  117. <description>
  118. </description>
  119. </method>
  120. <method name="is_item_disabled" qualifiers="const">
  121. <return type="bool">
  122. </return>
  123. <argument index="0" name="idx" type="int">
  124. </argument>
  125. <description>
  126. </description>
  127. </method>
  128. <method name="remove_item">
  129. <return type="void">
  130. </return>
  131. <argument index="0" name="idx" type="int">
  132. </argument>
  133. <description>
  134. </description>
  135. </method>
  136. <method name="select">
  137. <return type="void">
  138. </return>
  139. <argument index="0" name="idx" type="int">
  140. </argument>
  141. <description>
  142. Select an item by index and make it the current item.
  143. </description>
  144. </method>
  145. <method name="set_item_disabled">
  146. <return type="void">
  147. </return>
  148. <argument index="0" name="idx" type="int">
  149. </argument>
  150. <argument index="1" name="disabled" type="bool">
  151. </argument>
  152. <description>
  153. </description>
  154. </method>
  155. <method name="set_item_icon">
  156. <return type="void">
  157. </return>
  158. <argument index="0" name="idx" type="int">
  159. </argument>
  160. <argument index="1" name="texture" type="Texture">
  161. </argument>
  162. <description>
  163. Set the icon of an item at index "idx".
  164. </description>
  165. </method>
  166. <method name="set_item_id">
  167. <return type="void">
  168. </return>
  169. <argument index="0" name="idx" type="int">
  170. </argument>
  171. <argument index="1" name="id" type="int">
  172. </argument>
  173. <description>
  174. Set the ID of an item at index "idx".
  175. </description>
  176. </method>
  177. <method name="set_item_metadata">
  178. <return type="void">
  179. </return>
  180. <argument index="0" name="idx" type="int">
  181. </argument>
  182. <argument index="1" name="metadata" type="Variant">
  183. </argument>
  184. <description>
  185. </description>
  186. </method>
  187. <method name="set_item_text">
  188. <return type="void">
  189. </return>
  190. <argument index="0" name="idx" type="int">
  191. </argument>
  192. <argument index="1" name="text" type="String">
  193. </argument>
  194. <description>
  195. Set the text of an item at index "idx".
  196. </description>
  197. </method>
  198. </methods>
  199. <members>
  200. <member name="selected" type="int" setter="_select_int" getter="get_selected">
  201. </member>
  202. </members>
  203. <signals>
  204. <signal name="item_focused">
  205. <argument index="0" name="ID" type="int">
  206. </argument>
  207. <description>
  208. This signal is emitted when user navigated to an item using [code]ui_up[/code] or [code]ui_down[/code] action. ID of the item selected is passed as argument.
  209. </description>
  210. </signal>
  211. <signal name="item_selected">
  212. <argument index="0" name="ID" type="int">
  213. </argument>
  214. <description>
  215. This signal is emitted when the current item was changed by the user. Index of the item selected is passed as argument.
  216. </description>
  217. </signal>
  218. </signals>
  219. <constants>
  220. </constants>
  221. <theme_items>
  222. <theme_item name="arrow" type="Texture">
  223. </theme_item>
  224. <theme_item name="arrow_margin" type="int">
  225. </theme_item>
  226. <theme_item name="disabled" type="StyleBox">
  227. </theme_item>
  228. <theme_item name="focus" type="StyleBox">
  229. </theme_item>
  230. <theme_item name="font" type="Font">
  231. </theme_item>
  232. <theme_item name="font_color" type="Color">
  233. </theme_item>
  234. <theme_item name="font_color_disabled" type="Color">
  235. </theme_item>
  236. <theme_item name="font_color_hover" type="Color">
  237. </theme_item>
  238. <theme_item name="font_color_pressed" type="Color">
  239. </theme_item>
  240. <theme_item name="hover" type="StyleBox">
  241. </theme_item>
  242. <theme_item name="hseparation" type="int">
  243. </theme_item>
  244. <theme_item name="normal" type="StyleBox">
  245. </theme_item>
  246. <theme_item name="pressed" type="StyleBox">
  247. </theme_item>
  248. </theme_items>
  249. </class>