IInputElement.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Collections.Generic;
  3. using Avalonia.Interactivity;
  4. using Avalonia.VisualTree;
  5. namespace Avalonia.Input
  6. {
  7. /// <summary>
  8. /// Defines input-related functionality for a control.
  9. /// </summary>
  10. public interface IInputElement : IInteractive, IVisual
  11. {
  12. /// <summary>
  13. /// Occurs when the control receives focus.
  14. /// </summary>
  15. event EventHandler<GotFocusEventArgs> GotFocus;
  16. /// <summary>
  17. /// Occurs when the control loses focus.
  18. /// </summary>
  19. event EventHandler<RoutedEventArgs> LostFocus;
  20. /// <summary>
  21. /// Occurs when a key is pressed while the control has focus.
  22. /// </summary>
  23. event EventHandler<KeyEventArgs> KeyDown;
  24. /// <summary>
  25. /// Occurs when a key is released while the control has focus.
  26. /// </summary>
  27. event EventHandler<KeyEventArgs> KeyUp;
  28. /// <summary>
  29. /// Occurs when a user typed some text while the control has focus.
  30. /// </summary>
  31. event EventHandler<TextInputEventArgs> TextInput;
  32. /// <summary>
  33. /// Occurs when the pointer enters the control.
  34. /// </summary>
  35. event EventHandler<PointerEventArgs> PointerEnter;
  36. /// <summary>
  37. /// Occurs when the pointer leaves the control.
  38. /// </summary>
  39. event EventHandler<PointerEventArgs> PointerLeave;
  40. /// <summary>
  41. /// Occurs when the pointer is pressed over the control.
  42. /// </summary>
  43. event EventHandler<PointerPressedEventArgs> PointerPressed;
  44. /// <summary>
  45. /// Occurs when the pointer moves over the control.
  46. /// </summary>
  47. event EventHandler<PointerEventArgs> PointerMoved;
  48. /// <summary>
  49. /// Occurs when the pointer is released over the control.
  50. /// </summary>
  51. event EventHandler<PointerReleasedEventArgs> PointerReleased;
  52. /// <summary>
  53. /// Occurs when the mouse wheel is scrolled over the control.
  54. /// </summary>
  55. event EventHandler<PointerWheelEventArgs> PointerWheelChanged;
  56. /// <summary>
  57. /// Gets or sets a value indicating whether the control can receive keyboard focus.
  58. /// </summary>
  59. bool Focusable { get; }
  60. /// <summary>
  61. /// Gets or sets a value indicating whether the control is enabled for user interaction.
  62. /// </summary>
  63. bool IsEnabled { get; }
  64. /// <summary>
  65. /// Gets or sets the associated mouse cursor.
  66. /// </summary>
  67. Cursor? Cursor { get; }
  68. /// <summary>
  69. /// Gets a value indicating whether this control and all its parents are enabled.
  70. /// </summary>
  71. /// <remarks>
  72. /// The <see cref="IsEnabled"/> property is used to toggle the enabled state for individual
  73. /// controls. The <see cref="IsEffectivelyEnabled"/> property takes into account the
  74. /// <see cref="IsEnabled"/> value of this control and its parent controls.
  75. /// </remarks>
  76. bool IsEffectivelyEnabled { get; }
  77. /// <summary>
  78. /// Gets a value indicating whether keyboard focus is anywhere within the element or its visual tree child elements.
  79. /// </summary>
  80. bool IsKeyboardFocusWithin { get; }
  81. /// <summary>
  82. /// Gets a value indicating whether the control is focused.
  83. /// </summary>
  84. bool IsFocused { get; }
  85. /// <summary>
  86. /// Gets a value indicating whether the control is considered for hit testing.
  87. /// </summary>
  88. bool IsHitTestVisible { get; }
  89. /// <summary>
  90. /// Gets a value indicating whether the pointer is currently over the control.
  91. /// </summary>
  92. bool IsPointerOver { get; }
  93. /// <summary>
  94. /// Focuses the control.
  95. /// </summary>
  96. void Focus();
  97. /// <summary>
  98. /// Gets the key bindings for the element.
  99. /// </summary>
  100. List<KeyBinding> KeyBindings { get; }
  101. }
  102. }