OptionButton.xml 7.0 KB

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