コード例 #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);
 }