diff options
author | James Bursa <james@netsurf-browser.org> | 2004-12-12 21:51:01 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2004-12-12 21:51:01 +0000 |
commit | 9995dbad578947656f08e58ec873de85a90b606d (patch) | |
tree | 0a70a9c69a1b6f79e44df01d53431288c2c107fd /render/form.h | |
parent | de508f98a705d2b2a0887be1ac0d55a213c99f80 (diff) | |
download | netsurf-9995dbad578947656f08e58ec873de85a90b606d.tar.gz netsurf-9995dbad578947656f08e58ec873de85a90b606d.tar.bz2 |
[project @ 2004-12-12 21:49:23 by bursa]
Add form_new() and form_add_option().
svn path=/import/netsurf/; revision=1400
Diffstat (limited to 'render/form.h')
-rw-r--r-- | render/form.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/render/form.h b/render/form.h index b5f57cf3c..00d8eb565 100644 --- a/render/form.h +++ b/render/form.h @@ -20,14 +20,17 @@ struct box; struct form_control; struct form_option; +/** Form submit method. */ +typedef enum { + method_GET, /**< GET, always url encoded. */ + method_POST_URLENC, /**< POST, url encoded. */ + method_POST_MULTIPART /**< POST, multipart/form-data. */ +} form_method; + /** HTML form. */ struct form { - char *action; /**< Url to submit to. */ - enum { - method_GET, /**< GET, always url encoded. */ - method_POST_URLENC, /**< POST, url encoded. */ - method_POST_MULTIPART /**< POST, multipart/form-data. */ - } method; /**< Method and enctype. */ + char *action; /**< URL to submit to. */ + form_method method; /**< Method and enctype. */ struct form_control *controls; /**< Linked list of controls. */ struct form_control *last_control; /**< Last control in list. */ }; @@ -84,8 +87,8 @@ struct form_control { struct form_option { bool selected; bool initial_selected; - char* value; - char* text; /**< NUL terminated. */ + char *value; + char *text; /**< NUL terminated. */ struct form_option* next; }; @@ -97,9 +100,12 @@ struct form_successful_control { struct form_successful_control *next; /**< Next in linked list. */ }; +struct form *form_new(char *action, form_method method); struct form_control *form_new_control(form_control_type type); void form_add_control(struct form *form, struct form_control *control); void form_free_control(struct form_control *control); +bool form_add_option(struct form_control *control, char *value, char *text, + bool selected); bool form_successful_controls(struct form *form, struct form_control *submit_button, struct form_successful_control **successful_controls); |