Update Scintilla to version 3.6.5
[geany-mirror.git] / scintilla / src / KeyMap.h
blob7c4f8072045db4a6659a939a57303c097d440da8
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_SUPER SCMOD_SUPER
21 #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
22 #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
24 /**
26 class KeyModifiers {
27 public:
28 int key;
29 int modifiers;
30 KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) {
32 bool operator<(const KeyModifiers &other) const {
33 if (key == other.key)
34 return modifiers < other.modifiers;
35 else
36 return key < other.key;
40 /**
42 class KeyToCommand {
43 public:
44 int key;
45 int modifiers;
46 unsigned int msg;
49 /**
51 class KeyMap {
52 std::map<KeyModifiers, unsigned int> kmap;
53 static const KeyToCommand MapDefault[];
55 public:
56 KeyMap();
57 ~KeyMap();
58 void Clear();
59 void AssignCmdKey(int key, int modifiers, unsigned int msg);
60 unsigned int Find(int key, int modifiers) const; // 0 returned on failure
63 #ifdef SCI_NAMESPACE
65 #endif
67 #endif