Permalink
Browse files

[Input] Added modifier keys to KeyboardKeyEventArgs

  • Loading branch information...
thefiddler committed Feb 17, 2014
1 parent 0c262cd commit 221d4661d42e41629568fa1ad35e333ddf917deb
Showing with 39 additions and 0 deletions.
  1. +39 −0 Source/OpenTK/Input/KeyboardKeyEventArgs.cs
@@ -46,6 +46,7 @@ public class KeyboardKeyEventArgs : EventArgs
#region Fields
Key key;
+ KeyModifiers mods;
uint scancode;
#endregion
@@ -83,12 +84,50 @@ public Key Key
/// <summary>
/// Gets the scancode which generated this event.
/// </summary>
+ [CLSCompliant(false)]
public uint ScanCode
{
get { return scancode; }
internal set { scancode = value; }
}
+ /// <summary>
+ /// Gets a value indicating whether <see cref="OpenTK.Input.KeyModifiers.Alt"/> is pressed.
+ /// </summary>
+ /// <value><c>true</c> if pressed; otherwise, <c>false</c>.</value>
+ public bool Alt
+ {
+ get { return (mods & KeyModifiers.Alt) != 0; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether <see cref="OpenTK.Input.KeyModifiers.Control"/> is pressed.
+ /// </summary>
+ /// <value><c>true</c> if pressed; otherwise, <c>false</c>.</value>
+ public bool Control
+ {
+ get { return (mods & KeyModifiers.Control) != 0; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether <see cref="OpenTK.Input.KeyModifiers.Shift"/> is pressed.
+ /// </summary>
+ /// <value><c>true</c> if pressed; otherwise, <c>false</c>.</value>
+ public bool Shift
+ {
+ get { return (mods & KeyModifiers.Shift) != 0; }
+ }
+
+ /// <summary>
+ /// Gets a bitwise combination representing the <see cref="OpenTK.Input.KeyModifiers"/>
+ /// that are currently pressed.
+ /// </summary>
+ /// <value>The modifiers.</value>
+ public KeyModifiers Modifiers
+ {
+ get { return mods; }
+ internal set { mods = value; }
+ }
#endregion
}

0 comments on commit 221d466

Please sign in to comment.