1
1
#nullable enable
2
2
using System . ComponentModel ;
3
- using System . Diagnostics ;
4
3
5
4
namespace Terminal . Gui ;
6
5
@@ -21,7 +20,6 @@ private void SetupMouse ()
21
20
MouseBindings . Add ( MouseFlags . Button1Clicked | MouseFlags . ButtonCtrl , Command . Select ) ;
22
21
}
23
22
24
-
25
23
/// <summary>
26
24
/// Invokes the Commands bound to the MouseFlags specified by <paramref name="mouseEventArgs"/>.
27
25
/// <para>See <see href="../docs/mouse.md">for an overview of Terminal.Gui mouse APIs.</see></para>
@@ -43,7 +41,7 @@ private void SetupMouse ()
43
41
44
42
binding . MouseEventArgs = mouseEventArgs ;
45
43
46
- return InvokeCommands < MouseBinding > ( binding . Commands , binding ) ;
44
+ return InvokeCommands ( binding . Commands , binding ) ;
47
45
}
48
46
49
47
#region MouseEnterLeave
@@ -52,7 +50,8 @@ private void SetupMouse ()
52
50
private ColorScheme ? _savedNonHoverColorScheme ;
53
51
54
52
/// <summary>
55
- /// INTERNAL Called by <see cref="Application.RaiseMouseEvent"/> when the mouse moves over the View's <see cref="Frame"/>.
53
+ /// INTERNAL Called by <see cref="Application.RaiseMouseEvent"/> when the mouse moves over the View's
54
+ /// <see cref="Frame"/>.
56
55
/// <see cref="MouseLeave"/> will
57
56
/// be raised when the mouse is no longer over the <see cref="Frame"/>. If another View occludes this View, the
58
57
/// that View will also receive MouseEnter/Leave events.
@@ -167,7 +166,8 @@ private void SetupMouse ()
167
166
public event EventHandler < CancelEventArgs > ? MouseEnter ;
168
167
169
168
/// <summary>
170
- /// INTERNAL Called by <see cref="Application.RaiseMouseEvent"/> when the mouse leaves <see cref="Frame"/>, or is occluded
169
+ /// INTERNAL Called by <see cref="Application.RaiseMouseEvent"/> when the mouse leaves <see cref="Frame"/>, or is
170
+ /// occluded
171
171
/// by another non-SubView.
172
172
/// </summary>
173
173
/// <remarks>
@@ -245,7 +245,8 @@ protected virtual void OnMouseLeave () { }
245
245
public bool WantMousePositionReports { get ; set ; }
246
246
247
247
/// <summary>
248
- /// Processes a new <see cref="MouseEvent"/>. This method is called by <see cref="Application.RaiseMouseEvent"/> when a mouse
248
+ /// Processes a new <see cref="MouseEvent"/>. This method is called by <see cref="Application.RaiseMouseEvent"/> when a
249
+ /// mouse
249
250
/// event occurs.
250
251
/// </summary>
251
252
/// <remarks>
@@ -260,8 +261,10 @@ protected virtual void OnMouseLeave () { }
260
261
/// See <see cref="SetPressedHighlight"/> for more information.
261
262
/// </para>
262
263
/// <para>
263
- /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, the <see cref="RaiseMouseEvent"/>/<see cref="MouseEvent"/> event
264
- /// will be raised on any new mouse event where <see cref="Terminal.Gui.MouseEventArgs.Flags"/> indicates a button is pressed.
264
+ /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, the <see cref="RaiseMouseEvent"/>/
265
+ /// <see cref="MouseEvent"/> event
266
+ /// will be raised on any new mouse event where <see cref="Terminal.Gui.MouseEventArgs.Flags"/> indicates a button
267
+ /// is pressed.
265
268
/// </para>
266
269
/// </remarks>
267
270
/// <param name="mouseEvent"></param>
@@ -332,7 +335,7 @@ protected virtual void OnMouseLeave () { }
332
335
/// <returns><see langword="true"/>, if the event was handled, <see langword="false"/> otherwise.</returns>
333
336
public bool RaiseMouseEvent ( MouseEventArgs mouseEvent )
334
337
{
335
- if ( OnMouseEvent ( mouseEvent ) || mouseEvent . Handled == true )
338
+ if ( OnMouseEvent ( mouseEvent ) || mouseEvent . Handled )
336
339
{
337
340
return true ;
338
341
}
@@ -350,10 +353,7 @@ public bool RaiseMouseEvent (MouseEventArgs mouseEvent)
350
353
/// </remarks>
351
354
/// <param name="mouseEvent"></param>
352
355
/// <returns><see langword="true"/>, if the event was handled, <see langword="false"/> otherwise.</returns>
353
- protected virtual bool OnMouseEvent ( MouseEventArgs mouseEvent )
354
- {
355
- return false ;
356
- }
356
+ protected virtual bool OnMouseEvent ( MouseEventArgs mouseEvent ) { return false ; }
357
357
358
358
/// <summary>Raised when a mouse event occurs.</summary>
359
359
/// <remarks>
@@ -368,7 +368,8 @@ protected virtual bool OnMouseEvent (MouseEventArgs mouseEvent)
368
368
#region Mouse Pressed Events
369
369
370
370
/// <summary>
371
- /// INTERNAL For cases where the view is grabbed and the mouse is clicked, this method handles the released event (typically
371
+ /// INTERNAL For cases where the view is grabbed and the mouse is clicked, this method handles the released event
372
+ /// (typically
372
373
/// when <see cref="WantContinuousButtonPressed"/> or <see cref="HighlightStyle"/> are set).
373
374
/// </summary>
374
375
/// <remarks>
@@ -394,7 +395,8 @@ internal bool WhenGrabbedHandleReleased (MouseEventArgs mouseEvent)
394
395
}
395
396
396
397
/// <summary>
397
- /// INTERNAL For cases where the view is grabbed and the mouse is clicked, this method handles the released event (typically
398
+ /// INTERNAL For cases where the view is grabbed and the mouse is clicked, this method handles the released event
399
+ /// (typically
398
400
/// when <see cref="WantContinuousButtonPressed"/> or <see cref="HighlightStyle"/> are set).
399
401
/// </summary>
400
402
/// <remarks>
@@ -463,7 +465,8 @@ private bool WhenGrabbedHandlePressed (MouseEventArgs mouseEvent)
463
465
/// Called when the mouse is either clicked or double-clicked.
464
466
/// </para>
465
467
/// <para>
466
- /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, will be invoked on every mouse event where
468
+ /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, will be invoked on every mouse event
469
+ /// where
467
470
/// the mouse button is pressed.
468
471
/// </para>
469
472
/// </remarks>
@@ -507,7 +510,8 @@ protected bool RaiseMouseClickEvent (MouseEventArgs args)
507
510
/// Called when the mouse is either clicked or double-clicked.
508
511
/// </para>
509
512
/// <para>
510
- /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, will be called on every mouse event where
513
+ /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, will be called on every mouse event
514
+ /// where
511
515
/// the mouse button is pressed.
512
516
/// </para>
513
517
/// </remarks>
@@ -521,14 +525,16 @@ protected bool RaiseMouseClickEvent (MouseEventArgs args)
521
525
/// Raised when the mouse is either clicked or double-clicked.
522
526
/// </para>
523
527
/// <para>
524
- /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, will be raised on every mouse event where
528
+ /// If <see cref="WantContinuousButtonPressed"/> is <see langword="true"/>, will be raised on every mouse event
529
+ /// where
525
530
/// the mouse button is pressed.
526
531
/// </para>
527
532
/// </remarks>
528
533
public event EventHandler < MouseEventArgs > ? MouseClick ;
529
534
530
535
/// <summary>
531
- /// INTERNAL For cases where the view is grabbed and the mouse is clicked, this method handles the click event (typically
536
+ /// INTERNAL For cases where the view is grabbed and the mouse is clicked, this method handles the click event
537
+ /// (typically
532
538
/// when <see cref="WantContinuousButtonPressed"/> or <see cref="HighlightStyle"/> are set).
533
539
/// </summary>
534
540
/// <remarks>
@@ -562,10 +568,8 @@ internal bool WhenGrabbedHandleClicked (MouseEventArgs mouseEvent)
562
568
return false ;
563
569
}
564
570
565
-
566
571
#endregion Mouse Clicked Events
567
572
568
-
569
573
#region Mouse Wheel Events
570
574
571
575
/// <summary>Raises the <see cref="OnMouseWheel"/>/<see cref="MouseWheel"/> event.</summary>
@@ -601,7 +605,8 @@ protected bool RaiseMouseWheelEvent (MouseEventArgs args)
601
605
}
602
606
603
607
/// <summary>
604
- /// Called when a mouse wheel event occurs. Check <see cref="MouseEventArgs.Flags"/> to see which wheel was moved was clicked.
608
+ /// Called when a mouse wheel event occurs. Check <see cref="MouseEventArgs.Flags"/> to see which wheel was moved was
609
+ /// clicked.
605
610
/// </summary>
606
611
/// <remarks>
607
612
/// </remarks>
@@ -828,8 +833,5 @@ internal bool SetPressedHighlight (HighlightStyle newHighlightStyle)
828
833
return viewsUnderMouse ;
829
834
}
830
835
831
- private void DisposeMouse ( )
832
- {
833
-
834
- }
836
+ private void DisposeMouse ( ) { }
835
837
}
0 commit comments