w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

form.h (2434B)


      1 /* $Id$ */
      2 /*
      3  * HTML forms 
      4  */
      5 #ifndef FORM_H
      6 #define FORM_H
      7 
      8 #include "Str.h"
      9 
     10 #define FORM_UNKNOWN        -1
     11 #define FORM_INPUT_TEXT     0
     12 #define FORM_INPUT_PASSWORD 1
     13 #define FORM_INPUT_CHECKBOX 2
     14 #define FORM_INPUT_RADIO    3
     15 #define FORM_INPUT_SUBMIT   4
     16 #define FORM_INPUT_RESET    5
     17 #define FORM_INPUT_HIDDEN   6
     18 #define FORM_INPUT_IMAGE    7
     19 #define FORM_SELECT         8
     20 #define FORM_TEXTAREA       9
     21 #define FORM_INPUT_BUTTON   10
     22 #define FORM_INPUT_FILE     11
     23 
     24 #define FORM_I_TEXT_DEFAULT_SIZE 40
     25 #define FORM_I_SELECT_DEFAULT_SIZE 40
     26 #define FORM_I_TEXTAREA_DEFAULT_WIDTH 40
     27 
     28 #define FORM_METHOD_GET 0
     29 #define FORM_METHOD_POST 1
     30 #define FORM_METHOD_INTERNAL 2
     31 #define FORM_METHOD_HEAD 3
     32 
     33 #define FORM_ENCTYPE_URLENCODED 0
     34 #define FORM_ENCTYPE_MULTIPART  1
     35 
     36 #define MAX_TEXTAREA 10		/* max number of <textarea>..</textarea> 
     37 				 * within one document */
     38 #ifdef MENU_SELECT
     39 #define MAX_SELECT 10		/* max number of <select>..</select>
     40 				 * within one document */
     41 #endif				/* MENU_SELECT */
     42 
     43 typedef struct form_list {
     44     struct form_item_list *item;
     45     struct form_item_list *lastitem;
     46     int method;
     47     Str action;
     48     char *target;
     49     char *name;
     50 #ifdef USE_M17N
     51     wc_ces charset;
     52 #endif
     53     int enctype;
     54     struct form_list *next;
     55     int nitems;
     56     char *body;
     57     char *boundary;
     58     unsigned long length;
     59 } FormList;
     60 
     61 #ifdef MENU_SELECT
     62 typedef struct form_select_option_item {
     63     Str value;
     64     Str label;
     65     int checked;
     66     struct form_select_option_item *next;
     67 } FormSelectOptionItem;
     68 
     69 typedef struct form_select_option {
     70     FormSelectOptionItem *first;
     71     FormSelectOptionItem *last;
     72 } FormSelectOption;
     73 
     74 void addSelectOption(FormSelectOption *fso, Str value, Str label, int chk);
     75 void chooseSelectOption(struct form_item_list *fi, FormSelectOptionItem *item);
     76 void updateSelectOption(struct form_item_list *fi, FormSelectOptionItem *item);
     77 int formChooseOptionByMenu(struct form_item_list *fi, int x, int y);
     78 #endif				/* MENU_SELECT */
     79 
     80 typedef struct form_item_list {
     81     int type;
     82     Str name;
     83     Str value, init_value;
     84     int checked, init_checked;
     85     int accept;
     86     int size;
     87     int rows;
     88     int maxlength;
     89     int readonly;
     90 #ifdef MENU_SELECT
     91     FormSelectOptionItem *select_option;
     92     Str label, init_label;
     93     int selected, init_selected;
     94 #endif				/* MENU_SELECT */
     95     struct form_list *parent;
     96     struct form_item_list *next;
     97 } FormItemList;
     98 
     99 #endif				/* not FORM_H */