Changeset 2049 for libcaca/trunk/caca/caca.h
- Timestamp:
- Nov 25, 2007, 12:11:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/caca.h
r2043 r2049 54 54 struct caca_event 55 55 { 56 /** \brief User event type enumeration. 57 * 58 * This enum serves two purposes: 59 * - Build listening masks for caca_get_event(). 60 * - Define the type of a \e caca_event_t. 61 */ 62 enum caca_event_type 63 { 64 CACA_EVENT_NONE = 0x0000, /**< No event. */ 56 unsigned char opaque_structure[32]; 57 }; 65 58 66 CACA_EVENT_KEY_PRESS = 0x0001, /**< A key was pressed. */ 67 CACA_EVENT_KEY_RELEASE = 0x0002, /**< A key was released. */ 68 CACA_EVENT_MOUSE_PRESS = 0x0004, /**< A mouse button was pressed. */ 69 CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */ 70 CACA_EVENT_MOUSE_MOTION = 0x0010, /**< The mouse was moved. */ 71 CACA_EVENT_RESIZE = 0x0020, /**< The window was resized. */ 72 CACA_EVENT_QUIT = 0x0040, /**< The user requested to quit. */ 59 /** \brief User event type enumeration. 60 * 61 * This enum serves two purposes: 62 * - Build listening masks for caca_get_event(). 63 * - Define the type of a \e caca_event_t. 64 */ 65 enum caca_event_type 66 { 67 CACA_EVENT_NONE = 0x0000, /**< No event. */ 73 68 74 CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */75 }76 /** \brief User event type member.77 *78 * This field is always valid when caca_get_event() returns.79 */80 type;69 CACA_EVENT_KEY_PRESS = 0x0001, /**< A key was pressed. */ 70 CACA_EVENT_KEY_RELEASE = 0x0002, /**< A key was released. */ 71 CACA_EVENT_MOUSE_PRESS = 0x0004, /**< A mouse button was pressed. */ 72 CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */ 73 CACA_EVENT_MOUSE_MOTION = 0x0010, /**< The mouse was moved. */ 74 CACA_EVENT_RESIZE = 0x0020, /**< The window was resized. */ 75 CACA_EVENT_QUIT = 0x0040, /**< The user requested to quit. */ 81 76 82 /** \brief User event data member. 83 * 84 * The validity of the \e data union depends on the value of the \e type 85 * field: 86 * - \c CACA_EVENT_NONE: no other field is valid. 87 * - \c CACA_EVENT_KEY_PRESS, \c CACA_EVENT_KEY_RELEASE: the 88 * \e data.key.ch field is valid and contains either the ASCII value for 89 * the key, or an \e enum \e caca_key value. If the value is a printable 90 * ASCII character, the \e data.key.utf32 and \e data.key.utf8 fields are 91 * also filled and contain respectively the UTF-32/UCS-4 and the UTF-8 92 * representations of the character. Otherwise, their content is 93 * undefined. 94 * - \c CACA_EVENT_MOUSE_PRESS, \c CACA_EVENT_MOUSE_RELEASE: the 95 * \e data.mouse.button field is valid and contains the index of the 96 * mouse button that was pressed. 97 * - \c CACA_EVENT_MOUSE_MOTION: the \e data.mouse.x and \e data.mouse.y 98 * fields are valid and contain the mouse coordinates in character 99 * cells. 100 * - \c CACA_EVENT_RESIZE: the \e data.resize.w and \e data.resize.h 101 * fields are valid and contain the new width and height values of 102 * the \e libcucul canvas attached to \e libcaca. 103 * - \c CACA_EVENT_QUIT: no other field is valid. 104 * 105 * The result of accessing data members outside the above conditions is 106 * undefined. 107 */ 108 union 109 { 110 struct { unsigned int x, y, button; } mouse; 111 struct { unsigned int w, h; } resize; 112 struct { unsigned int ch; unsigned long int utf32; char utf8[8]; } key; 113 } data; 77 CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */ 114 78 }; 115 79 … … 197 161 __extern unsigned int caca_get_display_height(caca_display_t const *); 198 162 __extern int caca_set_display_title(caca_display_t *, char const *); 163 __extern int caca_set_mouse(caca_display_t *, int); 164 __extern int caca_set_cursor(caca_display_t *, int); 199 165 /* @} */ 200 166 … … 209 175 __extern unsigned int caca_get_mouse_x(caca_display_t const *); 210 176 __extern unsigned int caca_get_mouse_y(caca_display_t const *); 211 __extern int caca_set_mouse(caca_display_t *, int); 212 __extern int caca_set_cursor(caca_display_t *, int); 177 __extern enum caca_event_type caca_get_event_type(caca_event_t const *); 178 __extern unsigned int caca_get_event_key_ch(caca_event_t const *); 179 __extern unsigned long int caca_get_event_key_utf32(caca_event_t const *); 180 __extern int caca_get_event_key_utf8(caca_event_t const *, char *); 181 __extern unsigned int caca_get_event_mouse_button(caca_event_t const *); 182 __extern unsigned int caca_get_event_mouse_x(caca_event_t const *); 183 __extern unsigned int caca_get_event_mouse_y(caca_event_t const *); 184 __extern unsigned int caca_get_event_resize_width(caca_event_t const *); 185 __extern unsigned int caca_get_event_resize_height(caca_event_t const *); 213 186 /* @} */ 214 187
Note: See TracChangeset
for help on using the changeset viewer.