From 1eb86d9df2d6897d11b712f21d4ac23390fbdc70 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 30 May 2016 11:01:40 +0100 Subject: move window header into public API --- desktop/browser.c | 2 +- desktop/gui_factory.c | 2 +- desktop/gui_window.h | 291 -------------------------------------- desktop/selection.c | 2 +- desktop/textinput.c | 2 +- frontends/amiga/arexx.c | 2 +- frontends/amiga/bitmap.c | 2 +- frontends/amiga/clipboard.c | 2 +- frontends/amiga/cookies.c | 2 +- frontends/amiga/download.c | 2 +- frontends/amiga/drag.h | 2 +- frontends/amiga/file.c | 2 +- frontends/amiga/font_scan.c | 2 +- frontends/amiga/gui.c | 2 +- frontends/amiga/gui.h | 2 +- frontends/amiga/gui_options.c | 2 +- frontends/amiga/history.c | 2 +- frontends/amiga/history_local.c | 2 +- frontends/amiga/hotlist.c | 2 +- frontends/amiga/login.c | 2 +- frontends/amiga/menu.c | 2 +- frontends/amiga/misc.c | 2 +- frontends/amiga/plotters.c | 2 +- frontends/amiga/print.c | 2 +- frontends/amiga/search.c | 2 +- frontends/amiga/sslcert.c | 2 +- frontends/amiga/theme.c | 2 +- frontends/amiga/tree.c | 2 +- frontends/atari/gui.c | 2 +- frontends/beos/window.cpp | 2 +- frontends/cocoa/gui.m | 2 +- frontends/framebuffer/gui.c | 2 +- frontends/gtk/window.c | 2 +- frontends/monkey/browser.c | 2 +- frontends/riscos/global_history.c | 2 +- frontends/riscos/help.c | 2 +- frontends/riscos/hotlist.c | 2 +- frontends/riscos/save.c | 2 +- frontends/riscos/textselection.c | 2 +- frontends/riscos/window.c | 2 +- frontends/windows/plot.c | 2 +- frontends/windows/window.c | 2 +- include/netsurf/window.h | 291 ++++++++++++++++++++++++++++++++++++++ 43 files changed, 332 insertions(+), 332 deletions(-) delete mode 100644 desktop/gui_window.h create mode 100644 include/netsurf/window.h diff --git a/desktop/browser.c b/desktop/browser.c index 2ee36fd7d..bb39ee393 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -71,7 +71,7 @@ #include "desktop/plotters.h" #include "desktop/theme.h" #include "desktop/gui_misc.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_internal.h" diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c index 0aba19751..5ee6326ed 100644 --- a/desktop/gui_factory.c +++ b/desktop/gui_factory.c @@ -33,7 +33,7 @@ #include "desktop/gui_download.h" #include "desktop/gui_fetch.h" #include "desktop/gui_misc.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "netsurf/search.h" #include "desktop/gui_clipboard.h" #include "desktop/gui_utf8.h" diff --git a/desktop/gui_window.h b/desktop/gui_window.h deleted file mode 100644 index 7ecd3c21d..000000000 --- a/desktop/gui_window.h +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2014 Vincent Sanders - * - * 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 . - */ - -/** - * \file - * - * Interface to platform-specific graphical user interface window - * operations. - */ - -#ifndef _NETSURF_DESKTOP_GUI_WINDOW_H_ -#define _NETSURF_DESKTOP_GUI_WINDOW_H_ - -typedef enum gui_save_type { - GUI_SAVE_SOURCE, - GUI_SAVE_DRAW, - GUI_SAVE_PDF, - GUI_SAVE_TEXT, - GUI_SAVE_COMPLETE, - GUI_SAVE_OBJECT_ORIG, - GUI_SAVE_OBJECT_NATIVE, - GUI_SAVE_LINK_URI, - GUI_SAVE_LINK_URL, - GUI_SAVE_LINK_TEXT, - GUI_SAVE_HOTLIST_EXPORT_HTML, - GUI_SAVE_HISTORY_EXPORT_HTML, - GUI_SAVE_TEXT_SELECTION, - GUI_SAVE_CLIPBOARD_CONTENTS -} gui_save_type; - -typedef enum { - GDRAGGING_NONE, - GDRAGGING_SCROLLBAR, - GDRAGGING_SELECTION, - GDRAGGING_OTHER -} gui_drag_type; - -typedef enum { - GW_CREATE_NONE = 0, /* New window */ - GW_CREATE_CLONE = (1 << 0), /* Clone existing window */ - GW_CREATE_TAB = (1 << 1) /* In same window as existing */ -} gui_window_create_flags; - -struct browser_window; -struct form_control; -struct rect; -struct hlcache_handle; -struct nsurl; - -enum gui_pointer_shape; - -/** - * Graphical user interface window function table. - * - * function table implementing window operations - */ -struct gui_window_table { - - /* Mandantory entries */ - - /** - * Create and open a gui window for a browsing context. - * - * \param bw bw to create gui_window for - * \param existing an existing gui_window, may be NULL - * \param flags flags for gui window creation - * \return gui window, or NULL on error - * - * If GW_CREATE_CLONE flag is set existing is non-NULL. - * - * Front end's gui_window must include a reference to the - * browser window passed in the bw param. - */ - struct gui_window *(*create)(struct browser_window *bw, - struct gui_window *existing, - gui_window_create_flags flags); - - /** - * Destroy previously created gui window - * - * \param gw The gui window to destroy. - */ - void (*destroy)(struct gui_window *gw); - - /** - * Force a redraw of the entire contents of a window. - * - * @todo this API should be merged with update. - * - * \param g gui_window to redraw - */ - void (*redraw)(struct gui_window *g); - - /** - * Redraw an area of a window. - * - * \param g gui_window - * \param rect area to redraw - */ - void (*update)(struct gui_window *g, const struct rect *rect); - - /** - * Get the scroll position of a browser window. - * - * \param g gui_window - * \param sx receives x ordinate of point at top-left of window - * \param sy receives y ordinate of point at top-left of window - * \return true iff successful - */ - bool (*get_scroll)(struct gui_window *g, int *sx, int *sy); - - /** - * Set the scroll position of a browser window. - * - * \param g gui_window to scroll - * \param sx point to place at top-left of window - * \param sy point to place at top-left of window - */ - void (*set_scroll)(struct gui_window *g, int sx, int sy); - - /** - * Find the current dimensions of a browser window's content area. - * - * @todo The implementations of this are buggy and its only - * used from frames code. - * - * \param g gui_window to measure - * \param width receives width of window - * \param height receives height of window - * \param scaled whether to return scaled values - */ - void (*get_dimensions)(struct gui_window *g, int *width, int *height, bool scaled); - - /** - * Update the extent of the inside of a browser window to that of the - * current content. - * - * @todo this is used to update scroll bars does it need - * renaming? some frontends (windows) do not even implement it. - * - * \param g gui_window to update the extent of - */ - void (*update_extent)(struct gui_window *g); - - /** - * Reformat a window. - * - * This is used to perform reformats when the page contents - * require reformating. The reformat is requested using - * browser_window_schedule_reformat and occours via a scheduled - * callback hence from top level context. - * - * \param g gui_window to reformat. - */ - void (*reformat)(struct gui_window *g); - - - /* Optional entries */ - - /** - * Set the title of a window. - * - * \param g window to update - * \param title new window title - */ - void (*set_title)(struct gui_window *g, const char *title); - - /** - * Set the navigation url. - * - * \param gw window to update. - * \param url The url to use as icon. - */ - nserror (*set_url)(struct gui_window *gw, struct nsurl *url); - - /** - * Set a favicon for a gui window. - * - * \param gw window to update. - * \param icon handle to object to use as icon. - */ - void (*set_icon)(struct gui_window *gw, struct hlcache_handle *icon); - - /** - * Set the status bar of a browser window. - * - * \param g gui_window to update - * \param text new status text - */ - void (*set_status)(struct gui_window *g, const char *text); - - /** - * Change mouse pointer shape - */ - void (*set_pointer)(struct gui_window *g, enum gui_pointer_shape shape); - - /** - * Place the caret in a browser window. - * - * \param g window with caret - * \param x coordinates of caret - * \param y coordinates of caret - * \param height height of caret - * \param clip clip rectangle, or NULL if none - */ - void (*place_caret)(struct gui_window *g, int x, int y, int height, const struct rect *clip); - - /** - * Remove the caret, if present. - * - * \param g window with caret - */ - void (*remove_caret)(struct gui_window *g); - - /** start the navigation throbber. */ - void (*start_throbber)(struct gui_window *g); - - /** stop the navigation throbber. */ - void (*stop_throbber)(struct gui_window *g); - - /** start a drag operation within a window */ - bool (*drag_start)(struct gui_window *g, gui_drag_type type, const struct rect *rect); - - /** save link operation */ - nserror (*save_link)(struct gui_window *g, struct nsurl *url, const char *title); - - /** - * Scrolls the specified area of a browser window into view. - * - * @todo investigate if this can be merged with set_scroll - * which is what the default implementation used by most - * toolkits uses. - * - * \param g gui_window to scroll - * \param x0 left point to ensure visible - * \param y0 bottom point to ensure visible - * \param x1 right point to ensure visible - * \param y1 top point to ensure visible - */ - void (*scroll_visible)(struct gui_window *g, int x0, int y0, int x1, int y1); - - /** - * Starts drag scrolling of a browser window - * - * \param g the window to scroll - */ - bool (*scroll_start)(struct gui_window *g); - - /** - * Called when the gui_window has new content. - * - * \param g the gui_window that has new content - */ - void (*new_content)(struct gui_window *g); - - /** - * create a form select menu - */ - void (*create_form_select_menu)(struct gui_window *gw, struct form_control *control); - - /** - * Called when file chooser gadget is activated - */ - void (*file_gadget_open)(struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget); - - /** object dragged to window*/ - void (*drag_save_object)(struct gui_window *g, struct hlcache_handle *c, gui_save_type type); - - /** drag selection save */ - void (*drag_save_selection)(struct gui_window *g, const char *selection); - - /** selection started */ - void (*start_selection)(struct gui_window *g); -}; - -#endif diff --git a/desktop/selection.c b/desktop/selection.c index e2bd74722..8f064d4a6 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -43,7 +43,7 @@ #include "desktop/save_text.h" #include "desktop/selection.h" #include "desktop/gui_clipboard.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_internal.h" /** diff --git a/desktop/textinput.c b/desktop/textinput.c index bd51d5a0a..015c66936 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -41,7 +41,7 @@ #include "desktop/mouse.h" #include "desktop/browser_private.h" #include "desktop/textinput.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_internal.h" /* Define to enable textinput debug */ diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c index c5b5ab42d..38274f1ae 100644 --- a/frontends/amiga/arexx.c +++ b/frontends/amiga/arexx.c @@ -35,7 +35,7 @@ #include "utils/nsurl.h" #include "content/hlcache.h" #include "desktop/browser.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/version.h" #include "amiga/arexx.h" diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index cf342d8c7..506ae33bc 100644 --- a/frontends/amiga/bitmap.c +++ b/frontends/amiga/bitmap.c @@ -49,7 +49,7 @@ #include "utils/messages.h" #include "content/hlcache.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "netsurf/bitmap.h" #include "amiga/gui.h" diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c index 12ceb0f09..f906e5f76 100644 --- a/frontends/amiga/clipboard.c +++ b/frontends/amiga/clipboard.c @@ -34,7 +34,7 @@ #include "desktop/browser.h" #include "desktop/plotters.h" #include "desktop/textinput.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_clipboard.h" #include "amiga/bitmap.h" diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c index 0ca17413e..3181d0ffe 100755 --- a/frontends/amiga/cookies.c +++ b/frontends/amiga/cookies.c @@ -20,7 +20,7 @@ #include "desktop/cookie_manager.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/cookies.h" #include "amiga/tree.h" diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c index c646a5fa2..2b7d0e3e7 100644 --- a/frontends/amiga/download.c +++ b/frontends/amiga/download.c @@ -52,7 +52,7 @@ #include "desktop/save_complete.h" #include "desktop/browser.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_download.h" #include "content/handlers/image/ico.h" diff --git a/frontends/amiga/drag.h b/frontends/amiga/drag.h index 59a1a8467..b8ccec160 100644 --- a/frontends/amiga/drag.h +++ b/frontends/amiga/drag.h @@ -20,7 +20,7 @@ #define AMIGA_DRAG_H #include #include "desktop/browser.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #define AMI_DRAG_THRESHOLD 10 diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c index 8957ecfe6..3b5d5410b 100644 --- a/frontends/amiga/file.c +++ b/frontends/amiga/file.c @@ -33,7 +33,7 @@ #include "desktop/save_complete.h" #include "desktop/save_pdf.h" #include "desktop/save_text.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/gui.h" #include "amiga/bitmap.h" diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c index b65798d6e..12fb6071d 100644 --- a/frontends/amiga/font_scan.c +++ b/frontends/amiga/font_scan.c @@ -49,7 +49,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/font_scan.h" #include "amiga/gui.h" diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index b3f417180..88a06c628 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -112,7 +112,7 @@ #include "desktop/searchweb.h" #include "desktop/textinput.h" #include "desktop/tree.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_fetch.h" #include "desktop/gui_misc.h" diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index d301ac574..10e89cd9b 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -25,7 +25,7 @@ #include #include -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/mouse.h" #include "amiga/menu.h" diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c index 9402a3fa7..f921b093a 100755 --- a/frontends/amiga/gui_options.c +++ b/frontends/amiga/gui_options.c @@ -63,7 +63,7 @@ #include "utils/nsoption.h" #include "desktop/browser.h" #include "desktop/searchweb.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/file.h" #include "amiga/font.h" diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c index 72b69d435..61425f3d5 100755 --- a/frontends/amiga/history.c +++ b/frontends/amiga/history.c @@ -21,7 +21,7 @@ #include "utils/errors.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/history.h" #include "amiga/tree.h" diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c index 3016cbf16..3be097fa5 100755 --- a/frontends/amiga/history_local.c +++ b/frontends/amiga/history_local.c @@ -47,7 +47,7 @@ #include "desktop/browser_history.h" #include "desktop/browser.h" #include "desktop/plotters.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "graphics/rpattr.h" #include "amiga/libs.h" diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c index 79e679f77..71720cbf4 100755 --- a/frontends/amiga/hotlist.c +++ b/frontends/amiga/hotlist.c @@ -22,7 +22,7 @@ #include "utils/nsurl.h" #include "desktop/hotlist.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/hotlist.h" #include "amiga/tree.h" diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c index a4c0d62bb..34585159c 100755 --- a/frontends/amiga/login.c +++ b/frontends/amiga/login.c @@ -42,7 +42,7 @@ #include "utils/errors.h" #include "content/urldb.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/gui.h" #include "amiga/libs.h" diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c index 4a30c4878..969a65d38 100644 --- a/frontends/amiga/menu.c +++ b/frontends/amiga/menu.c @@ -51,7 +51,7 @@ #include "desktop/hotlist.h" #include "desktop/browser.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/textinput.h" #include "desktop/version.h" diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c index 2c233584d..1fc037332 100755 --- a/frontends/amiga/misc.c +++ b/frontends/amiga/misc.c @@ -36,7 +36,7 @@ #include "utils/nsurl.h" #include "utils/url.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/gui.h" #include "amiga/misc.h" diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index fb9c92394..1f7408100 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -39,7 +39,7 @@ #include "utils/log.h" #include "netsurf/css.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/plotters.h" #include "amiga/bitmap.h" diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c index fcccc91e2..ef70fe73e 100644 --- a/frontends/amiga/print.c +++ b/frontends/amiga/print.c @@ -54,7 +54,7 @@ #include "desktop/print.h" #include "desktop/gui_layout.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "content/hlcache.h" #include "amiga/plotters.h" diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c index 71ed0033d..2ecb7af53 100755 --- a/frontends/amiga/search.c +++ b/frontends/amiga/search.c @@ -51,7 +51,7 @@ #include "desktop/browser.h" #include "desktop/search.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "netsurf/search.h" #include "amiga/libs.h" diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c index 699ce71b8..ca6501a1a 100644 --- a/frontends/amiga/sslcert.c +++ b/frontends/amiga/sslcert.c @@ -21,7 +21,7 @@ #include "utils/nsurl.h" #include "content/llcache.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/sslcert_viewer.h" #include "amiga/tree.h" diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c index ab32b23dd..f4fed128e 100644 --- a/frontends/amiga/theme.c +++ b/frontends/amiga/theme.c @@ -42,7 +42,7 @@ #include "utils/utils.h" #include "desktop/searchweb.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "amiga/gui.h" #include "amiga/drag.h" diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c index f147b5e5c..05c2fa7c5 100644 --- a/frontends/amiga/tree.c +++ b/frontends/amiga/tree.c @@ -59,7 +59,7 @@ #include "desktop/cookie_manager.h" #include "desktop/global_history.h" #include "desktop/hotlist.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/sslcert_viewer.h" #include "amiga/gui.h" diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c index 810c7646f..9e6fd5ea8 100644 --- a/frontends/atari/gui.c +++ b/frontends/atari/gui.c @@ -36,7 +36,7 @@ #include "desktop/treeview.h" #include "desktop/browser.h" #include "desktop/gui_layout.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_clipboard.h" #include "desktop/gui_fetch.h" #include "desktop/gui_misc.h" diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp index 62624f077..2938b154a 100644 --- a/frontends/beos/window.cpp +++ b/frontends/beos/window.cpp @@ -33,7 +33,7 @@ extern "C" { #include "desktop/mouse.h" #include "desktop/textinput.h" #include "desktop/plotters.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_clipboard.h" } diff --git a/frontends/cocoa/gui.m b/frontends/cocoa/gui.m index c24357dbf..326e286b2 100644 --- a/frontends/cocoa/gui.m +++ b/frontends/cocoa/gui.m @@ -22,7 +22,7 @@ #import "utils/utils.h" #import "utils/log.h" #import "desktop/mouse.h" -#import "desktop/gui_window.h" +#import "netsurf/window.h" #import "desktop/gui_misc.h" #import "desktop/browser.h" #import "desktop/textinput.h" diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c index b0b98c546..4a8b7a645 100644 --- a/frontends/framebuffer/gui.c +++ b/frontends/framebuffer/gui.c @@ -38,7 +38,7 @@ #include "desktop/textinput.h" #include "desktop/browser_history.h" #include "desktop/plotters.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/gui_misc.h" #include "desktop/netsurf.h" #include "content/urldb.h" diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c index de333d1b0..5d49eebf3 100644 --- a/frontends/gtk/window.c +++ b/frontends/gtk/window.c @@ -43,7 +43,7 @@ #include "desktop/mouse.h" #include "desktop/searchweb.h" #include "desktop/textinput.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/plotters.h" #include "render/form.h" diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c index dfd2dcf6c..4ae35a1fa 100644 --- a/frontends/monkey/browser.c +++ b/frontends/monkey/browser.c @@ -26,7 +26,7 @@ #include "utils/log.h" #include "utils/messages.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/browser.h" #include "desktop/plotters.h" #include "content/hlcache.h" diff --git a/frontends/riscos/global_history.c b/frontends/riscos/global_history.c index c469847e0..88c071c23 100644 --- a/frontends/riscos/global_history.c +++ b/frontends/riscos/global_history.c @@ -36,7 +36,7 @@ #include "utils/log.h" #include "desktop/global_history.h" #include "desktop/tree.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "riscos/dialog.h" #include "riscos/global_history.h" diff --git a/frontends/riscos/help.c b/frontends/riscos/help.c index 73cb6957d..faabea708 100644 --- a/frontends/riscos/help.c +++ b/frontends/riscos/help.c @@ -28,7 +28,7 @@ #include "utils/messages.h" #include "utils/utf8.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "riscos/treeview.h" #include "riscos/help.h" diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c index 381978faf..d4acbc687 100644 --- a/frontends/riscos/hotlist.c +++ b/frontends/riscos/hotlist.c @@ -39,7 +39,7 @@ #include "content/urldb.h" #include "desktop/hotlist.h" #include "desktop/tree.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "riscos/gui.h" #include "riscos/dialog.h" diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c index 0432b1a23..6eab31533 100644 --- a/frontends/riscos/save.c +++ b/frontends/riscos/save.c @@ -48,7 +48,7 @@ #include "desktop/version.h" #include "desktop/save_complete.h" #include "desktop/save_text.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "netsurf/bitmap.h" #include "render/form.h" diff --git a/frontends/riscos/textselection.c b/frontends/riscos/textselection.c index 718171db0..0ddb26ddd 100644 --- a/frontends/riscos/textselection.c +++ b/frontends/riscos/textselection.c @@ -32,7 +32,7 @@ #include "utils/utils.h" #include "content/hlcache.h" #include "desktop/gui_clipboard.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/textinput.h" #include "desktop/browser.h" diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c index b6d074f55..d386685b4 100644 --- a/frontends/riscos/window.c +++ b/frontends/riscos/window.c @@ -64,7 +64,7 @@ #include "desktop/plotters.h" #include "desktop/textinput.h" #include "desktop/tree.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "netsurf/bitmap.h" #include "render/form.h" diff --git a/frontends/windows/plot.c b/frontends/windows/plot.c index 86870ea4e..d5ddf4f37 100644 --- a/frontends/windows/plot.c +++ b/frontends/windows/plot.c @@ -29,7 +29,7 @@ #include "utils/utf8.h" #include "utils/utils.h" #include "desktop/mouse.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/plotters.h" #include "windows/bitmap.h" diff --git a/frontends/windows/window.c b/frontends/windows/window.c index f5f13fe24..afc741ff1 100644 --- a/frontends/windows/window.c +++ b/frontends/windows/window.c @@ -31,7 +31,7 @@ #include "utils/messages.h" #include "content/content.h" #include "desktop/browser.h" -#include "desktop/gui_window.h" +#include "netsurf/window.h" #include "desktop/browser_history.h" #include "desktop/textinput.h" diff --git a/include/netsurf/window.h b/include/netsurf/window.h new file mode 100644 index 000000000..7ecd3c21d --- /dev/null +++ b/include/netsurf/window.h @@ -0,0 +1,291 @@ +/* + * Copyright 2014 Vincent Sanders + * + * 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 . + */ + +/** + * \file + * + * Interface to platform-specific graphical user interface window + * operations. + */ + +#ifndef _NETSURF_DESKTOP_GUI_WINDOW_H_ +#define _NETSURF_DESKTOP_GUI_WINDOW_H_ + +typedef enum gui_save_type { + GUI_SAVE_SOURCE, + GUI_SAVE_DRAW, + GUI_SAVE_PDF, + GUI_SAVE_TEXT, + GUI_SAVE_COMPLETE, + GUI_SAVE_OBJECT_ORIG, + GUI_SAVE_OBJECT_NATIVE, + GUI_SAVE_LINK_URI, + GUI_SAVE_LINK_URL, + GUI_SAVE_LINK_TEXT, + GUI_SAVE_HOTLIST_EXPORT_HTML, + GUI_SAVE_HISTORY_EXPORT_HTML, + GUI_SAVE_TEXT_SELECTION, + GUI_SAVE_CLIPBOARD_CONTENTS +} gui_save_type; + +typedef enum { + GDRAGGING_NONE, + GDRAGGING_SCROLLBAR, + GDRAGGING_SELECTION, + GDRAGGING_OTHER +} gui_drag_type; + +typedef enum { + GW_CREATE_NONE = 0, /* New window */ + GW_CREATE_CLONE = (1 << 0), /* Clone existing window */ + GW_CREATE_TAB = (1 << 1) /* In same window as existing */ +} gui_window_create_flags; + +struct browser_window; +struct form_control; +struct rect; +struct hlcache_handle; +struct nsurl; + +enum gui_pointer_shape; + +/** + * Graphical user interface window function table. + * + * function table implementing window operations + */ +struct gui_window_table { + + /* Mandantory entries */ + + /** + * Create and open a gui window for a browsing context. + * + * \param bw bw to create gui_window for + * \param existing an existing gui_window, may be NULL + * \param flags flags for gui window creation + * \return gui window, or NULL on error + * + * If GW_CREATE_CLONE flag is set existing is non-NULL. + * + * Front end's gui_window must include a reference to the + * browser window passed in the bw param. + */ + struct gui_window *(*create)(struct browser_window *bw, + struct gui_window *existing, + gui_window_create_flags flags); + + /** + * Destroy previously created gui window + * + * \param gw The gui window to destroy. + */ + void (*destroy)(struct gui_window *gw); + + /** + * Force a redraw of the entire contents of a window. + * + * @todo this API should be merged with update. + * + * \param g gui_window to redraw + */ + void (*redraw)(struct gui_window *g); + + /** + * Redraw an area of a window. + * + * \param g gui_window + * \param rect area to redraw + */ + void (*update)(struct gui_window *g, const struct rect *rect); + + /** + * Get the scroll position of a browser window. + * + * \param g gui_window + * \param sx receives x ordinate of point at top-left of window + * \param sy receives y ordinate of point at top-left of window + * \return true iff successful + */ + bool (*get_scroll)(struct gui_window *g, int *sx, int *sy); + + /** + * Set the scroll position of a browser window. + * + * \param g gui_window to scroll + * \param sx point to place at top-left of window + * \param sy point to place at top-left of window + */ + void (*set_scroll)(struct gui_window *g, int sx, int sy); + + /** + * Find the current dimensions of a browser window's content area. + * + * @todo The implementations of this are buggy and its only + * used from frames code. + * + * \param g gui_window to measure + * \param width receives width of window + * \param height receives height of window + * \param scaled whether to return scaled values + */ + void (*get_dimensions)(struct gui_window *g, int *width, int *height, bool scaled); + + /** + * Update the extent of the inside of a browser window to that of the + * current content. + * + * @todo this is used to update scroll bars does it need + * renaming? some frontends (windows) do not even implement it. + * + * \param g gui_window to update the extent of + */ + void (*update_extent)(struct gui_window *g); + + /** + * Reformat a window. + * + * This is used to perform reformats when the page contents + * require reformating. The reformat is requested using + * browser_window_schedule_reformat and occours via a scheduled + * callback hence from top level context. + * + * \param g gui_window to reformat. + */ + void (*reformat)(struct gui_window *g); + + + /* Optional entries */ + + /** + * Set the title of a window. + * + * \param g window to update + * \param title new window title + */ + void (*set_title)(struct gui_window *g, const char *title); + + /** + * Set the navigation url. + * + * \param gw window to update. + * \param url The url to use as icon. + */ + nserror (*set_url)(struct gui_window *gw, struct nsurl *url); + + /** + * Set a favicon for a gui window. + * + * \param gw window to update. + * \param icon handle to object to use as icon. + */ + void (*set_icon)(struct gui_window *gw, struct hlcache_handle *icon); + + /** + * Set the status bar of a browser window. + * + * \param g gui_window to update + * \param text new status text + */ + void (*set_status)(struct gui_window *g, const char *text); + + /** + * Change mouse pointer shape + */ + void (*set_pointer)(struct gui_window *g, enum gui_pointer_shape shape); + + /** + * Place the caret in a browser window. + * + * \param g window with caret + * \param x coordinates of caret + * \param y coordinates of caret + * \param height height of caret + * \param clip clip rectangle, or NULL if none + */ + void (*place_caret)(struct gui_window *g, int x, int y, int height, const struct rect *clip); + + /** + * Remove the caret, if present. + * + * \param g window with caret + */ + void (*remove_caret)(struct gui_window *g); + + /** start the navigation throbber. */ + void (*start_throbber)(struct gui_window *g); + + /** stop the navigation throbber. */ + void (*stop_throbber)(struct gui_window *g); + + /** start a drag operation within a window */ + bool (*drag_start)(struct gui_window *g, gui_drag_type type, const struct rect *rect); + + /** save link operation */ + nserror (*save_link)(struct gui_window *g, struct nsurl *url, const char *title); + + /** + * Scrolls the specified area of a browser window into view. + * + * @todo investigate if this can be merged with set_scroll + * which is what the default implementation used by most + * toolkits uses. + * + * \param g gui_window to scroll + * \param x0 left point to ensure visible + * \param y0 bottom point to ensure visible + * \param x1 right point to ensure visible + * \param y1 top point to ensure visible + */ + void (*scroll_visible)(struct gui_window *g, int x0, int y0, int x1, int y1); + + /** + * Starts drag scrolling of a browser window + * + * \param g the window to scroll + */ + bool (*scroll_start)(struct gui_window *g); + + /** + * Called when the gui_window has new content. + * + * \param g the gui_window that has new content + */ + void (*new_content)(struct gui_window *g); + + /** + * create a form select menu + */ + void (*create_form_select_menu)(struct gui_window *gw, struct form_control *control); + + /** + * Called when file chooser gadget is activated + */ + void (*file_gadget_open)(struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget); + + /** object dragged to window*/ + void (*drag_save_object)(struct gui_window *g, struct hlcache_handle *c, gui_save_type type); + + /** drag selection save */ + void (*drag_save_selection)(struct gui_window *g, const char *selection); + + /** selection started */ + void (*start_selection)(struct gui_window *g); +}; + +#endif -- cgit v1.2.3