µGFX  2.9
version 2.9
gwin_keyboard_layout.h
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.io/license.html
6  */
7 
8 /**
9  * @file src/gwin/gwin_keyboard_layout.h
10  * @brief GWIN Virtual Keyboard Layout structures.
11  */
12 
13 #ifndef _GWIN_KEYBOARD_LAYOUT_H
14 #define _GWIN_KEYBOARD_LAYOUT_H
15 
16 /**
17  * A GVKeyTable is a set of definitions that define how the keyboard lays out
18  * its keys. A GVKeyTable consists of a number of GVKeySets and a special key table.
19  *
20  * A GVKeySet is a set of keys that make up the currently visible keyboard.
21  * Special keys in the GVKeySet can be used to switch between GVKeySets within
22  * the GVKeyTable. An example is a shift key which switches between the GVKeySet of
23  * lower case keys and the GVKeySet of upper case keys. GVKeySet number 0 is special
24  * in that it is the default GVKeySet when the keyboard is first displayed.
25  *
26  * A GVKeySet is made up of GVKeyRow's. Each GVKeyRow describes the keys on one row
27  * of the keyboard.
28  *
29  * Each GVKeyRow covers a number of key columns. Different rows can have different numbers of columns.
30  * eg. 'Q' -> 'P' has 10 keys while 'A' to 'L' has 9. Additionally each key can cover more than one
31  * column position eg a wide space bar.
32  *
33  * Each GVKeyRow is just a string. Each character is the caption for one key. Using the same
34  * character for two or more adjacent keys merges the keys into one big key covering multiple key columns.
35  * Characters \001 to \037 (1 to 31) are special keys. How to handle and draw those is described by the
36  * special key structure array. Special keys do things like changing keysets, returning characters less than 32,
37  * have multiple character keycaps.
38  *
39  * Note: keycaps from the special key table with a single character from 1 to 31 in them may invoke special drawn
40  * symbols eg. character 13 may cause a special symbol to be drawn for the enter key. Other than those characters
41  * which are drawn as symbols by the keyboard draw function, all other characters for keycaps are drawn using the
42  * current widget font.
43  *
44  * Special keycaps handled by the standard draw:
45  * \001 (1) - Shift (up arrow)
46  * \002 (2) - Shift locked (up arrow - bold)
47  * \010 (8) - Tab (right arrow)
48  * \011 (9) - BackSpace (left arrow)
49  * \015 (13) - Carriage Return (hooked left arrow)
50  */
51 
52 typedef struct GVSpecialKey {
53  const char const *keycap; // The caption on the key
54  const char const *sendkey; // The key to send (NULL means none)
55  gU8 flags; // Flags
56  #define GVKEY_INVERT 0x01 // Invert the color
57  #define GVKEY_SINGLESET 0x02 // Change set when this key is pressed but only for a single keystroke
58  #define GVKEY_LOCKSET 0x04 // Change set when this key is pressed but stay there until the set is changed by the user
59  gU8 newset; // The new set to change to
61 
62 typedef const char **GVKeySet; // Array of Rows - Null indicates the end
63 typedef struct GVKeyTable {
64  const GVSpecialKey *skeys; // Array of Special Key structures
65  const GVKeySet *ksets; // Array of KeySets - Null indicates the end
66  } GVKeyTable;
67 
68 #endif /* _GWIN_KEYBOARD_LAYOUT_H */
struct GVSpecialKey GVSpecialKey