diff --git a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs index 5de19fa85..094b79be6 100644 --- a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs @@ -743,8 +743,8 @@ namespace Terminal.Gui { mLoop.ProcessInput = (e) => ProcessInput (e); - mLoop.WinChanged = (e) => { - ChangeWin (e); + mLoop.WinChanged = (s,e) => { + ChangeWin (e.Size); }; } @@ -1868,8 +1868,8 @@ namespace Terminal.Gui { /// /// Invoked when the window is changed. /// - public Action WinChanged; - + public EventHandler WinChanged; + public WindowsMainLoop (ConsoleDriver consoleDriver = null) { this.consoleDriver = consoleDriver ?? throw new ArgumentNullException ("Console driver instance must be provided."); @@ -1991,7 +1991,7 @@ namespace Terminal.Gui { } if (winChanged) { winChanged = false; - WinChanged?.Invoke (windowSize); + WinChanged?.Invoke (this, new SizeChangedEventArgs(windowSize)); } } } diff --git a/Terminal.Gui/Core/Application.cs b/Terminal.Gui/Core/Application.cs index 207ef3c7b..83be1867c 100644 --- a/Terminal.Gui/Core/Application.cs +++ b/Terminal.Gui/Core/Application.cs @@ -1530,7 +1530,7 @@ namespace Terminal.Gui { t.SetRelativeLayout (full); t.LayoutSubviews (); t.PositionToplevels (); - t.OnResized (full.Size); + t.OnResized (new SizeChangedEventArgs(full.Size)); } Refresh (); } diff --git a/Terminal.Gui/Core/EventArgs/HotKeyChangedEventArgs.cs b/Terminal.Gui/Core/EventArgs/KeyChangedEventArgs.cs similarity index 100% rename from Terminal.Gui/Core/EventArgs/HotKeyChangedEventArgs.cs rename to Terminal.Gui/Core/EventArgs/KeyChangedEventArgs.cs diff --git a/Terminal.Gui/Core/EventArgs/SizeChangedEventArgs.cs b/Terminal.Gui/Core/EventArgs/SizeChangedEventArgs.cs new file mode 100644 index 000000000..1fec64f91 --- /dev/null +++ b/Terminal.Gui/Core/EventArgs/SizeChangedEventArgs.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Terminal.Gui{ + public class SizeChangedEventArgs : EventArgs { + + public SizeChangedEventArgs (Size size) + { + Size = size; + } + + public Size Size { get; } + } +} diff --git a/Terminal.Gui/Core/Toplevel.cs b/Terminal.Gui/Core/Toplevel.cs index 1032ad912..fd4a405ef 100644 --- a/Terminal.Gui/Core/Toplevel.cs +++ b/Terminal.Gui/Core/Toplevel.cs @@ -111,11 +111,11 @@ namespace Terminal.Gui { /// /// Invoked when the terminal has been resized. The new of the terminal is provided. /// - public event Action Resized; + public event EventHandler Resized; - internal virtual void OnResized (Size size) + internal virtual void OnResized (SizeChangedEventArgs size) { - Resized?.Invoke (size); + Resized?.Invoke (this, size); } internal virtual void OnChildUnloaded (Toplevel top) diff --git a/Terminal.Gui/Views/ContextMenu.cs b/Terminal.Gui/Views/ContextMenu.cs index 84e4db4da..309f46035 100644 --- a/Terminal.Gui/Views/ContextMenu.cs +++ b/Terminal.Gui/Views/ContextMenu.cs @@ -145,7 +145,7 @@ namespace Terminal.Gui { menuBar.OpenMenu (); } - private void Container_Resized (Size obj) + private void Container_Resized (object sender, SizeChangedEventArgs e) { if (IsShow) { Show ();