2002-05-04 23:57:18 +04:00
|
|
|
/**
|
2002-12-30 05:06:03 +03:00
|
|
|
* $Id: box.h,v 1.14 2002/12/30 02:06:03 monkeyson Exp $
|
2002-05-04 23:57:18 +04:00
|
|
|
*/
|
|
|
|
|
2002-08-12 03:01:02 +04:00
|
|
|
#ifndef _NETSURF_RENDER_BOX_H_
|
|
|
|
#define _NETSURF_RENDER_BOX_H_
|
|
|
|
|
2002-09-18 23:36:28 +04:00
|
|
|
#include <limits.h>
|
2002-08-12 03:01:02 +04:00
|
|
|
#include "libxml/HTMLparser.h"
|
|
|
|
#include "netsurf/render/css.h"
|
2002-09-27 01:38:33 +04:00
|
|
|
#include "netsurf/riscos/font.h"
|
2002-08-12 03:01:02 +04:00
|
|
|
|
2002-05-04 23:57:18 +04:00
|
|
|
/**
|
|
|
|
* structures
|
|
|
|
*/
|
|
|
|
|
2002-06-27 03:27:30 +04:00
|
|
|
typedef enum {
|
|
|
|
BOX_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE,
|
2002-06-29 00:14:04 +04:00
|
|
|
BOX_TABLE, BOX_TABLE_ROW, BOX_TABLE_CELL,
|
2002-08-18 20:46:45 +04:00
|
|
|
BOX_TABLE_ROW_GROUP,
|
2002-06-29 00:14:04 +04:00
|
|
|
BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT
|
2002-06-27 03:27:30 +04:00
|
|
|
} box_type;
|
|
|
|
|
2002-09-18 23:36:28 +04:00
|
|
|
struct column {
|
|
|
|
enum { COLUMN_WIDTH_UNKNOWN = 0, COLUMN_WIDTH_FIXED,
|
|
|
|
COLUMN_WIDTH_AUTO, COLUMN_WIDTH_PERCENT } type;
|
|
|
|
unsigned long min, max, width;
|
|
|
|
};
|
|
|
|
|
2002-12-30 05:06:03 +03:00
|
|
|
struct formoption {
|
|
|
|
int selected;
|
|
|
|
char* value;
|
|
|
|
char* text;
|
|
|
|
struct formoption* next;
|
|
|
|
};
|
|
|
|
|
2002-12-30 01:27:35 +03:00
|
|
|
struct gui_gadget {
|
|
|
|
enum { GADGET_HIDDEN = 0, GADGET_TEXTBOX, GADGET_RADIO, GADGET_OPTION,
|
2002-12-30 05:06:03 +03:00
|
|
|
GADGET_SELECT, GADGET_TEXTAREA, GADGET_ACTIONBUTTON } type;
|
2002-12-30 01:27:35 +03:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
int maxlength;
|
|
|
|
char* text;
|
|
|
|
int size;
|
|
|
|
} textbox;
|
|
|
|
struct {
|
|
|
|
char* label;
|
|
|
|
} actionbutt;
|
2002-12-30 05:06:03 +03:00
|
|
|
struct {
|
|
|
|
int numitems;
|
|
|
|
struct formoption* items;
|
|
|
|
int size;
|
|
|
|
int multiple;
|
|
|
|
} select;
|
2002-12-30 01:27:35 +03:00
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
2002-12-30 05:06:03 +03:00
|
|
|
struct img {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
char* alt;
|
|
|
|
char* src;
|
|
|
|
};
|
|
|
|
|
2002-05-04 23:57:18 +04:00
|
|
|
struct box {
|
2002-06-27 03:27:30 +04:00
|
|
|
box_type type;
|
2002-05-04 23:57:18 +04:00
|
|
|
xmlNode * node;
|
|
|
|
struct css_style * style;
|
|
|
|
unsigned long x, y, width, height;
|
2002-09-18 23:36:28 +04:00
|
|
|
unsigned long min_width, max_width;
|
2002-05-04 23:57:18 +04:00
|
|
|
const char * text;
|
2002-12-27 20:28:19 +03:00
|
|
|
int space; /* 1 <=> followed by a space */
|
2002-08-12 03:01:02 +04:00
|
|
|
const char * href;
|
2002-05-04 23:57:18 +04:00
|
|
|
unsigned int length;
|
2002-09-18 23:36:28 +04:00
|
|
|
unsigned int columns;
|
2002-05-04 23:57:18 +04:00
|
|
|
struct box * next;
|
|
|
|
struct box * children;
|
|
|
|
struct box * last;
|
|
|
|
struct box * parent;
|
2002-05-28 03:21:11 +04:00
|
|
|
struct box * float_children;
|
|
|
|
struct box * next_float;
|
2002-09-18 23:36:28 +04:00
|
|
|
struct column *col;
|
2002-09-27 01:38:33 +04:00
|
|
|
struct font_data *font;
|
2002-12-30 01:27:35 +03:00
|
|
|
struct gui_gadget* gadget;
|
2002-12-30 05:06:03 +03:00
|
|
|
struct img* img;
|
2002-05-04 23:57:18 +04:00
|
|
|
};
|
|
|
|
|
2002-09-19 23:54:43 +04:00
|
|
|
#define UNKNOWN_WIDTH ULONG_MAX
|
2002-09-18 23:36:28 +04:00
|
|
|
#define UNKNOWN_MAX_WIDTH ULONG_MAX
|
|
|
|
|
2002-05-04 23:57:18 +04:00
|
|
|
/**
|
|
|
|
* interface
|
|
|
|
*/
|
|
|
|
|
2002-08-18 20:46:45 +04:00
|
|
|
void xml_to_box(xmlNode * n, struct css_style * parent_style, struct css_stylesheet * stylesheet,
|
2002-05-04 23:57:18 +04:00
|
|
|
struct css_selector ** selector, unsigned int depth,
|
2002-08-12 03:01:02 +04:00
|
|
|
struct box * parent, struct box * inline_container,
|
2002-12-30 05:06:03 +03:00
|
|
|
const char *href, struct font_set *fonts,
|
|
|
|
struct gui_gadget* current_select, struct formoption* current_option);
|
2002-05-04 23:57:18 +04:00
|
|
|
void box_dump(struct box * box, unsigned int depth);
|
2002-09-08 22:11:56 +04:00
|
|
|
void box_free(struct box *box);
|
2002-05-04 23:57:18 +04:00
|
|
|
|
2002-08-12 03:01:02 +04:00
|
|
|
#endif
|