Class ContextMenu | Terminal.Gui v1 (original) (raw)
Namespace
Assembly
Terminal.Gui.dll
ContextMenu provides a pop-up menu that can be positioned anywhere within a View. ContextMenu is analogous to MenuBar and, once activated, works like a sub-menu of a MenuBarItem (but can be positioned anywhere).
By default, a ContextMenu with sub-menus is displayed in a cascading manner, where each sub-menu pops out of the ContextMenu frame (either to the right or left, depending on where the ContextMenu is relative to the edge of the screen). By settingUseSubMenusSingleFrame to true, this behavior can be changed such that all sub-menus are drawn within the ContextMenu frame.
ContextMenus can be activated using the Shift-F10 key (by default; use the Key to change to another key).
Callers can cause the ContextMenu to be activated on a right-mouse click (or other interaction) by calling Show().
ContextMenus are located using screen using screen coordinates and appear above all other Views.
public sealed class ContextMenu : IDisposable
Inheritance
ContextMenu
Implements
Inherited Members
Constructors
Initializes a context menu with no menu items.
ContextMenu(int, int, MenuBarItem)
Initializes a context menu with menu items at a specific screen location.
ContextMenu(View, MenuBarItem)
Initializes a context menu, with a View specifiying the parent/hose of the menu.
Properties
Sets or gets whether the context menu be forced to the right, ensuring it is not clipped, if the x position is less than zero. The default is true which means the context menu will be forced to the right. If set to false, the context menu will be clipped on the left if x is less than zero.
The host View which position will be used, otherwise if it's null the container will be used.
Gets whether the ContextMenu is showing or not.
Key specifies they keyboard key that will activate the context menu with the keyboard.
Gets the MenuBar that is hosting this context menu.
Gets or sets the menu items for this context menu.
MouseFlags specifies the mouse action used to activate the context menu by mouse.
Gets or sets the menu position.
Gets or sets if sub-menus will be displayed using a "single frame" menu style. If true, the ContextMenu and any sub-menus that would normally cascade will be displayed within a single frame. If false (the default), sub-menus will cascade using separate frames for each level of the menu hierarchy.
Methods
Disposes the context menu object.
Hides (closes) the ContextMenu.
Shows (opens) the ContextMenu, displaying the MenuItems it contains.
Events
Event invoked when the Key is changed.
Event invoked when the MouseFlags is changed.