From ebb898aa3eb1680bd102bc35675a8b93f3ab1803 Mon Sep 17 00:00:00 2001 From: BDisp Date: Fri, 17 Mar 2023 16:57:58 +0000 Subject: [PATCH] Grouping Menu events in MenuEventArgs.cs file. --- Terminal.Gui/Core/MenuOpenedEventArgs.cs | 36 -------- Terminal.Gui/Views/MenuClosingEventArgs.cs | 42 ---------- Terminal.Gui/Views/MenuEventArgs.cs | 98 ++++++++++++++++++++++ Terminal.Gui/Views/MenuOpeningEventArgs.cs | 32 ------- 4 files changed, 98 insertions(+), 110 deletions(-) delete mode 100644 Terminal.Gui/Core/MenuOpenedEventArgs.cs delete mode 100644 Terminal.Gui/Views/MenuClosingEventArgs.cs create mode 100644 Terminal.Gui/Views/MenuEventArgs.cs delete mode 100644 Terminal.Gui/Views/MenuOpeningEventArgs.cs diff --git a/Terminal.Gui/Core/MenuOpenedEventArgs.cs b/Terminal.Gui/Core/MenuOpenedEventArgs.cs deleted file mode 100644 index dec432449..000000000 --- a/Terminal.Gui/Core/MenuOpenedEventArgs.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Terminal.Gui { - - /// - /// 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; } - } -} diff --git a/Terminal.Gui/Views/MenuClosingEventArgs.cs b/Terminal.Gui/Views/MenuClosingEventArgs.cs deleted file mode 100644 index 934ab1d41..000000000 --- a/Terminal.Gui/Views/MenuClosingEventArgs.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; - -namespace Terminal.Gui { - /// - /// 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; - } - } -} diff --git a/Terminal.Gui/Views/MenuEventArgs.cs b/Terminal.Gui/Views/MenuEventArgs.cs new file mode 100644 index 000000000..6f3e4c3d3 --- /dev/null +++ b/Terminal.Gui/Views/MenuEventArgs.cs @@ -0,0 +1,98 @@ +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; + } + } +} diff --git a/Terminal.Gui/Views/MenuOpeningEventArgs.cs b/Terminal.Gui/Views/MenuOpeningEventArgs.cs deleted file mode 100644 index a57c8b07b..000000000 --- a/Terminal.Gui/Views/MenuOpeningEventArgs.cs +++ /dev/null @@ -1,32 +0,0 @@ -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; - } - } -}