PopupMenu.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PopupMenu" inherits="Popup" version="3.4">
  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. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_check_item">
  13. <return type="void">
  14. </return>
  15. <argument index="0" name="label" type="String">
  16. </argument>
  17. <argument index="1" name="id" type="int" default="-1">
  18. </argument>
  19. <argument index="2" name="accel" type="int" default="0">
  20. </argument>
  21. <description>
  22. Adds a new checkable item with text [code]label[/code].
  23. 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.
  24. [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.
  25. </description>
  26. </method>
  27. <method name="add_check_shortcut">
  28. <return type="void">
  29. </return>
  30. <argument index="0" name="shortcut" type="ShortCut">
  31. </argument>
  32. <argument index="1" name="id" type="int" default="-1">
  33. </argument>
  34. <argument index="2" name="global" type="bool" default="false">
  35. </argument>
  36. <description>
  37. Adds a new checkable item and assigns the specified [ShortCut] to it. Sets the label of the checkbox to the [ShortCut]'s name.
  38. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  39. [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.
  40. </description>
  41. </method>
  42. <method name="add_icon_check_item">
  43. <return type="void">
  44. </return>
  45. <argument index="0" name="texture" type="Texture">
  46. </argument>
  47. <argument index="1" name="label" type="String">
  48. </argument>
  49. <argument index="2" name="id" type="int" default="-1">
  50. </argument>
  51. <argument index="3" name="accel" type="int" default="0">
  52. </argument>
  53. <description>
  54. Adds a new checkable item with text [code]label[/code] and icon [code]texture[/code].
  55. 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.
  56. [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.
  57. </description>
  58. </method>
  59. <method name="add_icon_check_shortcut">
  60. <return type="void">
  61. </return>
  62. <argument index="0" name="texture" type="Texture">
  63. </argument>
  64. <argument index="1" name="shortcut" type="ShortCut">
  65. </argument>
  66. <argument index="2" name="id" type="int" default="-1">
  67. </argument>
  68. <argument index="3" name="global" type="bool" default="false">
  69. </argument>
  70. <description>
  71. 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.
  72. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  73. [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.
  74. </description>
  75. </method>
  76. <method name="add_icon_item">
  77. <return type="void">
  78. </return>
  79. <argument index="0" name="texture" type="Texture">
  80. </argument>
  81. <argument index="1" name="label" type="String">
  82. </argument>
  83. <argument index="2" name="id" type="int" default="-1">
  84. </argument>
  85. <argument index="3" name="accel" type="int" default="0">
  86. </argument>
  87. <description>
  88. Adds a new item with text [code]label[/code] and icon [code]texture[/code].
  89. 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.
  90. </description>
  91. </method>
  92. <method name="add_icon_radio_check_item">
  93. <return type="void">
  94. </return>
  95. <argument index="0" name="texture" type="Texture">
  96. </argument>
  97. <argument index="1" name="label" type="String">
  98. </argument>
  99. <argument index="2" name="id" type="int" default="-1">
  100. </argument>
  101. <argument index="3" name="accel" type="int" default="0">
  102. </argument>
  103. <description>
  104. Same as [method add_icon_check_item], but uses a radio check button.
  105. </description>
  106. </method>
  107. <method name="add_icon_radio_check_shortcut">
  108. <return type="void">
  109. </return>
  110. <argument index="0" name="texture" type="Texture">
  111. </argument>
  112. <argument index="1" name="shortcut" type="ShortCut">
  113. </argument>
  114. <argument index="2" name="id" type="int" default="-1">
  115. </argument>
  116. <argument index="3" name="global" type="bool" default="false">
  117. </argument>
  118. <description>
  119. Same as [method add_icon_check_shortcut], but uses a radio check button.
  120. </description>
  121. </method>
  122. <method name="add_icon_shortcut">
  123. <return type="void">
  124. </return>
  125. <argument index="0" name="texture" type="Texture">
  126. </argument>
  127. <argument index="1" name="shortcut" type="ShortCut">
  128. </argument>
  129. <argument index="2" name="id" type="int" default="-1">
  130. </argument>
  131. <argument index="3" name="global" type="bool" default="false">
  132. </argument>
  133. <description>
  134. 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.
  135. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  136. </description>
  137. </method>
  138. <method name="add_item">
  139. <return type="void">
  140. </return>
  141. <argument index="0" name="label" type="String">
  142. </argument>
  143. <argument index="1" name="id" type="int" default="-1">
  144. </argument>
  145. <argument index="2" name="accel" type="int" default="0">
  146. </argument>
  147. <description>
  148. Adds a new item with text [code]label[/code].
  149. 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.
  150. </description>
  151. </method>
  152. <method name="add_multistate_item">
  153. <return type="void">
  154. </return>
  155. <argument index="0" name="label" type="String">
  156. </argument>
  157. <argument index="1" name="max_states" type="int">
  158. </argument>
  159. <argument index="2" name="default_state" type="int" default="0">
  160. </argument>
  161. <argument index="3" name="id" type="int" default="-1">
  162. </argument>
  163. <argument index="4" name="accel" type="int" default="0">
  164. </argument>
  165. <description>
  166. Adds a new multistate item with text [code]label[/code].
  167. 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].
  168. 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.
  169. </description>
  170. </method>
  171. <method name="add_radio_check_item">
  172. <return type="void">
  173. </return>
  174. <argument index="0" name="label" type="String">
  175. </argument>
  176. <argument index="1" name="id" type="int" default="-1">
  177. </argument>
  178. <argument index="2" name="accel" type="int" default="0">
  179. </argument>
  180. <description>
  181. Adds a new radio check button with text [code]label[/code].
  182. 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.
  183. [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.
  184. </description>
  185. </method>
  186. <method name="add_radio_check_shortcut">
  187. <return type="void">
  188. </return>
  189. <argument index="0" name="shortcut" type="ShortCut">
  190. </argument>
  191. <argument index="1" name="id" type="int" default="-1">
  192. </argument>
  193. <argument index="2" name="global" type="bool" default="false">
  194. </argument>
  195. <description>
  196. Adds a new radio check button and assigns a [ShortCut] to it. Sets the label of the checkbox to the [ShortCut]'s name.
  197. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  198. [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.
  199. </description>
  200. </method>
  201. <method name="add_separator">
  202. <return type="void">
  203. </return>
  204. <argument index="0" name="label" type="String" default="&quot;&quot;">
  205. </argument>
  206. <argument index="1" name="id" type="int" default="-1">
  207. </argument>
  208. <description>
  209. Adds a separator between items. Separators also occupy an index, which you can set by using the [code]id[/code] parameter.
  210. A [code]label[/code] can optionally be provided, which will appear at the center of the separator.
  211. </description>
  212. </method>
  213. <method name="add_shortcut">
  214. <return type="void">
  215. </return>
  216. <argument index="0" name="shortcut" type="ShortCut">
  217. </argument>
  218. <argument index="1" name="id" type="int" default="-1">
  219. </argument>
  220. <argument index="2" name="global" type="bool" default="false">
  221. </argument>
  222. <description>
  223. Adds a [ShortCut].
  224. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  225. </description>
  226. </method>
  227. <method name="add_submenu_item">
  228. <return type="void">
  229. </return>
  230. <argument index="0" name="label" type="String">
  231. </argument>
  232. <argument index="1" name="submenu" type="String">
  233. </argument>
  234. <argument index="2" name="id" type="int" default="-1">
  235. </argument>
  236. <description>
  237. 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.
  238. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index.
  239. </description>
  240. </method>
  241. <method name="clear">
  242. <return type="void">
  243. </return>
  244. <description>
  245. Removes all items from the [PopupMenu].
  246. </description>
  247. </method>
  248. <method name="get_current_index" qualifiers="const">
  249. <return type="int">
  250. </return>
  251. <description>
  252. </description>
  253. </method>
  254. <method name="get_item_accelerator" qualifiers="const">
  255. <return type="int">
  256. </return>
  257. <argument index="0" name="idx" type="int">
  258. </argument>
  259. <description>
  260. 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.
  261. </description>
  262. </method>
  263. <method name="get_item_count" qualifiers="const">
  264. <return type="int">
  265. </return>
  266. <description>
  267. Returns the number of items in the [PopupMenu].
  268. </description>
  269. </method>
  270. <method name="get_item_icon" qualifiers="const">
  271. <return type="Texture">
  272. </return>
  273. <argument index="0" name="idx" type="int">
  274. </argument>
  275. <description>
  276. Returns the icon of the item at index [code]idx[/code].
  277. </description>
  278. </method>
  279. <method name="get_item_id" qualifiers="const">
  280. <return type="int">
  281. </return>
  282. <argument index="0" name="idx" type="int">
  283. </argument>
  284. <description>
  285. Returns the id of the item at index [code]idx[/code]. [code]id[/code] can be manually assigned, while index can not.
  286. </description>
  287. </method>
  288. <method name="get_item_index" qualifiers="const">
  289. <return type="int">
  290. </return>
  291. <argument index="0" name="id" type="int">
  292. </argument>
  293. <description>
  294. 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.
  295. </description>
  296. </method>
  297. <method name="get_item_metadata" qualifiers="const">
  298. <return type="Variant">
  299. </return>
  300. <argument index="0" name="idx" type="int">
  301. </argument>
  302. <description>
  303. 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.
  304. </description>
  305. </method>
  306. <method name="get_item_shortcut" qualifiers="const">
  307. <return type="ShortCut">
  308. </return>
  309. <argument index="0" name="idx" type="int">
  310. </argument>
  311. <description>
  312. Returns the [ShortCut] associated with the specified [code]idx[/code] item.
  313. </description>
  314. </method>
  315. <method name="get_item_submenu" qualifiers="const">
  316. <return type="String">
  317. </return>
  318. <argument index="0" name="idx" type="int">
  319. </argument>
  320. <description>
  321. 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.
  322. </description>
  323. </method>
  324. <method name="get_item_text" qualifiers="const">
  325. <return type="String">
  326. </return>
  327. <argument index="0" name="idx" type="int">
  328. </argument>
  329. <description>
  330. Returns the text of the item at index [code]idx[/code].
  331. </description>
  332. </method>
  333. <method name="get_item_tooltip" qualifiers="const">
  334. <return type="String">
  335. </return>
  336. <argument index="0" name="idx" type="int">
  337. </argument>
  338. <description>
  339. Returns the tooltip associated with the specified index index [code]idx[/code].
  340. </description>
  341. </method>
  342. <method name="is_hide_on_window_lose_focus" qualifiers="const">
  343. <return type="bool">
  344. </return>
  345. <description>
  346. Returns [code]true[/code] if the popup will be hidden when the window loses focus or not.
  347. </description>
  348. </method>
  349. <method name="is_item_checkable" qualifiers="const">
  350. <return type="bool">
  351. </return>
  352. <argument index="0" name="idx" type="int">
  353. </argument>
  354. <description>
  355. 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.
  356. [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.
  357. </description>
  358. </method>
  359. <method name="is_item_checked" qualifiers="const">
  360. <return type="bool">
  361. </return>
  362. <argument index="0" name="idx" type="int">
  363. </argument>
  364. <description>
  365. Returns [code]true[/code] if the item at index [code]idx[/code] is checked.
  366. </description>
  367. </method>
  368. <method name="is_item_disabled" qualifiers="const">
  369. <return type="bool">
  370. </return>
  371. <argument index="0" name="idx" type="int">
  372. </argument>
  373. <description>
  374. 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.
  375. See [method set_item_disabled] for more info on how to disable an item.
  376. </description>
  377. </method>
  378. <method name="is_item_radio_checkable" qualifiers="const">
  379. <return type="bool">
  380. </return>
  381. <argument index="0" name="idx" type="int">
  382. </argument>
  383. <description>
  384. Returns [code]true[/code] if the item at index [code]idx[/code] has radio button-style checkability.
  385. [b]Note:[/b] This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
  386. </description>
  387. </method>
  388. <method name="is_item_separator" qualifiers="const">
  389. <return type="bool">
  390. </return>
  391. <argument index="0" name="idx" type="int">
  392. </argument>
  393. <description>
  394. 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.
  395. </description>
  396. </method>
  397. <method name="is_item_shortcut_disabled" qualifiers="const">
  398. <return type="bool">
  399. </return>
  400. <argument index="0" name="idx" type="int">
  401. </argument>
  402. <description>
  403. Returns [code]true[/code] if the specified item's shortcut is disabled.
  404. </description>
  405. </method>
  406. <method name="remove_item">
  407. <return type="void">
  408. </return>
  409. <argument index="0" name="idx" type="int">
  410. </argument>
  411. <description>
  412. Removes the item at index [code]idx[/code] from the menu.
  413. [b]Note:[/b] The indices of items after the removed item will be shifted by one.
  414. </description>
  415. </method>
  416. <method name="set_hide_on_window_lose_focus">
  417. <return type="void">
  418. </return>
  419. <argument index="0" name="enable" type="bool">
  420. </argument>
  421. <description>
  422. Hides the [PopupMenu] when the window loses focus.
  423. </description>
  424. </method>
  425. <method name="set_item_accelerator">
  426. <return type="void">
  427. </return>
  428. <argument index="0" name="idx" type="int">
  429. </argument>
  430. <argument index="1" name="accel" type="int">
  431. </argument>
  432. <description>
  433. 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.
  434. </description>
  435. </method>
  436. <method name="set_item_as_checkable">
  437. <return type="void">
  438. </return>
  439. <argument index="0" name="idx" type="int">
  440. </argument>
  441. <argument index="1" name="enable" type="bool">
  442. </argument>
  443. <description>
  444. 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.
  445. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
  446. </description>
  447. </method>
  448. <method name="set_item_as_radio_checkable">
  449. <return type="void">
  450. </return>
  451. <argument index="0" name="idx" type="int">
  452. </argument>
  453. <argument index="1" name="enable" type="bool">
  454. </argument>
  455. <description>
  456. 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.
  457. </description>
  458. </method>
  459. <method name="set_item_as_separator">
  460. <return type="void">
  461. </return>
  462. <argument index="0" name="idx" type="int">
  463. </argument>
  464. <argument index="1" name="enable" type="bool">
  465. </argument>
  466. <description>
  467. 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.
  468. </description>
  469. </method>
  470. <method name="set_item_checked">
  471. <return type="void">
  472. </return>
  473. <argument index="0" name="idx" type="int">
  474. </argument>
  475. <argument index="1" name="checked" type="bool">
  476. </argument>
  477. <description>
  478. Sets the checkstate status of the item at index [code]idx[/code].
  479. </description>
  480. </method>
  481. <method name="set_item_disabled">
  482. <return type="void">
  483. </return>
  484. <argument index="0" name="idx" type="int">
  485. </argument>
  486. <argument index="1" name="disabled" type="bool">
  487. </argument>
  488. <description>
  489. 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.
  490. </description>
  491. </method>
  492. <method name="set_item_icon">
  493. <return type="void">
  494. </return>
  495. <argument index="0" name="idx" type="int">
  496. </argument>
  497. <argument index="1" name="icon" type="Texture">
  498. </argument>
  499. <description>
  500. Replaces the [Texture] icon of the specified [code]idx[/code].
  501. </description>
  502. </method>
  503. <method name="set_item_id">
  504. <return type="void">
  505. </return>
  506. <argument index="0" name="idx" type="int">
  507. </argument>
  508. <argument index="1" name="id" type="int">
  509. </argument>
  510. <description>
  511. Sets the [code]id[/code] of the item at index [code]idx[/code].
  512. </description>
  513. </method>
  514. <method name="set_item_metadata">
  515. <return type="void">
  516. </return>
  517. <argument index="0" name="idx" type="int">
  518. </argument>
  519. <argument index="1" name="metadata" type="Variant">
  520. </argument>
  521. <description>
  522. 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.
  523. </description>
  524. </method>
  525. <method name="set_item_multistate">
  526. <return type="void">
  527. </return>
  528. <argument index="0" name="idx" type="int">
  529. </argument>
  530. <argument index="1" name="state" type="int">
  531. </argument>
  532. <description>
  533. Sets the state of a multistate item. See [method add_multistate_item] for details.
  534. </description>
  535. </method>
  536. <method name="set_item_shortcut">
  537. <return type="void">
  538. </return>
  539. <argument index="0" name="idx" type="int">
  540. </argument>
  541. <argument index="1" name="shortcut" type="ShortCut">
  542. </argument>
  543. <argument index="2" name="global" type="bool" default="false">
  544. </argument>
  545. <description>
  546. Sets a [ShortCut] for the specified item [code]idx[/code].
  547. </description>
  548. </method>
  549. <method name="set_item_shortcut_disabled">
  550. <return type="void">
  551. </return>
  552. <argument index="0" name="idx" type="int">
  553. </argument>
  554. <argument index="1" name="disabled" type="bool">
  555. </argument>
  556. <description>
  557. Disables the [ShortCut] of the specified index [code]idx[/code].
  558. </description>
  559. </method>
  560. <method name="set_item_submenu">
  561. <return type="void">
  562. </return>
  563. <argument index="0" name="idx" type="int">
  564. </argument>
  565. <argument index="1" name="submenu" type="String">
  566. </argument>
  567. <description>
  568. 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.
  569. </description>
  570. </method>
  571. <method name="set_item_text">
  572. <return type="void">
  573. </return>
  574. <argument index="0" name="idx" type="int">
  575. </argument>
  576. <argument index="1" name="text" type="String">
  577. </argument>
  578. <description>
  579. Sets the text of the item at index [code]idx[/code].
  580. </description>
  581. </method>
  582. <method name="set_item_tooltip">
  583. <return type="void">
  584. </return>
  585. <argument index="0" name="idx" type="int">
  586. </argument>
  587. <argument index="1" name="tooltip" type="String">
  588. </argument>
  589. <description>
  590. Sets the [String] tooltip of the item at the specified index [code]idx[/code].
  591. </description>
  592. </method>
  593. <method name="toggle_item_checked">
  594. <return type="void">
  595. </return>
  596. <argument index="0" name="idx" type="int">
  597. </argument>
  598. <description>
  599. Toggles the check state of the item of the specified index [code]idx[/code].
  600. </description>
  601. </method>
  602. <method name="toggle_item_multistate">
  603. <return type="void">
  604. </return>
  605. <argument index="0" name="idx" type="int">
  606. </argument>
  607. <description>
  608. Cycle to the next state of a multistate item. See [method add_multistate_item] for details.
  609. </description>
  610. </method>
  611. </methods>
  612. <members>
  613. <member name="allow_search" type="bool" setter="set_allow_search" getter="get_allow_search" default="false">
  614. If [code]true[/code], allows navigating [PopupMenu] with letter keys.
  615. </member>
  616. <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" />
  617. <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">
  618. If [code]true[/code], hides the [PopupMenu] when a checkbox or radio button is selected.
  619. </member>
  620. <member name="hide_on_item_selection" type="bool" setter="set_hide_on_item_selection" getter="is_hide_on_item_selection" default="true">
  621. If [code]true[/code], hides the [PopupMenu] when an item is selected.
  622. </member>
  623. <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">
  624. If [code]true[/code], hides the [PopupMenu] when a state item is selected.
  625. </member>
  626. <member name="submenu_popup_delay" type="float" setter="set_submenu_popup_delay" getter="get_submenu_popup_delay" default="0.3">
  627. 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.
  628. </member>
  629. </members>
  630. <signals>
  631. <signal name="id_focused">
  632. <argument index="0" name="id" type="int">
  633. </argument>
  634. <description>
  635. Emitted when user navigated to an item of some [code]id[/code] using [code]ui_up[/code] or [code]ui_down[/code] action.
  636. </description>
  637. </signal>
  638. <signal name="id_pressed">
  639. <argument index="0" name="id" type="int">
  640. </argument>
  641. <description>
  642. Emitted when an item of some [code]id[/code] is pressed or its accelerator is activated.
  643. </description>
  644. </signal>
  645. <signal name="index_pressed">
  646. <argument index="0" name="index" type="int">
  647. </argument>
  648. <description>
  649. Emitted when an item of some [code]index[/code] is pressed or its accelerator is activated.
  650. </description>
  651. </signal>
  652. </signals>
  653. <constants>
  654. </constants>
  655. <theme_items>
  656. <theme_item name="checked" type="Texture">
  657. [Texture] icon for the checked checkbox items.
  658. </theme_item>
  659. <theme_item name="font" type="Font">
  660. [Font] used for the menu items.
  661. </theme_item>
  662. <theme_item name="font_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
  663. The default text [Color] for menu items' names.
  664. </theme_item>
  665. <theme_item name="font_color_accel" type="Color" default="Color( 0.7, 0.7, 0.7, 0.8 )">
  666. 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.
  667. </theme_item>
  668. <theme_item name="font_color_disabled" type="Color" default="Color( 0.4, 0.4, 0.4, 0.8 )">
  669. [Color] used for disabled menu items' text.
  670. </theme_item>
  671. <theme_item name="font_color_hover" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
  672. [Color] used for the hovered text.
  673. </theme_item>
  674. <theme_item name="font_color_separator" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
  675. [Color] used for labeled separators' text. See [method add_separator].
  676. </theme_item>
  677. <theme_item name="hover" type="StyleBox">
  678. [StyleBox] displayed when the [PopupMenu] item is hovered.
  679. </theme_item>
  680. <theme_item name="hseparation" type="int" default="4">
  681. The horizontal space between the item's name and the shortcut text/submenu arrow.
  682. </theme_item>
  683. <theme_item name="labeled_separator_left" type="StyleBox">
  684. [StyleBox] for the left side of labeled separator. See [method add_separator].
  685. </theme_item>
  686. <theme_item name="labeled_separator_right" type="StyleBox">
  687. [StyleBox] for the right side of labeled separator. See [method add_separator].
  688. </theme_item>
  689. <theme_item name="panel" type="StyleBox">
  690. Default [StyleBox] of the [PopupMenu] items.
  691. </theme_item>
  692. <theme_item name="panel_disabled" type="StyleBox">
  693. [StyleBox] used when the [PopupMenu] item is disabled.
  694. </theme_item>
  695. <theme_item name="radio_checked" type="Texture">
  696. [Texture] icon for the checked radio button items.
  697. </theme_item>
  698. <theme_item name="radio_unchecked" type="Texture">
  699. [Texture] icon for the unchecked radio button items.
  700. </theme_item>
  701. <theme_item name="separator" type="StyleBox">
  702. [StyleBox] used for the separators. See [method add_separator].
  703. </theme_item>
  704. <theme_item name="submenu" type="Texture">
  705. [Texture] icon for the submenu arrow.
  706. </theme_item>
  707. <theme_item name="unchecked" type="Texture">
  708. [Texture] icon for the unchecked checkbox items.
  709. </theme_item>
  710. <theme_item name="vseparation" type="int" default="4">
  711. The vertical space between each menu item.
  712. </theme_item>
  713. </theme_items>
  714. </class>