Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bockover <abock@microsoft.com>2019-10-02 17:13:21 +0300
committerAaron Bockover <abock@microsoft.com>2019-10-02 17:13:21 +0300
commit96873d1f62934967cc15e4c601704978ab1ed0aa (patch)
tree816dc2ec13cb736695097a622f16c3619901a7ef
parent4bdb1aa96cb205950b172d0ec137d20523fb2360 (diff)
Sync with vs-editor-core@4624fd16
-rw-r--r--src/Editor/Text/Def/TextUICocoa/Input/KeyEvent.cs34
-rw-r--r--src/Editor/Text/Def/TextUICocoa/Input/KeyProcessor.cs33
2 files changed, 56 insertions, 11 deletions
diff --git a/src/Editor/Text/Def/TextUICocoa/Input/KeyEvent.cs b/src/Editor/Text/Def/TextUICocoa/Input/KeyEvent.cs
new file mode 100644
index 0000000..eab7599
--- /dev/null
+++ b/src/Editor/Text/Def/TextUICocoa/Input/KeyEvent.cs
@@ -0,0 +1,34 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+
+using System;
+using AppKit;
+
+namespace Microsoft.VisualStudio.Text.Editor
+{
+ /// <summary>
+ /// A native <see cref="NSEvent"/> key input event that allows for indicating that
+ /// the event has been handled. This event will wrap <see cref="NSEventType.KeyUp"/>,
+ /// <see cref="NSEventType.KeyDown"/>, and <see cref="NSEventType.FlagsChanged"/>
+ /// events.
+ /// </summary>
+ public sealed class KeyEvent : InputEvent
+ {
+ internal KeyEvent(NSEvent @event) : base(@event)
+ {
+ switch (@event.Type)
+ {
+ case NSEventType.KeyUp:
+ case NSEventType.KeyDown:
+ case NSEventType.FlagsChanged:
+ break;
+ default:
+ throw new ArgumentException(
+ "event type must be KeyUp, KeyDown, or FlagsChanged",
+ nameof(@event));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Editor/Text/Def/TextUICocoa/Input/KeyProcessor.cs b/src/Editor/Text/Def/TextUICocoa/Input/KeyProcessor.cs
index 5824b13..c45269f 100644
--- a/src/Editor/Text/Def/TextUICocoa/Input/KeyProcessor.cs
+++ b/src/Editor/Text/Def/TextUICocoa/Input/KeyProcessor.cs
@@ -2,10 +2,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
+
namespace Microsoft.VisualStudio.Text.Editor
{
- using AppKit;
-
/// <summary>
/// Processes the keyboard input of the editor.
/// </summary>
@@ -15,27 +14,39 @@ namespace Microsoft.VisualStudio.Text.Editor
public abstract class KeyProcessor
{
/// <summary>
+ /// Determines whether this processor should be called for events that have
+ /// been handled by earlier <see cref="KeyProcessor"/> objects.
+ /// </summary>
+ public virtual bool IsInterestedInHandledEvents => false;
+
+ /// <summary>
/// Handles the KeyDown event.
/// </summary>
- /// <param name="theEvent">
- /// A <see cref="NSEvent"/> describing the key event.
+ /// <param name="e">
+ /// Event arguments that describe the event.
/// </param>
- public virtual void KeyDown(NSEvent theEvent) { }
+ public virtual void KeyDown(KeyEvent e)
+ {
+ }
/// <summary>
/// Handles the KeyUp event.
/// </summary>
- /// <param name="theEvent">
- /// A <see cref="NSEvent"/> describing the key event.
+ /// <param name="e">
+ /// Event arguments that describe the event.
/// </param>
- public virtual void KeyUp(NSEvent theEvent) { }
+ public virtual void KeyUp(KeyEvent e)
+ {
+ }
/// <summary>
/// Handles the FlagsChanged event.
/// </summary>
- /// <param name="theEvent">
- /// A <see cref="FlagsChanged"/> describing the key event.
+ /// <param name="e">
+ /// Event arguments that describe the event.
/// </param>
- public virtual void FlagsChanged(NSEvent theEvent) { }
+ public virtual void FlagsChanged(KeyEvent e)
+ {
+ }
}
}