From 221d4661d42e41629568fa1ad35e333ddf917deb Mon Sep 17 00:00:00 2001 From: thefiddler Date: Mon, 17 Feb 2014 23:18:51 +0100 Subject: [PATCH] [Input] Added modifier keys to KeyboardKeyEventArgs --- Source/OpenTK/Input/KeyboardKeyEventArgs.cs | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Source/OpenTK/Input/KeyboardKeyEventArgs.cs b/Source/OpenTK/Input/KeyboardKeyEventArgs.cs index f607090c..75c17e68 100644 --- a/Source/OpenTK/Input/KeyboardKeyEventArgs.cs +++ b/Source/OpenTK/Input/KeyboardKeyEventArgs.cs @@ -46,6 +46,7 @@ namespace OpenTK.Input #region Fields Key key; + KeyModifiers mods; uint scancode; #endregion @@ -83,12 +84,50 @@ namespace OpenTK.Input /// /// Gets the scancode which generated this event. /// + [CLSCompliant(false)] public uint ScanCode { get { return scancode; } internal set { scancode = value; } } + /// + /// Gets a value indicating whether is pressed. + /// + /// true if pressed; otherwise, false. + public bool Alt + { + get { return (mods & KeyModifiers.Alt) != 0; } + } + + /// + /// Gets a value indicating whether is pressed. + /// + /// true if pressed; otherwise, false. + public bool Control + { + get { return (mods & KeyModifiers.Control) != 0; } + } + + /// + /// Gets a value indicating whether is pressed. + /// + /// true if pressed; otherwise, false. + public bool Shift + { + get { return (mods & KeyModifiers.Shift) != 0; } + } + + /// + /// Gets a bitwise combination representing the + /// that are currently pressed. + /// + /// The modifiers. + public KeyModifiers Modifiers + { + get { return mods; } + internal set { mods = value; } + } #endregion }