選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

48 行
1.3 KiB

  1. // This code is distributed under MIT license.
  2. // Copyright (c) 2015 George Mamaladze
  3. // See license.txt or https://mit-license.org/
  4. using System.Collections.Generic;
  5. namespace Gma.System.MouseKeyHook.HotKeys
  6. {
  7. /// <summary>
  8. /// A collection of HotKeySets
  9. /// </summary>
  10. public sealed class HotKeySetCollection : List<HotKeySet>
  11. {
  12. private KeyChainHandler m_keyChain;
  13. /// <summary>
  14. /// Adds a HotKeySet to the collection.
  15. /// </summary>
  16. /// <param name="hks"></param>
  17. public new void Add(HotKeySet hks)
  18. {
  19. m_keyChain += hks.OnKey;
  20. base.Add(hks);
  21. }
  22. /// <summary>
  23. /// Removes the HotKeySet from the collection.
  24. /// </summary>
  25. /// <param name="hks"></param>
  26. public new void Remove(HotKeySet hks)
  27. {
  28. m_keyChain -= hks.OnKey;
  29. base.Remove(hks);
  30. }
  31. /// <summary>
  32. /// Uses a multi-case delegate to invoke individual HotKeySets if the Key is in use by any HotKeySets.
  33. /// </summary>
  34. /// <param name="e"></param>
  35. internal void OnKey(KeyEventArgsExt e)
  36. {
  37. if (m_keyChain != null)
  38. m_keyChain(e);
  39. }
  40. private delegate void KeyChainHandler(KeyEventArgsExt kex);
  41. }
  42. }