The MenuBar provides a menu for Terminal.Gui applications.
Inheritance
System.Object
MenuBar
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Terminal.Gui.dll
public class MenuBar : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Constructors
Initializes a new instance of the
MenuBar.
Declaration
Initializes a new instance of the
MenuBar class with the specified set of toplevel menu items.
Declaration
public MenuBar(MenuBarItem[] menus)
Parameters
| Type |
Name |
Description |
| MenuBarItem[] |
menus |
Individual menu items; a null item will result in a separator being drawn. |
Properties
The specifier character for the hotkey to all menus.
Declaration
public static Rune HotKeySpecifier { get; }
Property Value
| Type |
Description |
| System.Rune |
|
True if the menu is open; otherwise false.
Declaration
public bool IsMenuOpen { get; protected set; }
Property Value
| Type |
Description |
| System.Boolean |
|
Get the lasted focused view before open the menu.
Declaration
public View LastFocused { get; }
Property Value
Gets or sets the array of
MenuBarItems for the menu. Only set this when the
MenuBar is visible.
Declaration
public MenuBarItem[] Menus { get; set; }
Property Value
Used for change the shortcut delimiter separator.
Declaration
public static ustring ShortcutDelimiter { get; set; }
Property Value
| Type |
Description |
| NStack.ustring |
|
Used for change the navigation key style.
Declaration
public bool UseKeysUpDownAsKeysLeftRight { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
Gets or sets if the sub-menus must be displayed in a single or multiple frames.
Declaration
public bool UseSubMenusSingleFrame { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
Methods
Closes the current Menu programatically, if open and not canceled.
Declaration
public bool CloseMenu(bool ignoreUseSubMenusSingleFrame = false)
Parameters
| Type |
Name |
Description |
| System.Boolean |
ignoreUseSubMenusSingleFrame |
|
Returns
| Type |
Description |
| System.Boolean |
|
Declaration
public override bool MouseEvent(MouseEvent me)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override bool OnEnter(View view)
Parameters
| Type |
Name |
Description |
| View |
view |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override bool OnKeyDown(KeyEvent keyEvent)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override bool OnKeyUp(KeyEvent keyEvent)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override bool OnLeave(View view)
Parameters
| Type |
Name |
Description |
| View |
view |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public virtual void OnMenuAllClosed()
Declaration
public virtual MenuClosingEventArgs OnMenuClosing(MenuBarItem currentMenu, bool reopen, bool isSubMenu)
Parameters
| Type |
Name |
Description |
| MenuBarItem |
currentMenu |
The current menu to be closed. |
| System.Boolean |
reopen |
Whether the current menu will be reopen. |
| System.Boolean |
isSubMenu |
Whether is a sub-menu or not. |
Returns
Virtual method that will invoke the
MenuOpened event if it's defined.
Declaration
public virtual void OnMenuOpened()
Virtual method that will invoke the
MenuOpening event if it's defined.
Declaration
public virtual MenuOpeningEventArgs OnMenuOpening(MenuBarItem currentMenu)
Parameters
| Type |
Name |
Description |
| MenuBarItem |
currentMenu |
The current menu to be replaced. |
Returns
Opens the current Menu programatically.
Declaration
Declaration
public override void PositionCursor()
Overrides
Declaration
public override bool ProcessColdKey(KeyEvent kb)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override bool ProcessHotKey(KeyEvent kb)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override bool ProcessKey(KeyEvent kb)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override void Redraw(Rect bounds)
Parameters
| Type |
Name |
Description |
| Rect |
bounds |
|
Overrides
Events
Raised when all the menu are closed.
Declaration
public event Action MenuAllClosed
Event Type
| Type |
Description |
| System.Action |
|
Declaration
public event Action<MenuClosingEventArgs> MenuClosing
Event Type
Raised when a menu is opened.
Declaration
public event Action<MenuItem> MenuOpened
Event Type
| Type |
Description |
| System.Action<MenuItem> |
|
Raised as a menu is opening.
Declaration
public event Action<MenuOpeningEventArgs> MenuOpening
Event Type
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize