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-2021 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 
46 namespace fabgl {
47 
48 
49 
53 struct VirtualKeyDef {
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 
74 struct 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 
97 extern const KeyboardLayout USLayout;
98 
100 extern const KeyboardLayout UKLayout;
101 
103 extern const KeyboardLayout GermanLayout;
104 
106 extern const KeyboardLayout ItalianLayout;
107 
109 extern const KeyboardLayout SpanishLayout;
110 
112 extern const KeyboardLayout FrenchLayout;
113 
115 extern const KeyboardLayout BelgianLayout;
116 
117 
118 struct SupportedLayouts {
119 
120  static constexpr int LAYOUTSCOUNT = 7;
121 
122  static int count() { return LAYOUTSCOUNT; }
123 
124  static char const * * names() {
125  static char const * NAMES[LAYOUTSCOUNT] = {
126  GermanLayout.desc,
127  ItalianLayout.desc,
128  UKLayout.desc,
129  USLayout.desc,
130  SpanishLayout.desc,
131  FrenchLayout.desc,
132  BelgianLayout.desc,
133  };
134  return NAMES;
135  }
136 
137  static char const * * shortNames() {
138  static char const * SNAMES[LAYOUTSCOUNT] = {
139  GermanLayout.name,
140  ItalianLayout.name,
141  UKLayout.name,
142  USLayout.name,
143  SpanishLayout.name,
144  FrenchLayout.name,
145  BelgianLayout.name,
146  };
147  return SNAMES;
148  }
149 
150  static const KeyboardLayout * * layouts() {
151  static KeyboardLayout const * LAYOUTS[LAYOUTSCOUNT] = {
152  &GermanLayout,
153  &ItalianLayout,
154  &UKLayout,
155  &USLayout,
156  &SpanishLayout,
157  &FrenchLayout,
158  &BelgianLayout,
159  };
160  return LAYOUTS;
161  }
162 
163 };
164 
165 
166 
167 } // end of namespace
All in one structure to fully represent a keyboard layout.
Definition: kbdlayouts.h:82
VirtualKey deadKeysVK[8]
Definition: kbdlayouts.h:90
VirtualKey virtualKey
Definition: kbdlayouts.h:55
AltVirtualKeyDef alternateVK[73]
Definition: kbdlayouts.h:88
const char * desc
Definition: kbdlayouts.h:84
const char * name
Definition: kbdlayouts.h:83
VirtualKey
Represents each possible real or derived (SHIFT + real) key.
Definition: fabutils.h:1036
VirtualKeyDef exScancodeToVK[22]
Definition: kbdlayouts.h:87
This file contains some utility classes and functions.
Definition: canvas.cpp:36
VirtualKey reqVirtualKey
Definition: kbdlayouts.h:63
Associates scancode to virtualkey.
Definition: kbdlayouts.h:53
Associates a virtualkey and various shift states (ctrl, alt, etc..) to another virtualkey.
Definition: kbdlayouts.h:62
DeadKeyVirtualKeyDef deadkeysToVK[60]
Definition: kbdlayouts.h:91
KeyboardLayout const * inherited
Definition: kbdlayouts.h:85
VirtualKeyDef scancodeToVK[86]
Definition: kbdlayouts.h:86