Event.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. //
  2. // Evemts.cs: Events, Key mappings
  3. //
  4. // Authors:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. using System;
  8. namespace Terminal.Gui {
  9. /// <summary>
  10. /// Identifies the state of the "shift"-keys within a event.
  11. /// </summary>
  12. public class KeyModifiers {
  13. /// <summary>
  14. /// Check if the Shift key was pressed or not.
  15. /// </summary>
  16. public bool Shift;
  17. /// <summary>
  18. /// Check if the Alt key was pressed or not.
  19. /// </summary>
  20. public bool Alt;
  21. /// <summary>
  22. /// Check if the Ctrl key was pressed or not.
  23. /// </summary>
  24. public bool Ctrl;
  25. /// <summary>
  26. /// Check if the Caps lock key was pressed or not.
  27. /// </summary>
  28. public bool Capslock;
  29. /// <summary>
  30. /// Check if the Num lock key was pressed or not.
  31. /// </summary>
  32. public bool Numlock;
  33. /// <summary>
  34. /// Check if the Scroll lock key was pressed or not.
  35. /// </summary>
  36. public bool Scrolllock;
  37. }
  38. /// <summary>
  39. /// The <see cref="Key"/> enumeration contains special encoding for some keys, but can also
  40. /// encode all the unicode values that can be passed.
  41. /// </summary>
  42. /// <remarks>
  43. /// <para>
  44. /// If the <see cref="SpecialMask"/> is set, then the value is that of the special mask,
  45. /// otherwise, the value is the one of the lower bits (as extracted by <see cref="CharMask"/>)
  46. /// <para>
  47. /// Numerics keys are the values between 48 and 57 corresponding to 0 to 9
  48. /// </para>
  49. /// </para>
  50. /// <para>
  51. /// Upper alpha keys are the values between 65 and 90 corresponding to A to Z
  52. /// </para>
  53. /// <para>
  54. /// Unicode runes are also stored here, the letter 'A" for example is encoded as a value 65 (not surfaced in the enum).
  55. /// </para>
  56. /// </remarks>
  57. [Flags]
  58. public enum Key : uint {
  59. /// <summary>
  60. /// Mask that indicates that this is a character value, values outside this range
  61. /// indicate special characters like Alt-key combinations or special keys on the
  62. /// keyboard like function keys, arrows keys and so on.
  63. /// </summary>
  64. CharMask = 0xfffff,
  65. /// <summary>
  66. /// If the <see cref="SpecialMask"/> is set, then the value is that of the special mask,
  67. /// otherwise, the value is the one of the lower bits (as extracted by <see cref="CharMask"/>).
  68. /// </summary>
  69. SpecialMask = 0xfff00000,
  70. /// <summary>
  71. /// The key code representing null or empty
  72. /// </summary>
  73. Null = '\0',
  74. /// <summary>
  75. /// The key code for the user pressing the return key.
  76. /// </summary>
  77. Enter = '\n',
  78. /// <summary>
  79. /// The key code for the user pressing the escape key
  80. /// </summary>
  81. Esc = 27,
  82. /// <summary>
  83. /// The key code for the user pressing the space bar
  84. /// </summary>
  85. Space = 32,
  86. /// <summary>
  87. /// Digit 0.
  88. /// </summary>
  89. D0 = 48,
  90. /// <summary>
  91. /// Digit 1.
  92. /// </summary>
  93. D1,
  94. /// <summary>
  95. /// Digit 2.
  96. /// </summary>
  97. D2,
  98. /// <summary>
  99. /// Digit 3.
  100. /// </summary>
  101. D3,
  102. /// <summary>
  103. /// Digit 4.
  104. /// </summary>
  105. D4,
  106. /// <summary>
  107. /// Digit 5.
  108. /// </summary>
  109. D5,
  110. /// <summary>
  111. /// Digit 6.
  112. /// </summary>
  113. D6,
  114. /// <summary>
  115. /// Digit 7.
  116. /// </summary>
  117. D7,
  118. /// <summary>
  119. /// Digit 8.
  120. /// </summary>
  121. D8,
  122. /// <summary>
  123. /// Digit 9.
  124. /// </summary>
  125. D9,
  126. /// <summary>
  127. /// The key code for the user pressing Shift-A
  128. /// </summary>
  129. A = 65,
  130. /// <summary>
  131. /// The key code for the user pressing Shift-B
  132. /// </summary>
  133. B,
  134. /// <summary>
  135. /// The key code for the user pressing Shift-C
  136. /// </summary>
  137. C,
  138. /// <summary>
  139. /// The key code for the user pressing Shift-D
  140. /// </summary>
  141. D,
  142. /// <summary>
  143. /// The key code for the user pressing Shift-E
  144. /// </summary>
  145. E,
  146. /// <summary>
  147. /// The key code for the user pressing Shift-F
  148. /// </summary>
  149. F,
  150. /// <summary>
  151. /// The key code for the user pressing Shift-G
  152. /// </summary>
  153. G,
  154. /// <summary>
  155. /// The key code for the user pressing Shift-H
  156. /// </summary>
  157. H,
  158. /// <summary>
  159. /// The key code for the user pressing Shift-I
  160. /// </summary>
  161. I,
  162. /// <summary>
  163. /// The key code for the user pressing Shift-J
  164. /// </summary>
  165. J,
  166. /// <summary>
  167. /// The key code for the user pressing Shift-K
  168. /// </summary>
  169. K,
  170. /// <summary>
  171. /// The key code for the user pressing Shift-L
  172. /// </summary>
  173. L,
  174. /// <summary>
  175. /// The key code for the user pressing Shift-M
  176. /// </summary>
  177. M,
  178. /// <summary>
  179. /// The key code for the user pressing Shift-N
  180. /// </summary>
  181. N,
  182. /// <summary>
  183. /// The key code for the user pressing Shift-O
  184. /// </summary>
  185. O,
  186. /// <summary>
  187. /// The key code for the user pressing Shift-P
  188. /// </summary>
  189. P,
  190. /// <summary>
  191. /// The key code for the user pressing Shift-Q
  192. /// </summary>
  193. Q,
  194. /// <summary>
  195. /// The key code for the user pressing Shift-R
  196. /// </summary>
  197. R,
  198. /// <summary>
  199. /// The key code for the user pressing Shift-S
  200. /// </summary>
  201. S,
  202. /// <summary>
  203. /// The key code for the user pressing Shift-T
  204. /// </summary>
  205. T,
  206. /// <summary>
  207. /// The key code for the user pressing Shift-U
  208. /// </summary>
  209. U,
  210. /// <summary>
  211. /// The key code for the user pressing Shift-V
  212. /// </summary>
  213. V,
  214. /// <summary>
  215. /// The key code for the user pressing Shift-W
  216. /// </summary>
  217. W,
  218. /// <summary>
  219. /// The key code for the user pressing Shift-X
  220. /// </summary>
  221. X,
  222. /// <summary>
  223. /// The key code for the user pressing Shift-Y
  224. /// </summary>
  225. Y,
  226. /// <summary>
  227. /// The key code for the user pressing Shift-Z
  228. /// </summary>
  229. Z,
  230. /// <summary>
  231. /// The key code for the user pressing A
  232. /// </summary>
  233. a = 97,
  234. /// <summary>
  235. /// The key code for the user pressing B
  236. /// </summary>
  237. b,
  238. /// <summary>
  239. /// The key code for the user pressing C
  240. /// </summary>
  241. c,
  242. /// <summary>
  243. /// The key code for the user pressing D
  244. /// </summary>
  245. d,
  246. /// <summary>
  247. /// The key code for the user pressing E
  248. /// </summary>
  249. e,
  250. /// <summary>
  251. /// The key code for the user pressing F
  252. /// </summary>
  253. f,
  254. /// <summary>
  255. /// The key code for the user pressing G
  256. /// </summary>
  257. g,
  258. /// <summary>
  259. /// The key code for the user pressing H
  260. /// </summary>
  261. h,
  262. /// <summary>
  263. /// The key code for the user pressing I
  264. /// </summary>
  265. i,
  266. /// <summary>
  267. /// The key code for the user pressing J
  268. /// </summary>
  269. j,
  270. /// <summary>
  271. /// The key code for the user pressing K
  272. /// </summary>
  273. k,
  274. /// <summary>
  275. /// The key code for the user pressing L
  276. /// </summary>
  277. l,
  278. /// <summary>
  279. /// The key code for the user pressing M
  280. /// </summary>
  281. m,
  282. /// <summary>
  283. /// The key code for the user pressing N
  284. /// </summary>
  285. n,
  286. /// <summary>
  287. /// The key code for the user pressing O
  288. /// </summary>
  289. o,
  290. /// <summary>
  291. /// The key code for the user pressing P
  292. /// </summary>
  293. p,
  294. /// <summary>
  295. /// The key code for the user pressing Q
  296. /// </summary>
  297. q,
  298. /// <summary>
  299. /// The key code for the user pressing R
  300. /// </summary>
  301. r,
  302. /// <summary>
  303. /// The key code for the user pressing S
  304. /// </summary>
  305. s,
  306. /// <summary>
  307. /// The key code for the user pressing T
  308. /// </summary>
  309. t,
  310. /// <summary>
  311. /// The key code for the user pressing U
  312. /// </summary>
  313. u,
  314. /// <summary>
  315. /// The key code for the user pressing V
  316. /// </summary>
  317. v,
  318. /// <summary>
  319. /// The key code for the user pressing W
  320. /// </summary>
  321. w,
  322. /// <summary>
  323. /// The key code for the user pressing X
  324. /// </summary>
  325. x,
  326. /// <summary>
  327. /// The key code for the user pressing Y
  328. /// </summary>
  329. y,
  330. /// <summary>
  331. /// The key code for the user pressing Z
  332. /// </summary>
  333. z,
  334. /// <summary>
  335. /// The key code for the user pressing the delete key.
  336. /// </summary>
  337. Delete = 127,
  338. /// <summary>
  339. /// When this value is set, the Key encodes the sequence Shift-KeyValue.
  340. /// </summary>
  341. ShiftMask = 0x10000000,
  342. /// <summary>
  343. /// When this value is set, the Key encodes the sequence Alt-KeyValue.
  344. /// And the actual value must be extracted by removing the AltMask.
  345. /// </summary>
  346. AltMask = 0x80000000,
  347. /// <summary>
  348. /// When this value is set, the Key encodes the sequence Ctrl-KeyValue.
  349. /// And the actual value must be extracted by removing the CtrlMask.
  350. /// </summary>
  351. CtrlMask = 0x40000000,
  352. /// <summary>
  353. /// Backspace key.
  354. /// </summary>
  355. Backspace = 0x100000,
  356. /// <summary>
  357. /// Cursor up key
  358. /// </summary>
  359. CursorUp,
  360. /// <summary>
  361. /// Cursor down key.
  362. /// </summary>
  363. CursorDown,
  364. /// <summary>
  365. /// Cursor left key.
  366. /// </summary>
  367. CursorLeft,
  368. /// <summary>
  369. /// Cursor right key.
  370. /// </summary>
  371. CursorRight,
  372. /// <summary>
  373. /// Page Up key.
  374. /// </summary>
  375. PageUp,
  376. /// <summary>
  377. /// Page Down key.
  378. /// </summary>
  379. PageDown,
  380. /// <summary>
  381. /// Home key
  382. /// </summary>
  383. Home,
  384. /// <summary>
  385. /// End key
  386. /// </summary>
  387. End,
  388. /// <summary>
  389. /// Delete character key
  390. /// </summary>
  391. DeleteChar,
  392. /// <summary>
  393. /// Insert character key
  394. /// </summary>
  395. InsertChar,
  396. /// <summary>
  397. /// F1 key.
  398. /// </summary>
  399. F1,
  400. /// <summary>
  401. /// F2 key.
  402. /// </summary>
  403. F2,
  404. /// <summary>
  405. /// F3 key.
  406. /// </summary>
  407. F3,
  408. /// <summary>
  409. /// F4 key.
  410. /// </summary>
  411. F4,
  412. /// <summary>
  413. /// F5 key.
  414. /// </summary>
  415. F5,
  416. /// <summary>
  417. /// F6 key.
  418. /// </summary>
  419. F6,
  420. /// <summary>
  421. /// F7 key.
  422. /// </summary>
  423. F7,
  424. /// <summary>
  425. /// F8 key.
  426. /// </summary>
  427. F8,
  428. /// <summary>
  429. /// F9 key.
  430. /// </summary>
  431. F9,
  432. /// <summary>
  433. /// F10 key.
  434. /// </summary>
  435. F10,
  436. /// <summary>
  437. /// F11 key.
  438. /// </summary>
  439. F11,
  440. /// <summary>
  441. /// F12 key.
  442. /// </summary>
  443. F12,
  444. /// <summary>
  445. /// The key code for the user pressing the tab key (forwards tab key).
  446. /// </summary>
  447. Tab,
  448. /// <summary>
  449. /// Shift-tab key (backwards tab key).
  450. /// </summary>
  451. BackTab,
  452. /// <summary>
  453. /// A key with an unknown mapping was raised.
  454. /// </summary>
  455. Unknown
  456. }
  457. /// <summary>
  458. /// Describes a keyboard event.
  459. /// </summary>
  460. public class KeyEvent {
  461. KeyModifiers keyModifiers;
  462. /// <summary>
  463. /// Symb olid definition for the key.
  464. /// </summary>
  465. public Key Key;
  466. /// <summary>
  467. /// The key value cast to an integer, you will typical use this for
  468. /// extracting the Unicode rune value out of a key, when none of the
  469. /// symbolic options are in use.
  470. /// </summary>
  471. public int KeyValue => (int)Key;
  472. /// <summary>
  473. /// Gets a value indicating whether the Shift key was pressed.
  474. /// </summary>
  475. /// <value><c>true</c> if is shift; otherwise, <c>false</c>.</value>
  476. public bool IsShift => keyModifiers.Shift || Key == Key.BackTab;
  477. /// <summary>
  478. /// Gets a value indicating whether the Alt key was pressed (real or synthesized)
  479. /// </summary>
  480. /// <value><c>true</c> if is alternate; otherwise, <c>false</c>.</value>
  481. public bool IsAlt => keyModifiers.Alt;
  482. /// <summary>
  483. /// Determines whether the value is a control key (and NOT just the ctrl key)
  484. /// </summary>
  485. /// <value><c>true</c> if is ctrl; otherwise, <c>false</c>.</value>
  486. //public bool IsCtrl => ((uint)Key >= 1) && ((uint)Key <= 26);
  487. public bool IsCtrl => keyModifiers.Ctrl;
  488. /// <summary>
  489. /// Gets a value indicating whether the Caps lock key was pressed (real or synthesized)
  490. /// </summary>
  491. /// <value><c>true</c> if is alternate; otherwise, <c>false</c>.</value>
  492. public bool IsCapslock => keyModifiers.Capslock;
  493. /// <summary>
  494. /// Gets a value indicating whether the Num lock key was pressed (real or synthesized)
  495. /// </summary>
  496. /// <value><c>true</c> if is alternate; otherwise, <c>false</c>.</value>
  497. public bool IsNumlock => keyModifiers.Numlock;
  498. /// <summary>
  499. /// Gets a value indicating whether the Scroll lock key was pressed (real or synthesized)
  500. /// </summary>
  501. /// <value><c>true</c> if is alternate; otherwise, <c>false</c>.</value>
  502. public bool IsScrolllock => keyModifiers.Scrolllock;
  503. /// <summary>
  504. /// Constructs a new <see cref="KeyEvent"/>
  505. /// </summary>
  506. public KeyEvent ()
  507. {
  508. Key = Key.Unknown;
  509. keyModifiers = new KeyModifiers ();
  510. }
  511. /// <summary>
  512. /// Constructs a new <see cref="KeyEvent"/> from the provided Key value - can be a rune cast into a Key value
  513. /// </summary>
  514. public KeyEvent (Key k, KeyModifiers km)
  515. {
  516. Key = k;
  517. keyModifiers = km;
  518. }
  519. /// <summary>
  520. /// Pretty prints the KeyEvent
  521. /// </summary>
  522. /// <returns></returns>
  523. public override string ToString ()
  524. {
  525. string msg = "";
  526. var key = this.Key;
  527. if (keyModifiers.Shift) {
  528. msg += "Shift-";
  529. }
  530. if (keyModifiers.Alt) {
  531. msg += "Alt-";
  532. }
  533. if (keyModifiers.Ctrl) {
  534. msg += "Ctrl-";
  535. }
  536. if (keyModifiers.Capslock) {
  537. msg += "Capslock-";
  538. }
  539. if (keyModifiers.Numlock) {
  540. msg += "Numlock-";
  541. }
  542. if (keyModifiers.Scrolllock) {
  543. msg += "Scrolllock-";
  544. }
  545. msg += $"{(((uint)this.KeyValue & (uint)Key.CharMask) > 27 ? $"{(char)this.KeyValue}" : $"{key}")}";
  546. return msg;
  547. }
  548. }
  549. /// <summary>
  550. /// Mouse flags reported in <see cref="MouseEvent"/>.
  551. /// </summary>
  552. /// <remarks>
  553. /// They just happen to map to the ncurses ones.
  554. /// </remarks>
  555. [Flags]
  556. public enum MouseFlags {
  557. /// <summary>
  558. /// The first mouse button was pressed.
  559. /// </summary>
  560. Button1Pressed = unchecked((int)0x2),
  561. /// <summary>
  562. /// The first mouse button was released.
  563. /// </summary>
  564. Button1Released = unchecked((int)0x1),
  565. /// <summary>
  566. /// The first mouse button was clicked (press+release).
  567. /// </summary>
  568. Button1Clicked = unchecked((int)0x4),
  569. /// <summary>
  570. /// The first mouse button was double-clicked.
  571. /// </summary>
  572. Button1DoubleClicked = unchecked((int)0x8),
  573. /// <summary>
  574. /// The first mouse button was triple-clicked.
  575. /// </summary>
  576. Button1TripleClicked = unchecked((int)0x10),
  577. /// <summary>
  578. /// The second mouse button was pressed.
  579. /// </summary>
  580. Button2Pressed = unchecked((int)0x80),
  581. /// <summary>
  582. /// The second mouse button was released.
  583. /// </summary>
  584. Button2Released = unchecked((int)0x40),
  585. /// <summary>
  586. /// The second mouse button was clicked (press+release).
  587. /// </summary>
  588. Button2Clicked = unchecked((int)0x100),
  589. /// <summary>
  590. /// The second mouse button was double-clicked.
  591. /// </summary>
  592. Button2DoubleClicked = unchecked((int)0x200),
  593. /// <summary>
  594. /// The second mouse button was triple-clicked.
  595. /// </summary>
  596. Button2TripleClicked = unchecked((int)0x400),
  597. /// <summary>
  598. /// The third mouse button was pressed.
  599. /// </summary>
  600. Button3Pressed = unchecked((int)0x2000),
  601. /// <summary>
  602. /// The third mouse button was released.
  603. /// </summary>
  604. Button3Released = unchecked((int)0x1000),
  605. /// <summary>
  606. /// The third mouse button was clicked (press+release).
  607. /// </summary>
  608. Button3Clicked = unchecked((int)0x4000),
  609. /// <summary>
  610. /// The third mouse button was double-clicked.
  611. /// </summary>
  612. Button3DoubleClicked = unchecked((int)0x8000),
  613. /// <summary>
  614. /// The third mouse button was triple-clicked.
  615. /// </summary>
  616. Button3TripleClicked = unchecked((int)0x10000),
  617. /// <summary>
  618. /// The fourth mouse button was pressed.
  619. /// </summary>
  620. Button4Pressed = unchecked((int)0x80000),
  621. /// <summary>
  622. /// The fourth mouse button was released.
  623. /// </summary>
  624. Button4Released = unchecked((int)0x40000),
  625. /// <summary>
  626. /// The fourth button was clicked (press+release).
  627. /// </summary>
  628. Button4Clicked = unchecked((int)0x100000),
  629. /// <summary>
  630. /// The fourth button was double-clicked.
  631. /// </summary>
  632. Button4DoubleClicked = unchecked((int)0x200000),
  633. /// <summary>
  634. /// The fourth button was triple-clicked.
  635. /// </summary>
  636. Button4TripleClicked = unchecked((int)0x400000),
  637. /// <summary>
  638. /// Flag: the shift key was pressed when the mouse button took place.
  639. /// </summary>
  640. ButtonShift = unchecked((int)0x2000000),
  641. /// <summary>
  642. /// Flag: the ctrl key was pressed when the mouse button took place.
  643. /// </summary>
  644. ButtonCtrl = unchecked((int)0x1000000),
  645. /// <summary>
  646. /// Flag: the alt key was pressed when the mouse button took place.
  647. /// </summary>
  648. ButtonAlt = unchecked((int)0x4000000),
  649. /// <summary>
  650. /// The mouse position is being reported in this event.
  651. /// </summary>
  652. ReportMousePosition = unchecked((int)0x8000000),
  653. /// <summary>
  654. /// Vertical button wheeled up.
  655. /// </summary>
  656. WheeledUp = unchecked((int)0x10000000),
  657. /// <summary>
  658. /// Vertical button wheeled up.
  659. /// </summary>
  660. WheeledDown = unchecked((int)0x20000000),
  661. /// <summary>
  662. /// Vertical button wheeled up while pressing ButtonShift.
  663. /// </summary>
  664. WheeledLeft = ButtonShift | WheeledUp,
  665. /// <summary>
  666. /// Vertical button wheeled down while pressing ButtonShift.
  667. /// </summary>
  668. WheeledRight = ButtonShift | WheeledDown,
  669. /// <summary>
  670. /// Mask that captures all the events.
  671. /// </summary>
  672. AllEvents = unchecked((int)0x7ffffff),
  673. }
  674. /// <summary>
  675. /// Low-level construct that conveys the details of mouse events, such
  676. /// as coordinates and button state, from ConsoleDrivers up to <see cref="Application"/> and
  677. /// Views.
  678. /// </summary>
  679. /// <remarks>The <see cref="Application"/> class includes the <see cref="Application.RootMouseEvent"/>
  680. /// Action which takes a MouseEvent argument.</remarks>
  681. public class MouseEvent {
  682. /// <summary>
  683. /// The X (column) location for the mouse event.
  684. /// </summary>
  685. public int X { get; set; }
  686. /// <summary>
  687. /// The Y (column) location for the mouse event.
  688. /// </summary>
  689. public int Y { get; set; }
  690. /// <summary>
  691. /// Flags indicating the kind of mouse event that is being posted.
  692. /// </summary>
  693. public MouseFlags Flags { get; set; }
  694. /// <summary>
  695. /// The offset X (column) location for the mouse event.
  696. /// </summary>
  697. public int OfX { get; set; }
  698. /// <summary>
  699. /// The offset Y (column) location for the mouse event.
  700. /// </summary>
  701. public int OfY { get; set; }
  702. /// <summary>
  703. /// The current view at the location for the mouse event.
  704. /// </summary>
  705. public View View { get; set; }
  706. /// <summary>
  707. /// Indicates if the current mouse event has already been processed and the driver should stop notifying any other event subscriber.
  708. /// Its important to set this value to true specially when updating any View's layout from inside the subscriber method.
  709. /// </summary>
  710. public bool Handled { get; set; }
  711. /// <summary>
  712. /// Returns a <see cref="T:System.String"/> that represents the current <see cref="MouseEvent"/>.
  713. /// </summary>
  714. /// <returns>A <see cref="T:System.String"/> that represents the current <see cref="MouseEvent"/>.</returns>
  715. public override string ToString ()
  716. {
  717. return $"({X},{Y}:{Flags}";
  718. }
  719. }
  720. }