From e7efa4058bb36db82bfc95aa54ac4e724498cdfe Mon Sep 17 00:00:00 2001 From: tznind Date: Wed, 19 Oct 2022 15:47:57 +0100 Subject: [PATCH] Updated docs and made MouseEvent fields into properties for futureproofing and consistency --- Terminal.Gui/Core/Event.cs | 18 +++++++++++------- Terminal.Gui/Core/View.cs | 6 +++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Terminal.Gui/Core/Event.cs b/Terminal.Gui/Core/Event.cs index 35212ed62..dd25b18a4 100644 --- a/Terminal.Gui/Core/Event.cs +++ b/Terminal.Gui/Core/Event.cs @@ -706,38 +706,42 @@ namespace Terminal.Gui { } /// - /// Describes a mouse event + /// Low-level construct that conveys the details of mouse events, such + /// as coordinates and button state, from ConsoleDrivers up to and + /// Views. /// + /// The class includes the + /// Action which takes a MouseEvent argument. public class MouseEvent { /// /// The X (column) location for the mouse event. /// - public int X; + public int X { get; set; } /// /// The Y (column) location for the mouse event. /// - public int Y; + public int Y { get; set; } /// /// Flags indicating the kind of mouse event that is being posted. /// - public MouseFlags Flags; + public MouseFlags Flags { get; set; } /// /// The offset X (column) location for the mouse event. /// - public int OfX; + public int OfX { get; set; } /// /// The offset Y (column) location for the mouse event. /// - public int OfY; + public int OfY { get; set; } /// /// The current view at the location for the mouse event. /// - public View View; + public View View { get; set; } /// /// Indicates if the current mouse event has already been processed and the driver should stop notifying any other event subscriber. diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index 0b7591d5a..a6cdb4fc8 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -2743,7 +2743,9 @@ namespace Terminal.Gui { } /// - /// Specifies the event arguments for + /// Specifies the event arguments for . This is a higher-level construct + /// than the wrapped class and is used for the events defined on + /// and subclasses of View (e.g. and ). /// public class MouseEventArgs : EventArgs { /// @@ -2760,6 +2762,8 @@ namespace Terminal.Gui { /// Indicates if the current mouse event has already been processed and the driver should stop notifying any other event subscriber. /// Its important to set this value to true specially when updating any View's layout from inside the subscriber method. /// + /// This property forwards to the property and is provided as a convenience and for + /// backwards compatibility public bool Handled { get => MouseEvent.Handled; set => MouseEvent.Handled = value;