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>
26
27constexpr sal_uInt16 KEY_CODE_MASK = 0x0FFF;
28
29// Modifier keys
30constexpr sal_uInt16 KEY_SHIFT = 0x1000;
31constexpr sal_uInt16 KEY_MOD1 = 0x2000;
32constexpr sal_uInt16 KEY_MOD2 = 0x4000;
33constexpr sal_uInt16 KEY_MOD3 = 0x8000;
34constexpr sal_uInt16 KEY_MODIFIERS_MASK = 0xF000;
35
36// Key groups
37constexpr sal_uInt16 KEYGROUP_NUM = css::awt::KeyGroup::NUM;
38constexpr sal_uInt16 KEYGROUP_ALPHA = css::awt::KeyGroup::ALPHA;
39constexpr sal_uInt16 KEYGROUP_FKEYS = css::awt::KeyGroup::FKEYS;
40constexpr sal_uInt16 KEYGROUP_CURSOR = css::awt::KeyGroup::CURSOR;
41constexpr sal_uInt16 KEYGROUP_MISC = css::awt::KeyGroup::MISC;
42constexpr sal_uInt16 KEYGROUP_TYPE = css::awt::KeyGroup::TYPE;
43
44// Key codes
45constexpr sal_uInt16 KEY_0 = css::awt::Key::NUM0;
46constexpr sal_uInt16 KEY_1 = css::awt::Key::NUM1;
47constexpr sal_uInt16 KEY_2 = css::awt::Key::NUM2;
48constexpr sal_uInt16 KEY_3 = css::awt::Key::NUM3;
49constexpr sal_uInt16 KEY_4 = css::awt::Key::NUM4;
50constexpr sal_uInt16 KEY_5 = css::awt::Key::NUM5;
51constexpr sal_uInt16 KEY_6 = css::awt::Key::NUM6;
52constexpr sal_uInt16 KEY_7 = css::awt::Key::NUM7;
53constexpr sal_uInt16 KEY_8 = css::awt::Key::NUM8;
54constexpr sal_uInt16 KEY_9 = css::awt::Key::NUM9;
55
56constexpr sal_uInt16 KEY_A = css::awt::Key::A;
57constexpr sal_uInt16 KEY_B = css::awt::Key::B;
58constexpr sal_uInt16 KEY_C = css::awt::Key::C;
59constexpr sal_uInt16 KEY_D = css::awt::Key::D;
60constexpr sal_uInt16 KEY_E = css::awt::Key::E;
61constexpr sal_uInt16 KEY_F = css::awt::Key::F;
62constexpr sal_uInt16 KEY_G = css::awt::Key::G;
63constexpr sal_uInt16 KEY_H = css::awt::Key::H;
64constexpr sal_uInt16 KEY_I = css::awt::Key::I;
65constexpr sal_uInt16 KEY_J = css::awt::Key::J;
66constexpr sal_uInt16 KEY_K = css::awt::Key::K;
67constexpr sal_uInt16 KEY_L = css::awt::Key::L;
68constexpr sal_uInt16 KEY_M = css::awt::Key::M;
69constexpr sal_uInt16 KEY_N = css::awt::Key::N;
70constexpr sal_uInt16 KEY_O = css::awt::Key::O;
71constexpr sal_uInt16 KEY_P = css::awt::Key::P;
72constexpr sal_uInt16 KEY_Q = css::awt::Key::Q;
73constexpr sal_uInt16 KEY_R = css::awt::Key::R;
74constexpr sal_uInt16 KEY_S = css::awt::Key::S;
75constexpr sal_uInt16 KEY_T = css::awt::Key::T;
76constexpr sal_uInt16 KEY_U = css::awt::Key::U;
77constexpr sal_uInt16 KEY_V = css::awt::Key::V;
78constexpr sal_uInt16 KEY_W = css::awt::Key::W;
79constexpr sal_uInt16 KEY_X = css::awt::Key::X;
80constexpr sal_uInt16 KEY_Y = css::awt::Key::Y;
81constexpr sal_uInt16 KEY_Z = css::awt::Key::Z;
82
83constexpr sal_uInt16 KEY_F1 = css::awt::Key::F1;
84constexpr sal_uInt16 KEY_F2 = css::awt::Key::F2;
85constexpr sal_uInt16 KEY_F3 = css::awt::Key::F3;
86constexpr sal_uInt16 KEY_F4 = css::awt::Key::F4;
87constexpr sal_uInt16 KEY_F5 = css::awt::Key::F5;
88constexpr sal_uInt16 KEY_F6 = css::awt::Key::F6;
89constexpr sal_uInt16 KEY_F7 = css::awt::Key::F7;
90constexpr sal_uInt16 KEY_F8 = css::awt::Key::F8;
91constexpr sal_uInt16 KEY_F9 = css::awt::Key::F9;
92constexpr sal_uInt16 KEY_F10 = css::awt::Key::F10;
93constexpr sal_uInt16 KEY_F11 = css::awt::Key::F11;
94constexpr sal_uInt16 KEY_F12 = css::awt::Key::F12;
95constexpr sal_uInt16 KEY_F13 = css::awt::Key::F13;
96constexpr sal_uInt16 KEY_F14 = css::awt::Key::F14;
97constexpr sal_uInt16 KEY_F15 = css::awt::Key::F15;
98constexpr sal_uInt16 KEY_F16 = css::awt::Key::F16;
99constexpr sal_uInt16 KEY_F17 = css::awt::Key::F17;
100constexpr sal_uInt16 KEY_F18 = css::awt::Key::F18;
101constexpr sal_uInt16 KEY_F19 = css::awt::Key::F19;
102constexpr sal_uInt16 KEY_F20 = css::awt::Key::F20;
103constexpr sal_uInt16 KEY_F21 = css::awt::Key::F21;
104constexpr sal_uInt16 KEY_F22 = css::awt::Key::F22;
105constexpr sal_uInt16 KEY_F23 = css::awt::Key::F23;
106constexpr sal_uInt16 KEY_F24 = css::awt::Key::F24;
107constexpr sal_uInt16 KEY_F25 = css::awt::Key::F25;
108constexpr sal_uInt16 KEY_F26 = css::awt::Key::F26;
109
110constexpr sal_uInt16 KEY_DOWN = css::awt::Key::DOWN;
111constexpr sal_uInt16 KEY_UP = css::awt::Key::UP;
112constexpr sal_uInt16 KEY_LEFT = css::awt::Key::LEFT;
113constexpr sal_uInt16 KEY_RIGHT = css::awt::Key::RIGHT;
114constexpr sal_uInt16 KEY_HOME = css::awt::Key::HOME;
115constexpr sal_uInt16 KEY_END = css::awt::Key::END;
116constexpr sal_uInt16 KEY_PAGEUP = css::awt::Key::PAGEUP;
117constexpr sal_uInt16 KEY_PAGEDOWN = css::awt::Key::PAGEDOWN;
118
119constexpr sal_uInt16 KEY_RETURN = css::awt::Key::RETURN;
120constexpr sal_uInt16 KEY_ESCAPE = css::awt::Key::ESCAPE;
121constexpr sal_uInt16 KEY_TAB = css::awt::Key::TAB;
122constexpr sal_uInt16 KEY_BACKSPACE = css::awt::Key::BACKSPACE;
123constexpr sal_uInt16 KEY_SPACE = css::awt::Key::SPACE;
124constexpr sal_uInt16 KEY_INSERT = css::awt::Key::INSERT;
125constexpr sal_uInt16 KEY_DELETE = css::awt::Key::DELETE;
126
127constexpr sal_uInt16 KEY_ADD = css::awt::Key::ADD;
128constexpr sal_uInt16 KEY_SUBTRACT = css::awt::Key::SUBTRACT;
129constexpr sal_uInt16 KEY_MULTIPLY = css::awt::Key::MULTIPLY;
130constexpr sal_uInt16 KEY_DIVIDE = css::awt::Key::DIVIDE;
131constexpr sal_uInt16 KEY_POINT = css::awt::Key::POINT;
132constexpr sal_uInt16 KEY_COMMA = css::awt::Key::COMMA;
133constexpr sal_uInt16 KEY_LESS = css::awt::Key::LESS;
134constexpr sal_uInt16 KEY_GREATER = css::awt::Key::GREATER;
135constexpr sal_uInt16 KEY_EQUAL = css::awt::Key::EQUAL;
136
137constexpr sal_uInt16 KEY_OPEN = css::awt::Key::OPEN;
138constexpr sal_uInt16 KEY_CUT = css::awt::Key::CUT;
139constexpr sal_uInt16 KEY_COPY = css::awt::Key::COPY;
140constexpr sal_uInt16 KEY_PASTE = css::awt::Key::PASTE;
141constexpr sal_uInt16 KEY_UNDO = css::awt::Key::UNDO;
142constexpr sal_uInt16 KEY_REPEAT = css::awt::Key::REPEAT;
143constexpr sal_uInt16 KEY_FIND = css::awt::Key::FIND;
144constexpr sal_uInt16 KEY_PROPERTIES = css::awt::Key::PROPERTIES;
145constexpr sal_uInt16 KEY_FRONT = css::awt::Key::FRONT;
146constexpr sal_uInt16 KEY_CONTEXTMENU = css::awt::Key::CONTEXTMENU;
147constexpr sal_uInt16 KEY_MENU = css::awt::Key::MENU;
148constexpr sal_uInt16 KEY_HELP = css::awt::Key::HELP;
149constexpr sal_uInt16 KEY_HANGUL_HANJA = css::awt::Key::HANGUL_HANJA;
150constexpr sal_uInt16 KEY_DECIMAL = css::awt::Key::DECIMAL;
151constexpr sal_uInt16 KEY_TILDE = css::awt::Key::TILDE;
152constexpr sal_uInt16 KEY_QUOTELEFT = css::awt::Key::QUOTELEFT;
153constexpr sal_uInt16 KEY_BRACKETLEFT = css::awt::Key::BRACKETLEFT;
154constexpr sal_uInt16 KEY_BRACKETRIGHT = css::awt::Key::BRACKETRIGHT;
155constexpr sal_uInt16 KEY_SEMICOLON = css::awt::Key::SEMICOLON;
156constexpr sal_uInt16 KEY_QUOTERIGHT = css::awt::Key::QUOTERIGHT;
157constexpr sal_uInt16 KEY_RIGHTCURLYBRACKET = css::awt::Key::RIGHTCURLYBRACKET;
158constexpr sal_uInt16 KEY_COLON = css::awt::Key::COLON;
159
160constexpr sal_uInt16 KEY_CAPSLOCK = css::awt::Key::CAPSLOCK;
161constexpr sal_uInt16 KEY_NUMLOCK = css::awt::Key::NUMLOCK;
162constexpr sal_uInt16 KEY_SCROLLLOCK = css::awt::Key::SCROLLLOCK;
163
164// extended Modifier-Keys (only used for modkey events)
165enum class ModKeyFlags
166{
167 NONE = 0x0000,
168 LeftShift = 0x0001,
169 RightShift = 0x0002,
170 LeftMod1 = 0x0004,
171 RightMod1 = 0x0008,
172 LeftMod2 = 0x0010,
173 RightMod2 = 0x0020,
174 LeftMod3 = 0x0040,
175 RightMod3 = 0x0080,
176 Mod1Msk = LeftMod1 | RightMod1, // should be Mod1Mask, but that conflicts with a X.h macro grrrr
178};
179namespace o3tl
180{
181template <> struct typed_flags<ModKeyFlags> : is_typed_flags<ModKeyFlags, 0x00ff>
182{
183};
184}
185
187{
188 NONE = 0x0000,
189 CAPSLOCK = 0x0001,
190 NUMLOCK = 0x0002,
191 SCROLLLOCK = 0x0004
192};
193namespace o3tl
194{
195template <> struct typed_flags<KeyIndicatorState> : is_typed_flags<KeyIndicatorState, 0x0007>
196{
197};
198}
199
200#endif // INCLUDED_VCL_KEYCODES_HXX
201
202/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_uInt16 KEY_X
Definition: keycodes.hxx:79
constexpr sal_uInt16 KEY_M
Definition: keycodes.hxx:68
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
constexpr sal_uInt16 KEY_0
Definition: keycodes.hxx:45
constexpr sal_uInt16 KEY_Q
Definition: keycodes.hxx:72
constexpr sal_uInt16 KEY_SEMICOLON
Definition: keycodes.hxx:155
constexpr sal_uInt16 KEY_R
Definition: keycodes.hxx:73
constexpr sal_uInt16 KEY_F2
Definition: keycodes.hxx:84
constexpr sal_uInt16 KEY_6
Definition: keycodes.hxx:51
KeyIndicatorState
Definition: keycodes.hxx:187
constexpr sal_uInt16 KEY_CONTEXTMENU
Definition: keycodes.hxx:146
constexpr sal_uInt16 KEY_8
Definition: keycodes.hxx:53
constexpr sal_uInt16 KEY_F3
Definition: keycodes.hxx:85
constexpr sal_uInt16 KEY_MOD2
Definition: keycodes.hxx:32
constexpr sal_uInt16 KEYGROUP_ALPHA
Definition: keycodes.hxx:38
constexpr sal_uInt16 KEY_N
Definition: keycodes.hxx:69
constexpr sal_uInt16 KEY_ESCAPE
Definition: keycodes.hxx:120
constexpr sal_uInt16 KEY_FIND
Definition: keycodes.hxx:143
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
constexpr sal_uInt16 KEY_I
Definition: keycodes.hxx:64
constexpr sal_uInt16 KEY_CUT
Definition: keycodes.hxx:138
constexpr sal_uInt16 KEY_K
Definition: keycodes.hxx:66
constexpr sal_uInt16 KEY_F19
Definition: keycodes.hxx:101
constexpr sal_uInt16 KEY_BRACKETRIGHT
Definition: keycodes.hxx:154
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
constexpr sal_uInt16 KEY_T
Definition: keycodes.hxx:75
constexpr sal_uInt16 KEY_SCROLLLOCK
Definition: keycodes.hxx:162
constexpr sal_uInt16 KEY_F15
Definition: keycodes.hxx:97
constexpr sal_uInt16 KEY_7
Definition: keycodes.hxx:52
constexpr sal_uInt16 KEY_1
Definition: keycodes.hxx:46
constexpr sal_uInt16 KEY_ADD
Definition: keycodes.hxx:127
constexpr sal_uInt16 KEY_V
Definition: keycodes.hxx:77
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
constexpr sal_uInt16 KEY_F26
Definition: keycodes.hxx:108
constexpr sal_uInt16 KEY_F4
Definition: keycodes.hxx:86
constexpr sal_uInt16 KEY_NUMLOCK
Definition: keycodes.hxx:161
constexpr sal_uInt16 KEY_F5
Definition: keycodes.hxx:87
constexpr sal_uInt16 KEY_GREATER
Definition: keycodes.hxx:134
constexpr sal_uInt16 KEY_HANGUL_HANJA
Definition: keycodes.hxx:149
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
constexpr sal_uInt16 KEY_EQUAL
Definition: keycodes.hxx:135
constexpr sal_uInt16 KEY_TAB
Definition: keycodes.hxx:121
constexpr sal_uInt16 KEY_LESS
Definition: keycodes.hxx:133
constexpr sal_uInt16 KEY_F23
Definition: keycodes.hxx:105
constexpr sal_uInt16 KEY_COMMA
Definition: keycodes.hxx:132
constexpr sal_uInt16 KEY_F17
Definition: keycodes.hxx:99
constexpr sal_uInt16 KEY_J
Definition: keycodes.hxx:65
constexpr sal_uInt16 KEY_B
Definition: keycodes.hxx:57
constexpr sal_uInt16 KEY_4
Definition: keycodes.hxx:49
constexpr sal_uInt16 KEY_POINT
Definition: keycodes.hxx:131
constexpr sal_uInt16 KEY_DECIMAL
Definition: keycodes.hxx:150
constexpr sal_uInt16 KEY_F6
Definition: keycodes.hxx:88
constexpr sal_uInt16 KEY_U
Definition: keycodes.hxx:76
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
constexpr sal_uInt16 KEY_PASTE
Definition: keycodes.hxx:140
constexpr sal_uInt16 KEY_F10
Definition: keycodes.hxx:92
constexpr sal_uInt16 KEY_CODE_MASK
Definition: keycodes.hxx:27
constexpr sal_uInt16 KEY_COLON
Definition: keycodes.hxx:158
constexpr sal_uInt16 KEYGROUP_MISC
Definition: keycodes.hxx:41
constexpr sal_uInt16 KEY_F9
Definition: keycodes.hxx:91
constexpr sal_uInt16 KEY_5
Definition: keycodes.hxx:50
constexpr sal_uInt16 KEY_F7
Definition: keycodes.hxx:89
constexpr sal_uInt16 KEY_COPY
Definition: keycodes.hxx:139
constexpr sal_uInt16 KEY_F1
Definition: keycodes.hxx:83
constexpr sal_uInt16 KEY_MENU
Definition: keycodes.hxx:147
constexpr sal_uInt16 KEY_MODIFIERS_MASK
Definition: keycodes.hxx:34
constexpr sal_uInt16 KEY_9
Definition: keycodes.hxx:54
constexpr sal_uInt16 KEY_BRACKETLEFT
Definition: keycodes.hxx:153
constexpr sal_uInt16 KEY_PROPERTIES
Definition: keycodes.hxx:144
constexpr sal_uInt16 KEY_FRONT
Definition: keycodes.hxx:145
constexpr sal_uInt16 KEY_O
Definition: keycodes.hxx:70
constexpr sal_uInt16 KEYGROUP_FKEYS
Definition: keycodes.hxx:39
constexpr sal_uInt16 KEY_F20
Definition: keycodes.hxx:102
constexpr sal_uInt16 KEY_Z
Definition: keycodes.hxx:81
constexpr sal_uInt16 KEY_S
Definition: keycodes.hxx:74
constexpr sal_uInt16 KEY_3
Definition: keycodes.hxx:48
constexpr sal_uInt16 KEY_F22
Definition: keycodes.hxx:104
constexpr sal_uInt16 KEY_MOD3
Definition: keycodes.hxx:33
constexpr sal_uInt16 KEY_QUOTERIGHT
Definition: keycodes.hxx:156
constexpr sal_uInt16 KEY_A
Definition: keycodes.hxx:56
constexpr sal_uInt16 KEY_REPEAT
Definition: keycodes.hxx:142
constexpr sal_uInt16 KEY_Y
Definition: keycodes.hxx:80
constexpr sal_uInt16 KEY_UNDO
Definition: keycodes.hxx:141
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
constexpr sal_uInt16 KEY_F13
Definition: keycodes.hxx:95
constexpr sal_uInt16 KEY_F
Definition: keycodes.hxx:61
constexpr sal_uInt16 KEY_D
Definition: keycodes.hxx:59
constexpr sal_uInt16 KEY_H
Definition: keycodes.hxx:63
constexpr sal_uInt16 KEY_G
Definition: keycodes.hxx:62
constexpr sal_uInt16 KEY_OPEN
Definition: keycodes.hxx:137
constexpr sal_uInt16 KEY_DELETE
Definition: keycodes.hxx:125
constexpr sal_uInt16 KEY_L
Definition: keycodes.hxx:67
constexpr sal_uInt16 KEY_F8
Definition: keycodes.hxx:90
constexpr sal_uInt16 KEY_F12
Definition: keycodes.hxx:94
constexpr sal_uInt16 KEY_TILDE
Definition: keycodes.hxx:151
constexpr sal_uInt16 KEY_F18
Definition: keycodes.hxx:100
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
constexpr sal_uInt16 KEY_F24
Definition: keycodes.hxx:106
constexpr sal_uInt16 KEY_SPACE
Definition: keycodes.hxx:123
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
constexpr sal_uInt16 KEY_F11
Definition: keycodes.hxx:93
constexpr sal_uInt16 KEYGROUP_TYPE
Definition: keycodes.hxx:42
constexpr sal_uInt16 KEY_CAPSLOCK
Definition: keycodes.hxx:160
constexpr sal_uInt16 KEY_E
Definition: keycodes.hxx:60
ModKeyFlags
Definition: keycodes.hxx:166
constexpr sal_uInt16 KEY_F25
Definition: keycodes.hxx:107
constexpr sal_uInt16 KEY_QUOTELEFT
Definition: keycodes.hxx:152
constexpr sal_uInt16 KEYGROUP_NUM
Definition: keycodes.hxx:37
constexpr sal_uInt16 KEY_C
Definition: keycodes.hxx:58
constexpr sal_uInt16 KEY_HELP
Definition: keycodes.hxx:148
constexpr sal_uInt16 KEY_2
Definition: keycodes.hxx:47
constexpr sal_uInt16 KEY_W
Definition: keycodes.hxx:78
constexpr sal_uInt16 KEY_P
Definition: keycodes.hxx:71
constexpr sal_uInt16 KEY_SUBTRACT
Definition: keycodes.hxx:128
constexpr sal_uInt16 KEY_DIVIDE
Definition: keycodes.hxx:130
constexpr sal_uInt16 KEY_F16
Definition: keycodes.hxx:98
constexpr sal_uInt16 KEY_SHIFT
Definition: keycodes.hxx:30
constexpr sal_uInt16 KEY_F14
Definition: keycodes.hxx:96
constexpr sal_uInt16 KEY_RIGHTCURLYBRACKET
Definition: keycodes.hxx:157
constexpr sal_uInt16 KEY_INSERT
Definition: keycodes.hxx:124
constexpr sal_uInt16 KEY_BACKSPACE
Definition: keycodes.hxx:122
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
constexpr sal_uInt16 KEYGROUP_CURSOR
Definition: keycodes.hxx:40
constexpr sal_uInt16 KEY_F21
Definition: keycodes.hxx:103
constexpr sal_uInt16 KEY_MULTIPLY
Definition: keycodes.hxx:129
NONE