OnKeyDown() protected method

Raises the Control.KeyDown event.
protected OnKeyDown ( Eto.Forms.KeyEventArgs e ) : void
e Eto.Forms.KeyEventArgs Key event arguments
return void
示例#1
0
		public static bool KeyDown(Control control, NSEvent theEvent)
		{
			if (control != null)
			{
				var kpea = theEvent.ToEtoKeyPressEventArgs();
				control.OnKeyDown(kpea);
				if (!kpea.Handled)
				{
					var handler = control.Handler as IMacViewHandler;
					if (handler != null)
						handler.PostKeyDown(kpea);
				}

				return kpea.Handled;
			}
			return false;
		}
示例#2
0
文件: Control.cs 项目: mhusen/Eto
			/// <summary>
			/// Raises the key down event.
			/// </summary>
			public void OnKeyDown(Control widget, KeyEventArgs e)
			{
				widget.Platform.Invoke(() => widget.OnKeyDown(e));
			}
示例#3
0
		public static bool KeyDown (Control control, NSEvent theEvent)
		{
			if (control != null) {
				char keyChar = !string.IsNullOrEmpty (theEvent.Characters) ? theEvent.Characters [0] : '\0';
				Key key = KeyMap.MapKey (theEvent.KeyCode);
				KeyPressEventArgs kpea;
				Key modifiers = KeyMap.GetModifiers (theEvent);
				key |= modifiers;
				//Console.WriteLine("\t\tkeymap.Add({2}, Key.{0}({1})); {3}", theEvent.Characters, (int)keyChar, theEvent.KeyCode, theEvent.ModifierFlags);
				//Console.WriteLine("\t\t{0} {1} {2}", key & Key.ModifierMask, key & Key.KeyMask, (NSKey)keyChar);
				if (key != Key.None) {
					if (((modifiers & ~(Key.Shift | Key.Alt)) == 0))
						kpea = new KeyPressEventArgs (key, keyChar);
					else
						kpea = new KeyPressEventArgs (key);
				} else {
					kpea = new KeyPressEventArgs (key, keyChar);
				}
				control.OnKeyDown (kpea);
				return kpea.Handled;
			}
			return false;
		}