public static string KeyEquivalent (Key key) { string value; if (inverse.TryGetValue (key & Key.KeyMask, out value)) return value; return string.Empty; }
public MouseEventArgs(MouseButtons buttons, Key modifiers, Point location) { this.Modifiers = modifiers; this.Buttons = buttons; this.Location = location; this.Pressure = 1.0f; }
public MouseEventArgs(MouseButtons buttons, Key modifiers, PointF location, SizeF? delta = null) { this.Modifiers = modifiers; this.Buttons = buttons; this.Location = location; this.Pressure = 1.0f; this.Delta = delta ?? SizeF.Empty; }
public static Gdk.ModifierType ConvertToModifier(Key key) { Gdk.ModifierType result = Gdk.ModifierType.None; if ((key & Key.Alt) > 0) result |= Gdk.ModifierType.Mod1Mask; if ((key & Key.Control) > 0) result |= Gdk.ModifierType.ControlMask; if ((key & Key.Application) > 0) result |= Gdk.ModifierType.SuperMask; if ((key & Key.Shift) > 0) result |= Gdk.ModifierType.ShiftMask; return result; }
public static swi.ModifierKeys ConvertModifier (Key key) { key &= Key.ModifierMask; swi.ModifierKeys val = swi.ModifierKeys.None; if (key.HasFlag (Key.Alt)) val |= swi.ModifierKeys.Alt; if (key.HasFlag (Key.Control)) val |= swi.ModifierKeys.Control; if (key.HasFlag (Key.Shift)) val |= swi.ModifierKeys.Shift; if (key.HasFlag (Key.Application)) val |= swi.ModifierKeys.Windows; return val; }
public static swi.Key ConvertKey (Key key) { key &= Key.KeyMask; var keys = key.ToString () .Split (new[] { ", " }, StringSplitOptions.None) .Select (v => (Key)Enum.Parse (typeof (Key), v)); var ret = swi.Key.None; foreach (var val in keys) { ret |= Find (val); } return ret; }
public static SWF.Keys Convert(Key key) { var keys = key.ToString() .Split(new[] { ", " }, StringSplitOptions.None) .Select(v => (Key)Enum.Parse(typeof(Key), v)); SWF.Keys ret = SWF.Keys.None; foreach (var val in keys) { ret |= Find(val); } return ret; }
public static NSEventModifierMask KeyEquivalentModifierMask (Key key) { key &= Key.ModifierMask; NSEventModifierMask mask = (NSEventModifierMask)0; if ((key & Key.Shift) > 0) mask |= NSEventModifierMask.ShiftKeyMask; if ((key & Key.Alt) > 0) mask |= NSEventModifierMask.AlternateKeyMask; if ((key & Key.Control) > 0) mask |= NSEventModifierMask.ControlKeyMask; if ((key & Key.Application) > 0) mask |= NSEventModifierMask.CommandKeyMask; return mask; }
public static string KeyToString (Key key) { if (key != Key.None) { string val = string.Empty; Key modifier = (key & Key.ModifierMask); if (modifier != Key.None) val += modifier.ToString (); Key mainKey = (key & Key.KeyMask); if (mainKey != Key.None) { if (val.Length > 0) val += "+"; val += mainKey.ToString (); } return val; } return string.Empty; }
/// <summary> /// Initializes a new instance of the KeyPressEventArgs class for a non-character key press /// </summary> /// <param name="key">key and modifiers that were pressed</param> public KeyPressEventArgs(Key key) { this.KeyData = key; this.keyChar = null; }
public static SWF.Keys Find(Key key) { SWF.Keys mapped; if (inverse.TryGetValue(key, out mapped)) return mapped; else return SWF.Keys.None; }
/// <summary>Obsolete. Use Keys instead</summary> public bool HasFlag(Key key) { return keys.HasFlag(key.keys); }
public static Gdk.Key ConvertToKey(Key key) { Gdk.Key result; if (inversekeymap.TryGetValue(key & Key.KeyMask, out result)) return result; return (Gdk.Key)0; }
/// <summary> /// Determines whether the specified key and modifier was pressed /// </summary> /// <returns><c>true</c> the key with modifier was pressed; otherwise, <c>false</c>.</returns> /// <param name="key">Key to test if it was pressed</param> /// <param name="modifier">Modifier of the key, or null to allow any modifiers</param> public bool IsKeyDown (Key key, Key? modifier = null) { return KeyEventType == KeyEventType.KeyDown && Key == key && (modifier == null || modifier == Modifiers); }
/// <summary> /// Initializes a new instance of the KeyPressEventArgs class for a character key press /// </summary> /// <param name="keyData">Key and modifiers that were pressed</param> /// <param name="keyEventType">Type of key event</param> /// <param name="keyChar">Character equivalent</param> public KeyEventArgs(Key keyData, KeyEventType keyEventType, char? keyChar = null) : base (keyData, keyEventType, keyChar) { }
public static swi.Key Find (Key key) { swi.Key mapped; if (inverse.TryGetValue (key, out mapped)) return mapped; else return swi.Key.None; }
/// <summary> /// Initializes a new instance of the KeyPressEventArgs class for a character key press /// </summary> /// <param name="keyData">Key and modifiers that were pressed</param> /// <param name="keyEventType">Type of key event</param> /// <param name="keyChar">Character equivalent</param> public KeyPressEventArgs(Key keyData, KeyEventType keyEventType, char? keyChar = null) { this.KeyData = keyData; this.KeyEventType = keyEventType; this.keyChar = keyChar; }
public static av.Keycode Find(Key key) { av.Keycode mapped; if (inverse.TryGetValue(key, out mapped)) return mapped; else return av.Keycode.Unknown; }
/// <summary> /// Initializes a new instance of the KeyPressEventArgs class for a character key press /// </summary> /// <param name="key">key and modifiers that were pressed</param> /// <param name="keyChar">character equivalent</param> public KeyPressEventArgs(Key key, char keyChar) { this.KeyData = key; this.keyChar = keyChar; }