Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
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 ( int menu ) const |
|
get_menu_title ( int menu ) const |
|
get_menu_tooltip ( int menu ) const |
|
is_menu_disabled ( int menu ) const |
|
is_menu_hidden ( int menu ) const |
|
is_native_menu ( ) const |
|
void |
set_disable_shortcuts ( bool disabled ) |
void |
set_menu_disabled ( int menu, bool disabled ) |
void |
set_menu_hidden ( int menu, bool hidden ) |
void |
set_menu_title ( int menu, String title ) |
void |
set_menu_tooltip ( int menu, String tooltip ) |
Theme Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Property Descriptions¶
bool flat = false
Flat MenuBar don't display item decoration.
String language = ""
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.
int start_index = -1
Position in the global menu to insert first MenuBar item at.
bool switch_on_hover = true
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 ( TextDirection value )
TextDirection get_text_direction ( )
Base text writing direction.
Method Descriptions¶
int get_menu_count ( ) const
Returns number of menu items.
PopupMenu get_menu_popup ( int menu ) const
Returns PopupMenu associated with menu item.
String get_menu_title ( int menu ) const
Returns menu item title.
String get_menu_tooltip ( int menu ) const
Returns menu item tooltip.
bool is_menu_disabled ( int menu ) const
Returns true
, if menu item is disabled.
bool is_menu_hidden ( int menu ) const
Returns true
, if menu item is hidden.
bool is_native_menu ( ) const
Returns true
, if system global menu is supported and used by this MenuBar.
void set_disable_shortcuts ( bool disabled )
If true
, shortcuts are disabled and cannot be used to trigger the button.
void set_menu_disabled ( int menu, bool disabled )
If true
, menu item is disabled.
void set_menu_hidden ( int menu, bool hidden )
If true
, menu item is hidden.
void set_menu_title ( int menu, String title )
Sets menu item title.
void set_menu_tooltip ( int menu, String tooltip )
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