using System;
namespace Terminal.Gui {
///
/// An which allows passing a cancelable menu opening event or replacing with a new .
///
public class MenuOpeningEventArgs : EventArgs {
///
/// The current parent.
///
public MenuBarItem CurrentMenu { get; }
///
/// The new to be replaced.
///
public MenuBarItem NewMenuBarItem { get; set; }
///
/// 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; }
///
/// Initializes a new instance of .
///
/// The current parent.
public MenuOpeningEventArgs (MenuBarItem currentMenu)
{
CurrentMenu = currentMenu;
}
}
///
/// 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;
}
///
/// The parent of . Will be null if menu opening
/// is the root (see ).
///
public MenuBarItem Parent { get; }
///
/// Gets the being opened.
///
public MenuItem MenuItem { get; }
}
///
/// An which allows passing a cancelable menu closing event.
///
public class MenuClosingEventArgs : EventArgs {
///
/// The current parent.
///
public MenuBarItem CurrentMenu { get; }
///
/// Indicates whether the current menu will reopen.
///
public bool Reopen { get; }
///
/// Indicates whether the current menu is a sub-menu.
///
public bool IsSubMenu { get; }
///
/// 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; }
///
/// 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;
}
}
}