Update Scintilla to version 3.4.1
[geany-mirror.git] / scintilla / src / KeyMap.h
blobb102b356f3d40807122454706eeb8091e8609915
1 // Scintilla source code edit control
2 /** @file KeyMap.h
3 ** Defines a mapping between keystrokes and commands.
4 **/
5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #ifndef KEYMAP_H
9 #define KEYMAP_H
11 #ifdef SCI_NAMESPACE
12 namespace Scintilla {
13 #endif
15 #define SCI_NORM 0
16 #define SCI_SHIFT SCMOD_SHIFT
17 #define SCI_CTRL SCMOD_CTRL
18 #define SCI_ALT SCMOD_ALT
19 #define SCI_META SCMOD_META
20 #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
21 #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
23 /**
25 class KeyModifiers {
26 public:
27 int key;
28 int modifiers;
29 KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) {
31 bool operator<(const KeyModifiers &other) const {
32 if (key == other.key)
33 return modifiers < other.modifiers;
34 else
35 return key < other.key;
39 /**
41 class KeyToCommand {
42 public:
43 int key;
44 int modifiers;
45 unsigned int msg;
48 /**
50 class KeyMap {
51 std::map<KeyModifiers, unsigned int> kmap;
52 static const KeyToCommand MapDefault[];
54 public:
55 KeyMap();
56 ~KeyMap();
57 void Clear();
58 void AssignCmdKey(int key, int modifiers, unsigned int msg);
59 unsigned int Find(int key, int modifiers) const; // 0 returned on failure
62 #ifdef SCI_NAMESPACE
64 #endif
66 #endif