void dlg_stdcolour_handler(control *ctrl, int event) { colour *cp = ctrl->context; if (event == EVENT_ACTION) dlg_coloursel_start(*cp); else if (event == EVENT_CALLBACK) { colour c; if (dlg_coloursel_results(&c)) *cp = c; } }
static void colour_handler(control *ctrl, void *unused(data), int event) { colour *colour_p = ctrl->context.p; if (event == EVENT_ACTION) { /* * Start a colour selector, which will send us an * EVENT_CALLBACK when it's finished and allow us to * pick up the results. */ dlg_coloursel_start(*colour_p); } else if (event == EVENT_CALLBACK) { /* * Collect the results of the colour selector. Will * return nonzero on success, or zero if the colour * selector did nothing (user hit Cancel, for example). */ colour result; if (dlg_coloursel_results(&result)) *colour_p = result; } }