MenuBar
Inherits: Control < CanvasItem < Node < Object
A horizontal menu bar that creates a MenuButton for each PopupMenu child.
Description
A horizontal menu bar that creates a MenuButton for each PopupMenu child. New items are created by adding PopupMenus to this node.
Properties
| ||
| ||
| ||
| ||
| ||
|
Methods
get_menu_count() const | |
get_menu_popup(menu: int) const | |
get_menu_title(menu: int) const | |
get_menu_tooltip(menu: int) const | |
is_menu_disabled(menu: int) const | |
is_menu_hidden(menu: int) const | |
is_native_menu() const | |
void | set_disable_shortcuts(disabled: bool) |
void | set_menu_disabled(menu: int, disabled: bool) |
void | set_menu_hidden(menu: int, hidden: bool) |
void | set_menu_title(menu: int, title: String) |
void | set_menu_tooltip(menu: int, tooltip: String) |
Theme Properties
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
Property Descriptions
Flat MenuBar don’t display item decoration.
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
bool prefer_global_menu = true
🔗
If true
, MenuBar will use system global menu when supported.
Position in the global menu to insert first MenuBar item at.
If true
, when the cursor hovers above menu item, it will close the current PopupMenu and open the other one.
TextDirection text_direction = 0
🔗
void set_text_direction(value: TextDirection)
TextDirection get_text_direction()
Base text writing direction.
Method Descriptions
Returns number of menu items.
PopupMenu get_menu_popup(menu: int) const 🔗
Returns PopupMenu associated with menu item.
String get_menu_title(menu: int) const 🔗
Returns menu item title.
String get_menu_tooltip(menu: int) const 🔗
Returns menu item tooltip.
bool is_menu_disabled(menu: int) const 🔗
Returns true
, if menu item is disabled.
bool is_menu_hidden(menu: int) const 🔗
Returns true
, if menu item is hidden.
Returns true
, if system global menu is supported and used by this MenuBar.
void set_disable_shortcuts(disabled: bool) 🔗
If true
, shortcuts are disabled and cannot be used to trigger the button.
void set_menu_disabled(menu: int, disabled: bool) 🔗
If true
, menu item is disabled.
void set_menu_hidden(menu: int, hidden: bool) 🔗
If true
, menu item is hidden.
void set_menu_title(menu: int, title: String) 🔗
Sets menu item title.
void set_menu_tooltip(menu: int, tooltip: String) 🔗
Sets menu item tooltip.
Theme Property Descriptions
Color font_color = Color(0.875, 0.875, 0.875, 1)
🔗
Default text Color of the menu item.
Color font_disabled_color = Color(0.875, 0.875, 0.875, 0.5)
🔗
Text Color used when the menu item is disabled.
Color font_focus_color = Color(0.95, 0.95, 0.95, 1)
🔗
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 font_hover_color = Color(0.95, 0.95, 0.95, 1)
🔗
Text Color used when the menu item is being hovered.
Color font_hover_pressed_color = Color(1, 1, 1, 1)
🔗
Text Color used when the menu item is being hovered and pressed.
Color font_outline_color = Color(0, 0, 0, 1)
🔗
The tint of text outline of the menu item.
Color font_pressed_color = Color(1, 1, 1, 1)
🔗
Text Color used when the menu item is being pressed.
The horizontal space between menu items.
The size of the text outline.
Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.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.
Font of the menu item’s text.
Font size of the menu item’s text.
StyleBox used when the menu item is disabled.
StyleBox used when the menu item is disabled (for right-to-left layouts).
StyleBox used when the menu item is being hovered.
StyleBox used when the menu item is being hovered (for right-to-left layouts).
StyleBox used when the menu item is being pressed and hovered at the same time.
StyleBox hover_pressed_mirrored 🔗
StyleBox used when the menu item is being pressed and hovered at the same time (for right-to-left layouts).
Default StyleBox for the menu item.
Default StyleBox for the menu item (for right-to-left layouts).
StyleBox used when the menu item is being pressed.
StyleBox used when the menu item is being pressed (for right-to-left layouts).
User-contributed notes
Please read the User-contributed notes policy before submitting a comment.