forked from sabrogden/Ditto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Accels.h
65 lines (48 loc) · 1.33 KB
/
Accels.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
#pragma once
#include <map>
#include ".\Shared\ArrayEx.h"
#define ACCEL_VKEY(key) LOBYTE(key)
#define ACCEL_MOD(key) HIBYTE(key)
#define ACCEL_MAKEKEY(vkey,mod) ((mod << 8) | vkey)
using namespace std;
class CAccel
{
public:
DWORD Key;
DWORD Key2;
DWORD Cmd;
int RefId;
CString RefData;
CAccel(DWORD key = 0, DWORD cmd = 0, DWORD key2 = 0, CString refData = _T(""))
{
Key = key;
Key2 = key2;
Cmd = cmd;
RefId = 0;
RefData = refData;
}
};
/*------------------------------------------------------------------*\
CAccels - Manages a set of CAccel
\*------------------------------------------------------------------*/
class CAccels
{
public:
CAccels();
void AddAccel(CAccel a);
void AddAccel(DWORD cmd, DWORD key, DWORD key2 = 0, CString refData = _T(""));
void RemoveAll();
CString GetCmdKeyText(DWORD cmd, CString refData = _T(""));
// handles a key's first WM_KEYDOWN or WM_SYSKEYDOWN message.
// it uses GetKeyState to test for modifiers.
// returns a pointer to the internal CAccel if it matches the given key or NULL
bool OnMsg(MSG *pMsg, CAccel &a);
bool ContainsKey(int vKey);
bool m_handleRepeatKeys;
bool m_checkModifierKeys;
static BYTE GetKeyStateModifiers();
protected:
multimap<DWORD, CAccel> m_multiMap;
DWORD m_activeFirstKey;
DWORD m_firstMapTick;
};