ShortcutKey.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Runtime.InteropServices;
  2. namespace BansheeEngine
  3. {
  4. /// <summary>
  5. /// A key combination that is used for triggering keyboard shortcuts. Contains a button code and an optional modifier.
  6. /// </summary>
  7. [StructLayout(LayoutKind.Sequential)]
  8. public struct ShortcutKey // Note: Must match C++ class ShortcutKey
  9. {
  10. /// <summary>
  11. /// Optional modifier that is required to be pressed along with the shortcut button
  12. /// </summary>
  13. public ButtonModifier modifier;
  14. /// <summary>
  15. /// Shortcut button that triggers the shortcut.
  16. /// </summary>
  17. public ButtonCode key;
  18. /// <summary>
  19. /// Creates a new shortcut key.
  20. /// </summary>
  21. /// <param name="modifier">Optional modifier that is required to be pressed along with the shortcut button.</param>
  22. /// <param name="key">Shortcut button that triggers the shortcut.</param>
  23. public ShortcutKey(ButtonModifier modifier, ButtonCode key)
  24. {
  25. this.modifier = modifier;
  26. this.key = key;
  27. }
  28. /// <summary>
  29. /// Blank shortcut key that is triggered by no key combination.
  30. /// </summary>
  31. public static ShortcutKey None = new ShortcutKey(ButtonModifier.None, ButtonCode.Unassigned);
  32. }
  33. }