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

A hotkey that executes an action when pressed. More...

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

Public Member Functions

 Hotkey (string name, EFriendlyKey key, EModifierKey modifiers, bool isRegistered, HotkeyActionInstance actionInstance)
 Creates a new Hotkey instance with the specified parameters. More...
 
 Hotkey (string name, EFriendlyKey key, EModifierKey modifiers, bool isRegistered)
 
 Hotkey (EFriendlyKey key, EModifierKey modifiers, bool isRegistered, HotkeyActionInstance actionInstance)
 
 Hotkey (EFriendlyKey key, EModifierKey modifiers, bool isRegistered)
 
void GetNewID ()
 Gets a new ID from the WindowsHotkeyAPI. More...
 
void Dispose ()
 Cleans up the Hotkey instance by unregistering it, if necessary. More...
 

Protected Member Functions

void NotifyPropertyChanged ([CallerMemberName] string propertyName="")
 Triggers the PropertyChanged event. More...
 
virtual bool RegisterHotkey ()
 Registers the hotkey with the Windows API. More...
 
virtual bool UnregisterHotkey ()
 Unregisters the hotkey with the Windows API. More...
 

Properties

ushort ID [get]
 
string Name [get, set]
 
EFriendlyKey Key [get, set]
 
EModifierKey Modifiers [get, set]
 
bool Alt [get, set]
 
bool Shift [get, set]
 
bool Ctrl [get, set]
 
bool Win [get, set]
 
bool NoRepeat [get, set]
 
HwndSourceHook MessageHook [get]
 
bool IsRegistered [get, set]
 
HotkeyActionInstanceAction [get, set]
 
- Properties inherited from VolumeControl.Core.Input.IHotkey
string Name [get, set]
 Gets or sets the friendly name of this hotkey. More...
 
ushort ID [get]
 Gets the ID number of this hotkey. More...
 
EFriendlyKey Key [get, set]
 Gets or sets the main key for this hotkey. More...
 
EModifierKey Modifiers [get, set]
 Gets or sets the modifier keys for this hotkey. More...
 
bool Alt [get, set]
 Gets or sets whether the Alt modifier key is enabled. More...
 
bool Shift [get, set]
 Gets or sets whether the Shift modifier key is enabled. More...
 
bool Ctrl [get, set]
 Gets or sets whether the Ctrl modifier key is enabled. More...
 
bool Win [get, set]
 Gets or sets whether the Win modifier key is enabled. More...
 
bool NoRepeat [get, set]
 Gets or sets whether NoRepeat is enabled. More...
 
bool IsRegistered [get, set]
 Gets or sets whether this hotkey is registered with the Win32 API. More...
 
HotkeyActionInstanceAction [get, set]
 Gets or sets the action that this hotkey triggers when pressed. More...
 
- Properties inherited from VolumeControl.Core.Input.IHotkeyMessageHook
HwndSourceHook MessageHook [get]
 Gets the windows message hook method. More...
 

Events

HotkeyPressedEventHandlerPressed
 Occurs when the hotkey was pressed, after the Action has been triggered. More...
 
PropertyChangedEventHandler? PropertyChanged
 
HotkeyRegisteringEventHandlerRegistering
 
EventHandler? Registered
 
HotkeyRegisteringEventHandlerUnregistering
 
EventHandler? Unregistered
 
- Events inherited from VolumeControl.Core.Input.IHotkey
HotkeyPressedEventHandlerPressed
 Occurs when the hotkey combination was pressed. More...
 
HotkeyRegisteringEventHandlerRegistering
 Occurs when the hotkey is about to be registered for any reason. More...
 
EventHandler? Registered
 Occurs when the hotkey has been registered for any reason. More...
 
HotkeyRegisteringEventHandlerUnregistering
 Occurs when the hotkey is about to be unregistered for any reason. More...
 
EventHandler? Unregistered
 Occurs when the hotkey has been unregistered for any reason. More...
 

Detailed Description

A hotkey that executes an action when pressed.

Constructor & Destructor Documentation

◆ Hotkey()

VolumeControl.Core.Input.Hotkey.Hotkey ( string  name,
EFriendlyKey  key,
EModifierKey  modifiers,
bool  isRegistered,
HotkeyActionInstance  actionInstance 
)

Creates a new Hotkey instance with the specified parameters.

Parameters
nameThe name of the hotkey.
keyThe primary key of the hotkey combination.
modifiersThe modifier keys of the hotkey combination.
isRegisteredThe registration state of the hotkey.
actionInstanceThe action to trigger when the hotkey is pressed.

References VolumeControl.Core.Input.Hotkey.Action, VolumeControl.Core.Input.Hotkey.ID, VolumeControl.Core.Input.Hotkey.IsRegistered, VolumeControl.Core.Input.Hotkey.Key, VolumeControl.Core.Input.Hotkey.Modifiers, and VolumeControl.Core.Input.Hotkey.Name.

Member Function Documentation

◆ Dispose()

void VolumeControl.Core.Input.Hotkey.Dispose ( )

Cleans up the Hotkey instance by unregistering it, if necessary.

Referenced by VolumeControl.Core.Input.HotkeyManager.RemoveHotkey().

Here is the caller graph for this function:

◆ GetNewID()

void VolumeControl.Core.Input.Hotkey.GetNewID ( )

Gets a new ID from the WindowsHotkeyAPI.

This method automatically unregisters & reregisters the hotkey when called.

References VolumeControl.Core.Input.Hotkey.ID, and VolumeControl.Core.Input.Hotkey.IsRegistered.

◆ NotifyPropertyChanged()

void VolumeControl.Core.Input.Hotkey.NotifyPropertyChanged ( [CallerMemberName] string  propertyName = "")
protected

Triggers the PropertyChanged event.

Parameters
propertyNameThe name of the property that was changed.

◆ RegisterHotkey()

virtual bool VolumeControl.Core.Input.Hotkey.RegisterHotkey ( )
protectedvirtual

Registers the hotkey with the Windows API.

This can be overridden in derived classes to change how the hotkey is registered. This method is only called after the Registering event returns without being set as handled.

Returns
true when successful; otherwise false.

Referenced by VolumeControl.Core.Input.Hotkey.UnregisterHotkey().

Here is the caller graph for this function:

◆ UnregisterHotkey()

virtual bool VolumeControl.Core.Input.Hotkey.UnregisterHotkey ( )
protectedvirtual

Unregisters the hotkey with the Windows API.

This can be overridden in derived classes to change how the hotkey is unregistered.

Returns
true when successful; otherwise false.

References VolumeControl.Core.Input.Hotkey.IsRegistered, and VolumeControl.Core.Input.Hotkey.RegisterHotkey().

Here is the call graph for this function:

Event Documentation

◆ Pressed

HotkeyPressedEventHandler? VolumeControl.Core.Input.Hotkey.Pressed

Occurs when the hotkey was pressed, after the Action has been triggered.


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