static cb_ret_t help_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_RESIZE: { WButtonBar *bb; help_lines = MIN (LINES - 4, MAX (2 * LINES / 3, 18)); dlg_set_size (h, help_lines + 4, HELP_WINDOW_WIDTH + 4); bb = find_buttonbar (h); widget_set_size (WIDGET (bb), LINES - 1, 0, 1, COLS); return MSG_HANDLED; } case MSG_DRAW: dlg_default_repaint (h); help_show (h, currentpoint); return MSG_HANDLED; case MSG_KEY: return help_handle_key (h, parm); case MSG_ACTION: /* Handle shortcuts and buttonbar. */ return help_execute_cmd (parm); default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t help_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); switch (msg) { case MSG_RESIZE: { WButtonBar *bb; help_lines = min (LINES - 4, max (2 * LINES / 3, 18)); dlg_set_size (h, help_lines + 4, HELP_WINDOW_WIDTH + 4); bb = find_buttonbar (h); widget_set_size (WIDGET (bb), LINES - 1, 0, 1, COLS); return MSG_HANDLED; } case MSG_DRAW: dlg_default_repaint (h); help_show (h, currentpoint); return MSG_HANDLED; case MSG_KEY: return help_handle_key (h, parm); case MSG_ACTION: /* shortcut */ if (sender == NULL) return help_execute_cmd (parm); /* message from buttonbar */ if (sender == WIDGET (find_buttonbar (h))) { if (data != NULL) return send_message (data, NULL, MSG_ACTION, parm, NULL); return help_execute_cmd (parm); } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }