NetSurf
box_manipulate.h
Go to the documentation of this file.
1/*
2 * Copyright 2005 James Bursa <bursa@users.sourceforge.net>
3 * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
4 *
5 * This file is part of NetSurf, http://www.netsurf-browser.org/
6 *
7 * NetSurf is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * NetSurf is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/**
21 * \file
22 * Box tree manipulation interface.
23 */
24
25#ifndef NETSURF_HTML_BOX_MANIPULATE_H
26#define NETSURF_HTML_BOX_MANIPULATE_H
27
28
29/**
30 * Create a box tree node.
31 *
32 * \param styles selection results for the box, or NULL
33 * \param style computed style for the box (not copied), or 0
34 * \param style_owned whether style is owned by this box
35 * \param href href for the box (copied), or 0
36 * \param target target for the box (not copied), or 0
37 * \param title title for the box (not copied), or 0
38 * \param id id for the box (not copied), or 0
39 * \param context context for allocations
40 * \return allocated and initialised box, or 0 on memory exhaustion
41 *
42 * styles is always owned by the box, if it is set.
43 * style is only owned by the box in the case of implied boxes.
44 */
45struct box * box_create(css_select_results *styles, css_computed_style *style, bool style_owned, struct nsurl *href, const char *target, const char *title, lwc_string *id, void *context);
46
47
48/**
49 * Add a child to a box tree node.
50 *
51 * \param parent box giving birth
52 * \param child box to link as last child of parent
53 */
54void box_add_child(struct box *parent, struct box *child);
55
56
57/**
58 * Insert a new box as a sibling to a box in a tree.
59 *
60 * \param box box already in tree
61 * \param new_box box to link into tree as next sibling
62 */
63void box_insert_sibling(struct box *box, struct box *new_box);
64
65
66/**
67 * Unlink a box from the box tree and then free it recursively.
68 *
69 * \param box box to unlink and free recursively.
70 */
71void box_unlink_and_free(struct box *box);
72
73
74/**
75 * Free a box tree recursively.
76 *
77 * \param box box to free recursively
78 *
79 * The box and all its children is freed.
80 */
81void box_free(struct box *box);
82
83
84/**
85 * Free the data in a single box structure.
86 *
87 * \param box box to free
88 */
89void box_free_box(struct box *box);
90
91
92/**
93 * Applies the given scroll setup to a box. This includes scroll
94 * creation/deletion as well as scroll dimension updates.
95 *
96 * \param c content in which the box is located
97 * \param box the box to handle the scrolls for
98 * \param bottom whether the horizontal scrollbar should be present
99 * \param right whether the vertical scrollbar should be present
100 * \return true on success false otherwise
101 */
102nserror box_handle_scrollbars(struct content *c, struct box *box,
103 bool bottom, bool right);
104
105
106#endif
void box_insert_sibling(struct box *box, struct box *new_box)
Insert a new box as a sibling to a box in a tree.
void box_unlink_and_free(struct box *box)
Unlink a box from the box tree and then free it recursively.
void box_free_box(struct box *box)
Free the data in a single box structure.
nserror box_handle_scrollbars(struct content *c, struct box *box, bool bottom, bool right)
Applies the given scroll setup to a box.
void box_free(struct box *box)
Free a box tree recursively.
struct box * box_create(css_select_results *styles, css_computed_style *style, bool style_owned, struct nsurl *href, const char *target, const char *title, lwc_string *id, void *context)
Create a box tree node.
void box_add_child(struct box *parent, struct box *child)
Add a child to a box tree node.
wimp_w parent
Definition: dialog.c:88
nserror
Enumeration of error codes.
Definition: errors.h:29
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
Node in box tree.
Definition: box.h:177
const char * title
Title, or NULL.
Definition: box.h:386
const char * target
Link target, or NULL.
Definition: box.h:381
css_select_results * styles
Computed styles for elements and their pseudo elements.
Definition: box.h:197
struct nsurl * href
Link, or NULL.
Definition: box.h:376
css_computed_style * style
Style for this box.
Definition: box.h:205
Content which corresponds to a single URL.