2003-07-30 17:06:22 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2004-02-13 19:09:12 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2004-07-25 23:25:26 +04:00
|
|
|
* Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-07-30 17:06:22 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_RISCOS_GUI_H_
|
|
|
|
#define _NETSURF_RISCOS_GUI_H_
|
|
|
|
|
2003-09-11 01:44:11 +04:00
|
|
|
#include <stdbool.h>
|
2004-08-14 16:57:02 +04:00
|
|
|
#include <stdlib.h>
|
2008-07-27 02:29:15 +04:00
|
|
|
#include "oslib/osspriteop.h"
|
|
|
|
#include "oslib/wimp.h"
|
|
|
|
#include "rufl.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "desktop/browser.h"
|
|
|
|
#include "content/content_type.h"
|
|
|
|
#include "utils/config.h"
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2005-04-22 01:36:23 +04:00
|
|
|
#define RISCOS5 0xAA
|
|
|
|
|
2005-12-31 07:38:27 +03:00
|
|
|
#define THUMBNAIL_WIDTH 100
|
|
|
|
#define THUMBNAIL_HEIGHT 86
|
|
|
|
|
2014-01-26 18:35:57 +04:00
|
|
|
/* The maximum size for user-editable URLs in the RISC OS GUI. */
|
|
|
|
|
|
|
|
#define RO_GUI_MAX_URL_SIZE 2048
|
|
|
|
|
2005-04-22 01:36:23 +04:00
|
|
|
extern int os_version;
|
|
|
|
|
2005-01-23 19:09:05 +03:00
|
|
|
extern const char * NETSURF_DIR;
|
2003-08-27 02:37:32 +04:00
|
|
|
|
2004-07-17 17:00:38 +04:00
|
|
|
struct toolbar;
|
2006-11-30 18:30:54 +03:00
|
|
|
struct status_bar;
|
2004-10-18 01:16:00 +04:00
|
|
|
struct plotter_table;
|
2006-07-13 16:46:02 +04:00
|
|
|
struct gui_window;
|
|
|
|
struct tree;
|
|
|
|
struct node;
|
|
|
|
struct history;
|
|
|
|
struct css_style;
|
2014-02-03 22:12:44 +04:00
|
|
|
struct ssl_cert_info;
|
2004-07-17 17:00:38 +04:00
|
|
|
|
2005-04-15 09:54:44 +04:00
|
|
|
extern wimp_t task_handle; /**< RISC OS wimp task handle. */
|
|
|
|
|
2006-01-03 01:07:36 +03:00
|
|
|
extern wimp_w dialog_info, dialog_saveas, dialog_zoom, dialog_pageinfo,
|
2005-04-08 00:46:22 +04:00
|
|
|
dialog_objinfo, dialog_tooltip, dialog_warning, dialog_openurl,
|
2013-10-03 23:04:29 +04:00
|
|
|
dialog_folder, dialog_entry, dialog_url_complete,
|
2006-01-03 01:07:36 +03:00
|
|
|
dialog_search, dialog_print, dialog_theme_install;
|
2005-12-31 07:38:27 +03:00
|
|
|
extern wimp_w current_menu_window;
|
|
|
|
extern bool current_menu_open;
|
|
|
|
extern wimp_menu *recent_search_menu; /* search.c */
|
2003-11-15 03:26:42 +03:00
|
|
|
extern wimp_w history_window;
|
2003-10-25 04:35:49 +04:00
|
|
|
extern struct form_control *current_gadget;
|
2004-02-02 03:22:59 +03:00
|
|
|
extern bool gui_redraw_debug;
|
2004-06-30 03:13:40 +04:00
|
|
|
extern osspriteop_area *gui_sprites;
|
2004-07-09 02:05:35 +04:00
|
|
|
extern bool dialog_folder_add, dialog_entry_add, hotlist_insert;
|
2004-08-19 05:01:31 +04:00
|
|
|
extern bool print_active, print_text_black;
|
2013-08-16 12:15:50 +04:00
|
|
|
extern bool no_font_blending;
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2013-09-08 18:51:29 +04:00
|
|
|
typedef enum { GUI_DRAG_NONE, GUI_DRAG_DOWNLOAD_SAVE, GUI_DRAG_SAVE }
|
|
|
|
ro_gui_drag_type;
|
2005-04-15 09:54:44 +04:00
|
|
|
|
2012-01-11 18:20:26 +04:00
|
|
|
extern ro_gui_drag_type gui_current_drag_type;
|
2003-07-30 17:06:22 +04:00
|
|
|
|
2006-08-21 07:11:44 +04:00
|
|
|
/** desktop font, size and style being used */
|
|
|
|
extern char ro_gui_desktop_font_family[];
|
|
|
|
extern int ro_gui_desktop_font_size;
|
|
|
|
extern rufl_style ro_gui_desktop_font_style;
|
|
|
|
|
2004-07-17 17:00:38 +04:00
|
|
|
|
|
|
|
/** RISC OS data for a browser window. */
|
2004-06-28 03:24:11 +04:00
|
|
|
struct gui_window {
|
2004-07-17 17:00:38 +04:00
|
|
|
/** Associated platform-independent browser window data. */
|
|
|
|
struct browser_window *bw;
|
|
|
|
|
|
|
|
struct toolbar *toolbar; /**< Toolbar, or 0 if not present. */
|
2006-11-30 18:30:54 +03:00
|
|
|
struct status_bar *status_bar; /**< Status bar, or 0 if not present. */
|
2004-07-17 17:00:38 +04:00
|
|
|
|
|
|
|
wimp_w window; /**< RISC OS window handle. */
|
|
|
|
|
|
|
|
int old_width; /**< Width when last opened / os units. */
|
|
|
|
int old_height; /**< Height when last opened / os units. */
|
2007-01-03 18:15:54 +03:00
|
|
|
bool update_extent; /**< Update the extent on next opening */
|
2004-07-17 17:00:38 +04:00
|
|
|
|
|
|
|
char title[256]; /**< Buffer for window title. */
|
|
|
|
|
2006-03-24 06:44:37 +03:00
|
|
|
int iconise_icon; /**< ID number of icon when window is iconised */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
char validation[12]; /**< Validation string for colours */
|
2006-03-24 06:44:37 +03:00
|
|
|
|
2004-07-17 17:00:38 +04:00
|
|
|
/** Options. */
|
|
|
|
struct {
|
2004-07-21 00:02:59 +04:00
|
|
|
bool buffer_animations; /**< Use screen buffering for animations. */
|
|
|
|
bool buffer_everything; /**< Use screen buffering for everything. */
|
2004-07-17 17:00:38 +04:00
|
|
|
} option;
|
|
|
|
|
|
|
|
struct gui_window *prev; /**< Previous in linked list. */
|
|
|
|
struct gui_window *next; /**< Next in linked list. */
|
2003-07-30 17:06:22 +04:00
|
|
|
};
|
|
|
|
|
2003-10-01 04:26:42 +04:00
|
|
|
|
2004-07-17 17:00:38 +04:00
|
|
|
extern struct gui_window *ro_gui_current_redraw_gui;
|
|
|
|
|
|
|
|
|
2003-08-22 01:39:07 +04:00
|
|
|
/* in gui.c */
|
2005-03-20 17:57:51 +03:00
|
|
|
void ro_gui_open_window_request(wimp_open *open);
|
2003-11-08 02:51:13 +03:00
|
|
|
void ro_gui_screen_size(int *width, int *height);
|
2010-04-07 14:33:46 +04:00
|
|
|
void ro_gui_view_source(struct hlcache_handle *c);
|
2012-08-20 19:46:33 +04:00
|
|
|
void ro_gui_dump_browser_window(struct browser_window *bw);
|
2003-12-27 03:11:57 +03:00
|
|
|
void ro_gui_drag_box_start(wimp_pointer *pointer);
|
2005-04-23 06:58:27 +04:00
|
|
|
bool ro_gui_prequit(void);
|
2006-01-25 05:43:07 +03:00
|
|
|
const char *ro_gui_default_language(void);
|
2014-01-26 03:21:28 +04:00
|
|
|
char *url_to_path(const char *url);
|
2003-08-22 01:39:07 +04:00
|
|
|
|
2003-08-28 23:21:27 +04:00
|
|
|
/* in download.c */
|
|
|
|
void ro_gui_download_init(void);
|
2004-06-28 03:24:11 +04:00
|
|
|
void ro_gui_download_datasave_ack(wimp_message *message);
|
2005-04-23 06:58:27 +04:00
|
|
|
bool ro_gui_download_prequit(void);
|
2014-01-15 23:37:05 +04:00
|
|
|
extern struct gui_download_table *riscos_download_table;
|
2003-08-28 23:21:27 +04:00
|
|
|
|
2003-10-23 04:09:17 +04:00
|
|
|
/* in 401login.c */
|
|
|
|
void ro_gui_401login_init(void);
|
2014-01-16 04:52:17 +04:00
|
|
|
void gui_401login_open(nsurl *url, const char *realm,
|
|
|
|
nserror (*cb)(bool proceed, void *pw), void *cbpw);
|
2003-10-23 04:09:17 +04:00
|
|
|
|
2003-11-08 02:51:13 +03:00
|
|
|
/* in window.c */
|
2011-02-21 02:16:33 +03:00
|
|
|
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
|
2013-09-08 03:47:55 +04:00
|
|
|
void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data);
|
2011-02-21 02:16:33 +03:00
|
|
|
void ro_gui_window_iconise(struct gui_window *g,
|
|
|
|
wimp_full_message_window_info *wi);
|
|
|
|
bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
|
|
|
|
void ro_gui_window_redraw_all(void);
|
|
|
|
void ro_gui_window_update_boxes(void);
|
|
|
|
void ro_gui_window_process_reformats(void);
|
2004-07-30 20:16:07 +04:00
|
|
|
void ro_gui_window_quit(void);
|
2008-12-26 12:25:30 +03:00
|
|
|
/* void ro_gui_window_close_all(void); */
|
|
|
|
#define ro_gui_window_close_all ro_gui_window_quit /* no need for a separate fn */
|
2003-11-08 02:51:13 +03:00
|
|
|
void ro_gui_throb(void);
|
2011-02-21 02:16:33 +03:00
|
|
|
void ro_gui_window_default_options(struct browser_window *bw);
|
2004-07-17 17:00:38 +04:00
|
|
|
struct gui_window *ro_gui_window_lookup(wimp_w window);
|
|
|
|
struct gui_window *ro_gui_toolbar_lookup(wimp_w window);
|
2008-06-06 17:58:56 +04:00
|
|
|
bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y,
|
|
|
|
os_coord *pos);
|
|
|
|
bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y,
|
|
|
|
os_coord *pos);
|
2010-10-05 23:14:46 +04:00
|
|
|
browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons,
|
|
|
|
wimp_icon_flags type);
|
|
|
|
browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons,
|
|
|
|
wimp_icon_flags type);
|
2005-04-15 09:54:44 +04:00
|
|
|
bool ro_gui_shift_pressed(void);
|
|
|
|
bool ro_gui_ctrl_pressed(void);
|
2008-12-26 12:25:30 +03:00
|
|
|
bool ro_gui_alt_pressed(void);
|
2014-01-13 18:51:27 +04:00
|
|
|
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
|
2014-01-15 03:31:54 +04:00
|
|
|
void gui_create_form_select_menu(struct browser_window *bw, struct form_control *control);
|
2003-11-08 02:51:13 +03:00
|
|
|
|
2003-11-15 03:26:42 +03:00
|
|
|
/* in history.c */
|
|
|
|
void ro_gui_history_init(void);
|
2014-02-15 22:43:59 +04:00
|
|
|
void ro_gui_history_open(struct gui_window *g, bool pointer);
|
2004-06-30 03:13:40 +04:00
|
|
|
|
2004-03-11 05:19:14 +03:00
|
|
|
/* in filetype.c */
|
2014-01-23 03:19:57 +04:00
|
|
|
const char *fetch_filetype(const char *unix_path);
|
|
|
|
char *fetch_mimetype(const char *ro_path);
|
2010-04-07 13:12:46 +04:00
|
|
|
int ro_content_filetype(struct hlcache_handle *c);
|
2011-05-07 00:40:09 +04:00
|
|
|
int ro_content_native_type(struct hlcache_handle *c);
|
|
|
|
int ro_content_filetype_from_mime_type(lwc_string *mime_type);
|
2005-12-31 07:38:27 +03:00
|
|
|
int ro_content_filetype_from_type(content_type type);
|
2008-05-23 17:29:37 +04:00
|
|
|
bits ro_filetype_from_unix_path(const char *unix_path);
|
2004-03-11 05:19:14 +03:00
|
|
|
|
2004-03-21 15:46:56 +03:00
|
|
|
/* in schedule.c */
|
|
|
|
extern bool sched_active;
|
|
|
|
extern os_t sched_time;
|
2014-03-08 18:13:27 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Process events up to current time.
|
|
|
|
*/
|
2010-04-29 02:39:37 +04:00
|
|
|
bool schedule_run(void);
|
2004-03-21 15:46:56 +03:00
|
|
|
|
2014-03-08 18:13:27 +04:00
|
|
|
/**
|
|
|
|
* Schedule a callback.
|
|
|
|
*
|
|
|
|
* \param t interval before the callback should be made in ms
|
|
|
|
* \param callback callback function
|
|
|
|
* \param p user parameter, passed to callback function
|
|
|
|
*
|
|
|
|
* The callback function will be called as soon as possible after t ms have
|
|
|
|
* passed.
|
|
|
|
*/
|
|
|
|
nserror riscos_schedule(int t, void (*callback)(void *p), void *p);
|
|
|
|
|
2004-08-06 00:32:00 +04:00
|
|
|
/* in search.c */
|
2005-12-31 07:38:27 +03:00
|
|
|
void ro_gui_search_init(void);
|
2009-12-18 02:55:02 +03:00
|
|
|
void ro_gui_search_prepare(struct browser_window *g);
|
2004-08-06 00:32:00 +04:00
|
|
|
|
2004-08-09 10:28:57 +04:00
|
|
|
/* in print.c */
|
2005-12-31 07:38:27 +03:00
|
|
|
void ro_gui_print_init(void);
|
2005-04-08 00:46:22 +04:00
|
|
|
void ro_gui_print_prepare(struct gui_window *g);
|
2004-08-09 10:28:57 +04:00
|
|
|
|
2005-02-20 16:19:19 +03:00
|
|
|
/* in font.c */
|
2005-02-23 02:36:14 +03:00
|
|
|
void nsfont_init(void);
|
2006-01-03 00:24:43 +03:00
|
|
|
bool nsfont_exists(const char *font_family);
|
|
|
|
const char *nsfont_fallback_font(void);
|
2009-07-21 14:59:53 +04:00
|
|
|
bool nsfont_paint(const plot_font_style_t *fstyle, const char *string,
|
2011-03-08 22:02:19 +03:00
|
|
|
size_t length, int x, int y);
|
2009-07-21 14:59:53 +04:00
|
|
|
void nsfont_read_style(const plot_font_style_t *fstyle,
|
2005-11-20 23:16:08 +03:00
|
|
|
const char **font_family, unsigned int *font_size,
|
|
|
|
rufl_style *font_style);
|
2006-08-21 07:11:44 +04:00
|
|
|
void ro_gui_wimp_get_desktop_font(void);
|
2005-02-20 16:19:19 +03:00
|
|
|
|
2004-10-18 01:16:00 +04:00
|
|
|
/* in plotters.c */
|
|
|
|
extern const struct plotter_table ro_plotters;
|
|
|
|
extern int ro_plot_origin_x;
|
|
|
|
extern int ro_plot_origin_y;
|
|
|
|
|
2005-01-14 01:42:39 +03:00
|
|
|
/* in theme_install.c */
|
2005-12-31 07:38:27 +03:00
|
|
|
bool ro_gui_theme_install_apply(wimp_w w);
|
2005-01-14 01:42:39 +03:00
|
|
|
|
2014-01-15 03:31:54 +04:00
|
|
|
/* in sslcert.c */
|
|
|
|
void gui_cert_verify(nsurl *url,
|
|
|
|
const struct ssl_cert_info *certs, unsigned long num,
|
|
|
|
nserror (*cb)(bool proceed, void *pw), void *cbpw);
|
|
|
|
|
2006-03-25 23:30:35 +03:00
|
|
|
/* icon numbers */
|
2004-08-31 01:03:48 +04:00
|
|
|
#define ICON_STATUS_RESIZE 0
|
|
|
|
#define ICON_STATUS_TEXT 1
|
2003-11-20 03:16:31 +03:00
|
|
|
|
2004-02-26 03:44:42 +03:00
|
|
|
#define ICON_SAVE_ICON 0
|
|
|
|
#define ICON_SAVE_PATH 1
|
|
|
|
#define ICON_SAVE_OK 2
|
|
|
|
#define ICON_SAVE_CANCEL 3
|
|
|
|
|
2004-04-03 06:59:35 +04:00
|
|
|
#define ICON_PAGEINFO_TITLE 0
|
|
|
|
#define ICON_PAGEINFO_URL 1
|
|
|
|
#define ICON_PAGEINFO_ENC 2
|
|
|
|
#define ICON_PAGEINFO_TYPE 3
|
|
|
|
#define ICON_PAGEINFO_ICON 4
|
|
|
|
|
2004-05-05 04:02:13 +04:00
|
|
|
#define ICON_OBJINFO_URL 0
|
|
|
|
#define ICON_OBJINFO_TARGET 1
|
|
|
|
#define ICON_OBJINFO_TYPE 2
|
|
|
|
#define ICON_OBJINFO_ICON 3
|
|
|
|
|
2004-05-07 23:14:54 +04:00
|
|
|
#define ICON_WARNING_MESSAGE 0
|
|
|
|
#define ICON_WARNING_CONTINUE 1
|
|
|
|
#define ICON_WARNING_HELP 2
|
|
|
|
|
2004-08-06 00:32:00 +04:00
|
|
|
#define ICON_SEARCH_TEXT 0
|
2005-07-19 07:56:17 +04:00
|
|
|
#define ICON_SEARCH_CASE_SENSITIVE 1
|
|
|
|
#define ICON_SEARCH_FIND_NEXT 2
|
|
|
|
#define ICON_SEARCH_FIND_PREV 3
|
|
|
|
#define ICON_SEARCH_CANCEL 4
|
|
|
|
#define ICON_SEARCH_STATUS 5
|
2005-12-31 07:38:27 +03:00
|
|
|
#define ICON_SEARCH_MENU 8
|
2006-02-23 18:06:54 +03:00
|
|
|
#define ICON_SEARCH_SHOW_ALL 9
|
2004-08-06 00:32:00 +04:00
|
|
|
|
2005-01-14 01:42:39 +03:00
|
|
|
#define ICON_THEME_INSTALL_MESSAGE 0
|
|
|
|
#define ICON_THEME_INSTALL_INSTALL 1
|
|
|
|
#define ICON_THEME_INSTALL_CANCEL 2
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
#define ICON_OPENURL_URL 1
|
|
|
|
#define ICON_OPENURL_CANCEL 2
|
|
|
|
#define ICON_OPENURL_OPEN 3
|
2005-05-11 02:49:41 +04:00
|
|
|
#define ICON_OPENURL_MENU 4
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2005-12-31 07:38:27 +03:00
|
|
|
#define ICON_ENTRY_NAME 1
|
|
|
|
#define ICON_ENTRY_URL 3
|
|
|
|
#define ICON_ENTRY_CANCEL 4
|
|
|
|
#define ICON_ENTRY_OK 5
|
|
|
|
#define ICON_ENTRY_RECENT 6
|
|
|
|
|
|
|
|
#define ICON_FOLDER_NAME 1
|
|
|
|
#define ICON_FOLDER_CANCEL 2
|
|
|
|
#define ICON_FOLDER_OK 3
|
|
|
|
|
2003-07-30 17:06:22 +04:00
|
|
|
#endif
|