浏览代码

Updated docs and made MouseEvent fields into properties for futureproofing and consistency

tznind 2 年之前
父节点
当前提交
711d4d739e
共有 2 个文件被更改,包括 16 次插入8 次删除
  1. 11 7
      Terminal.Gui/Core/Event.cs
  2. 5 1
      Terminal.Gui/Core/View.cs

+ 11 - 7
Terminal.Gui/Core/Event.cs

@@ -706,38 +706,42 @@ namespace Terminal.Gui {
 	}
 
 	/// <summary>
-	/// Describes a mouse event
+	/// Low-level construct that conveys the details of mouse events, such
+	/// as coordinates and button state, from ConsoleDrivers up to <see cref="Application"/> and
+	/// Views.
 	/// </summary>
+	/// <remarks>The <see cref="Application"/> class includes the <see cref="Application.RootMouseEvent"/>
+	/// Action which takes a MouseEvent argument.</remarks>
 	public class MouseEvent {
 		/// <summary>
 		/// The X (column) location for the mouse event.
 		/// </summary>
-		public int X;
+		public int X { get; set; }
 
 		/// <summary>
 		/// The Y (column) location for the mouse event.
 		/// </summary>
-		public int Y;
+		public int Y { get; set; }
 
 		/// <summary>
 		/// Flags indicating the kind of mouse event that is being posted.
 		/// </summary>
-		public MouseFlags Flags;
+		public MouseFlags Flags { get; set; }
 
 		/// <summary>
 		/// The offset X (column) location for the mouse event.
 		/// </summary>
-		public int OfX;
+		public int OfX { get; set; }
 
 		/// <summary>
 		/// The offset Y (column) location for the mouse event.
 		/// </summary>
-		public int OfY;
+		public int OfY { get; set; }
 
 		/// <summary>
 		/// The current view at the location for the mouse event.
 		/// </summary>
-		public View View;
+		public View View { get; set; }
 
 		/// <summary>
 		/// Indicates if the current mouse event has already been processed and the driver should stop notifying any other event subscriber.

+ 5 - 1
Terminal.Gui/Core/View.cs

@@ -2743,7 +2743,9 @@ namespace Terminal.Gui {
 		}
 
 		/// <summary>
-		/// Specifies the event arguments for <see cref="MouseEvent"/>
+		/// Specifies the event arguments for <see cref="MouseEvent"/>.  This is a higher-level construct
+		/// than the wrapped <see cref="MouseEvent"/> class and is used for the events defined on <see cref="View"/>
+		/// and subclasses of View (e.g. <see cref="View.MouseEnter"/> and <see cref="View.MouseClick"/>).
 		/// </summary>
 		public class MouseEventArgs : EventArgs {
 			/// <summary>
@@ -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.
 			/// </summary>
+			/// <remarks>This property forwards to the <see cref="MouseEvent.Handled"/> property and is provided as a convenience and for
+			/// backwards compatibility</remarks>
 			public bool Handled { 
 				get => MouseEvent.Handled;
 				set => MouseEvent.Handled = value;