NetSurf
gui.h
Go to the documentation of this file.
1/*
2 * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
3 * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
4 * Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
5 *
6 * This file is part of NetSurf, http://www.netsurf-browser.org/
7 *
8 * NetSurf is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * NetSurf is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef _NETSURF_RISCOS_GUI_H_
22#define _NETSURF_RISCOS_GUI_H_
23
24#include <oslib/wimp.h>
25
26#define RISCOS5 0xAA
27
28#define THUMBNAIL_WIDTH 100
29#define THUMBNAIL_HEIGHT 86
30
31/* The maximum size for user-editable URLs in the RISC OS GUI. */
32
33#define RO_GUI_MAX_URL_SIZE 2048
34
35extern int os_version;
36
38
39extern const char * NETSURF_DIR;
40
41struct toolbar;
42struct status_bar;
43struct plotter_table;
44struct gui_window;
45struct tree;
46struct node;
47struct history;
48struct css_style;
49struct nsurl;
50struct hlcache_handle;
51
53
54extern wimp_t task_handle; /**< RISC OS wimp task handle. */
55
60extern wimp_w current_menu_window;
61extern bool current_menu_open;
62extern wimp_menu *recent_search_menu; /* search.c */
63extern bool gui_redraw_debug;
64extern osspriteop_area *gui_sprites;
67extern bool no_font_blending;
68
71
73
74extern bool riscos_done;
75
76/** RISC OS data for a browser window. */
77struct gui_window {
78 /** Associated platform-independent browser window data. */
79 struct browser_window *bw;
80
81 struct toolbar *toolbar; /**< Toolbar, or 0 if not present. */
82 struct status_bar *status_bar; /**< Status bar, or 0 if not present. */
83
84 wimp_w window; /**< RISC OS window handle. */
85
86 int old_width; /**< Width when last opened / os units. */
87 int old_height; /**< Height when last opened / os units. */
88 bool update_extent; /**< Update the extent on next opening */
89 bool active; /**< Whether the throbber should be active */
90
91 char title[256]; /**< Buffer for window title. */
92
93 int iconise_icon; /**< ID number of icon when window is iconised */
94
95 char validation[12]; /**< Validation string for colours */
96
97 /** Options. */
98 struct {
99 bool buffer_animations; /**< Use screen buffering for animations. */
100 bool buffer_everything; /**< Use screen buffering for everything. */
102
103 struct gui_window *prev; /**< Previous in linked list. */
104 struct gui_window *next; /**< Next in linked list. */
105};
106
107
109
110
111/* in gui.c */
112void ro_gui_open_window_request(wimp_open *open);
113void ro_gui_screen_size(int *width, int *height);
114void ro_gui_view_source(struct hlcache_handle *c);
116void ro_gui_drag_box_start(wimp_pointer *pointer);
117bool ro_gui_prequit(void);
118const char *ro_gui_default_language(void);
119nserror ro_warn_user(const char *warning, const char *detail);
120
121/**
122 * Cause an abnormal program termination.
123 *
124 * \note This never returns and is intended to terminate without any cleanup.
125 *
126 * \param error The message to display to the user.
127 */
128void die(const char * const error) __attribute__ ((noreturn));
129
130/* in download.c */
131void ro_gui_download_init(void);
132void ro_gui_download_datasave_ack(wimp_message *message);
133bool ro_gui_download_prequit(void);
135
136/* in schedule.c */
137extern bool sched_active;
138extern os_t sched_time;
139
140/**
141 * Process events up to current time.
142 */
143bool schedule_run(void);
144
145/**
146 * Schedule a callback.
147 *
148 * \param t interval before the callback should be made in ms
149 * \param callback callback function
150 * \param p user parameter, passed to callback function
151 *
152 * The callback function will be called as soon as possible after t ms have
153 * passed.
154 */
155nserror riscos_schedule(int t, void (*callback)(void *p), void *p);
156
157/* in search.c */
158void ro_gui_search_init(void);
161
162/* in print.c */
163void ro_gui_print_init(void);
164void ro_gui_print_prepare(struct gui_window *g);
165
166/* in plotters.c */
167extern const struct plotter_table ro_plotters;
168extern int ro_plot_origin_x;
169extern int ro_plot_origin_y;
170extern struct rect ro_plot_clip_rect;
171
172/* in theme_install.c */
173bool ro_gui_theme_install_apply(wimp_w w);
174
175/* icon numbers */
176#define ICON_STATUS_RESIZE 0
177#define ICON_STATUS_TEXT 1
178
179#define ICON_SAVE_ICON 0
180#define ICON_SAVE_PATH 1
181#define ICON_SAVE_OK 2
182#define ICON_SAVE_CANCEL 3
183
184#define ICON_PAGEINFO_TITLE 0
185#define ICON_PAGEINFO_URL 1
186#define ICON_PAGEINFO_ENC 2
187#define ICON_PAGEINFO_TYPE 3
188#define ICON_PAGEINFO_ICON 4
189
190#define ICON_OBJINFO_URL 0
191#define ICON_OBJINFO_TARGET 1
192#define ICON_OBJINFO_TYPE 2
193#define ICON_OBJINFO_ICON 3
194
195#define ICON_WARNING_MESSAGE 0
196#define ICON_WARNING_CONTINUE 1
197#define ICON_WARNING_HELP 2
198
199#define ICON_SEARCH_TEXT 0
200#define ICON_SEARCH_CASE_SENSITIVE 1
201#define ICON_SEARCH_FIND_NEXT 2
202#define ICON_SEARCH_FIND_PREV 3
203#define ICON_SEARCH_CANCEL 4
204#define ICON_SEARCH_STATUS 5
205#define ICON_SEARCH_MENU 8
206#define ICON_SEARCH_SHOW_ALL 9
207
208#define ICON_THEME_INSTALL_MESSAGE 0
209#define ICON_THEME_INSTALL_INSTALL 1
210#define ICON_THEME_INSTALL_CANCEL 2
211
212#define ICON_OPENURL_URL 1
213#define ICON_OPENURL_CANCEL 2
214#define ICON_OPENURL_OPEN 3
215#define ICON_OPENURL_MENU 4
216
217#define ICON_ENTRY_NAME 1
218#define ICON_ENTRY_URL 3
219#define ICON_ENTRY_CANCEL 4
220#define ICON_ENTRY_OK 5
221#define ICON_ENTRY_RECENT 6
222
223#define ICON_FOLDER_NAME 1
224#define ICON_FOLDER_CANCEL 2
225#define ICON_FOLDER_OK 3
226
227#endif
static const __attribute__((used))
Definition: gui.c:359
void die(const char *const error) __attribute__((noreturn))
Cause an abnormal program termination.
Definition: misc.c:69
nserror
Enumeration of error codes.
Definition: errors.h:29
gui_pointer_shape
Definition: mouse.h:89
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
int width
Definition: gui.c:160
int height
Definition: gui.c:161
void ro_gui_screen_size(int *width, int *height)
Find screen size in OS units.
Definition: gui.c:2343
void ro_gui_download_init(void)
Load the download window template.
Definition: download.c:189
wimp_w dialog_zoom
Definition: gui.h:56
os_t sched_time
Time of soonest scheduled event (valid only if sched_active is true).
Definition: schedule.c:52
bool current_menu_open
Whether a menu is currently open.
Definition: menus.c:98
ro_gui_drag_type gui_current_drag_type
Definition: gui.c:115
bool dialog_entry_add
Definition: gui.h:65
int ro_plot_origin_x
Definition: plotters.c:40
void ro_gui_view_source(struct hlcache_handle *c)
Send the source of a content to a text editor.
Definition: gui.c:1942
wimp_w dialog_url_complete
Definition: gui.h:58
nserror riscos_schedule(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: schedule.c:93
bool ro_gui_theme_install_apply(wimp_w w)
Install the downloaded theme.
int ro_plot_origin_y
Definition: plotters.c:41
bool print_text_black
Definition: gui.h:66
osspriteop_area * gui_sprites
Sprite area containing pointer and hotlist sprites.
Definition: gui.c:118
wimp_w dialog_print
Definition: gui.h:59
bool ro_gui_prequit(void)
Test whether it's okay to shutdown, prompting the user if not.
Definition: gui.c:2145
const char * NETSURF_DIR
Definition: gui.c:110
wimp_w current_menu_window
Window that owns the current menu.
Definition: menus.c:100
wimp_t task_handle
RISC OS wimp task handle.
Definition: gui.c:116
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
Definition: gui.c:2077
struct rect ro_plot_clip_rect
Definition: plotters.c:42
wimp_w dialog_saveas
Definition: gui.h:56
bool hotlist_insert
Definition: gui.h:65
bool sched_active
Items have been scheduled.
Definition: schedule.c:50
bool riscos_done
Definition: gui.c:93
struct gui_window * ro_gui_current_redraw_gui
GUI window which is being redrawn.
Definition: window.c:124
void ro_gui_dump_browser_window(struct browser_window *bw)
Send the debug dump of a content to a text editor.
Definition: gui.c:2353
wimp_w dialog_tooltip
Definition: gui.h:57
const struct plotter_table ro_plotters
RISC OS plotter operation table.
Definition: plotters.c:727
bool no_font_blending
Definition: font.c:48
wimp_w dialog_theme_install
Definition: gui.h:59
wimp_w dialog_entry
Definition: gui.h:58
void ro_gui_print_init(void)
Initialise the print dialog.
Definition: print.c:119
bool dialog_folder_add
bool gui_redraw_debug
wimp_menu * recent_search_menu
struct gui_search_table * riscos_search_table
Definition: search.c:85
void ro_gui_drag_box_start(wimp_pointer *pointer)
bool ro_gui_download_prequit(void)
Respond to PreQuit message, displaying a prompt message if we need the user to confirm the shutdown.
Definition: download.c:1680
struct gui_download_table * riscos_download_table
Definition: download.c:1697
bool schedule_run(void)
Process events up to current time.
Definition: schedule.c:137
wimp_w dialog_warning
Definition: gui.h:57
wimp_w dialog_info
Definition: dialog.c:75
wimp_w dialog_openurl
Definition: gui.h:57
wimp_w dialog_search
Definition: gui.h:59
void ro_gui_print_prepare(struct gui_window *g)
Prepares all aspects of the print dialog prior to opening.
Definition: print.c:158
void ro_gui_open_window_request(wimp_open *open)
Handle Open_Window_Request events.
Definition: gui.c:1901
wimp_w dialog_pageinfo
Definition: gui.h:56
wimp_w dialog_folder
Definition: gui.h:58
bool os_alpha_sprite_supported
Definition: gui.c:98
ro_gui_drag_type
Definition: gui.h:69
@ GUI_DRAG_SAVE
Definition: gui.h:69
@ GUI_DRAG_NONE
Definition: gui.h:69
@ GUI_DRAG_DOWNLOAD_SAVE
Definition: gui.h:69
bool print_active
Definition: print.c:81
int os_version
Definition: gui.c:97
void ro_gui_search_prepare(struct browser_window *g)
Open the search dialog.
Definition: search.c:292
wimp_w dialog_objinfo
Definition: gui.h:57
const char * ro_gui_default_language(void)
Determine the default language to use.
Definition: gui.c:1384
void ro_gui_search_init(void)
Definition: search.c:87
void ro_gui_download_datasave_ack(wimp_message *message)
Handle Message_DataSaveAck for a drag from a download window.
Definition: download.c:1010
Browser window data.
function table for download windows.
Definition: download.h:34
function table for page text search.
Definition: search.h:31
first entry in window list
Definition: gui.c:297
struct gui_window * prev
Previous in linked list.
Definition: gui.h:159
int old_width
Width when last opened / os units.
Definition: gui.h:86
bool update_extent
Update the extent on next opening.
Definition: gui.h:88
struct gui_window * next
list for cleanup
Definition: gui.h:159
bool active
Whether the throbber should be active.
Definition: gui.h:89
struct status_bar * status_bar
Status bar, or 0 if not present.
Definition: gui.h:82
wimp_w window
RISC OS window handle.
Definition: gui.h:84
bool buffer_animations
Use screen buffering for animations.
Definition: gui.h:99
bool buffer_everything
Use screen buffering for everything.
Definition: gui.h:100
struct toolbar * toolbar
Toolbar, or 0 if not present.
Definition: gui.h:81
int old_height
Height when last opened / os units.
Definition: gui.h:87
struct gui_window::@47 option
Options.
int iconise_icon
ID number of icon when window is iconised.
Definition: gui.h:93
char validation[12]
Validation string for colours.
Definition: gui.h:95
char * title
Definition: gui.h:153
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
Definition: gui.c:315
History tree for a window.
High-level cache handle.
Definition: hlcache.c:66
Plotter operations table.
Definition: plotters.h:102
Rectangle coordinates.
Definition: types.h:40