The official µGFX library repository.

gwin_keyboard_layout.h 3.1KB

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