#ifndef EL__DOCUMENT_DOCUMENT_H #define EL__DOCUMENT_DOCUMENT_H #include "document/options.h" #include "intl/charsets.h" /* unicode_val_T */ #include "main/object.h" #include "protocol/uri.h" #include "util/color.h" #include "util/lists.h" #include "util/box.h" struct cache_entry; struct document_refresh; struct form_control; struct frame_desc; struct frameset_desc; struct module; struct screen_char; /* Nodes are used for marking areas of text on the document canvas as * searchable. */ struct node { LIST_HEAD(struct node); struct box box; }; /* The document line consisting of the chars ready to be copied to the terminal * screen. */ struct line { struct screen_char *chars; int length; }; /* Codepage status */ enum cp_status { CP_STATUS_NONE, CP_STATUS_SERVER, CP_STATUS_ASSUMED, CP_STATUS_IGNORED }; struct point { int x, y; }; enum link_type { LINK_HYPERTEXT, LINK_MAP, LINK_BUTTON, LINK_CHECKBOX, LINK_SELECT, LINK_FIELD, LINK_AREA, }; struct script_event_hook { LIST_HEAD(struct script_event_hook); enum script_event_hook_type { SEVHOOK_ONCLICK, SEVHOOK_ONDBLCLICK, SEVHOOK_ONMOUSEOVER, SEVHOOK_ONHOVER, SEVHOOK_ONFOCUS, SEVHOOK_ONMOUSEOUT, SEVHOOK_ONBLUR, } type; unsigned char *src; }; struct link { unicode_val_T accesskey; enum link_type type; unsigned char *where; unsigned char *target; unsigned char *where_img; unsigned char *title; /* The set of characters belonging to this link (their coordinates * in the document) - each character has own {struct point}. */ struct point *points; int npoints; int number; /* This is supposed to be the colour-pair of the link, but the actual * colours on the canvas can differ--e.g., with image links. */ struct color_pair color; /* XXX: They don't neccessary need to be link-specific, but we just * don't support them for any other elements for now. Well, we don't * even have a good place where to store them in that case. */ struct list_head *event_hooks; /* -> struct script_event_hook */ union { unsigned char *name; struct form_control *form_control; } data; }; #define get_link_index(document, link) (link - document->links) #define link_is_textinput(link) \ ((link)->type == LINK_FIELD || (link)->type == LINK_AREA) #define link_is_form(link) \ ((link)->type != LINK_HYPERTEXT && (link)->type != LINK_MAP) #define get_link_form_control(link) \ (link_is_form(link) ? (link)->data.form_control : NULL) #define get_link_name(link) \ (!link_is_form(link) ? (link)->data.name : NULL) #ifdef CONFIG_UTF_8 struct search { int x, y; signed int n; /* RAM is cheap nowadays */ unicode_val_T c; }; #else struct search { int x, y; signed int n:24; /* This structure is size-critical */ unsigned char c; }; #endif struct document { OBJECT_HEAD(struct document); struct document_options options; struct list_head forms; /* -> struct form */ struct list_head tags; /* -> struct tag */ struct list_head nodes; /* -> struct node */ #ifdef CONFIG_ECMASCRIPT /* ECMAScript snippets to be executed during loading the document into * a window. This currently involves