1 module keyboard;
2 
3 // Key constants. See also struct Event's key field.
4 enum Key {
5      
6     /* These are a safe subset of terminfo keys, which exist on all popular
7      * terminals. Termbox uses only them to stay truly portable.
8      */
9     f1             = cast(ushort) 0xffff-0,
10     f2             = cast(ushort) 0xffff-1,
11     f3             = cast(ushort) 0xffff-2,
12     f4             = cast(ushort) 0xffff-3,
13     f5             = cast(ushort) 0xffff-4,
14     f6             = cast(ushort) 0xffff-5,
15     f7             = cast(ushort) 0xffff-6,
16     f8             = cast(ushort) 0xffff-7,
17     f9             = cast(ushort) 0xffff-8,
18     f10            = cast(ushort) 0xffff-9,
19     f11            = cast(ushort) 0xffff-10,
20     f12            = cast(ushort) 0xffff-11,
21     insert         = cast(ushort) 0xffff-12,
22     delete_        = cast(ushort) 0xffff-13,
23     home           = cast(ushort) 0xffff-14,
24     end            = cast(ushort) 0xffff-15,
25     pgup           = cast(ushort) 0xffff-16,
26     pgdn           = cast(ushort) 0xffff-17,
27     arrowUp        = cast(ushort) 0xffff-18,
28     arrowDown      = cast(ushort) 0xffff-19,
29     arrowLeft      = cast(ushort) 0xffff-20,
30     arrowRight     = cast(ushort) 0xffff-21,
31     mouseLeft      = cast(ushort) 0xffff-22,
32     mouseRight     = cast(ushort) 0xffff-23,
33     mouseMiddle    = cast(ushort) 0xffff-24,
34     mouseRelease   = cast(ushort) 0xffff-25,
35     mouseWheelUp   = cast(ushort) 0xffff-26,
36     mouseWheelDown = cast(ushort) 0xffff-27,
37 
38     /* These are all ASCII code points below SPACE character and a BACKSPACE key. */
39     ctrl_tilde      = cast(ushort) 0x00,
40     ctrl_2          = cast(ushort) 0x00, /* clash with 'ctrl_tilde' */
41     ctrl_a          = cast(ushort) 0x01,
42     ctrl_b          = cast(ushort) 0x02,
43     ctrl_c          = cast(ushort) 0x03,
44     ctrl_d          = cast(ushort) 0x04,
45     ctrl_e          = cast(ushort) 0x05,
46     ctrl_f          = cast(ushort) 0x06,
47     ctrl_g          = cast(ushort) 0x07,
48     backspace       = cast(ushort) 0x08,
49     ctrl_h          = cast(ushort) 0x08, /* clash with 'ctrl_backspace' */
50     tab             = cast(ushort) 0x09,
51     ctrl_i          = cast(ushort) 0x09, /* clash with 'tab' */
52     ctrl_j          = cast(ushort) 0x0a,
53     ctrl_k          = cast(ushort) 0x0b,
54     ctrl_l          = cast(ushort) 0x0c,
55     enter           = cast(ushort) 0x0d,
56     ctrl_m          = cast(ushort) 0x0d, /* clash with 'enter' */
57     ctrl_n          = cast(ushort) 0x0e,
58     ctrl_o          = cast(ushort) 0x0f,
59     ctrl_p          = cast(ushort) 0x10,
60     ctrl_q          = cast(ushort) 0x11,
61     ctrl_r          = cast(ushort) 0x12,
62     ctrl_s          = cast(ushort) 0x13,
63     ctrl_t          = cast(ushort) 0x14,
64     ctrl_u          = cast(ushort) 0x15,
65     ctrl_v          = cast(ushort) 0x16,
66     ctrl_w          = cast(ushort) 0x17,
67     ctrl_x          = cast(ushort) 0x18,
68     ctrl_y          = cast(ushort) 0x19,
69     ctrl_z          = cast(ushort) 0x1a,
70     esc             = cast(ushort) 0x1b,
71     ctrl_lsqBracket = cast(ushort) 0x1b, /* clash with 'esc' */
72     ctrl_3          = cast(ushort) 0x1b, /* clash with 'esc' */
73     ctrl_4          = cast(ushort) 0x1c,
74     ctrl_backslash  = cast(ushort) 0x1c, /* clash with 'ctrl_4' */
75     ctrl_5          = cast(ushort) 0x1d,
76     ctrl_rsqBracket = cast(ushort) 0x1d, /* clash with 'ctrl_5' */
77     ctrl_6          = cast(ushort) 0x1e,
78     ctrl_7          = cast(ushort) 0x1f,
79     ctrl_slash      = cast(ushort) 0x1f, /* clash with 'ctrl_7' */
80     ctrl_underscore = cast(ushort) 0x1f, /* clash with 'ctrl_7' */
81     space           = cast(ushort) 0x20,
82     backspace2      = cast(ushort) 0x7f,
83     ctrl_8          = cast(ushort) 0x7f /* clash with 'backspace2' */
84 }
85 
86 /* Currently there is only one modifier. See also struct Event's mod
87  * field.
88  */
89 enum Mod {
90     alt = cast(ubyte) 0x01
91 }