typedef void (*actionfn)(control c); typedef void (*drawfn)(control c, rect r); typedef void (*mousefn)(control c, int buttons, point xy); typedef void (*keyfn)(control c, int key); typedef void (*intfn)(control c, int value); typedef void (*scrollfn)(control c, int pos);
void setredraw(control c, drawfn fn); /* redraw event */ void setresize(control c, drawfn fn); /* resize event */ void setclose(window w, actionfn fn); /* window closure */ void setmousedown(control c, mousefn fn); /* button clicked */ void setmousemove(control c, mousefn fn); /* buttons up, move */ void setmousedrag(control c, mousefn fn); /* buttons down, drag */ void setmouseup(control c, mousefn fn); /* buttons released */ void setmouserepeat(control c, mousefn fn); /* mouse-down repeat */ void setkeydown(control c, keyfn fn); /* ASCII key event */ void setkeyaction(control c, keyfn fn); /* other key event */ void setaction(control c, actionfn fn); /* action call-back */ void sethit(control c, intfn fn); /* hit call-back */ void setdel(control c, actionfn fn); /* deletion event */
Above is a list of the event handling call-back functions which can be set for programmer-defined controls and windows. Some of these functions will do nothing for pre-defined controls such as buttons, checkboxes etc. See the individual sections for more details.