5 int HandleEvent(TWidget
*widget
, char event
[EVENT_LENGHT
], void *data
){
10 if(strncmp(event
, eh
->event
, EVENT_LENGHT
) == 0)
11 return eh
->handler(widget
, data
, eh
->userdata
);
18 void AddHandler(TWidget
*widget
char event
[EVENT_LENGHT
], int (*handler
)(TWidget
*widget
, void *data
, void *userdata
), void *userdata
){
21 eh
= malloc(sizeof(TEventHandler
));
22 memset(eh
, 0, sizeof(TEventHandler
)); //TODO:check if this is valid for eh->event
23 strncpy(eh
->event
, event
, EVENT_LENGHT
);
24 eh
->userdata
= userdata
;
25 eh
->next
= widget
->handlers
;
26 eh
->handler
= handler
;
27 widget
->handlers
= eh
;