NetSurf
interaction.h
Go to the documentation of this file.
1/*
2 * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * HTML content user interaction handling
22 */
23
24#ifndef NETSURF_HTML_INTERACTION_H
25#define NETSURF_HTML_INTERACTION_H
26
27#include "desktop/search.h" /* search flags enum */
28
29/**
30 * Context for scrollbar
31 */
33 struct content *c;
34 struct box *box;
35};
36
37/**
38 * Handle mouse tracking (including drags) in an HTML content window.
39 *
40 * \param c content of type html
41 * \param bw browser window
42 * \param mouse state of mouse buttons and modifier keys
43 * \param x coordinate of mouse
44 * \param y coordinate of mouse
45 */
47 browser_mouse_state mouse, int x, int y);
48
49
50/**
51 * Handle mouse clicks and movements in an HTML content window.
52 *
53 * This function handles both hovering and clicking. It is important that the
54 * code path is identical (except that hovering doesn't carry out the action),
55 * so that the status bar reflects exactly what will happen. Having separate
56 * code paths opens the possibility that an attacker will make the status bar
57 * show some harmless action where clicking will be harmful.
58 *
59 * \param c content of type html
60 * \param bw browser window
61 * \param mouse state of mouse buttons and modifier keys
62 * \param x x coordinate of mouse
63 * \param y y coordinate of mouse
64 * \return NSERROR_OK or appropriate error code.
65 */
67 browser_mouse_state mouse, int x, int y);
68
69
70bool html_keypress(struct content *c, uint32_t key);
71
72
73void html_overflow_scroll_callback(void *client_data,
74 struct scrollbar_msg_data *scrollbar_data);
75
76
77void html_search(struct content *c, void *context,
78 search_flags_t flags, const char *string);
79
80
81void html_search_clear(struct content *c);
82
83
84/**
85 * Set our drag status, and inform whatever owns the content
86 *
87 * \param html HTML content
88 * \param drag_type Type of drag
89 * \param drag_owner What owns the drag
90 * \param rect Pointer movement bounds
91 */
93 union html_drag_owner drag_owner, const struct rect *rect);
94
95
96/**
97 * Set our selection status, and inform whatever owns the content
98 *
99 * \param html HTML content
100 * \param selection_type Type of selection
101 * \param selection_owner What owns the selection
102 * \param read_only True iff selection is read only
103 */
104void html_set_selection(html_content *html, html_selection_type selection_type,
105 union html_selection_owner selection_owner, bool read_only);
106
107
108/**
109 * Set our input focus, and inform whatever owns the content
110 *
111 * \param html HTML content
112 * \param focus_type Type of input focus
113 * \param focus_owner What owns the focus
114 * \param hide_caret True iff caret to be hidden
115 * \param x Carret x-coord rel to owner
116 * \param y Carret y-coord rel to owner
117 * \param height Carret height
118 * \param clip Carret clip rect
119 */
120void html_set_focus(html_content *html, html_focus_type focus_type,
121 union html_focus_owner focus_owner, bool hide_caret,
122 int x, int y, int height, const struct rect *clip);
123
124
125#endif
Browseing window text search interface.
search_flags_t
Definition: search.h:29
nserror
Enumeration of error codes.
Definition: errors.h:29
browser_mouse_state
Mouse state.
Definition: mouse.h:43
nserror html_mouse_track(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse tracking (including drags) in an HTML content window.
Definition: interaction.c:1451
void html_search_clear(struct content *c)
bool html_keypress(struct content *c, uint32_t key)
Handle keypresses.
Definition: interaction.c:1519
void html_overflow_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data)
Callback for in-page scrollbars.
Definition: interaction.c:1601
void html_set_drag_type(html_content *html, html_drag_type drag_type, union html_drag_owner drag_owner, const struct rect *rect)
Set our drag status, and inform whatever owns the content.
Definition: interaction.c:1648
void html_search(struct content *c, void *context, search_flags_t flags, const char *string)
void html_set_focus(html_content *html, html_focus_type focus_type, union html_focus_owner focus_owner, bool hide_caret, int x, int y, int height, const struct rect *clip)
Set our input focus, and inform whatever owns the content.
Definition: interaction.c:1685
nserror html_mouse_action(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks and movements in an HTML content window.
Definition: interaction.c:1462
void html_set_selection(html_content *html, html_selection_type selection_type, union html_selection_owner selection_owner, bool read_only)
Set our selection status, and inform whatever owns the content.
Definition: interaction.c:1743
html_drag_type
Definition: private.h:39
html_focus_type
Definition: private.h:75
html_selection_type
Definition: private.h:59
int height
Definition: gui.c:161
Node in box tree.
Definition: box.h:177
int x
Coordinate of left padding edge relative to parent box, or relative to ancestor that contains this bo...
Definition: box.h:280
box_flags flags
Box flags.
Definition: box.h:186
int y
Coordinate of top padding edge, relative as for x.
Definition: box.h:284
Browser window data.
Content which corresponds to a single URL.
Data specific to CONTENT_HTML.
Definition: private.h:93
Context for scrollbar.
Definition: interaction.h:32
struct box * box
Definition: interaction.h:34
struct content * c
Definition: interaction.h:33
Rectangle coordinates.
Definition: types.h:40
scrollbar message context data
Definition: scrollbar.h:59
For drags we don't own.
Definition: private.h:52
For directing input.
Definition: private.h:84
For getting at selections in this content or things in this content.
Definition: private.h:69
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357