NetSurf
window.h
Go to the documentation of this file.
1/*
2 * Copyright 2010, 2011 Stephen Fryatt <stevef@netsurf-browser.org>
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/** \file
20 * Browser window handling (interface).
21 */
22
23#include <stdbool.h>
24
25#ifndef _NETSURF_RISCOS_WINDOW_H_
26#define _NETSURF_RISCOS_WINDOW_H_
27
28struct gui_window;
29struct nsurl;
30
32
33/**
34 * Initialise the browser window module and its menus.
35 */
37
38
39/**
40 * Check if a particular menu handle is a browser window menu
41 *
42 * \param menu The menu in question.
43 * \return true if this menu is a browser window menu
44 */
45bool ro_gui_window_check_menu(wimp_menu *menu);
46
47
48/**
49 * Set the contents of a window's address bar.
50 *
51 * \param g gui_window to update
52 * \param url new url for address bar
53 */
54nserror ro_gui_window_set_url(struct gui_window *g, struct nsurl *url);
55
56
57/**
58 * Cause an area of a window to be invalidated
59 *
60 * The specified area of the window should now be considered out of
61 * date. If the entire window is invalidated this simply calls
62 * wimp_force_redraw() otherwise the area is added to a queue of
63 * pending updates which will be processed from a wimp poll allowing
64 * multiple invalidation requests to be agregated.
65 *
66 * \param g The window to update
67 * \param rect The area of the window to update or NULL to redraw entire contents.
68 */
70
71
72/**
73 * Set a gui_window's scale
74 */
75void ro_gui_window_set_scale(struct gui_window *g, float scale);
76
77
78/**
79 * Handle Message_DataLoad (file dragged in) for a window.
80 *
81 * If the file was dragged into a form file input, it is used as the value.
82 *
83 * \param g window
84 * \param message Message_DataLoad block
85 * \return true if the load was processed
86 */
87bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
88
89
90/**
91 * Handle pointer movements in a browser window.
92 *
93 * \param pointer new mouse position
94 * \param data browser window that the pointer is in
95 */
96void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data);
97
98
99/**
100 * Window is being iconised.
101 *
102 * Create a suitable thumbnail sprite (which, sadly, must be in the
103 * Wimp sprite pool), and return the sprite name and truncated title
104 * to the iconiser
105 *
106 * \param g the gui window being iconised
107 * \param wi the WindowInfo message from the iconiser
108 */
109void ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi);
110
111
112/**
113 * Handle Message_DataLoad (file dragged in) for a toolbar
114 *
115 * @todo This belongs in the toolbar module, and should be moved there
116 * once the module is able to usefully handle its own events.
117 *
118 * \param g window
119 * \param message Message_DataLoad block
120 * \return true if the load was processed
121 */
122bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
123
124
125/**
126 * Redraws the content for all windows.
127 */
128void ro_gui_window_redraw_all(void);
129
130
131/**
132 * Redraw any pending update boxes.
133 */
135
136
137/**
138 * Destroy all browser windows.
139 */
140void ro_gui_window_quit(void);
141
142
143/**
144 * Close all browser windows
145 *
146 * no need for a separate fn same operation as quit
147*/
148#define ro_gui_window_close_all ro_gui_window_quit
149
150
151/**
152 * Animate the "throbbers" of all browser windows.
153 */
154void ro_gui_throb(void);
155
156/**
157 * Makes a browser window's options the default.
158 *
159 * \param gui The riscos gui window to set default options in.
160 */
162
163
164/**
165 * Convert a RISC OS window handle to a gui_window.
166 *
167 * \param window RISC OS window handle.
168 * \return A pointer to a riscos gui window if found or NULL.
169 */
171
172
173/**
174 * Convert a toolbar RISC OS window handle to a gui_window.
175 *
176 * \param window RISC OS window handle of a toolbar
177 * \return pointer to a structure if found, NULL otherwise
178 */
180
181
182/**
183 * Convert x,y screen co-ordinates into window co-ordinates.
184 *
185 * \param g gui window
186 * \param x x ordinate
187 * \param y y ordinate
188 * \param pos receives position in window co-ordinatates
189 * \return true iff conversion successful
190 */
191bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos);
192
193
194/**
195 * Returns the state of the mouse buttons and modifiers keys for a
196 * mouse action, suitable for passing to the OS-independent
197 * browser window/ treeview/ etc code.
198 *
199 * \param buttons Wimp button state.
200 * \param type Wimp work-area/icon type for decoding.
201 * \return NetSurf core button state.
202 */
203enum browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type);
204
205
206/**
207 * Returns the state of the mouse buttons and modifiers keys whilst
208 * dragging, for passing to the OS-independent browser window/ treeview/
209 * etc code
210 *
211 * \param buttons Wimp button state.
212 * \param type Wimp work-area/icon type for decoding.
213 * \return NetSurf core button state.
214 */
215enum browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons, wimp_icon_flags type);
216
217
218/**
219 * Returns true iff one or more Shift keys is held down
220 */
221bool ro_gui_shift_pressed(void);
222
223
224/**
225 * Returns true iff one or more Ctrl keys is held down
226 */
227bool ro_gui_ctrl_pressed(void);
228
229
230/**
231 * Returns true iff one or more Alt keys is held down
232 */
233bool ro_gui_alt_pressed(void);
234
235
236/**
237 * Change mouse pointer shape
238 */
239void gui_window_set_pointer(struct gui_window *g, enum gui_pointer_shape shape);
240
241#endif
242
nserror
Enumeration of error codes.
Definition: errors.h:29
const char * type
Definition: filetype.cpp:44
enum browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type)
Returns the state of the mouse buttons and modifiers keys for a mouse action, suitable for passing to...
Definition: window.c:4878
nserror ro_gui_window_set_url(struct gui_window *g, struct nsurl *url)
Set the contents of a window's address bar.
Definition: window.c:4450
bool ro_gui_shift_pressed(void)
Returns true iff one or more Shift keys is held down.
Definition: window.c:5024
void ro_gui_throb(void)
Animate the "throbbers" of all browser windows.
Definition: window.c:4778
void ro_gui_window_set_scale(struct gui_window *g, float scale)
Set a gui_window's scale.
Definition: window.c:4474
struct gui_window * ro_gui_toolbar_lookup(wimp_w window)
Convert a toolbar RISC OS window handle to a gui_window.
Definition: window.c:4836
nserror ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect)
Cause an area of a window to be invalidated.
Definition: window.c:4371
void ro_gui_window_update_boxes(void)
Redraw any pending update boxes.
Definition: window.c:4699
bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos)
Convert x,y screen co-ordinates into window co-ordinates.
Definition: window.c:4855
bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message)
Handle Message_DataLoad (file dragged in) for a toolbar.
Definition: window.c:4657
bool ro_gui_ctrl_pressed(void)
Returns true iff one or more Ctrl keys is held down.
Definition: window.c:5033
void ro_gui_window_redraw_all(void)
Redraws the content for all windows.
Definition: window.c:4690
bool ro_gui_window_check_menu(wimp_menu *menu)
Check if a particular menu handle is a browser window menu.
Definition: window.c:4683
struct gui_window_table * riscos_window_table
Definition: window.c:4258
bool ro_gui_alt_pressed(void)
Returns true iff one or more Alt keys is held down.
Definition: window.c:5042
void ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi)
Window is being iconised.
Definition: window.c:4531
void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data)
Handle pointer movements in a browser window.
Definition: window.c:4513
struct gui_window * ro_gui_window_lookup(wimp_w window)
Convert a RISC OS window handle to a gui_window.
Definition: window.c:4823
enum browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons, wimp_icon_flags type)
Returns the state of the mouse buttons and modifiers keys whilst dragging, for passing to the OS-inde...
Definition: window.c:4995
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message)
Handle Message_DataLoad (file dragged in) for a window.
Definition: window.c:4481
void ro_gui_window_quit(void)
Destroy all browser windows.
Definition: window.c:4766
void gui_window_set_pointer(struct gui_window *g, enum gui_pointer_shape shape)
Change mouse pointer shape.
Definition: theme.c:216
void ro_gui_window_default_options(struct gui_window *gui)
Makes a browser window's options the default.
Definition: window.c:4792
void ro_gui_window_initialise(void)
Initialise the browser window module and its menus.
Definition: window.c:4262
browser_mouse_state
Mouse state.
Definition: mouse.h:43
gui_pointer_shape
Definition: mouse.h:89
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
Graphical user interface window function table.
Definition: window.h:137
first entry in window list
Definition: gui.c:296
struct fbtk_widget_s * window
Definition: gui.h:33
Rectangle coordinates.
Definition: types.h:40