Class MenuBar
The MenuBar provides a menu for Terminal.Gui applications.
Implements
System.Collections.IEnumerable
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)
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class MenuBar : View, IEnumerable
Remarks
The MenuBar appears on the first row of the terminal.
The MenuBar provides global hotkeys for the application.
Constructors
MenuBar(MenuBarItem[])
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
IsMenuOpen
True if the menu is open; otherwise false.
Declaration
public bool IsMenuOpen { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LastFocused
Get the lasted focused view before open the menu.
Declaration
public View LastFocused { get; }
Property Value
Type | Description |
---|---|
View |
Menus
Gets or sets the array of MenuBarItems for the menu. Only set this when the MenuBar is vislble.
Declaration
public MenuBarItem[] Menus { get; set; }
Property Value
Type | Description |
---|---|
MenuBarItem[] | The menu array. |
UseKeysUpDownAsKeysLeftRight
Used for change the navigation key style.
Declaration
public bool UseKeysUpDownAsKeysLeftRight { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
CloseMenu()
Closes the current Menu programatically, if open.
Declaration
public void CloseMenu()
MouseEvent(MouseEvent)
Declaration
public override bool MouseEvent(MouseEvent me)
Parameters
Type | Name | Description |
---|---|---|
MouseEvent | me |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
OnKeyDown(KeyEvent)
Declaration
public override bool OnKeyDown(KeyEvent keyEvent)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | keyEvent |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
OnKeyUp(KeyEvent)
Declaration
public override bool OnKeyUp(KeyEvent keyEvent)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | keyEvent |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
OpenMenu()
Opens the current Menu programatically.
Declaration
public void OpenMenu()
PositionCursor()
Declaration
public override void PositionCursor()
Overrides
ProcessHotKey(KeyEvent)
Declaration
public override bool ProcessHotKey(KeyEvent kb)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | kb |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
ProcessKey(KeyEvent)
Declaration
public override bool ProcessKey(KeyEvent kb)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | kb |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Redraw(Rect)
Declaration
public override void Redraw(Rect region)
Parameters
Type | Name | Description |
---|---|---|
Rect | region |
Overrides
Events
OnCloseMenu
Raised when a menu is closing.
Declaration
public event EventHandler OnCloseMenu
Event Type
Type | Description |
---|---|
System.EventHandler |
OnOpenMenu
Raised as a menu is opened.
Declaration
public event EventHandler OnOpenMenu
Event Type
Type | Description |
---|---|
System.EventHandler |
Implements
System.Collections.IEnumerable