namespace Terminal.Gui.Views;
///
/// A -derived view that provides a cascading menu.
/// Can be used as a context menu or a drop-down menu as part of .
///
///
///
/// IMPORTANT: Must be registered with via
/// before calling or
/// .
///
///
/// Usage Example:
///
///
/// var menu = new PopoverMenu ([
/// new MenuItem ("Cut", Command.Cut),
/// new MenuItem ("Copy", Command.Copy),
/// new MenuItem ("Paste", Command.Paste)
/// ]);
/// Application.Popover?.Register (menu);
/// menu.MakeVisible (); // or Application.Popover?.Show (menu);
///
///
/// See and for lifecycle, focus, and keyboard handling details.
///
///
public class PopoverMenu : PopoverBaseImpl, IDesignable
{
///
/// Initializes a new instance of the class.
///
public PopoverMenu () : this ((Menu?)null) { }
///
/// Initializes a new instance of the class. If any of the elements of
/// is , a will be created instead.
///
/// The views to use as menu items. Null elements become separator lines.
///
/// Remember to call before calling .
///
public PopoverMenu (IEnumerable? menuItems) : this (
new Menu (menuItems?.Select (item => item ?? new Line ()))
{
Title = "Popover Root"
})
{ }
///
/// Initializes a new instance of the class with the specified menu items.
///
/// The menu items to display in the popover.
///
/// Remember to call before calling .
///
public PopoverMenu (IEnumerable