Пример #1
0
 public InputEventKeyboard(KeyboardEvent eventType, InputEventKeyboard parent)
     : base(parent)
 {
     m_eventType = eventType;
     KeyCode = parent.KeyCode;
     m_KeyDataExtra = parent.m_KeyDataExtra;
 }
Пример #2
0
 public InputEventKeyboard(KeyboardEvent eventType, InputEventKeyboard parent)
     : base(parent)
 {
     m_eventType    = eventType;
     KeyCode        = parent.KeyCode;
     m_KeyDataExtra = parent.m_KeyDataExtra;
 }
Пример #3
0
 private void OnKeyDown(InputEventKeyboard e)
 {
     // handle the initial key down
     if (e.DataPreviousState == 0)
     {
         AddEvent(new InputEventKeyboard(KeyboardEvent.Down, e));
     }
     // handle the key presses. Possibly multiple per keydown message.
     for (int i = 0; i < e.DataRepeatCount; i++)
     {
         AddEvent(new InputEventKeyboard(KeyboardEvent.Press, e));
     }
 }
Пример #4
0
        private void OnKeyChar(InputEventKeyboard e)
        {
            // Control key sends a strange wm_char message ...
            if (e.Control && !e.Alt)
            {
                return;
            }
            InputEventKeyboard pressEvent = LastKeyPressEvent;

            if (pressEvent == null)
            {
                throw new Exception("No corresponding KeyPress event for this WM_CHAR message");
            }
            pressEvent.OverrideKeyChar(e.KeyCode);
        }
Пример #5
0
 public bool HandleKeyboardEvent(KeyboardEvent type, WinKeys key, bool shift, bool alt, bool ctrl)
 {
     foreach (InputEvent e in m_EventsThisFrame)
     {
         if (!e.Handled && e is InputEventKeyboard)
         {
             InputEventKeyboard ek = (InputEventKeyboard)e;
             if (ek.EventType == type &&
                 ek.KeyCode == key &&
                 ek.Shift == shift &&
                 ek.Alt == alt &&
                 ek.Control == ctrl)
             {
                 e.Handled = true;
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #6
0
 /// <summary>
 /// Reads the supplied message and executes any Keyboard events required.
 /// </summary>
 /// <param name="message">The Message to parse</param>
 /// <returns>A Boolean value indicating wether the Key events were handled or not</returns>
 private void WmKeyEvent(ref Message message)
 {
     // HandleKeyBindings();
     // KeyPressEventArgs keyPressEventArgs = null;
     if ((message.Id == NativeConstants.WmChar) || (message.Id == NativeConstants.WmSyschar)) {
         // Is this extra information necessary?
         // wm_(sys)char: http://msdn.microsoft.com/en-us/library/ms646276(VS.85).aspx
         InputEventKeyboard e = new InputEventKeyboard(KeyboardEvent.Press,
             (WinKeys)(int)(long)message.WParam,
             (int)(long)message.LParam,
             ModifierKeys
             );
         IntPtr zero = (IntPtr)0;
         InvokeChar(e);
     }
     else {
         // wm_(sys)keydown: http://msdn.microsoft.com/en-us/library/ms912654.aspx
         // wm_(sys)keyup: http://msdn.microsoft.com/en-us/library/ms646281(VS.85).aspx
         if ((message.Id == NativeConstants.WmKeydown) || (message.Id == NativeConstants.WmSyskeydown)) {
             InputEventKeyboard e = new InputEventKeyboard(KeyboardEvent.Down,
                 (WinKeys)(int)(long)message.WParam,
                 (int)(long)message.LParam,
                 ModifierKeys
                 );
             InvokeKeyDown(e);
         }
         else if ((message.Id == NativeConstants.WmKeyup) || (message.Id == NativeConstants.WmSyskeyup)) {
             InputEventKeyboard e = new InputEventKeyboard(KeyboardEvent.Up,
                 (WinKeys)(int)(long)message.WParam,
                 (int)(long)message.LParam,
                 ModifierKeys
                 );
             InvokeKeyUp(e);
         }
     }
 }
Пример #7
0
 /// <summary>
 /// Raises the KeyUp event. Override this method to add code to handle when a key is released
 /// </summary>
 /// <param name="e">KeyboardPressEventArgs for the KeyUp event</param>
 private void InvokeKeyUp(InputEventKeyboard e)
 {
     if (KeyUp != null)
         KeyUp(e);
 }
Пример #8
0
 /// <summary>
 /// Raises the KeyDown event. Override this method to add code to handle when a key is pressed
 /// </summary>
 /// <param name="e">InputEventCKB for the KeyDown event</param>
 private void InvokeKeyDown(InputEventKeyboard e)
 {
     if (KeyDown != null)
         KeyDown(e);
 }
Пример #9
0
 /// <summary>
 /// Raises the OnChar event. Override this method to add code to handle when a WM_CHAR message is received
 /// </summary>
 /// <param name="e">InputEventCKB for the OnChar event</param>
 private void InvokeChar(InputEventKeyboard e)
 {
     if (KeyChar != null)
         KeyChar(e);
 }
Пример #10
0
 private void OnKeyUp(InputEventKeyboard e)
 {
     AddEvent(new InputEventKeyboard(KeyboardEvent.Up, e));
 }
Пример #11
0
 private void OnKeyDown(InputEventKeyboard e)
 {
     // handle the initial key down
     if (e.DataPreviousState == 0) {
         AddEvent(new InputEventKeyboard(KeyboardEvent.Down, e));
     }
     // handle the key presses. Possibly multiple per keydown message.
     for (int i = 0; i < e.DataRepeatCount; i++) {
         AddEvent(new InputEventKeyboard(KeyboardEvent.Press, e));
     }
 }
Пример #12
0
 private void OnKeyChar(InputEventKeyboard e)
 {
     // Control key sends a strange wm_char message ...
     if (e.Control && !e.Alt) {
         return;
     }
     InputEventKeyboard pressEvent = LastKeyPressEvent;
     if (pressEvent == null) {
         throw new Exception("No corresponding KeyPress event for this WM_CHAR message");
     }
     pressEvent.OverrideKeyChar(e.KeyCode);
 }
Пример #13
0
 private void OnKeyUp(InputEventKeyboard e)
 {
     AddEvent(new InputEventKeyboard(KeyboardEvent.Up, e));
 }