diff options
Diffstat (limited to 'include/netsurf/window.h')
-rw-r--r-- | include/netsurf/window.h | 145 |
1 files changed, 90 insertions, 55 deletions
diff --git a/include/netsurf/window.h b/include/netsurf/window.h index 53d9b30f2..16fd95e30 100644 --- a/include/netsurf/window.h +++ b/include/netsurf/window.h @@ -26,6 +26,16 @@ #ifndef NETSURF_WINDOW_H #define NETSURF_WINDOW_H +#include "netsurf/console.h" + +struct browser_window; +struct form_control; +struct rect; +struct hlcache_handle; +struct nsurl; + +enum gui_pointer_shape; + typedef enum gui_save_type { GUI_SAVE_SOURCE, GUI_SAVE_DRAW, @@ -56,16 +66,68 @@ typedef enum { typedef enum { GW_CREATE_NONE = 0, /**< New window */ GW_CREATE_CLONE = (1 << 0), /**< Clone existing window */ - GW_CREATE_TAB = (1 << 1) /**< Create tab in same window as existing */ + GW_CREATE_TAB = (1 << 1), /**< Create tab in same window as existing */ + GW_CREATE_FOREGROUND = (1 << 2), /**< Request this window/tab is foregrounded */ + GW_CREATE_FOCUS_LOCATION = (1 << 3) , /** Request this window/tab focusses the URL input */ } gui_window_create_flags; -struct browser_window; -struct form_control; -struct rect; -struct hlcache_handle; -struct nsurl; +/** + * Window events + * + * these are events delivered to a gui window which have no additional + * parameters and hence do not require separate callbacks. + */ +enum gui_window_event { + /** + * An empty event should never occur + */ + GW_EVENT_NONE = 0, -enum gui_pointer_shape; + /** + * 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. + */ + GW_EVENT_UPDATE_EXTENT, + + /** + * Remove the caret, if present. + */ + GW_EVENT_REMOVE_CARET, + + /** + * start the navigation throbber. + */ + GW_EVENT_START_THROBBER, + + /** + * stop the navigation throbber. + */ + GW_EVENT_STOP_THROBBER, + + /** + * Starts drag scrolling of a browser window + */ + GW_EVENT_SCROLL_START, + + /** + * Called when the gui_window has new content. + */ + GW_EVENT_NEW_CONTENT, + + /** + * selection started + */ + GW_EVENT_START_SELECTION, + + /** + * Page status has changed and so the padlock should be + * updated. + */ + GW_EVENT_PAGE_INFO_CHANGE, +}; /** * Graphical user interface window function table. @@ -173,24 +235,23 @@ struct gui_window_table { * \param gw The gui window to measure content area of. * \param width receives width of window * \param height receives height of window - * \param scaled whether to return scaled values * \return NSERROR_OK on success and width and height updated * else error code. */ - nserror (*get_dimensions)(struct gui_window *gw, int *width, int *height, bool scaled); + nserror (*get_dimensions)(struct gui_window *gw, int *width, int *height); /** - * Update the extent of the inside of a browser window to that of the - * current content. + * Miscellaneous event occurred for a window * - * @todo this is used to update scroll bars does it need - * renaming? some frontends (windows) do not even implement it. + * This is used to inform the frontend of window events which + * require no additional parameters. * - * \param gw The gui window to update the extent of. + * \param gw The gui window the event occurred for + * \param event Which event has occurred. + * \return NSERROR_OK if the event was processed else error code. */ - void (*update_extent)(struct gui_window *gw); - + nserror (*event)(struct gui_window *gw, enum gui_window_event event); /* Optional entries */ @@ -246,27 +307,6 @@ struct gui_window_table { 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. - * - * \param g window in which to start throbber. - */ - void (*start_throbber)(struct gui_window *g); - - /** - * stop the navigation throbber. - * - * \param g window with throbber to stop - */ - void (*stop_throbber)(struct gui_window *g); - - /** * start a drag operation within a window * * \param g window to start drag from. @@ -286,21 +326,6 @@ struct gui_window_table { */ nserror (*save_link)(struct gui_window *g, struct nsurl *url, const char *title); - - /** - * 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 gw The gui window that has new content - */ - void (*new_content)(struct gui_window *gw); - /** * create a form select menu * @@ -336,11 +361,21 @@ struct gui_window_table { void (*drag_save_selection)(struct gui_window *gw, const char *selection); /** - * selection started + * console logging happening. + * + * See \ref browser_window_console_log * - * \param gw The gui window to start selection in. + * \param gw The gui window receiving the logging. + * \param src The source of the logging message + * \param msg The text of the logging message + * \param msglen The length of the text of the logging message + * \param flags Flags associated with the logging. */ - void (*start_selection)(struct gui_window *gw); + void (*console_log)(struct gui_window *gw, + browser_window_console_source src, + const char *msg, + size_t msglen, + browser_window_console_flags flags); }; #endif |