diff options
author | James Bursa <james@netsurf-browser.org> | 2004-05-21 23:42:26 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2004-05-21 23:42:26 +0000 |
commit | 4a500f5614a9f238a144d05388dcb41b76f2c9f7 (patch) | |
tree | b484714a9457bed566798e2fcac0650279b5de0d /render | |
parent | bb9149e93bed263f27ea572f5b89fa9aa1775595 (diff) | |
download | netsurf-4a500f5614a9f238a144d05388dcb41b76f2c9f7.tar.gz netsurf-4a500f5614a9f238a144d05388dcb41b76f2c9f7.tar.bz2 |
[project @ 2004-05-21 23:42:26 by bursa]
Fix and clean code for radio and checkbox inputs.
svn path=/import/netsurf/; revision=884
Diffstat (limited to 'render')
-rw-r--r-- | render/box.c | 5 | ||||
-rw-r--r-- | render/form.c | 5 | ||||
-rw-r--r-- | render/form.h | 7 |
3 files changed, 5 insertions, 12 deletions
diff --git a/render/box.c b/render/box.c index 656b9923f..d763ed8a1 100644 --- a/render/box.c +++ b/render/box.c @@ -1134,10 +1134,7 @@ struct box_result box_input(xmlNode *n, struct box_status *status, gadget->type = GADGET_CHECKBOX; if ((s = (char *) xmlGetProp(n, (const xmlChar *) "checked"))) { - if (gadget->type == GADGET_CHECKBOX) - gadget->data.checkbox.selected = -1; - else - gadget->data.radio.selected = -1; + gadget->selected = true; xmlFree(s); } diff --git a/render/form.c b/render/form.c index a9714b78d..6b1b247df 100644 --- a/render/form.c +++ b/render/form.c @@ -43,6 +43,7 @@ struct form_control *form_new_control(form_control_type type) control->disabled = false; control->form = 0; control->box = 0; + control->selected = false; control->prev = 0; control->next = 0; return control; @@ -124,9 +125,9 @@ struct form_successful_control *form_successful_controls(struct form *form, continue; /* ignore checkboxes and radio buttons which aren't selected */ - if (control->type == GADGET_CHECKBOX && !control->data.checkbox.selected) + if (control->type == GADGET_CHECKBOX && !control->selected) continue; - if (control->type == GADGET_RADIO && !control->data.radio.selected) + if (control->type == GADGET_RADIO && !control->selected) continue; /* select */ diff --git a/render/form.h b/render/form.h index 48801f9a9..2de0e38e5 100644 --- a/render/form.h +++ b/render/form.h @@ -60,6 +60,7 @@ struct form_control { struct box *caret_text_box; int caret_char_offset; unsigned int maxlength; + bool selected; union { struct { int mx, my; @@ -72,12 +73,6 @@ struct form_control { /** Currently selected item, if num_selected == 1. */ struct form_option *current; } select; - struct { - int selected; - } checkbox; - struct { - int selected; - } radio; } data; struct form_control *prev; /**< Previous control in this form */ struct form_control *next; /**< Next control in this form. */ |