-
Notifications
You must be signed in to change notification settings - Fork 8
/
DlgHotkey.h
60 lines (41 loc) · 1.49 KB
/
DlgHotkey.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
#pragma once
#include "stdafx.h"
#include "Settings.h"
class DlgHotkey
{
public:
// 'instance' - module instance handle.
// 'parent' - parent window handle.
DlgHotkey( const HINSTANCE instance, const HWND parent );
virtual ~DlgHotkey();
// Gets the 'hotkey', returning true if the hot key is valid.
bool GetHotkey( Settings::Hotkey& hotkey ) const;
private:
// Dialog box procedure.
static INT_PTR CALLBACK DialogProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
// Cancel button procedure.
static LRESULT CALLBACK ButtonProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
// WM_KEYDOWN message handler, returns true if a valid hotkey was pressed.
bool OnKeyDown( WPARAM wParam, LPARAM lParam );
// Called when the dialog is initialised.
// 'hwnd' - dialog window handle.
void OnInitDialog( const HWND hwnd );
// Returns the default window procedure for the dialog button.
WNDPROC GetDefaultButtonProc();
// Initialises the allowed hotkeys.
void InitAllowedHotkeys();
// Returns whether the 'alt', 'control' & 'shift' keys are pressed.
void GetKeyStates( bool& alt, bool &control, bool& shift ) const;
// Hotkey information.
Settings::Hotkey m_Hotkey;
// Whether the user has pressed a valid hotkey.
bool m_Valid;
// Allowed unmodified hotkeys.
std::set<int> m_UnmodifiedHotkeys;
// Allowed modified hotkeys.
std::set<int> m_ModifiedHotkeys;
// Dialog window handle.
HWND m_hWnd;
// Default button window procedure.
WNDPROC m_DefaultButtonProc;
};