LibreOffice Module vcl (master)  1
keycodes.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_KEYCODES_HXX
21 #define INCLUDED_VCL_KEYCODES_HXX
22 
23 #include <com/sun/star/awt/Key.hpp>
24 #include <com/sun/star/awt/KeyGroup.hpp>
25 #include <o3tl/typed_flags_set.hxx>
26 
27 constexpr sal_uInt16 KEY_CODE_MASK = 0x0FFF;
28 
29 // Modifier keys
30 constexpr sal_uInt16 KEY_SHIFT = 0x1000;
31 constexpr sal_uInt16 KEY_MOD1 = 0x2000;
32 constexpr sal_uInt16 KEY_MOD2 = 0x4000;
33 constexpr sal_uInt16 KEY_MOD3 = 0x8000;
34 constexpr sal_uInt16 KEY_MODIFIERS_MASK = 0xF000;
35 
36 // Key groups
37 constexpr sal_uInt16 KEYGROUP_NUM = css::awt::KeyGroup::NUM;
38 constexpr sal_uInt16 KEYGROUP_ALPHA = css::awt::KeyGroup::ALPHA;
39 constexpr sal_uInt16 KEYGROUP_FKEYS = css::awt::KeyGroup::FKEYS;
40 constexpr sal_uInt16 KEYGROUP_CURSOR = css::awt::KeyGroup::CURSOR;
41 constexpr sal_uInt16 KEYGROUP_MISC = css::awt::KeyGroup::MISC;
42 constexpr sal_uInt16 KEYGROUP_TYPE = css::awt::KeyGroup::TYPE;
43 
44 // Key codes
45 constexpr sal_uInt16 KEY_0 = css::awt::Key::NUM0;
46 constexpr sal_uInt16 KEY_1 = css::awt::Key::NUM1;
47 constexpr sal_uInt16 KEY_2 = css::awt::Key::NUM2;
48 constexpr sal_uInt16 KEY_3 = css::awt::Key::NUM3;
49 constexpr sal_uInt16 KEY_4 = css::awt::Key::NUM4;
50 constexpr sal_uInt16 KEY_5 = css::awt::Key::NUM5;
51 constexpr sal_uInt16 KEY_6 = css::awt::Key::NUM6;
52 constexpr sal_uInt16 KEY_7 = css::awt::Key::NUM7;
53 constexpr sal_uInt16 KEY_8 = css::awt::Key::NUM8;
54 constexpr sal_uInt16 KEY_9 = css::awt::Key::NUM9;
55 
56 constexpr sal_uInt16 KEY_A = css::awt::Key::A;
57 constexpr sal_uInt16 KEY_B = css::awt::Key::B;
58 constexpr sal_uInt16 KEY_C = css::awt::Key::C;
59 constexpr sal_uInt16 KEY_D = css::awt::Key::D;
60 constexpr sal_uInt16 KEY_E = css::awt::Key::E;
61 constexpr sal_uInt16 KEY_F = css::awt::Key::F;
62 constexpr sal_uInt16 KEY_G = css::awt::Key::G;
63 constexpr sal_uInt16 KEY_H = css::awt::Key::H;
64 constexpr sal_uInt16 KEY_I = css::awt::Key::I;
65 constexpr sal_uInt16 KEY_J = css::awt::Key::J;
66 constexpr sal_uInt16 KEY_K = css::awt::Key::K;
67 constexpr sal_uInt16 KEY_L = css::awt::Key::L;
68 constexpr sal_uInt16 KEY_M = css::awt::Key::M;
69 constexpr sal_uInt16 KEY_N = css::awt::Key::N;
70 constexpr sal_uInt16 KEY_O = css::awt::Key::O;
71 constexpr sal_uInt16 KEY_P = css::awt::Key::P;
72 constexpr sal_uInt16 KEY_Q = css::awt::Key::Q;
73 constexpr sal_uInt16 KEY_R = css::awt::Key::R;
74 constexpr sal_uInt16 KEY_S = css::awt::Key::S;
75 constexpr sal_uInt16 KEY_T = css::awt::Key::T;
76 constexpr sal_uInt16 KEY_U = css::awt::Key::U;
77 constexpr sal_uInt16 KEY_V = css::awt::Key::V;
78 constexpr sal_uInt16 KEY_W = css::awt::Key::W;
79 constexpr sal_uInt16 KEY_X = css::awt::Key::X;
80 constexpr sal_uInt16 KEY_Y = css::awt::Key::Y;
81 constexpr sal_uInt16 KEY_Z = css::awt::Key::Z;
82 
83 constexpr sal_uInt16 KEY_F1 = css::awt::Key::F1;
84 constexpr sal_uInt16 KEY_F2 = css::awt::Key::F2;
85 constexpr sal_uInt16 KEY_F3 = css::awt::Key::F3;
86 constexpr sal_uInt16 KEY_F4 = css::awt::Key::F4;
87 constexpr sal_uInt16 KEY_F5 = css::awt::Key::F5;
88 constexpr sal_uInt16 KEY_F6 = css::awt::Key::F6;
89 constexpr sal_uInt16 KEY_F7 = css::awt::Key::F7;
90 constexpr sal_uInt16 KEY_F8 = css::awt::Key::F8;
91 constexpr sal_uInt16 KEY_F9 = css::awt::Key::F9;
92 constexpr sal_uInt16 KEY_F10 = css::awt::Key::F10;
93 constexpr sal_uInt16 KEY_F11 = css::awt::Key::F11;
94 constexpr sal_uInt16 KEY_F12 = css::awt::Key::F12;
95 constexpr sal_uInt16 KEY_F13 = css::awt::Key::F13;
96 constexpr sal_uInt16 KEY_F14 = css::awt::Key::F14;
97 constexpr sal_uInt16 KEY_F15 = css::awt::Key::F15;
98 constexpr sal_uInt16 KEY_F16 = css::awt::Key::F16;
99 constexpr sal_uInt16 KEY_F17 = css::awt::Key::F17;
100 constexpr sal_uInt16 KEY_F18 = css::awt::Key::F18;
101 constexpr sal_uInt16 KEY_F19 = css::awt::Key::F19;
102 constexpr sal_uInt16 KEY_F20 = css::awt::Key::F20;
103 constexpr sal_uInt16 KEY_F21 = css::awt::Key::F21;
104 constexpr sal_uInt16 KEY_F22 = css::awt::Key::F22;
105 constexpr sal_uInt16 KEY_F23 = css::awt::Key::F23;
106 constexpr sal_uInt16 KEY_F24 = css::awt::Key::F24;
107 constexpr sal_uInt16 KEY_F25 = css::awt::Key::F25;
108 constexpr sal_uInt16 KEY_F26 = css::awt::Key::F26;
109 
110 constexpr sal_uInt16 KEY_DOWN = css::awt::Key::DOWN;
111 constexpr sal_uInt16 KEY_UP = css::awt::Key::UP;
112 constexpr sal_uInt16 KEY_LEFT = css::awt::Key::LEFT;
113 constexpr sal_uInt16 KEY_RIGHT = css::awt::Key::RIGHT;
114 constexpr sal_uInt16 KEY_HOME = css::awt::Key::HOME;
115 constexpr sal_uInt16 KEY_END = css::awt::Key::END;
116 constexpr sal_uInt16 KEY_PAGEUP = css::awt::Key::PAGEUP;
117 constexpr sal_uInt16 KEY_PAGEDOWN = css::awt::Key::PAGEDOWN;
118 
119 constexpr sal_uInt16 KEY_RETURN = css::awt::Key::RETURN;
120 constexpr sal_uInt16 KEY_ESCAPE = css::awt::Key::ESCAPE;
121 constexpr sal_uInt16 KEY_TAB = css::awt::Key::TAB;
122 constexpr sal_uInt16 KEY_BACKSPACE = css::awt::Key::BACKSPACE;
123 constexpr sal_uInt16 KEY_SPACE = css::awt::Key::SPACE;
124 constexpr sal_uInt16 KEY_INSERT = css::awt::Key::INSERT;
125 constexpr sal_uInt16 KEY_DELETE = css::awt::Key::DELETE;
126 
127 constexpr sal_uInt16 KEY_ADD = css::awt::Key::ADD;
128 constexpr sal_uInt16 KEY_SUBTRACT = css::awt::Key::SUBTRACT;
129 constexpr sal_uInt16 KEY_MULTIPLY = css::awt::Key::MULTIPLY;
130 constexpr sal_uInt16 KEY_DIVIDE = css::awt::Key::DIVIDE;
131 constexpr sal_uInt16 KEY_POINT = css::awt::Key::POINT;
132 constexpr sal_uInt16 KEY_COMMA = css::awt::Key::COMMA;
133 constexpr sal_uInt16 KEY_LESS = css::awt::Key::LESS;
134 constexpr sal_uInt16 KEY_GREATER = css::awt::Key::GREATER;
135 constexpr sal_uInt16 KEY_EQUAL = css::awt::Key::EQUAL;
136 
137 constexpr sal_uInt16 KEY_OPEN = css::awt::Key::OPEN;
138 constexpr sal_uInt16 KEY_CUT = css::awt::Key::CUT;
139 constexpr sal_uInt16 KEY_COPY = css::awt::Key::COPY;
140 constexpr sal_uInt16 KEY_PASTE = css::awt::Key::PASTE;
141 constexpr sal_uInt16 KEY_UNDO = css::awt::Key::UNDO;
142 constexpr sal_uInt16 KEY_REPEAT = css::awt::Key::REPEAT;
143 constexpr sal_uInt16 KEY_FIND = css::awt::Key::FIND;
144 constexpr sal_uInt16 KEY_PROPERTIES = css::awt::Key::PROPERTIES;
145 constexpr sal_uInt16 KEY_FRONT = css::awt::Key::FRONT;
146 constexpr sal_uInt16 KEY_CONTEXTMENU = css::awt::Key::CONTEXTMENU;
147 constexpr sal_uInt16 KEY_MENU = css::awt::Key::MENU;
148 constexpr sal_uInt16 KEY_HELP = css::awt::Key::HELP;
149 constexpr sal_uInt16 KEY_HANGUL_HANJA = css::awt::Key::HANGUL_HANJA;
150 constexpr sal_uInt16 KEY_DECIMAL = css::awt::Key::DECIMAL;
151 constexpr sal_uInt16 KEY_TILDE = css::awt::Key::TILDE;
152 constexpr sal_uInt16 KEY_QUOTELEFT = css::awt::Key::QUOTELEFT;
153 constexpr sal_uInt16 KEY_BRACKETLEFT = css::awt::Key::BRACKETLEFT;
154 constexpr sal_uInt16 KEY_BRACKETRIGHT = css::awt::Key::BRACKETRIGHT;
155 constexpr sal_uInt16 KEY_SEMICOLON = css::awt::Key::SEMICOLON;
156 constexpr sal_uInt16 KEY_QUOTERIGHT = css::awt::Key::QUOTERIGHT;
157 
158 constexpr sal_uInt16 KEY_CAPSLOCK = css::awt::Key::CAPSLOCK;
159 constexpr sal_uInt16 KEY_NUMLOCK = css::awt::Key::NUMLOCK;
160 constexpr sal_uInt16 KEY_SCROLLLOCK = css::awt::Key::SCROLLLOCK;
161 
162 // extended Modifier-Keys (only used for modkey events)
163 enum class ModKeyFlags {
164  NONE = 0x0000,
165  LeftShift = 0x0001,
166  RightShift = 0x0002,
167  LeftMod1 = 0x0004,
168  RightMod1 = 0x0008,
169  LeftMod2 = 0x0010,
170  RightMod2 = 0x0020,
171  LeftMod3 = 0x0040,
172  RightMod3 = 0x0080,
173  Mod1Msk = LeftMod1 | RightMod1, // should be Mod1Mask, but that conflicts with a X.h macro grrrr
175 };
176 namespace o3tl {
177  template<> struct typed_flags<ModKeyFlags> : is_typed_flags<ModKeyFlags, 0x00ff> {};
178 }
179 
180 enum class KeyIndicatorState {
181  NONE = 0x0000,
182  CAPSLOCK = 0x0001,
183  NUMLOCK = 0x0002,
184  SCROLLLOCK = 0x0004
185 };
186 namespace o3tl
187 {
188  template<> struct typed_flags<KeyIndicatorState> : is_typed_flags<KeyIndicatorState, 0x0007> {};
189 }
190 
191 #endif // INCLUDED_VCL_KEYCODES_HXX
192 
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_uInt16 KEYGROUP_MISC
Definition: keycodes.hxx:41
constexpr sal_uInt16 KEY_4
Definition: keycodes.hxx:49
constexpr sal_uInt16 KEY_F18
Definition: keycodes.hxx:100
constexpr sal_uInt16 KEY_E
Definition: keycodes.hxx:60
constexpr sal_uInt16 KEY_GREATER
Definition: keycodes.hxx:134
constexpr sal_uInt16 KEY_CODE_MASK
Definition: keycodes.hxx:27
constexpr sal_uInt16 KEY_FRONT
Definition: keycodes.hxx:145
constexpr sal_uInt16 KEY_7
Definition: keycodes.hxx:52
constexpr sal_uInt16 KEY_F20
Definition: keycodes.hxx:102
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
constexpr sal_uInt16 KEY_NUMLOCK
Definition: keycodes.hxx:159
constexpr sal_uInt16 KEY_QUOTERIGHT
Definition: keycodes.hxx:156
constexpr sal_uInt16 KEY_J
Definition: keycodes.hxx:65
constexpr sal_uInt16 KEY_C
Definition: keycodes.hxx:58
constexpr sal_uInt16 KEY_COMMA
Definition: keycodes.hxx:132
constexpr sal_uInt16 KEY_2
Definition: keycodes.hxx:47
constexpr sal_uInt16 KEY_LESS
Definition: keycodes.hxx:133
constexpr sal_uInt16 KEY_F3
Definition: keycodes.hxx:85
constexpr sal_uInt16 KEY_A
Definition: keycodes.hxx:56
constexpr sal_uInt16 KEY_0
Definition: keycodes.hxx:45
constexpr sal_uInt16 KEY_F5
Definition: keycodes.hxx:87
constexpr sal_uInt16 KEY_V
Definition: keycodes.hxx:77
constexpr sal_uInt16 KEY_F7
Definition: keycodes.hxx:89
constexpr sal_uInt16 KEY_X
Definition: keycodes.hxx:79
constexpr sal_uInt16 KEY_H
Definition: keycodes.hxx:63
constexpr sal_uInt16 KEY_F4
Definition: keycodes.hxx:86
ModKeyFlags
Definition: keycodes.hxx:163
constexpr sal_uInt16 KEY_F6
Definition: keycodes.hxx:88
constexpr sal_uInt16 KEYGROUP_ALPHA
Definition: keycodes.hxx:38
constexpr sal_uInt16 KEY_MENU
Definition: keycodes.hxx:147
constexpr sal_uInt16 KEY_SPACE
Definition: keycodes.hxx:123
constexpr sal_uInt16 KEY_ADD
Definition: keycodes.hxx:127
constexpr sal_uInt16 KEY_DECIMAL
Definition: keycodes.hxx:150
constexpr sal_uInt16 KEY_Y
Definition: keycodes.hxx:80
constexpr sal_uInt16 KEY_SEMICOLON
Definition: keycodes.hxx:155
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
constexpr sal_uInt16 KEY_F1
Definition: keycodes.hxx:83
constexpr sal_uInt16 KEY_F9
Definition: keycodes.hxx:91
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
constexpr sal_uInt16 KEY_9
Definition: keycodes.hxx:54
constexpr sal_uInt16 KEY_REPEAT
Definition: keycodes.hxx:142
#define X
Definition: field.cxx:977
constexpr sal_uInt16 KEY_1
Definition: keycodes.hxx:46
constexpr sal_uInt16 KEY_D
Definition: keycodes.hxx:59
constexpr sal_uInt16 KEY_UNDO
Definition: keycodes.hxx:141
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
constexpr sal_uInt16 KEY_F2
Definition: keycodes.hxx:84
constexpr sal_uInt16 KEY_OPEN
Definition: keycodes.hxx:137
constexpr sal_uInt16 KEYGROUP_CURSOR
Definition: keycodes.hxx:40
constexpr sal_uInt16 KEY_R
Definition: keycodes.hxx:73
constexpr sal_uInt16 KEY_Q
Definition: keycodes.hxx:72
constexpr sal_uInt16 KEY_QUOTELEFT
Definition: keycodes.hxx:152
constexpr sal_uInt16 KEY_CUT
Definition: keycodes.hxx:138
constexpr sal_uInt16 KEY_F24
Definition: keycodes.hxx:106
constexpr sal_uInt16 KEY_TILDE
Definition: keycodes.hxx:151
constexpr sal_uInt16 KEY_PROPERTIES
Definition: keycodes.hxx:144
constexpr sal_uInt16 KEY_CONTEXTMENU
Definition: keycodes.hxx:146
constexpr sal_uInt16 KEY_MODIFIERS_MASK
Definition: keycodes.hxx:34
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
constexpr sal_uInt16 KEY_5
Definition: keycodes.hxx:50
constexpr sal_uInt16 KEYGROUP_FKEYS
Definition: keycodes.hxx:39
constexpr sal_uInt16 KEY_CAPSLOCK
Definition: keycodes.hxx:158
constexpr sal_uInt16 KEY_K
Definition: keycodes.hxx:66
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
constexpr sal_uInt16 KEY_F21
Definition: keycodes.hxx:103
KeyIndicatorState
Definition: keycodes.hxx:180
constexpr sal_uInt16 KEY_F25
Definition: keycodes.hxx:107
constexpr sal_uInt16 KEY_F13
Definition: keycodes.hxx:95
constexpr sal_uInt16 KEY_3
Definition: keycodes.hxx:48
constexpr sal_uInt16 KEY_W
Definition: keycodes.hxx:78
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
constexpr sal_uInt16 KEY_BRACKETLEFT
Definition: keycodes.hxx:153
constexpr sal_uInt16 KEYGROUP_TYPE
Definition: keycodes.hxx:42
constexpr sal_uInt16 KEY_COPY
Definition: keycodes.hxx:139
constexpr sal_uInt16 KEY_HELP
Definition: keycodes.hxx:148
constexpr sal_uInt16 KEY_O
Definition: keycodes.hxx:70
constexpr sal_uInt16 KEY_MOD2
Definition: keycodes.hxx:32
constexpr sal_uInt16 KEY_F10
Definition: keycodes.hxx:92
constexpr sal_uInt16 KEY_6
Definition: keycodes.hxx:51
constexpr sal_uInt16 KEY_B
Definition: keycodes.hxx:57
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
constexpr sal_uInt16 KEY_M
Definition: keycodes.hxx:68
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
constexpr sal_uInt16 KEY_S
Definition: keycodes.hxx:74
#define M
Definition: field.cxx:976
constexpr sal_uInt16 KEY_FIND
Definition: keycodes.hxx:143
constexpr sal_uInt16 KEY_F26
Definition: keycodes.hxx:108
constexpr sal_uInt16 KEY_8
Definition: keycodes.hxx:53
constexpr sal_uInt16 KEY_G
Definition: keycodes.hxx:62
constexpr sal_uInt16 KEY_SUBTRACT
Definition: keycodes.hxx:128
#define K
Definition: field.cxx:975
constexpr sal_uInt16 KEY_F16
Definition: keycodes.hxx:98
constexpr sal_uInt16 KEY_ESCAPE
Definition: keycodes.hxx:120
constexpr sal_uInt16 KEY_F22
Definition: keycodes.hxx:104
constexpr sal_uInt16 KEY_SCROLLLOCK
Definition: keycodes.hxx:160
constexpr sal_uInt16 KEY_F
Definition: keycodes.hxx:61
constexpr sal_uInt16 KEY_F14
Definition: keycodes.hxx:96
constexpr sal_uInt16 KEY_F19
Definition: keycodes.hxx:101
constexpr sal_uInt16 KEY_N
Definition: keycodes.hxx:69
constexpr sal_uInt16 KEY_F11
Definition: keycodes.hxx:93
constexpr sal_uInt16 KEY_F12
Definition: keycodes.hxx:94
constexpr sal_uInt16 KEY_BRACKETRIGHT
Definition: keycodes.hxx:154
constexpr sal_uInt16 KEY_L
Definition: keycodes.hxx:67
constexpr sal_uInt16 KEY_BACKSPACE
Definition: keycodes.hxx:122
constexpr sal_uInt16 KEYGROUP_NUM
Definition: keycodes.hxx:37
constexpr sal_uInt16 KEY_U
Definition: keycodes.hxx:76
constexpr sal_uInt16 KEY_HANGUL_HANJA
Definition: keycodes.hxx:149
constexpr sal_uInt16 KEY_POINT
Definition: keycodes.hxx:131
constexpr sal_uInt16 KEY_MULTIPLY
Definition: keycodes.hxx:129
constexpr sal_uInt16 KEY_EQUAL
Definition: keycodes.hxx:135
constexpr sal_uInt16 KEY_Z
Definition: keycodes.hxx:81
constexpr sal_uInt16 KEY_I
Definition: keycodes.hxx:64
constexpr sal_uInt16 KEY_T
Definition: keycodes.hxx:75
constexpr sal_uInt16 KEY_P
Definition: keycodes.hxx:71
constexpr sal_uInt16 KEY_PASTE
Definition: keycodes.hxx:140
constexpr sal_uInt16 KEY_F23
Definition: keycodes.hxx:105
constexpr sal_uInt16 KEY_DELETE
Definition: keycodes.hxx:125
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
constexpr sal_uInt16 KEY_F15
Definition: keycodes.hxx:97
constexpr sal_uInt16 KEY_MOD3
Definition: keycodes.hxx:33
constexpr sal_uInt16 KEY_INSERT
Definition: keycodes.hxx:124
constexpr sal_uInt16 KEY_SHIFT
Definition: keycodes.hxx:30
constexpr sal_uInt16 KEY_DIVIDE
Definition: keycodes.hxx:130
constexpr sal_uInt16 KEY_F17
Definition: keycodes.hxx:99
constexpr sal_uInt16 KEY_TAB
Definition: keycodes.hxx:121
constexpr sal_uInt16 KEY_F8
Definition: keycodes.hxx:90