blob: 9b30bc4b2b6a13cf76b49c3b852c94bb3b2b113b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/** \file
* \brief Manage keys encoding and decoding.
*
* See Copyright Notice in "iup.h"
*/
#ifndef __IUP_KEY_H
#define __IUP_KEY_H
/** \defgroup key Key Coding and Key Callbacks
* \par
* See \ref iup_key.h
* \ingroup cpi */
/** Returns the key name from its code.
* Returns NULL if code not found.
* \ingroup key */
char *iupKeyCodeToName(int code);
/** Returns the key code from its name.
* Returns 0 if name not found.
* \ingroup key */
int iupKeyNameToCode(const char *name);
/** Returns true if the key code can be changed by CAPSLOCK.
* \ingroup key */
int iupKeyCanCaps(int code);
/** Calls a function for each defined key.
* \ingroup key */
void iupKeyForEach(void (*func)(const char *name, int code, void* user_data), void* user_data);
/** Calls the K_ANY or K_* callbacks. Should be called when a keyboard event occoured.
* \ingroup key */
int iupKeyCallKeyCb(Ihandle *ih, int c);
/** Calls the KEYPRESS_CB callback. Should be called when a keyboard event occoured.
* \ingroup key */
int iupKeyCallKeyPressCb(Ihandle *ih, int code, int press);
/** Process Tab, DEFAULTENTER and DEFAULTESC in key press events.
* \ingroup key */
int iupKeyProcessNavigation(Ihandle* ih, int key, int shift);
/* Called only from IupOpen. */
void iupKeyInit(void);
#define IUPKEY_STATUS_SIZE 11 /* 10 chars + null */
#define IUPKEY_STATUS_INIT " " /* 10 spaces */
#define iupKEY_SETSHIFT(_s) (_s[0]='S')
#define iupKEY_SETCONTROL(_s) (_s[1]='C')
#define iupKEY_SETBUTTON1(_s) (_s[2]='1')
#define iupKEY_SETBUTTON2(_s) (_s[3]='2')
#define iupKEY_SETBUTTON3(_s) (_s[4]='3')
#define iupKEY_SETDOUBLE(_s) (_s[5]='D')
#define iupKEY_SETALT(_s) (_s[6]='A')
#define iupKEY_SETSYS(_s) (_s[7]='Y')
#define iupKEY_SETBUTTON4(_s) (_s[8]='4')
#define iupKEY_SETBUTTON5(_s) (_s[9]='5')
#ifdef __cplusplus
}
#endif
#endif
|