Table of Contents

Class MenuBar

Namespace
Godot
Assembly
GodotSharp.dll

A horizontal menu bar that creates a MenuButton for each PopupMenu child. New items are created by adding PopupMenus to this node.

public class MenuBar : Control, IDisposable
Inheritance
MenuBar
Implements
Inherited Members

Constructors

MenuBar()

public MenuBar()

Properties

Flat

Flat MenuBar don't display item decoration.

public bool Flat { get; set; }

Property Value

bool

Language

Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.

public string Language { get; set; }

Property Value

string

PreferGlobalMenu

If true, MenuBar will use system global menu when supported.

public bool PreferGlobalMenu { get; set; }

Property Value

bool

StartIndex

Position in the global menu to insert first MenuBar item at.

public int StartIndex { get; set; }

Property Value

int

SwitchOnHover

If true, when the cursor hovers above menu item, it will close the current PopupMenu and open the other one.

public bool SwitchOnHover { get; set; }

Property Value

bool

TextDirection

Base text writing direction.

public Control.TextDirection TextDirection { get; set; }

Property Value

Control.TextDirection

Methods

GetMenuCount()

Returns number of menu items.

public int GetMenuCount()

Returns

int

GetMenuPopup(int)

Returns PopupMenu associated with menu item.

public PopupMenu GetMenuPopup(int menu)

Parameters

menu int

Returns

PopupMenu

GetMenuTitle(int)

Returns menu item title.

public string GetMenuTitle(int menu)

Parameters

menu int

Returns

string

GetMenuTooltip(int)

Returns menu item tooltip.

public string GetMenuTooltip(int menu)

Parameters

menu int

Returns

string

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsMenuDisabled(int)

Returns true, if menu item is disabled.

public bool IsMenuDisabled(int menu)

Parameters

menu int

Returns

bool

IsMenuHidden(int)

Returns true, if menu item is hidden.

public bool IsMenuHidden(int menu)

Parameters

menu int

Returns

bool

IsNativeMenu()

Returns true, if system global menu is supported and used by this MenuBar.

public bool IsNativeMenu()

Returns

bool

SetDisableShortcuts(bool)

If true, shortcuts are disabled and cannot be used to trigger the button.

public void SetDisableShortcuts(bool disabled)

Parameters

disabled bool

SetMenuDisabled(int, bool)

If true, menu item is disabled.

public void SetMenuDisabled(int menu, bool disabled)

Parameters

menu int
disabled bool

SetMenuHidden(int, bool)

If true, menu item is hidden.

public void SetMenuHidden(int menu, bool hidden)

Parameters

menu int
hidden bool

SetMenuTitle(int, string)

Sets menu item title.

public void SetMenuTitle(int menu, string title)

Parameters

menu int
title string

SetMenuTooltip(int, string)

Sets menu item tooltip.

public void SetMenuTooltip(int menu, string tooltip)

Parameters

menu int
tooltip string