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
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 vislble.
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 |
|
Methods
Closes the current Menu programatically, if open.
Declaration
Method invoked when a mouse event is generated
Declaration
public override bool MouseEvent(MouseEvent me)
Parameters
Returns
| Type |
Description |
| System.Boolean |
true, if the event was handled, false otherwise. |
Overrides
Method invoked when a view gets focus.
Declaration
public override bool OnEnter(View view)
Parameters
| Type |
Name |
Description |
| View |
view |
The view that is losing focus. |
Returns
| Type |
Description |
| System.Boolean |
true, if the event was handled, false otherwise. |
Overrides
Declaration
public override bool OnKeyDown(KeyEvent keyEvent)
Parameters
| Type |
Name |
Description |
| KeyEvent |
keyEvent |
Contains the details about the key that produced the event. |
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Declaration
public override bool OnKeyUp(KeyEvent keyEvent)
Parameters
| Type |
Name |
Description |
| KeyEvent |
keyEvent |
Contains the details about the key that produced the event. |
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Method invoked when a view loses focus.
Declaration
public override bool OnLeave(View view)
Parameters
| Type |
Name |
Description |
| View |
view |
The view that is getting focus. |
Returns
| Type |
Description |
| System.Boolean |
true, if the event was handled, false otherwise. |
Overrides
Declaration
public virtual void OnMenuClosing()
Declaration
public virtual void OnMenuOpening()
Opens the current Menu programatically.
Declaration
Positions the cursor in the right position based on the currently focused view in the chain.
Declaration
public override void PositionCursor()
Overrides
This method can be overwritten by views that
want to provide accelerator functionality
(Alt-key for example), but without
interefering with normal ProcessKey behavior.
Declaration
public override bool ProcessColdKey(KeyEvent kb)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
This method can be overwritten by view that
want to provide accelerator functionality
(Alt-key for example).
Declaration
public override bool ProcessHotKey(KeyEvent kb)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
If the view is focused, gives the view a
chance to process the keystroke.
Declaration
public override bool ProcessKey(KeyEvent kb)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
Declaration
public override void Redraw(Rect bounds)
Parameters
| Type |
Name |
Description |
| Rect |
bounds |
The bounds (view-relative region) to redraw. |
Overrides
Events
Raised when a menu is closing.
Declaration
public event Action MenuClosing
Event Type
| Type |
Description |
| System.Action |
|
Raised as a menu is opening.
Declaration
public event Action MenuOpening
Event Type
| Type |
Description |
| System.Action |
|
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize