0.2.0-dev Download ZIP
87 lines ·5.2 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="MenuButton" inherits="Button" api_type="core" keywords="dropdown" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A button that brings up a [PopupMenu] when clicked. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | A button that brings up a [PopupMenu] when clicked. To create new items inside this [PopupMenu], use [code]get_popup().add_item("My Item Name")[/code]. You can also create them directly from Godot editor's inspector. |
| 8 | See also [BaseButton] which contains common properties and methods associated with this node. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="get_popup" qualifiers="const"> |
| 14 | <return type="PopupMenu" /> |
| 15 | <description> |
| 16 | Returns the [PopupMenu] contained in this button. |
| 17 | [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property. |
| 18 | </description> |
| 19 | </method> |
| 20 | <method name="set_disable_shortcuts"> |
| 21 | <return type="void" /> |
| 22 | <param index="0" name="disabled" type="bool" /> |
| 23 | <description> |
| 24 | If [code]true[/code], shortcuts are disabled and cannot be used to trigger the button. |
| 25 | </description> |
| 26 | </method> |
| 27 | <method name="show_popup"> |
| 28 | <return type="void" /> |
| 29 | <description> |
| 30 | Adjusts popup position and sizing for the [MenuButton], then shows the [PopupMenu]. Prefer this over using [code]get_popup().popup()[/code]. |
| 31 | </description> |
| 32 | </method> |
| 33 | </methods> |
| 34 | <members> |
| 35 | <member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" overrides="BaseButton" enum="BaseButton.ActionMode" default="0" /> |
| 36 | <member name="flat" type="bool" setter="set_flat" getter="is_flat" overrides="Button" default="true" /> |
| 37 | <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="3" /> |
| 38 | <member name="item_count" type="int" setter="set_item_count" getter="get_item_count" default="0"> |
| 39 | The number of items currently in the list. |
| 40 | </member> |
| 41 | <member name="popup/item_{index}/checkable" type="int" setter="" getter="" default="0"> |
| 42 | The checkable item type of the item at [code]index[/code]. |
| 43 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 44 | </member> |
| 45 | <member name="popup/item_{index}/checked" type="bool" setter="" getter="" default="false"> |
| 46 | If [code]true[/code], the item at [code]index[/code] is checked. |
| 47 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 48 | [b]Note:[/b] An item cannot be both in a checked and indeterminate state, so if [code]checked[/code] is set to [code]true[/code], [member popup/item_{index}/indeterminate] will be set to [code]false[/code]. |
| 49 | </member> |
| 50 | <member name="popup/item_{index}/disabled" type="bool" setter="" getter="" default="false"> |
| 51 | If [code]true[/code], the item at [code]index[/code] is disabled. |
| 52 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 53 | </member> |
| 54 | <member name="popup/item_{index}/icon" type="Texture2D" setter="" getter=""> |
| 55 | The icon of the item at [code]index[/code]. |
| 56 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 57 | </member> |
| 58 | <member name="popup/item_{index}/id" type="int" setter="" getter="" default="0"> |
| 59 | The ID of the item at [code]index[/code]. |
| 60 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 61 | </member> |
| 62 | <member name="popup/item_{index}/indeterminate" type="bool" setter="" getter="" default="false"> |
| 63 | If [code]true[/code], the item at [code]index[/code] is in an indeterminate state. |
| 64 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 65 | [b]Note:[/b] An item cannot be both in a checked and indeterminate state, so if [code]indeterminate[/code] is set to [code]true[/code], [member popup/item_{index}/checked] will be set to [code]false[/code]. |
| 66 | </member> |
| 67 | <member name="popup/item_{index}/separator" type="bool" setter="" getter="" default="false"> |
| 68 | If [code]true[/code], the item at [code]index[/code] is a separator. |
| 69 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 70 | </member> |
| 71 | <member name="popup/item_{index}/text" type="String" setter="" getter="" default=""""> |
| 72 | The text of the item at [code]index[/code]. |
| 73 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. item_count - 1[/code] range. |
| 74 | </member> |
| 75 | <member name="switch_on_hover" type="bool" setter="set_switch_on_hover" getter="is_switch_on_hover" default="false"> |
| 76 | If [code]true[/code], when the cursor hovers above another [MenuButton] within the same parent which also has [member switch_on_hover] enabled, it will close the current [MenuButton] and open the other one. |
| 77 | </member> |
| 78 | <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" overrides="BaseButton" default="true" /> |
| 79 | </members> |
| 80 | <signals> |
| 81 | <signal name="about_to_popup"> |
| 82 | <description> |
| 83 | Emitted when the [PopupMenu] of this MenuButton is about to show. |
| 84 | </description> |
| 85 | </signal> |
| 86 | </signals> |
| 87 | </class> |