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 #define KEY_CODE_MASK (sal_uInt16(0x0FFF))
28 
29 // Modifier keys
30 #define KEY_SHIFT (sal_uInt16(0x1000))
31 #define KEY_MOD1 (sal_uInt16(0x2000))
32 #define KEY_MOD2 (sal_uInt16(0x4000))
33 #define KEY_MOD3 (sal_uInt16(0x8000))
34 #define KEY_MODIFIERS_MASK (sal_uInt16(0xF000))
35 
36 // Key groups
37 #define KEYGROUP_NUM (sal_uInt16(css::awt::KeyGroup::NUM))
38 #define KEYGROUP_ALPHA (sal_uInt16(css::awt::KeyGroup::ALPHA))
39 #define KEYGROUP_FKEYS (sal_uInt16(css::awt::KeyGroup::FKEYS))
40 #define KEYGROUP_CURSOR (sal_uInt16(css::awt::KeyGroup::CURSOR))
41 #define KEYGROUP_MISC (sal_uInt16(css::awt::KeyGroup::MISC))
42 #define KEYGROUP_TYPE (sal_uInt16(css::awt::KeyGroup::TYPE))
43 
44 // Key codes
45 #define KEY_0 (sal_uInt16(css::awt::Key::NUM0))
46 #define KEY_1 (sal_uInt16(css::awt::Key::NUM1))
47 #define KEY_2 (sal_uInt16(css::awt::Key::NUM2))
48 #define KEY_3 (sal_uInt16(css::awt::Key::NUM3))
49 #define KEY_4 (sal_uInt16(css::awt::Key::NUM4))
50 #define KEY_5 (sal_uInt16(css::awt::Key::NUM5))
51 #define KEY_6 (sal_uInt16(css::awt::Key::NUM6))
52 #define KEY_7 (sal_uInt16(css::awt::Key::NUM7))
53 #define KEY_8 (sal_uInt16(css::awt::Key::NUM8))
54 #define KEY_9 (sal_uInt16(css::awt::Key::NUM9))
55 
56 #define KEY_A (sal_uInt16(css::awt::Key::A))
57 #define KEY_B (sal_uInt16(css::awt::Key::B))
58 #define KEY_C (sal_uInt16(css::awt::Key::C))
59 #define KEY_D (sal_uInt16(css::awt::Key::D))
60 #define KEY_E (sal_uInt16(css::awt::Key::E))
61 #define KEY_F (sal_uInt16(css::awt::Key::F))
62 #define KEY_G (sal_uInt16(css::awt::Key::G))
63 #define KEY_H (sal_uInt16(css::awt::Key::H))
64 #define KEY_I (sal_uInt16(css::awt::Key::I))
65 #define KEY_J (sal_uInt16(css::awt::Key::J))
66 #define KEY_K (sal_uInt16(css::awt::Key::K))
67 #define KEY_L (sal_uInt16(css::awt::Key::L))
68 #define KEY_M (sal_uInt16(css::awt::Key::M))
69 #define KEY_N (sal_uInt16(css::awt::Key::N))
70 #define KEY_O (sal_uInt16(css::awt::Key::O))
71 #define KEY_P (sal_uInt16(css::awt::Key::P))
72 #define KEY_Q (sal_uInt16(css::awt::Key::Q))
73 #define KEY_R (sal_uInt16(css::awt::Key::R))
74 #define KEY_S (sal_uInt16(css::awt::Key::S))
75 #define KEY_T (sal_uInt16(css::awt::Key::T))
76 #define KEY_U (sal_uInt16(css::awt::Key::U))
77 #define KEY_V (sal_uInt16(css::awt::Key::V))
78 #define KEY_W (sal_uInt16(css::awt::Key::W))
79 #define KEY_X (sal_uInt16(css::awt::Key::X))
80 #define KEY_Y (sal_uInt16(css::awt::Key::Y))
81 #define KEY_Z (sal_uInt16(css::awt::Key::Z))
82 
83 #define KEY_F1 (sal_uInt16(css::awt::Key::F1))
84 #define KEY_F2 (sal_uInt16(css::awt::Key::F2))
85 #define KEY_F3 (sal_uInt16(css::awt::Key::F3))
86 #define KEY_F4 (sal_uInt16(css::awt::Key::F4))
87 #define KEY_F5 (sal_uInt16(css::awt::Key::F5))
88 #define KEY_F6 (sal_uInt16(css::awt::Key::F6))
89 #define KEY_F7 (sal_uInt16(css::awt::Key::F7))
90 #define KEY_F8 (sal_uInt16(css::awt::Key::F8))
91 #define KEY_F9 (sal_uInt16(css::awt::Key::F9))
92 #define KEY_F10 (sal_uInt16(css::awt::Key::F10))
93 #define KEY_F11 (sal_uInt16(css::awt::Key::F11))
94 #define KEY_F12 (sal_uInt16(css::awt::Key::F12))
95 #define KEY_F13 (sal_uInt16(css::awt::Key::F13))
96 #define KEY_F14 (sal_uInt16(css::awt::Key::F14))
97 #define KEY_F15 (sal_uInt16(css::awt::Key::F15))
98 #define KEY_F16 (sal_uInt16(css::awt::Key::F16))
99 #define KEY_F17 (sal_uInt16(css::awt::Key::F17))
100 #define KEY_F18 (sal_uInt16(css::awt::Key::F18))
101 #define KEY_F19 (sal_uInt16(css::awt::Key::F19))
102 #define KEY_F20 (sal_uInt16(css::awt::Key::F20))
103 #define KEY_F21 (sal_uInt16(css::awt::Key::F21))
104 #define KEY_F22 (sal_uInt16(css::awt::Key::F22))
105 #define KEY_F23 (sal_uInt16(css::awt::Key::F23))
106 #define KEY_F24 (sal_uInt16(css::awt::Key::F24))
107 #define KEY_F25 (sal_uInt16(css::awt::Key::F25))
108 #define KEY_F26 (sal_uInt16(css::awt::Key::F26))
109 
110 #define KEY_DOWN (sal_uInt16(css::awt::Key::DOWN))
111 #define KEY_UP (sal_uInt16(css::awt::Key::UP))
112 #define KEY_LEFT (sal_uInt16(css::awt::Key::LEFT))
113 #define KEY_RIGHT (sal_uInt16(css::awt::Key::RIGHT))
114 #define KEY_HOME (sal_uInt16(css::awt::Key::HOME))
115 #define KEY_END (sal_uInt16(css::awt::Key::END))
116 #define KEY_PAGEUP (sal_uInt16(css::awt::Key::PAGEUP))
117 #define KEY_PAGEDOWN (sal_uInt16(css::awt::Key::PAGEDOWN))
118 
119 #define KEY_RETURN (sal_uInt16(css::awt::Key::RETURN))
120 #define KEY_ESCAPE (sal_uInt16(css::awt::Key::ESCAPE))
121 #define KEY_TAB (sal_uInt16(css::awt::Key::TAB))
122 #define KEY_BACKSPACE (sal_uInt16(css::awt::Key::BACKSPACE))
123 #define KEY_SPACE (sal_uInt16(css::awt::Key::SPACE))
124 #define KEY_INSERT (sal_uInt16(css::awt::Key::INSERT))
125 #define KEY_DELETE (sal_uInt16(css::awt::Key::DELETE))
126 
127 #define KEY_ADD (sal_uInt16(css::awt::Key::ADD))
128 #define KEY_SUBTRACT (sal_uInt16(css::awt::Key::SUBTRACT))
129 #define KEY_MULTIPLY (sal_uInt16(css::awt::Key::MULTIPLY))
130 #define KEY_DIVIDE (sal_uInt16(css::awt::Key::DIVIDE))
131 #define KEY_POINT (sal_uInt16(css::awt::Key::POINT))
132 #define KEY_COMMA (sal_uInt16(css::awt::Key::COMMA))
133 #define KEY_LESS (sal_uInt16(css::awt::Key::LESS))
134 #define KEY_GREATER (sal_uInt16(css::awt::Key::GREATER))
135 #define KEY_EQUAL (sal_uInt16(css::awt::Key::EQUAL))
136 
137 #define KEY_OPEN (sal_uInt16(css::awt::Key::OPEN))
138 #define KEY_CUT (sal_uInt16(css::awt::Key::CUT))
139 #define KEY_COPY (sal_uInt16(css::awt::Key::COPY))
140 #define KEY_PASTE (sal_uInt16(css::awt::Key::PASTE))
141 #define KEY_UNDO (sal_uInt16(css::awt::Key::UNDO))
142 #define KEY_REPEAT (sal_uInt16(css::awt::Key::REPEAT))
143 #define KEY_FIND (sal_uInt16(css::awt::Key::FIND))
144 #define KEY_PROPERTIES (sal_uInt16(css::awt::Key::PROPERTIES))
145 #define KEY_FRONT (sal_uInt16(css::awt::Key::FRONT))
146 #define KEY_CONTEXTMENU (sal_uInt16(css::awt::Key::CONTEXTMENU))
147 #define KEY_MENU (sal_uInt16(css::awt::Key::MENU))
148 #define KEY_HELP (sal_uInt16(css::awt::Key::HELP))
149 #define KEY_HANGUL_HANJA (sal_uInt16(css::awt::Key::HANGUL_HANJA))
150 #define KEY_DECIMAL (sal_uInt16(css::awt::Key::DECIMAL))
151 #define KEY_TILDE (sal_uInt16(css::awt::Key::TILDE))
152 #define KEY_QUOTELEFT (sal_uInt16(css::awt::Key::QUOTELEFT))
153 #define KEY_BRACKETLEFT (sal_uInt16(css::awt::Key::BRACKETLEFT))
154 #define KEY_BRACKETRIGHT (sal_uInt16(css::awt::Key::BRACKETRIGHT))
155 #define KEY_SEMICOLON (sal_uInt16(css::awt::Key::SEMICOLON))
156 #define KEY_QUOTERIGHT (sal_uInt16(css::awt::Key::QUOTERIGHT))
157 
158 #define KEY_CAPSLOCK (sal_uInt16(css::awt::Key::CAPSLOCK))
159 #define KEY_NUMLOCK (sal_uInt16(css::awt::Key::NUMLOCK))
160 #define KEY_SCROLLLOCK (sal_uInt16(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: */
ModKeyFlags
Definition: keycodes.hxx:163
KeyIndicatorState
Definition: keycodes.hxx:180