forked from jfchapman/VUPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hotkeys.h
76 lines (59 loc) · 1.44 KB
/
Hotkeys.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once
#include "stdafx.h"
#include "Settings.h"
class Hotkeys
{
public:
// Hotkey identifiers
enum class ID {
Play = 1,
Stop,
Previous,
Next,
SkipBackwards,
SkipForwards,
StopAtTrackEnd,
FadeOut,
FadeToNext,
MuteVolume,
DecreaseVolume,
IncreaseVolume,
DecreasePitch,
IncreasePitch,
ResetPitch,
BalanceLeft,
BalanceRight,
ResetBalance
};
// Constructor.
// 'wnd' - application window handle.
// 'settings' - application settings.
Hotkeys( const HWND wnd, Settings& settings );
virtual ~Hotkeys();
// Updates the currently registered hotkeys based on the current application settings.
void Update();
// Unregisters all hotkeys.
void Unregister();
// Called when a hotkey message is received.
// 'wParam' - hotkey identifier.
void OnHotkey( const WPARAM wParam );
// Returns a description of a hotkey.
// 'instance' - module instance handle.
// 'id' - hotkey ID.
static std::wstring GetDescription( const HINSTANCE instance, const ID id );
// Returns all the hotkey IDs.
static std::set<ID> GetHotkeyIDs();
private:
// Application window handle.
HWND m_hWnd;
// Application settings.
Settings& m_Settings;
// Registered hotkey IDs.
std::set<int> m_RegisteredHotkeys;
// All hotkey IDs.
static std::set<ID> s_Hotkeys;
// Maps a hotkey ID to a command ID.
static std::map<ID,WPARAM> s_CommandMap;
// Maps a hotkey ID to a string resource ID.
static std::map<ID,UINT> s_DescriptionMap;
};