lib/ewl_events.h
Go to the documentation of this file.00001 /* vim: set sw=8 ts=8 sts=8 expandtab: */ 00002 #ifndef EWL_EVENTS_H 00003 #define EWL_EVENTS_H 00004 00016 #define EWL_EVENT_WINDOW_EXPOSE(e) ((Ewl_Event_Window_Expose *)(e)) 00017 00021 typedef struct Ewl_Event_Window_Expose Ewl_Event_Window_Expose; 00022 00026 struct Ewl_Event_Window_Expose 00027 { 00028 int x; 00029 int y; 00030 int w; 00031 int h; 00032 }; 00033 00038 #define EWL_EVENT_KEY(e) ((Ewl_Event_Key *)(e)) 00039 00040 00044 typedef struct Ewl_Event_Key Ewl_Event_Key; 00045 00049 struct Ewl_Event_Key 00050 { 00051 unsigned int modifiers; 00052 char *keyname; 00053 }; 00054 00059 #define EWL_EVENT_KEY_DOWN(e) ((Ewl_Event_Key_Down *)(e)) 00060 00064 typedef struct Ewl_Event_Key_Down Ewl_Event_Key_Down; 00065 00069 struct Ewl_Event_Key_Down 00070 { 00071 Ewl_Event_Key base; 00072 }; 00073 00078 #define EWL_EVENT_KEY_UP(e) ((Ewl_Event_Key_Up *)(e)) 00079 00083 typedef struct Ewl_Event_Key_Up Ewl_Event_Key_Up; 00084 00088 struct Ewl_Event_Key_Up 00089 { 00090 Ewl_Event_Key base; 00091 }; 00092 00097 #define EWL_EVENT_MOUSE(e) ((Ewl_Event_Mouse *)(e)) 00098 00102 typedef struct Ewl_Event_Mouse Ewl_Event_Mouse; 00103 00107 struct Ewl_Event_Mouse 00108 { 00109 unsigned int modifiers; 00110 int x; 00111 int y; 00112 }; 00113 00118 #define EWL_EVENT_MOUSE_DOWN(e) ((Ewl_Event_Mouse_Down *)(e)) 00119 00123 typedef struct Ewl_Event_Mouse_Down Ewl_Event_Mouse_Down; 00124 00128 struct Ewl_Event_Mouse_Down 00129 { 00130 Ewl_Event_Mouse base; 00131 int button; 00132 int clicks; 00133 }; 00134 00139 #define EWL_EVENT_MOUSE_UP(e) ((Ewl_Event_Mouse_Up *)(e)) 00140 00144 typedef struct Ewl_Event_Mouse_Up Ewl_Event_Mouse_Up; 00145 00149 struct Ewl_Event_Mouse_Up 00150 { 00151 Ewl_Event_Mouse base; 00152 int button; 00153 }; 00154 00159 #define EWL_EVENT_MOUSE_MOVE(e) ((Ewl_Event_Mouse_Move *)(e)) 00160 00164 typedef struct Ewl_Event_Mouse_Move Ewl_Event_Mouse_Move; 00165 00169 struct Ewl_Event_Mouse_Move 00170 { 00171 Ewl_Event_Mouse base; 00172 }; 00173 00178 #define EWL_EVENT_MOUSE_IN(e) ((Ewl_Event_Mouse_In *)(e)) 00179 00183 typedef struct Ewl_Event_Mouse_In Ewl_Event_Mouse_In; 00184 00188 struct Ewl_Event_Mouse_In 00189 { 00190 Ewl_Event_Mouse base; 00191 }; 00192 00197 #define EWL_EVENT_MOUSE_OUT(e) ((Ewl_Event_Mouse_Out *)(e)) 00198 00202 typedef struct Ewl_Event_Mouse_Out Ewl_Event_Mouse_Out; 00203 00207 struct Ewl_Event_Mouse_Out 00208 { 00209 Ewl_Event_Mouse base; 00210 }; 00211 00216 #define EWL_EVENT_MOUSE_WHEEL(e) ((Ewl_Event_Mouse_Wheel *)(e)) 00217 00221 typedef struct Ewl_Event_Mouse_Wheel Ewl_Event_Mouse_Wheel; 00222 00226 struct Ewl_Event_Mouse_Wheel 00227 { 00228 Ewl_Event_Mouse base; 00229 int z; 00230 int dir; 00231 }; 00232 00237 #define EWL_DND_TYPES(t) ((Ewl_Dnd_Types *)(t)) 00238 00242 typedef struct Ewl_Dnd_Types Ewl_Dnd_Types; 00243 00247 struct Ewl_Dnd_Types 00248 { 00249 int num_types; 00250 char** types; 00251 }; 00252 00257 #define EWL_EVENT_DND_POSITION(e) ((Ewl_Event_Dnd_Position *)(e)) 00258 00262 typedef struct Ewl_Event_Dnd_Position Ewl_Event_Dnd_Position; 00263 00267 struct Ewl_Event_Dnd_Position 00268 { 00269 int x; 00270 int y; 00271 }; 00272 00277 #define EWL_EVENT_DND_DROP(e) ((Ewl_Event_Dnd_Drop *)(e)) 00278 00282 typedef struct Ewl_Event_Dnd_Drop Ewl_Event_Dnd_Drop; 00283 00287 struct Ewl_Event_Dnd_Drop 00288 { 00289 int x; 00290 int y; 00291 void* data; 00292 }; 00293 00298 #define EWL_EVENT_DND_DATA_RECEIVED(e) ((Ewl_Event_Dnd_Data_Received *)(e)) 00299 00303 typedef struct Ewl_Event_Dnd_Data_Received Ewl_Event_Dnd_Data_Received; 00304 00308 struct Ewl_Event_Dnd_Data_Received 00309 { 00310 char *type; 00311 void *data; 00312 unsigned int len; 00313 unsigned int format; 00314 }; 00315 00320 #define EWL_EVENT_DND_DATA_REQUEST(e) ((Ewl_Event_Dnd_Data_Request *)(e)) 00321 00325 typedef struct Ewl_Event_Dnd_Data_Request Ewl_Event_Dnd_Data_Request; 00326 00330 struct Ewl_Event_Dnd_Data_Request 00331 { 00332 void *handle; 00333 char *type; 00334 }; 00335 00340 #define EWL_EVENT_ACTION_RESPONSE(e) ((Ewl_Event_Action_Response*)(e)) 00341 00345 typedef struct Ewl_Event_Action_Response Ewl_Event_Action_Response; 00346 00350 struct Ewl_Event_Action_Response 00351 { 00352 unsigned int response; 00353 }; 00354 00359 #define EWL_EVENT_STATE_CHANGE(e) ((Ewl_Event_State_Change*)(e)) 00360 00364 typedef struct Ewl_Event_State_Change Ewl_Event_State_Change; 00365 00369 struct Ewl_Event_State_Change 00370 { 00371 const char *state; 00372 Ewl_State_Type flag; 00373 }; 00374 00375 unsigned int ewl_ev_modifiers_get(void); 00376 void ewl_ev_modifiers_set(unsigned int modifiers); 00377 00382 #endif