| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="MenuBar" inherits="Control" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A horizontal menu bar that creates a menu for each [PopupMenu] child. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | A horizontal menu bar that creates a menu for each [PopupMenu] child. New items are created by adding [PopupMenu]s to this node. Item title is determined by [member Window.title], or node name if [member Window.title] is empty. Item title can be overridden using [method set_menu_title]. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | </tutorials> |
| 11 | <methods> |
| 12 | <method name="get_menu_count" qualifiers="const"> |
| 13 | <return type="int" /> |
| 14 | <description> |
| 15 | Returns number of menu items. |
| 16 | </description> |
| 17 | </method> |
| 18 | <method name="get_menu_popup" qualifiers="const"> |
| 19 | <return type="PopupMenu" /> |
| 20 | <param index="0" name="menu" type="int" /> |
| 21 | <description> |
| 22 | Returns [PopupMenu] associated with menu item. |
| 23 | </description> |
| 24 | </method> |
| 25 | <method name="get_menu_title" qualifiers="const"> |
| 26 | <return type="String" /> |
| 27 | <param index="0" name="menu" type="int" /> |
| 28 | <description> |
| 29 | Returns menu item title. |
| 30 | </description> |
| 31 | </method> |
| 32 | <method name="get_menu_tooltip" qualifiers="const"> |
| 33 | <return type="String" /> |
| 34 | <param index="0" name="menu" type="int" /> |
| 35 | <description> |
| 36 | Returns menu item tooltip. |
| 37 | </description> |
| 38 | </method> |
| 39 | <method name="is_menu_disabled" qualifiers="const"> |
| 40 | <return type="bool" /> |
| 41 | <param index="0" name="menu" type="int" /> |
| 42 | <description> |
| 43 | Returns [code]true[/code] if the menu item is disabled. |
| 44 | </description> |
| 45 | </method> |
| 46 | <method name="is_menu_hidden" qualifiers="const"> |
| 47 | <return type="bool" /> |
| 48 | <param index="0" name="menu" type="int" /> |
| 49 | <description> |
| 50 | Returns [code]true[/code] if the menu item is hidden. |
| 51 | </description> |
| 52 | </method> |
| 53 | <method name="is_native_menu" qualifiers="const"> |
| 54 | <return type="bool" /> |
| 55 | <description> |
| 56 | Returns [code]true[/code] if the current system's global menu is supported and used by this [MenuBar]. |
| 57 | </description> |
| 58 | </method> |
| 59 | <method name="set_disable_shortcuts"> |
| 60 | <return type="void" /> |
| 61 | <param index="0" name="disabled" type="bool" /> |
| 62 | <description> |
| 63 | If [code]true[/code], shortcuts are disabled and cannot be used to trigger the button. |
| 64 | </description> |
| 65 | </method> |
| 66 | <method name="set_menu_disabled"> |
| 67 | <return type="void" /> |
| 68 | <param index="0" name="menu" type="int" /> |
| 69 | <param index="1" name="disabled" type="bool" /> |
| 70 | <description> |
| 71 | If [code]true[/code], menu item is disabled. |
| 72 | </description> |
| 73 | </method> |
| 74 | <method name="set_menu_hidden"> |
| 75 | <return type="void" /> |
| 76 | <param index="0" name="menu" type="int" /> |
| 77 | <param index="1" name="hidden" type="bool" /> |
| 78 | <description> |
| 79 | If [code]true[/code], menu item is hidden. |
| 80 | </description> |
| 81 | </method> |
| 82 | <method name="set_menu_title"> |
| 83 | <return type="void" /> |
| 84 | <param index="0" name="menu" type="int" /> |
| 85 | <param index="1" name="title" type="String" /> |
| 86 | <description> |
| 87 | Sets menu item title. |
| 88 | </description> |
| 89 | </method> |
| 90 | <method name="set_menu_tooltip"> |
| 91 | <return type="void" /> |
| 92 | <param index="0" name="menu" type="int" /> |
| 93 | <param index="1" name="tooltip" type="String" /> |
| 94 | <description> |
| 95 | Sets menu item tooltip. |
| 96 | </description> |
| 97 | </method> |
| 98 | </methods> |
| 99 | <members> |
| 100 | <member name="flat" type="bool" setter="set_flat" getter="is_flat" default="false"> |
| 101 | Flat [MenuBar] don't display item decoration. |
| 102 | </member> |
| 103 | <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="3" /> |
| 104 | <member name="language" type="String" setter="set_language" getter="get_language" default=""""> |
| 105 | Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead. |
| 106 | </member> |
| 107 | <member name="prefer_global_menu" type="bool" setter="set_prefer_global_menu" getter="is_prefer_global_menu" default="true"> |
| 108 | If [code]true[/code], [MenuBar] will use system global menu when supported. |
| 109 | [b]Note:[/b] If [code]true[/code] and global menu is supported, this node is not displayed, has zero size, and all its child nodes except [PopupMenu]s are inaccessible. |
| 110 | [b]Note:[/b] This property overrides the value of the [member PopupMenu.prefer_native_menu] property of the child nodes. |
| 111 | </member> |
| 112 | <member name="start_index" type="int" setter="set_start_index" getter="get_start_index" default="-1"> |
| 113 | Position order in the global menu to insert [MenuBar] items at. All menu items in the [MenuBar] are always inserted as a continuous range. Menus with lower [member start_index] are inserted first. Menus with [member start_index] equal to [code]-1[/code] are inserted last. |
| 114 | </member> |
| 115 | <member name="switch_on_hover" type="bool" setter="set_switch_on_hover" getter="is_switch_on_hover" default="true"> |
| 116 | If [code]true[/code], when the cursor hovers above menu item, it will close the current [PopupMenu] and open the other one. |
| 117 | </member> |
| 118 | <member name="text_direction" type="int" setter="set_text_direction" getter="get_text_direction" enum="Control.TextDirection" default="0"> |
| 119 | Base text writing direction. |
| 120 | </member> |
| 121 | </members> |
| 122 | <theme_items> |
| 123 | <theme_item name="font_color" data_type="color" type="Color" default="Color(0.875, 0.875, 0.875, 1)"> |
| 124 | Default text [Color] of the menu item. |
| 125 | </theme_item> |
| 126 | <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.875, 0.875, 0.875, 0.5)"> |
| 127 | Text [Color] used when the menu item is disabled. |
| 128 | </theme_item> |
| 129 | <theme_item name="font_focus_color" data_type="color" type="Color" default="Color(0.95, 0.95, 0.95, 1)"> |
| 130 | Text [Color] used when the menu item is focused. Only replaces the normal text color of the menu item. Disabled, hovered, and pressed states take precedence over this color. |
| 131 | </theme_item> |
| 132 | <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.95, 0.95, 0.95, 1)"> |
| 133 | Text [Color] used when the menu item is being hovered. |
| 134 | </theme_item> |
| 135 | <theme_item name="font_hover_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)"> |
| 136 | Text [Color] used when the menu item is being hovered and pressed. |
| 137 | </theme_item> |
| 138 | <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)"> |
| 139 | The tint of text outline of the menu item. |
| 140 | </theme_item> |
| 141 | <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)"> |
| 142 | Text [Color] used when the menu item is being pressed. |
| 143 | </theme_item> |
| 144 | <theme_item name="h_separation" data_type="constant" type="int" default="4"> |
| 145 | The horizontal space between menu items. |
| 146 | </theme_item> |
| 147 | <theme_item name="outline_size" data_type="constant" type="int" default="0"> |
| 148 | The size of the text outline. |
| 149 | [b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended. |
| 150 | </theme_item> |
| 151 | <theme_item name="font" data_type="font" type="Font"> |
| 152 | [Font] of the menu item's text. |
| 153 | </theme_item> |
| 154 | <theme_item name="font_size" data_type="font_size" type="int"> |
| 155 | Font size of the menu item's text. |
| 156 | </theme_item> |
| 157 | <theme_item name="disabled" data_type="style" type="StyleBox" keywords="enabled"> |
| 158 | [StyleBox] used when the menu item is disabled. |
| 159 | </theme_item> |
| 160 | <theme_item name="disabled_mirrored" data_type="style" type="StyleBox"> |
| 161 | [StyleBox] used when the menu item is disabled (for right-to-left layouts). |
| 162 | </theme_item> |
| 163 | <theme_item name="hover" data_type="style" type="StyleBox"> |
| 164 | [StyleBox] used when the menu item is being hovered. |
| 165 | </theme_item> |
| 166 | <theme_item name="hover_mirrored" data_type="style" type="StyleBox"> |
| 167 | [StyleBox] used when the menu item is being hovered (for right-to-left layouts). |
| 168 | </theme_item> |
| 169 | <theme_item name="hover_pressed" data_type="style" type="StyleBox"> |
| 170 | [StyleBox] used when the menu item is being pressed and hovered at the same time. |
| 171 | </theme_item> |
| 172 | <theme_item name="hover_pressed_mirrored" data_type="style" type="StyleBox"> |
| 173 | [StyleBox] used when the menu item is being pressed and hovered at the same time (for right-to-left layouts). |
| 174 | </theme_item> |
| 175 | <theme_item name="normal" data_type="style" type="StyleBox"> |
| 176 | Default [StyleBox] for the menu item. |
| 177 | </theme_item> |
| 178 | <theme_item name="normal_mirrored" data_type="style" type="StyleBox"> |
| 179 | Default [StyleBox] for the menu item (for right-to-left layouts). |
| 180 | </theme_item> |
| 181 | <theme_item name="pressed" data_type="style" type="StyleBox"> |
| 182 | [StyleBox] used when the menu item is being pressed. |
| 183 | </theme_item> |
| 184 | <theme_item name="pressed_mirrored" data_type="style" type="StyleBox"> |
| 185 | [StyleBox] used when the menu item is being pressed (for right-to-left layouts). |
| 186 | </theme_item> |
| 187 | </theme_items> |
| 188 | </class> |