16
15
#include "terminal/mouse.h"
17
16
#include "terminal/terminal.h"
18
#define CHECKBOX_HEIGHT 1
20
19
#define CHECKBOX_LEN 3 /* "[X]" or "(X)" */
21
20
#define CHECKBOX_SPACING 1 /* "[X]" + " " + "Label" */
22
21
#define CHECKBOX_LS (CHECKBOX_LEN + CHECKBOX_SPACING) /* "[X] " */
25
24
add_dlg_radio_do(struct dialog *dlg, unsigned char *text,
26
int groupid, int groupnum, void *data)
25
int groupid, int groupnum, int *data)
28
struct widget *widget;
30
widget = &dlg->widgets[dlg->number_of_widgets++];
31
widget->type = WIDGET_CHECKBOX;
33
widget->info.checkbox.gid = groupid;
27
struct widget *widget = &dlg->widgets[dlg->number_of_widgets++];
29
widget->type = WIDGET_CHECKBOX;
31
widget->datalen = sizeof(*data);
32
widget->data = (void *) data;
34
widget->info.checkbox.gid = groupid;
34
35
widget->info.checkbox.gnum = groupnum;
35
widget->datalen = sizeof(int);
45
44
unsigned char *text = widget_data->widget->text;
47
set_box(&widget_data->box, x, *y, CHECKBOX_LS, 1);
46
set_box(&widget_data->box, x, *y, CHECKBOX_LEN, CHECKBOX_HEIGHT);
49
48
if (w <= CHECKBOX_LS) return;
51
if (rw) *rw -= CHECKBOX_LS;
52
dlg_format_text_do(term, text, x + CHECKBOX_LS, y, w - CHECKBOX_LS, rw,
53
get_bfu_color(term, "dialog.checkbox-label"), align);
54
if (rw) *rw += CHECKBOX_LS;
51
if (rw) *rw -= CHECKBOX_LS;
52
dlg_format_text_do(term, text, x + CHECKBOX_LS, y,
54
get_bfu_color(term, "dialog.checkbox-label"),
56
if (rw) *rw += CHECKBOX_LS;
58
static t_handler_event_status
60
static widget_handler_status_T
59
61
display_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
61
63
struct terminal *term = dlg_data->win->term;
86
88
return EVENT_PROCESSED;
89
static t_handler_event_status
91
static widget_handler_status_T
90
92
init_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
92
94
int *cdata = (int *) widget_data->cdata;
103
105
return EVENT_PROCESSED;
106
static t_handler_event_status
108
static widget_handler_status_T
107
109
mouse_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
109
111
struct terminal *term = dlg_data->win->term;