2
0

PopupMenu.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PopupMenu" inherits="Popup" version="4.0">
  3. <brief_description>
  4. PopupMenu displays a list of options.
  5. </brief_description>
  6. <description>
  7. [PopupMenu] is a [Control] that displays a list of options. They are popular in toolbars or context menus.
  8. The size of a [PopupMenu] can be limited by using [member Window.max_size]. If the height of the list of items is larger than the maximum height of the [PopupMenu], a [ScrollContainer] within the popup will allow the user to scroll the contents.
  9. If no maximum size is set, or if it is set to 0, the [PopupMenu] height will be limited by its parent rect.
  10. </description>
  11. <tutorials>
  12. </tutorials>
  13. <methods>
  14. <method name="add_check_item">
  15. <return type="void" />
  16. <argument index="0" name="label" type="String" />
  17. <argument index="1" name="id" type="int" default="-1" />
  18. <argument index="2" name="accel" type="int" default="0" />
  19. <description>
  20. Adds a new checkable item with text [code]label[/code].
  21. An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
  22. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
  23. </description>
  24. </method>
  25. <method name="add_check_shortcut">
  26. <return type="void" />
  27. <argument index="0" name="shortcut" type="Shortcut" />
  28. <argument index="1" name="id" type="int" default="-1" />
  29. <argument index="2" name="global" type="bool" default="false" />
  30. <description>
  31. Adds a new checkable item and assigns the specified [Shortcut] to it. Sets the label of the checkbox to the [Shortcut]'s name.
  32. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  33. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
  34. </description>
  35. </method>
  36. <method name="add_icon_check_item">
  37. <return type="void" />
  38. <argument index="0" name="texture" type="Texture2D" />
  39. <argument index="1" name="label" type="String" />
  40. <argument index="2" name="id" type="int" default="-1" />
  41. <argument index="3" name="accel" type="int" default="0" />
  42. <description>
  43. Adds a new checkable item with text [code]label[/code] and icon [code]texture[/code].
  44. An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
  45. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
  46. </description>
  47. </method>
  48. <method name="add_icon_check_shortcut">
  49. <return type="void" />
  50. <argument index="0" name="texture" type="Texture2D" />
  51. <argument index="1" name="shortcut" type="Shortcut" />
  52. <argument index="2" name="id" type="int" default="-1" />
  53. <argument index="3" name="global" type="bool" default="false" />
  54. <description>
  55. Adds a new checkable item and assigns the specified [Shortcut] and icon [code]texture[/code] to it. Sets the label of the checkbox to the [Shortcut]'s name.
  56. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  57. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
  58. </description>
  59. </method>
  60. <method name="add_icon_item">
  61. <return type="void" />
  62. <argument index="0" name="texture" type="Texture2D" />
  63. <argument index="1" name="label" type="String" />
  64. <argument index="2" name="id" type="int" default="-1" />
  65. <argument index="3" name="accel" type="int" default="0" />
  66. <description>
  67. Adds a new item with text [code]label[/code] and icon [code]texture[/code].
  68. An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
  69. </description>
  70. </method>
  71. <method name="add_icon_radio_check_item">
  72. <return type="void" />
  73. <argument index="0" name="texture" type="Texture2D" />
  74. <argument index="1" name="label" type="String" />
  75. <argument index="2" name="id" type="int" default="-1" />
  76. <argument index="3" name="accel" type="int" default="0" />
  77. <description>
  78. Same as [method add_icon_check_item], but uses a radio check button.
  79. </description>
  80. </method>
  81. <method name="add_icon_radio_check_shortcut">
  82. <return type="void" />
  83. <argument index="0" name="texture" type="Texture2D" />
  84. <argument index="1" name="shortcut" type="Shortcut" />
  85. <argument index="2" name="id" type="int" default="-1" />
  86. <argument index="3" name="global" type="bool" default="false" />
  87. <description>
  88. Same as [method add_icon_check_shortcut], but uses a radio check button.
  89. </description>
  90. </method>
  91. <method name="add_icon_shortcut">
  92. <return type="void" />
  93. <argument index="0" name="texture" type="Texture2D" />
  94. <argument index="1" name="shortcut" type="Shortcut" />
  95. <argument index="2" name="id" type="int" default="-1" />
  96. <argument index="3" name="global" type="bool" default="false" />
  97. <description>
  98. Adds a new item and assigns the specified [Shortcut] and icon [code]texture[/code] to it. Sets the label of the checkbox to the [Shortcut]'s name.
  99. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  100. </description>
  101. </method>
  102. <method name="add_item">
  103. <return type="void" />
  104. <argument index="0" name="label" type="String" />
  105. <argument index="1" name="id" type="int" default="-1" />
  106. <argument index="2" name="accel" type="int" default="0" />
  107. <description>
  108. Adds a new item with text [code]label[/code].
  109. An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
  110. </description>
  111. </method>
  112. <method name="add_multistate_item">
  113. <return type="void" />
  114. <argument index="0" name="label" type="String" />
  115. <argument index="1" name="max_states" type="int" />
  116. <argument index="2" name="default_state" type="int" default="0" />
  117. <argument index="3" name="id" type="int" default="-1" />
  118. <argument index="4" name="accel" type="int" default="0" />
  119. <description>
  120. Adds a new multistate item with text [code]label[/code].
  121. Contrarily to normal binary items, multistate items can have more than two states, as defined by [code]max_states[/code]. Each press or activate of the item will increase the state by one. The default value is defined by [code]default_state[/code].
  122. An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
  123. </description>
  124. </method>
  125. <method name="add_radio_check_item">
  126. <return type="void" />
  127. <argument index="0" name="label" type="String" />
  128. <argument index="1" name="id" type="int" default="-1" />
  129. <argument index="2" name="accel" type="int" default="0" />
  130. <description>
  131. Adds a new radio check button with text [code]label[/code].
  132. An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
  133. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
  134. </description>
  135. </method>
  136. <method name="add_radio_check_shortcut">
  137. <return type="void" />
  138. <argument index="0" name="shortcut" type="Shortcut" />
  139. <argument index="1" name="id" type="int" default="-1" />
  140. <argument index="2" name="global" type="bool" default="false" />
  141. <description>
  142. Adds a new radio check button and assigns a [Shortcut] to it. Sets the label of the checkbox to the [Shortcut]'s name.
  143. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  144. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
  145. </description>
  146. </method>
  147. <method name="add_separator">
  148. <return type="void" />
  149. <argument index="0" name="label" type="String" default="&quot;&quot;" />
  150. <argument index="1" name="id" type="int" default="-1" />
  151. <description>
  152. Adds a separator between items. Separators also occupy an index, which you can set by using the [code]id[/code] parameter.
  153. A [code]label[/code] can optionally be provided, which will appear at the center of the separator.
  154. </description>
  155. </method>
  156. <method name="add_shortcut">
  157. <return type="void" />
  158. <argument index="0" name="shortcut" type="Shortcut" />
  159. <argument index="1" name="id" type="int" default="-1" />
  160. <argument index="2" name="global" type="bool" default="false" />
  161. <description>
  162. Adds a [Shortcut].
  163. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  164. </description>
  165. </method>
  166. <method name="add_submenu_item">
  167. <return type="void" />
  168. <argument index="0" name="label" type="String" />
  169. <argument index="1" name="submenu" type="String" />
  170. <argument index="2" name="id" type="int" default="-1" />
  171. <description>
  172. Adds an item that will act as a submenu of the parent [PopupMenu] node when clicked. The [code]submenu[/code] argument is the name of the child [PopupMenu] node that will be shown when the item is clicked.
  173. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  174. </description>
  175. </method>
  176. <method name="clear">
  177. <return type="void" />
  178. <description>
  179. Removes all items from the [PopupMenu].
  180. </description>
  181. </method>
  182. <method name="clear_item_opentype_features">
  183. <return type="void" />
  184. <argument index="0" name="idx" type="int" />
  185. <description>
  186. Removes all OpenType features form the item's text.
  187. </description>
  188. </method>
  189. <method name="get_current_index" qualifiers="const">
  190. <return type="int" />
  191. <description>
  192. Returns the index of the currently focused item. Returns [code]-1[/code] if no item is focused.
  193. </description>
  194. </method>
  195. <method name="get_item_accelerator" qualifiers="const">
  196. <return type="int" />
  197. <argument index="0" name="idx" type="int" />
  198. <description>
  199. Returns the accelerator of the item at index [code]idx[/code]. Accelerators are special combinations of keys that activate the item, no matter which control is focused.
  200. </description>
  201. </method>
  202. <method name="get_item_icon" qualifiers="const">
  203. <return type="Texture2D" />
  204. <argument index="0" name="idx" type="int" />
  205. <description>
  206. Returns the icon of the item at index [code]idx[/code].
  207. </description>
  208. </method>
  209. <method name="get_item_id" qualifiers="const">
  210. <return type="int" />
  211. <argument index="0" name="idx" type="int" />
  212. <description>
  213. Returns the id of the item at index [code]idx[/code]. [code]id[/code] can be manually assigned, while index can not.
  214. </description>
  215. </method>
  216. <method name="get_item_index" qualifiers="const">
  217. <return type="int" />
  218. <argument index="0" name="id" type="int" />
  219. <description>
  220. Returns the index of the item containing the specified [code]id[/code]. Index is automatically assigned to each item by the engine. Index can not be set manually.
  221. </description>
  222. </method>
  223. <method name="get_item_language" qualifiers="const">
  224. <return type="String" />
  225. <argument index="0" name="idx" type="int" />
  226. <description>
  227. Returns item's text language code.
  228. </description>
  229. </method>
  230. <method name="get_item_metadata" qualifiers="const">
  231. <return type="Variant" />
  232. <argument index="0" name="idx" type="int" />
  233. <description>
  234. Returns the metadata of the specified item, which might be of any type. You can set it with [method set_item_metadata], which provides a simple way of assigning context data to items.
  235. </description>
  236. </method>
  237. <method name="get_item_opentype_feature" qualifiers="const">
  238. <return type="int" />
  239. <argument index="0" name="idx" type="int" />
  240. <argument index="1" name="tag" type="String" />
  241. <description>
  242. Returns OpenType feature [code]tag[/code] of the item's text.
  243. </description>
  244. </method>
  245. <method name="get_item_shortcut" qualifiers="const">
  246. <return type="Shortcut" />
  247. <argument index="0" name="idx" type="int" />
  248. <description>
  249. Returns the [Shortcut] associated with the specified [code]idx[/code] item.
  250. </description>
  251. </method>
  252. <method name="get_item_submenu" qualifiers="const">
  253. <return type="String" />
  254. <argument index="0" name="idx" type="int" />
  255. <description>
  256. Returns the submenu name of the item at index [code]idx[/code]. See [method add_submenu_item] for more info on how to add a submenu.
  257. </description>
  258. </method>
  259. <method name="get_item_text" qualifiers="const">
  260. <return type="String" />
  261. <argument index="0" name="idx" type="int" />
  262. <description>
  263. Returns the text of the item at index [code]idx[/code].
  264. </description>
  265. </method>
  266. <method name="get_item_text_direction" qualifiers="const">
  267. <return type="int" enum="Control.TextDirection" />
  268. <argument index="0" name="idx" type="int" />
  269. <description>
  270. Returns item's text base writing direction.
  271. </description>
  272. </method>
  273. <method name="get_item_tooltip" qualifiers="const">
  274. <return type="String" />
  275. <argument index="0" name="idx" type="int" />
  276. <description>
  277. Returns the tooltip associated with the specified index index [code]idx[/code].
  278. </description>
  279. </method>
  280. <method name="is_item_checkable" qualifiers="const">
  281. <return type="bool" />
  282. <argument index="0" name="idx" type="int" />
  283. <description>
  284. Returns [code]true[/code] if the item at index [code]idx[/code] is checkable in some way, i.e. if it has a checkbox or radio button.
  285. [b]Note:[/b] Checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.
  286. </description>
  287. </method>
  288. <method name="is_item_checked" qualifiers="const">
  289. <return type="bool" />
  290. <argument index="0" name="idx" type="int" />
  291. <description>
  292. Returns [code]true[/code] if the item at index [code]idx[/code] is checked.
  293. </description>
  294. </method>
  295. <method name="is_item_disabled" qualifiers="const">
  296. <return type="bool" />
  297. <argument index="0" name="idx" type="int" />
  298. <description>
  299. Returns [code]true[/code] if the item at index [code]idx[/code] is disabled. When it is disabled it can't be selected, or its action invoked.
  300. See [method set_item_disabled] for more info on how to disable an item.
  301. </description>
  302. </method>
  303. <method name="is_item_radio_checkable" qualifiers="const">
  304. <return type="bool" />
  305. <argument index="0" name="idx" type="int" />
  306. <description>
  307. Returns [code]true[/code] if the item at index [code]idx[/code] has radio button-style checkability.
  308. [b]Note:[/b] This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
  309. </description>
  310. </method>
  311. <method name="is_item_separator" qualifiers="const">
  312. <return type="bool" />
  313. <argument index="0" name="idx" type="int" />
  314. <description>
  315. Returns [code]true[/code] if the item is a separator. If it is, it will be displayed as a line. See [method add_separator] for more info on how to add a separator.
  316. </description>
  317. </method>
  318. <method name="is_item_shortcut_disabled" qualifiers="const">
  319. <return type="bool" />
  320. <argument index="0" name="idx" type="int" />
  321. <description>
  322. Returns [code]true[/code] if the specified item's shortcut is disabled.
  323. </description>
  324. </method>
  325. <method name="remove_item">
  326. <return type="void" />
  327. <argument index="0" name="idx" type="int" />
  328. <description>
  329. Removes the item at index [code]idx[/code] from the menu.
  330. [b]Note:[/b] The indices of items after the removed item will be shifted by one.
  331. </description>
  332. </method>
  333. <method name="set_item_accelerator">
  334. <return type="void" />
  335. <argument index="0" name="idx" type="int" />
  336. <argument index="1" name="accel" type="int" />
  337. <description>
  338. Sets the accelerator of the item at index [code]idx[/code]. Accelerators are special combinations of keys that activate the item, no matter which control is focused.
  339. </description>
  340. </method>
  341. <method name="set_item_as_checkable">
  342. <return type="void" />
  343. <argument index="0" name="idx" type="int" />
  344. <argument index="1" name="enable" type="bool" />
  345. <description>
  346. Sets whether the item at index [code]idx[/code] has a checkbox. If [code]false[/code], sets the type of the item to plain text.
  347. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
  348. </description>
  349. </method>
  350. <method name="set_item_as_radio_checkable">
  351. <return type="void" />
  352. <argument index="0" name="idx" type="int" />
  353. <argument index="1" name="enable" type="bool" />
  354. <description>
  355. Sets the type of the item at the specified index [code]idx[/code] to radio button. If [code]false[/code], sets the type of the item to plain text.
  356. </description>
  357. </method>
  358. <method name="set_item_as_separator">
  359. <return type="void" />
  360. <argument index="0" name="idx" type="int" />
  361. <argument index="1" name="enable" type="bool" />
  362. <description>
  363. Mark the item at index [code]idx[/code] as a separator, which means that it would be displayed as a line. If [code]false[/code], sets the type of the item to plain text.
  364. </description>
  365. </method>
  366. <method name="set_item_checked">
  367. <return type="void" />
  368. <argument index="0" name="idx" type="int" />
  369. <argument index="1" name="checked" type="bool" />
  370. <description>
  371. Sets the checkstate status of the item at index [code]idx[/code].
  372. </description>
  373. </method>
  374. <method name="set_item_disabled">
  375. <return type="void" />
  376. <argument index="0" name="idx" type="int" />
  377. <argument index="1" name="disabled" type="bool" />
  378. <description>
  379. Enables/disables the item at index [code]idx[/code]. When it is disabled, it can't be selected and its action can't be invoked.
  380. </description>
  381. </method>
  382. <method name="set_item_icon">
  383. <return type="void" />
  384. <argument index="0" name="idx" type="int" />
  385. <argument index="1" name="icon" type="Texture2D" />
  386. <description>
  387. Replaces the [Texture2D] icon of the specified [code]idx[/code].
  388. </description>
  389. </method>
  390. <method name="set_item_id">
  391. <return type="void" />
  392. <argument index="0" name="idx" type="int" />
  393. <argument index="1" name="id" type="int" />
  394. <description>
  395. Sets the [code]id[/code] of the item at index [code]idx[/code].
  396. </description>
  397. </method>
  398. <method name="set_item_language">
  399. <return type="void" />
  400. <argument index="0" name="idx" type="int" />
  401. <argument index="1" name="language" type="String" />
  402. <description>
  403. Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  404. </description>
  405. </method>
  406. <method name="set_item_metadata">
  407. <return type="void" />
  408. <argument index="0" name="idx" type="int" />
  409. <argument index="1" name="metadata" type="Variant" />
  410. <description>
  411. Sets the metadata of an item, which may be of any type. You can later get it with [method get_item_metadata], which provides a simple way of assigning context data to items.
  412. </description>
  413. </method>
  414. <method name="set_item_multistate">
  415. <return type="void" />
  416. <argument index="0" name="idx" type="int" />
  417. <argument index="1" name="state" type="int" />
  418. <description>
  419. Sets the state of a multistate item. See [method add_multistate_item] for details.
  420. </description>
  421. </method>
  422. <method name="set_item_opentype_feature">
  423. <return type="void" />
  424. <argument index="0" name="idx" type="int" />
  425. <argument index="1" name="tag" type="String" />
  426. <argument index="2" name="value" type="int" />
  427. <description>
  428. Sets OpenType feature [code]tag[/code] for the item's text. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url].
  429. </description>
  430. </method>
  431. <method name="set_item_shortcut">
  432. <return type="void" />
  433. <argument index="0" name="idx" type="int" />
  434. <argument index="1" name="shortcut" type="Shortcut" />
  435. <argument index="2" name="global" type="bool" default="false" />
  436. <description>
  437. Sets a [Shortcut] for the specified item [code]idx[/code].
  438. </description>
  439. </method>
  440. <method name="set_item_shortcut_disabled">
  441. <return type="void" />
  442. <argument index="0" name="idx" type="int" />
  443. <argument index="1" name="disabled" type="bool" />
  444. <description>
  445. Disables the [Shortcut] of the specified index [code]idx[/code].
  446. </description>
  447. </method>
  448. <method name="set_item_submenu">
  449. <return type="void" />
  450. <argument index="0" name="idx" type="int" />
  451. <argument index="1" name="submenu" type="String" />
  452. <description>
  453. Sets the submenu of the item at index [code]idx[/code]. The submenu is the name of a child [PopupMenu] node that would be shown when the item is clicked.
  454. </description>
  455. </method>
  456. <method name="set_item_text">
  457. <return type="void" />
  458. <argument index="0" name="idx" type="int" />
  459. <argument index="1" name="text" type="String" />
  460. <description>
  461. Sets the text of the item at index [code]idx[/code].
  462. </description>
  463. </method>
  464. <method name="set_item_text_direction">
  465. <return type="void" />
  466. <argument index="0" name="idx" type="int" />
  467. <argument index="1" name="direction" type="int" enum="Control.TextDirection" />
  468. <description>
  469. Sets item's text base writing direction.
  470. </description>
  471. </method>
  472. <method name="set_item_tooltip">
  473. <return type="void" />
  474. <argument index="0" name="idx" type="int" />
  475. <argument index="1" name="tooltip" type="String" />
  476. <description>
  477. Sets the [String] tooltip of the item at the specified index [code]idx[/code].
  478. </description>
  479. </method>
  480. <method name="toggle_item_checked">
  481. <return type="void" />
  482. <argument index="0" name="idx" type="int" />
  483. <description>
  484. Toggles the check state of the item of the specified index [code]idx[/code].
  485. </description>
  486. </method>
  487. <method name="toggle_item_multistate">
  488. <return type="void" />
  489. <argument index="0" name="idx" type="int" />
  490. <description>
  491. Cycle to the next state of a multistate item. See [method add_multistate_item] for details.
  492. </description>
  493. </method>
  494. </methods>
  495. <members>
  496. <member name="allow_search" type="bool" setter="set_allow_search" getter="get_allow_search" default="true">
  497. If [code]true[/code], allows navigating [PopupMenu] with letter keys.
  498. </member>
  499. <member name="hide_on_checkable_item_selection" type="bool" setter="set_hide_on_checkable_item_selection" getter="is_hide_on_checkable_item_selection" default="true">
  500. If [code]true[/code], hides the [PopupMenu] when a checkbox or radio button is selected.
  501. </member>
  502. <member name="hide_on_item_selection" type="bool" setter="set_hide_on_item_selection" getter="is_hide_on_item_selection" default="true">
  503. If [code]true[/code], hides the [PopupMenu] when an item is selected.
  504. </member>
  505. <member name="hide_on_state_item_selection" type="bool" setter="set_hide_on_state_item_selection" getter="is_hide_on_state_item_selection" default="false">
  506. If [code]true[/code], hides the [PopupMenu] when a state item is selected.
  507. </member>
  508. <member name="items_count" type="int" setter="set_item_count" getter="get_item_count" default="0">
  509. The number of items currently in the list.
  510. </member>
  511. <member name="submenu_popup_delay" type="float" setter="set_submenu_popup_delay" getter="get_submenu_popup_delay" default="0.3">
  512. Sets the delay time in seconds for the submenu item to popup on mouse hovering. If the popup menu is added as a child of another (acting as a submenu), it will inherit the delay time of the parent menu item.
  513. </member>
  514. </members>
  515. <signals>
  516. <signal name="id_focused">
  517. <argument index="0" name="id" type="int" />
  518. <description>
  519. Emitted when user navigated to an item of some [code]id[/code] using [code]ui_up[/code] or [code]ui_down[/code] action.
  520. </description>
  521. </signal>
  522. <signal name="id_pressed">
  523. <argument index="0" name="id" type="int" />
  524. <description>
  525. Emitted when an item of some [code]id[/code] is pressed or its accelerator is activated.
  526. </description>
  527. </signal>
  528. <signal name="index_pressed">
  529. <argument index="0" name="index" type="int" />
  530. <description>
  531. Emitted when an item of some [code]index[/code] is pressed or its accelerator is activated.
  532. </description>
  533. </signal>
  534. </signals>
  535. <theme_items>
  536. <theme_item name="checked" data_type="icon" type="Texture2D">
  537. [Texture2D] icon for the checked checkbox items.
  538. </theme_item>
  539. <theme_item name="font" data_type="font" type="Font">
  540. [Font] used for the menu items.
  541. </theme_item>
  542. <theme_item name="font_accelerator_color" data_type="color" type="Color" default="Color(0.7, 0.7, 0.7, 0.8)">
  543. The text [Color] used for shortcuts and accelerators that show next to the menu item name when defined. See [method get_item_accelerator] for more info on accelerators.
  544. </theme_item>
  545. <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
  546. The default text [Color] for menu items' names.
  547. </theme_item>
  548. <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.4, 0.4, 0.4, 0.8)">
  549. [Color] used for disabled menu items' text.
  550. </theme_item>
  551. <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
  552. [Color] used for the hovered text.
  553. </theme_item>
  554. <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
  555. The tint of text outline of the menu item.
  556. </theme_item>
  557. <theme_item name="font_separator_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
  558. [Color] used for labeled separators' text. See [method add_separator].
  559. </theme_item>
  560. <theme_item name="font_size" data_type="font_size" type="int">
  561. Font size of the menu items.
  562. </theme_item>
  563. <theme_item name="hover" data_type="style" type="StyleBox">
  564. [StyleBox] displayed when the [PopupMenu] item is hovered.
  565. </theme_item>
  566. <theme_item name="hseparation" data_type="constant" type="int" default="4">
  567. The horizontal space between the item's name and the shortcut text/submenu arrow.
  568. </theme_item>
  569. <theme_item name="item_end_padding" data_type="constant" type="int" default="2">
  570. </theme_item>
  571. <theme_item name="item_start_padding" data_type="constant" type="int" default="2">
  572. </theme_item>
  573. <theme_item name="labeled_separator_left" data_type="style" type="StyleBox">
  574. [StyleBox] for the left side of labeled separator. See [method add_separator].
  575. </theme_item>
  576. <theme_item name="labeled_separator_right" data_type="style" type="StyleBox">
  577. [StyleBox] for the right side of labeled separator. See [method add_separator].
  578. </theme_item>
  579. <theme_item name="outline_size" data_type="constant" type="int" default="0">
  580. The size of the item text outline.
  581. </theme_item>
  582. <theme_item name="panel" data_type="style" type="StyleBox">
  583. Default [StyleBox] of the [PopupMenu] items.
  584. </theme_item>
  585. <theme_item name="panel_disabled" data_type="style" type="StyleBox">
  586. [StyleBox] used when the [PopupMenu] item is disabled.
  587. </theme_item>
  588. <theme_item name="radio_checked" data_type="icon" type="Texture2D">
  589. [Texture2D] icon for the checked radio button items.
  590. </theme_item>
  591. <theme_item name="radio_unchecked" data_type="icon" type="Texture2D">
  592. [Texture2D] icon for the unchecked radio button items.
  593. </theme_item>
  594. <theme_item name="separator" data_type="style" type="StyleBox">
  595. [StyleBox] used for the separators. See [method add_separator].
  596. </theme_item>
  597. <theme_item name="submenu" data_type="icon" type="Texture2D">
  598. [Texture2D] icon for the submenu arrow (for left-to-right layouts).
  599. </theme_item>
  600. <theme_item name="submenu_mirrored" data_type="icon" type="Texture2D">
  601. [Texture2D] icon for the submenu arrow (for right-to-left layouts).
  602. </theme_item>
  603. <theme_item name="unchecked" data_type="icon" type="Texture2D">
  604. [Texture2D] icon for the unchecked checkbox items.
  605. </theme_item>
  606. <theme_item name="vseparation" data_type="constant" type="int" default="4">
  607. The vertical space between each menu item.
  608. </theme_item>
  609. </theme_items>
  610. </class>