示例#1
0
        public void KeyDown(KeyEventArgs keyEvent)
        {
            // TODO: This is ugly.
            if (keyEvent.Key == Keyboard.Key.Tilde)
            {
                keyEvent.Handle();
                DebugConsole.Toggle();
                return;
            }

            if (KeyboardFocused == null)
            {
                return;
            }

            var guiArgs = new GUIKeyEventArgs(KeyboardFocused, keyEvent.Key, keyEvent.IsRepeat, keyEvent.Alt,
                                              keyEvent.Control, keyEvent.Shift, keyEvent.System);

            KeyboardFocused.KeyDown(guiArgs);

            if (guiArgs.Handled)
            {
                keyEvent.Handle();
            }
        }
示例#2
0
        public void KeyUp(KeyEventArgs keyEvent)
        {
            if (KeyboardFocused == null)
            {
                return;
            }

            var guiArgs = new GUIKeyEventArgs(KeyboardFocused, keyEvent.Key, keyEvent.IsRepeat, keyEvent.Alt,
                                              keyEvent.Control, keyEvent.Shift, keyEvent.System);

            KeyboardFocused.KeyUp(guiArgs);
        }
示例#3
0
 protected internal virtual void KeyHeld(GUIKeyEventArgs args)
 {
 }
示例#4
0
 protected internal virtual void KeyDown(GUIKeyEventArgs args)
 {
     OnKeyDown?.Invoke(args);
 }