Class MenuBar
A horizontal menu bar that creates a menu for each PopupMenu child.
- Inheritance
-
MenuBar
Remarks
A horizontal menu bar that creates a menu for each PopupMenu child. New items are created by adding PopupMenus to this node. Item title is determined by title, or node name if title is empty. Item title can be overridden using MenuBar.set_menu_title.
Properties
flat
Flat MenuBar don't display item decoration.
var flat : bool = false
Property Value
Remarks
language
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
var language : String = ""
Property Value
Remarks
prefer_global_menu
If true
, MenuBar will use system global menu when supported.
Note: If true
and global menu is supported, this node is not displayed, has zero size, and all its child nodes except PopupMenus are inaccessible.
Note: This property overrides the value of the prefer_native_menu property of the child nodes.
var prefer_global_menu : bool = true
Property Value
Remarks
start_index
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 start_index are inserted first. Menus with start_index equal to -1
are inserted last.
var start_index : int = -1
Property Value
Remarks
switch_on_hover
If true
, when the cursor hovers above menu item, it will close the current PopupMenu and open the other one.
var switch_on_hover : bool = true
Property Value
Remarks
text_direction
Base text writing direction.
var text_direction : int = 0
Property Value
Remarks
font_color
Theme Property
Default text Color of the menu item.
= ``Color(0.875, 0.875, 0.875, 1)``
Property Value
font_disabled_color
Theme Property
Text Color used when the menu item is disabled.
= ``Color(0.875, 0.875, 0.875, 0.5)``
Property Value
font_focus_color
Theme Property
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.
= ``Color(0.95, 0.95, 0.95, 1)``
Property Value
font_hover_color
Theme Property
Text Color used when the menu item is being hovered.
= ``Color(0.95, 0.95, 0.95, 1)``
Property Value
font_hover_pressed_color
Theme Property
Text Color used when the menu item is being hovered and pressed.
= ``Color(1, 1, 1, 1)``
Property Value
font_outline_color
Theme Property
The tint of text outline of the menu item.
= ``Color(0, 0, 0, 1)``
Property Value
font_pressed_color
Theme Property
Text Color used when the menu item is being pressed.
= ``Color(1, 1, 1, 1)``
Property Value
h_separation
Theme Property
The horizontal space between menu items.
= ``4``
Property Value
outline_size
Theme Property
The size of the text outline.
Note: If using a font with multichannel_signed_distance_field enabled, its msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
= ``0``
Property Value
font
Theme Property
Font of the menu item's text.
Font font
Property Value
font_size
Theme Property
Font size of the menu item's text.
int font_size
Property Value
disabled
Theme Property
StyleBox used when the menu item is disabled.
StyleBox disabled
Property Value
disabled_mirrored
Theme Property
StyleBox used when the menu item is disabled (for right-to-left layouts).
StyleBox disabled_mirrored
Property Value
hover
Theme Property
StyleBox used when the menu item is being hovered.
StyleBox hover
Property Value
hover_mirrored
Theme Property
StyleBox used when the menu item is being hovered (for right-to-left layouts).
StyleBox hover_mirrored
Property Value
hover_pressed
Theme Property
StyleBox used when the menu item is being pressed and hovered at the same time.
StyleBox hover_pressed
Property Value
hover_pressed_mirrored
Theme Property
StyleBox used when the menu item is being pressed and hovered at the same time (for right-to-left layouts).
StyleBox hover_pressed_mirrored
Property Value
normal
Theme Property
Default StyleBox for the menu item.
StyleBox normal
Property Value
normal_mirrored
Theme Property
Default StyleBox for the menu item (for right-to-left layouts).
StyleBox normal_mirrored
Property Value
pressed
Theme Property
StyleBox used when the menu item is being pressed.
StyleBox pressed
Property Value
pressed_mirrored
Theme Property
StyleBox used when the menu item is being pressed (for right-to-left layouts).
StyleBox pressed_mirrored
Property Value
Methods
get_menu_count
Qualifiers: const
Returns number of menu items.
int get_menu_count
get_menu_popup(int)
Qualifiers: const
Returns PopupMenu associated with menu item.
PopupMenu get_menu_popup(int menu)
Parameters
menu
int
get_menu_title(int)
Qualifiers: const
Returns menu item title.
String get_menu_title(int menu)
Parameters
menu
int
get_menu_tooltip(int)
Qualifiers: const
Returns menu item tooltip.
String get_menu_tooltip(int menu)
Parameters
menu
int
is_menu_disabled(int)
Qualifiers: const
Returns true
, if menu item is disabled.
bool is_menu_disabled(int menu)
Parameters
menu
int
is_menu_hidden(int)
Qualifiers: const
Returns true
, if menu item is hidden.
bool is_menu_hidden(int menu)
Parameters
menu
int
is_native_menu
Qualifiers: const
Returns true
, if system global menu is supported and used by this MenuBar.
bool is_native_menu
set_disable_shortcuts(bool)
If true
, shortcuts are disabled and cannot be used to trigger the button.
void set_disable_shortcuts(bool disabled)
Parameters
disabled
bool
set_menu_disabled(int, bool)
If true
, menu item is disabled.
void set_menu_disabled(int menu, bool disabled)
Parameters
set_menu_hidden(int, bool)
If true
, menu item is hidden.
void set_menu_hidden(int menu, bool hidden)
Parameters
set_menu_title(int, String)
Sets menu item title.
void set_menu_title(int menu, String title)
Parameters
set_menu_tooltip(int, String)
Sets menu item tooltip.
void set_menu_tooltip(int menu, String tooltip)