diff options
Diffstat (limited to 'render/form_internal.h')
-rw-r--r-- | render/form_internal.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/render/form_internal.h b/render/form_internal.h index 07512b508..ea46b6a78 100644 --- a/render/form_internal.h +++ b/render/form_internal.h @@ -26,6 +26,94 @@ #include "render/form.h" +#include <stdbool.h> + +struct box; +struct form_control; +struct form_option; +struct form_select_menu; +struct form; +struct html_content; +struct dom_string; +struct content; +struct nsurl; +struct fetch_multipart_data; +struct redraw_context; +struct browser_window; + +enum browser_mouse_state; + +/** Type of a struct form_control. */ +typedef enum { + GADGET_HIDDEN, + GADGET_TEXTBOX, + GADGET_RADIO, + GADGET_CHECKBOX, + GADGET_SELECT, + GADGET_TEXTAREA, + GADGET_IMAGE, + GADGET_PASSWORD, + GADGET_SUBMIT, + GADGET_RESET, + GADGET_FILE, + GADGET_BUTTON +} form_control_type; + +/** Data for textarea */ +struct form_textarea_data { + struct form_control *gadget; +}; + +struct image_input_coords { + int x; + int y; +}; + +/** Form control. */ +struct form_control { + void *node; /**< Corresponding DOM node */ + struct html_content *html; /**< HTML content containing control */ + + form_control_type type; /**< Type of control */ + + struct form *form; /**< Containing form */ + + char *name; /**< Control name */ + char *value; /**< Current value of control */ + char *initial_value; /**< Initial value of control */ + bool disabled; /**< Whether control is disabled */ + + struct box *box; /**< Box for control */ + + unsigned int length; /**< Number of characters in control */ + unsigned int maxlength; /**< Maximum characters permitted */ + + bool selected; /**< Whether control is selected */ + + union { + struct { + int mx, my; + } image; + struct { + int num_items; + struct form_option *items, *last_item; + bool multiple; + int num_selected; + /** Currently selected item, if num_selected == 1. */ + struct form_option *current; + struct form_select_menu *menu; + } select; + struct { + struct textarea *ta; + struct dom_string *initial; + struct form_textarea_data data; + } text; /**< input type=text or textarea */ + } data; + + struct form_control *prev; /**< Previous control in this form */ + struct form_control *next; /**< Next control in this form. */ +}; + /** Form submit method. */ typedef enum { method_GET, /**< GET, always url encoded. */ |