コード例 #1
0
ファイル: KeyMap.cs プロジェクト: majorsilence/Eto
		public static string KeyEquivalent (Key key)
		{
			string value;
			if (inverse.TryGetValue (key & Key.KeyMask, out value))
				return value;
			return string.Empty;
		}
コード例 #2
0
ファイル: MouseEventArgs.cs プロジェクト: hultqvist/Eto
		public MouseEventArgs(MouseButtons buttons, Key modifiers, Point location)
		{
			this.Modifiers = modifiers;
			this.Buttons = buttons;
			this.Location = location;
			this.Pressure = 1.0f;
		}
コード例 #3
0
ファイル: MouseEventArgs.cs プロジェクト: JohnACarruthers/Eto
		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;
		}
コード例 #4
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		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;
		}
コード例 #5
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		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;
		}
コード例 #6
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		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;
		}
コード例 #7
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		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;
		}
コード例 #8
0
ファイル: KeyMap.cs プロジェクト: majorsilence/Eto
		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;
		}
コード例 #9
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		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;
		}
コード例 #10
0
ファイル: KeyPressEventArgs.cs プロジェクト: majorsilence/Eto
		/// <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;
		}
コード例 #11
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		public static SWF.Keys Find(Key key)
		{
			SWF.Keys mapped;
			if (inverse.TryGetValue(key, out mapped)) return mapped;
			else return SWF.Keys.None;
		}
コード例 #12
0
ファイル: Key.cs プロジェクト: alexandrebaker/Eto
		/// <summary>Obsolete. Use Keys instead</summary>
		public bool HasFlag(Key key)
		{
			return keys.HasFlag(key.keys);
		}
コード例 #13
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		public static Gdk.Key ConvertToKey(Key key)
		{
			Gdk.Key result;
			if (inversekeymap.TryGetValue(key & Key.KeyMask, out result)) return result;
			return (Gdk.Key)0;
		}
コード例 #14
0
ファイル: KeyEventArgs.cs プロジェクト: JohnACarruthers/Eto
		/// <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);
		}
コード例 #15
0
ファイル: KeyEventArgs.cs プロジェクト: JohnACarruthers/Eto
		/// <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)
		{
		}
コード例 #16
0
ファイル: KeyMap.cs プロジェクト: hultqvist/Eto
		public static swi.Key Find (Key key)
		{
			swi.Key mapped;
			if (inverse.TryGetValue (key, out mapped)) return mapped;
			else return swi.Key.None;
		}
コード例 #17
0
ファイル: KeyEventArgs.cs プロジェクト: JohnACarruthers/Eto
		/// <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;
		}
コード例 #18
-1
ファイル: KeyMap.cs プロジェクト: alexandrebaker/Eto
		public static av.Keycode Find(Key key)
		{
			av.Keycode mapped;
			if (inverse.TryGetValue(key, out mapped)) return mapped;
			else return av.Keycode.Unknown;
		}
コード例 #19
-1
ファイル: KeyPressEventArgs.cs プロジェクト: majorsilence/Eto
		/// <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;
		}