浏览代码

Highlight stuff to distinct files

Tig 1 年之前
父节点
当前提交
57145ec258
共有 2 个文件被更改,包括 40 次插入0 次删除
  1. 10 0
      Terminal.Gui/View/HighlightEventArgs.cs
  2. 30 0
      Terminal.Gui/View/HighlightStyle.cs

+ 10 - 0
Terminal.Gui/View/HighlightEventArgs.cs

@@ -0,0 +1,10 @@
+namespace Terminal.Gui;
+
+/// <summary>
+/// Event arguments for the <see cref="View.Highlight"/> event.
+/// </summary>
+public class HighlightEventArgs : CancelEventArgs<HighlightStyle>
+{
+    /// <inheritdoc />
+    public HighlightEventArgs (HighlightStyle currentValue, HighlightStyle newValue) : base (currentValue, newValue) { }
+}

+ 30 - 0
Terminal.Gui/View/HighlightStyle.cs

@@ -0,0 +1,30 @@
+namespace Terminal.Gui;
+
+/// <summary>
+/// Describes the highlight style of a view.
+/// </summary>
+[Flags]
+public enum HighlightStyle
+{
+    /// <summary>
+    /// No highlight.
+    /// </summary>
+    None = 0,
+
+#if HOVER
+    /// <summary>
+    /// The mouse is hovering over the view.
+    /// </summary>
+    Hover = 1,
+#endif
+
+    /// <summary>
+    /// The mouse is pressed within the <see cref="View.Viewport"/>.
+    /// </summary>
+    Pressed = 2,
+
+    /// <summary>
+    /// The mouse is pressed but moved outside the <see cref="View.Viewport"/>.
+    /// </summary>
+    PressedOutside = 4
+}