Volume Control
Application-specific hotkeys for Windows
VolumeControl.Core.Input.HotkeyMessageHookAbstractor Class Reference

Maintains a single message hook for multiple hotkeys with the same key combination to allow them all to be "registered" at the same time. More...

Inheritance diagram for VolumeControl.Core.Input.HotkeyMessageHookAbstractor:
Collaboration diagram for VolumeControl.Core.Input.HotkeyMessageHookAbstractor:

Public Member Functions

 HotkeyMessageHookAbstractor ()
 Creates a new HotkeyMessageHookAbstractor instance. More...
 
bool HotkeyHasManagedKeyCombination (IHotkey hotkey)
 Checks if the specified hotkey instance has the same key combination as the one managed by this instance. More...
 
void AddHotkey (IHotkey hotkey)
 Adds the specified hotkey to this message hook abstractor instance. More...
 
void AddHotkeys (params IHotkey[] hotkeys)
 Adds the specified hotkeys to this message hook abstractor instance. More...
 
void RemoveHotkey (IHotkey hotkey)
 Removes the specified hotkey from this message hook abstractor instance. More...
 

Properties

IReadOnlyList< IHotkeyHotkeys [get]
 Gets the list of hotkeys currently using this message hook abstractor. More...
 
HwndSourceHook MessageHook [get]
 
bool HasStarted = false [get]
 Gets whether this instance has started managing a specific key combination yet. More...
 
EFriendlyKey ManagedKey = EFriendlyKey.None [get]
 Gets the key in the key combination that this instance manages. More...
 
EModifierKey ManagedModifiers = EModifierKey.None [get]
 Gets the modifier keys in the key combination that this instance manages. More...
 
- Properties inherited from VolumeControl.Core.Input.IHotkeyMessageHook
HwndSourceHook MessageHook [get]
 Gets the windows message hook method. More...
 

Events

EventHandler? AllHotkeysRemoved
 Occurs when this HotkeyMessageHookAbstractor instance is no longer managing any hotkey message hooks. More...
 
EventHandler< IHotkey >? OneHotkeyRemaining
 Occurs when there is only one hotkey remaining in this hook abstractor instance. More...
 

Detailed Description

Maintains a single message hook for multiple hotkeys with the same key combination to allow them all to be "registered" at the same time.

Hotkeys are automatically removed when they are unregistered (which occurs during re-registration). Anything that uses this must ensure the instance is removed when no hotkeys remain.

Constructor & Destructor Documentation

◆ HotkeyMessageHookAbstractor()

VolumeControl.Core.Input.HotkeyMessageHookAbstractor.HotkeyMessageHookAbstractor ( )

Creates a new HotkeyMessageHookAbstractor instance.

Member Function Documentation

◆ AddHotkey()

void VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkey ( IHotkey  hotkey)

Adds the specified hotkey to this message hook abstractor instance.

Parameters
hotkeyAn IHotkey that is not being managed by this instance.
Exceptions
ArgumentExceptionThe specified hotkey is already being managed by this instance.
InvalidOperationExceptionThe specified hotkey does not have this instance's managed key combination.

References VolumeControl.Core.Input.HotkeyMessageHookAbstractor.HasStarted, VolumeControl.Core.Input.HotkeyMessageHookAbstractor.HotkeyHasManagedKeyCombination(), VolumeControl.Core.Input.HotkeyMessageHookAbstractor.Hotkeys, VolumeControl.Core.Input.IHotkey.ID, VolumeControl.Core.Input.IHotkey.IsRegistered, VolumeControl.Core.Input.IHotkey.Key, VolumeControl.Core.Input.HotkeyMessageHookAbstractor.ManagedKey, VolumeControl.Core.Input.HotkeyMessageHookAbstractor.ManagedModifiers, VolumeControl.Core.Input.IHotkey.Modifiers, VolumeControl.Core.Input.IHotkey.Unregistered, and VolumeControl.Core.Input.IHotkey.Unregistering.

Referenced by VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkeys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddHotkeys()

void VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkeys ( params IHotkey[]  hotkeys)

Adds the specified hotkeys to this message hook abstractor instance.

Parameters
hotkeysAny number of IHotkey instances that are not being managed by this instance.
Exceptions
ArgumentExceptionAt least one of the hotkeys is already being managed by this instance.
InvalidOperationExceptionAt least one of the hotkeys does not have the same key combination as the one managed by this instance.

References VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkey().

Here is the call graph for this function:

◆ HotkeyHasManagedKeyCombination()

bool VolumeControl.Core.Input.HotkeyMessageHookAbstractor.HotkeyHasManagedKeyCombination ( IHotkey  hotkey)

Checks if the specified hotkey instance has the same key combination as the one managed by this instance.

Parameters
hotkeyA hotkey to check the key combination of.
Returns
true when the hotkey does have the same key combination; otherwise false.

Referenced by VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkey().

Here is the caller graph for this function:

◆ RemoveHotkey()

void VolumeControl.Core.Input.HotkeyMessageHookAbstractor.RemoveHotkey ( IHotkey  hotkey)

Removes the specified hotkey from this message hook abstractor instance.

Parameters
hotkeyAn IHotkey that is being managed by this instance.
Exceptions
ArgumentExceptionThe specified hotkey is not being managed by this instance.

References VolumeControl.Core.Input.HotkeyMessageHookAbstractor.Hotkeys, VolumeControl.Core.Input.IHotkey.ID, VolumeControl.Core.Input.IHotkey.IsRegistered, VolumeControl.Core.Input.IHotkey.Unregistered, and VolumeControl.Core.Input.IHotkey.Unregistering.

Property Documentation

◆ HasStarted

bool VolumeControl.Core.Input.HotkeyMessageHookAbstractor.HasStarted = false
get

Gets whether this instance has started managing a specific key combination yet.

Referenced by VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkey().

◆ Hotkeys

IReadOnlyList<IHotkey> VolumeControl.Core.Input.HotkeyMessageHookAbstractor.Hotkeys
get

Gets the list of hotkeys currently using this message hook abstractor.

Referenced by VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkey(), and VolumeControl.Core.Input.HotkeyMessageHookAbstractor.RemoveHotkey().

◆ ManagedKey

EFriendlyKey VolumeControl.Core.Input.HotkeyMessageHookAbstractor.ManagedKey = EFriendlyKey.None
get

Gets the key in the key combination that this instance manages.

Referenced by VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkey().

◆ ManagedModifiers

EModifierKey VolumeControl.Core.Input.HotkeyMessageHookAbstractor.ManagedModifiers = EModifierKey.None
get

Gets the modifier keys in the key combination that this instance manages.

Referenced by VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AddHotkey().

Event Documentation

◆ AllHotkeysRemoved

EventHandler? VolumeControl.Core.Input.HotkeyMessageHookAbstractor.AllHotkeysRemoved

Occurs when this HotkeyMessageHookAbstractor instance is no longer managing any hotkey message hooks.

◆ OneHotkeyRemaining

EventHandler<IHotkey>? VolumeControl.Core.Input.HotkeyMessageHookAbstractor.OneHotkeyRemaining

Occurs when there is only one hotkey remaining in this hook abstractor instance.


The documentation for this class was generated from the following file: