namespace Terminal.Gui;
///
/// An which allows passing a cancelable menu opening event or replacing with a new
/// .
///
public class MenuOpeningEventArgs : EventArgs
{
/// Initializes a new instance of .
/// The current parent.
public MenuOpeningEventArgs (MenuBarItem currentMenu) { CurrentMenu = currentMenu; }
///
/// Flag that allows the cancellation of the event. If set to in the event handler, the
/// event will be canceled.
///
public bool Cancel { get; set; }
/// The current parent.
public MenuBarItem CurrentMenu { get; }
/// The new to be replaced.
public MenuBarItem NewMenuBarItem { get; set; }
}
/// Defines arguments for the event
public class MenuOpenedEventArgs : EventArgs
{
/// Creates a new instance of the class
///
///
public MenuOpenedEventArgs (MenuBarItem parent, MenuItem menuItem)
{
Parent = parent;
MenuItem = menuItem;
}
/// Gets the being opened.
public MenuItem MenuItem { get; }
/// The parent of . Will be null if menu opening is the root.
public MenuBarItem Parent { get; }
}
/// An which allows passing a cancelable menu closing event.
public class MenuClosingEventArgs : EventArgs
{
/// Initializes a new instance of .
/// The current parent.
/// Whether the current menu will reopen.
/// Indicates whether it is a sub-menu.
public MenuClosingEventArgs (MenuBarItem currentMenu, bool reopen, bool isSubMenu)
{
CurrentMenu = currentMenu;
Reopen = reopen;
IsSubMenu = isSubMenu;
}
///
/// Flag that allows the cancellation of the event. If set to in the event handler, the
/// event will be canceled.
///
public bool Cancel { get; set; }
/// The current parent.
public MenuBarItem CurrentMenu { get; }
/// Indicates whether the current menu is a sub-menu.
public bool IsSubMenu { get; }
/// Indicates whether the current menu will reopen.
public bool Reopen { get; }
}