FabGL
ESP32 Display Controller and Graphics Library
kbdlayouts.h
Go to the documentation of this file.
1/*
2 Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - <http://www.fabgl.com>
3 Copyright (c) 2019-2022 Fabrizio Di Vittorio.
4 All rights reserved.
5
6
7* Please contact fdivitto2013@gmail.com if you need a commercial license.
8
9
10* This library and related software is available under GPL v3.
11
12 FabGL is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
16
17 FabGL is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with FabGL. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26
27#pragma once
28
29
30
39#include <stdint.h>
40
41#include "fabutils.h"
42
43
44
45
46namespace fabgl {
47
48
49
54 uint8_t scancode;
56};
57
58
64 struct {
65 uint8_t ctrl : 1;
66 uint8_t lalt : 1;
67 uint8_t ralt : 1;
68 uint8_t shift : 1;
69 };
71};
72
73
74struct DeadKeyVirtualKeyDef {
75 VirtualKey deadKey;
76 VirtualKey reqVirtualKey;
77 VirtualKey virtualKey;
78};
79
80
83 const char * name;
84 const char * desc;
91 DeadKeyVirtualKeyDef deadkeysToVK[60];
92};
93
94
95
97extern const KeyboardLayout USLayout;
98
100extern const KeyboardLayout UKLayout;
101
103extern const KeyboardLayout GermanLayout;
104
106extern const KeyboardLayout ItalianLayout;
107
109extern const KeyboardLayout SpanishLayout;
110
112extern const KeyboardLayout FrenchLayout;
113
115extern const KeyboardLayout BelgianLayout;
116
118extern const KeyboardLayout NorwegianLayout;
119
121extern const KeyboardLayout JapaneseLayout;
122
123
124
125struct SupportedLayouts {
126
127 static constexpr int LAYOUTSCOUNT = 9;
128
129 static int count() { return LAYOUTSCOUNT; }
130
131 static char const * * names() {
132 static char const * NAMES[LAYOUTSCOUNT] = {
133 GermanLayout.desc,
134 ItalianLayout.desc,
135 UKLayout.desc,
136 USLayout.desc,
137 SpanishLayout.desc,
138 FrenchLayout.desc,
139 BelgianLayout.desc,
140 NorwegianLayout.desc,
141 JapaneseLayout.desc,
142 };
143 return NAMES;
144 }
145
146 static char const * * shortNames() {
147 static char const * SNAMES[LAYOUTSCOUNT] = {
148 GermanLayout.name,
149 ItalianLayout.name,
150 UKLayout.name,
151 USLayout.name,
152 SpanishLayout.name,
153 FrenchLayout.name,
154 BelgianLayout.name,
155 NorwegianLayout.name,
156 JapaneseLayout.name,
157 };
158 return SNAMES;
159 }
160
161 static const KeyboardLayout * * layouts() {
162 static KeyboardLayout const * LAYOUTS[LAYOUTSCOUNT] = {
163 &GermanLayout,
164 &ItalianLayout,
165 &UKLayout,
166 &USLayout,
167 &SpanishLayout,
168 &FrenchLayout,
169 &BelgianLayout,
170 &NorwegianLayout,
171 &JapaneseLayout,
172 };
173 return LAYOUTS;
174 }
175
176};
177
178
179
180} // end of namespace
This file contains some utility classes and functions.
VirtualKey
Represents each possible real or derived (SHIFT + real) key.
Definition: fabutils.h:1097
VirtualKey reqVirtualKey
Definition: kbdlayouts.h:63
Associates a virtualkey and various shift states (ctrl, alt, etc..) to another virtualkey.
Definition: kbdlayouts.h:62
VirtualKeyDef exScancodeToVK[22]
Definition: kbdlayouts.h:87
VirtualKeyDef scancodeToVK[86]
Definition: kbdlayouts.h:86
const char * desc
Definition: kbdlayouts.h:84
DeadKeyVirtualKeyDef deadkeysToVK[60]
Definition: kbdlayouts.h:91
const char * name
Definition: kbdlayouts.h:83
VirtualKey deadKeysVK[8]
Definition: kbdlayouts.h:90
AltVirtualKeyDef alternateVK[73]
Definition: kbdlayouts.h:88
KeyboardLayout const * inherited
Definition: kbdlayouts.h:85
All in one structure to fully represent a keyboard layout.
Definition: kbdlayouts.h:82
VirtualKey virtualKey
Definition: kbdlayouts.h:55
Associates scancode to virtualkey.
Definition: kbdlayouts.h:53