2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2006-03-25 23:30:35 +03:00
|
|
|
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
|
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/>.
|
2004-02-25 18:12:58 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Browser window creation and manipulation (interface).
|
2002-09-11 18:24:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_DESKTOP_BROWSER_H_
|
|
|
|
#define _NETSURF_DESKTOP_BROWSER_H_
|
|
|
|
|
2003-11-15 03:26:42 +03:00
|
|
|
#include <stdbool.h>
|
2014-02-03 21:56:24 +04:00
|
|
|
#include <stdio.h>
|
2009-08-14 14:37:33 +04:00
|
|
|
|
2014-02-03 21:56:24 +04:00
|
|
|
#include "utils/types.h"
|
2014-07-06 21:34:34 +04:00
|
|
|
#include "utils/errors.h"
|
2014-02-03 21:56:24 +04:00
|
|
|
#include "desktop/plot_style.h"
|
2012-08-22 13:37:22 +04:00
|
|
|
#include "desktop/frame_types.h"
|
2010-06-04 13:35:08 +04:00
|
|
|
#include "desktop/mouse.h"
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2012-08-22 15:22:58 +04:00
|
|
|
struct browser_window;
|
2010-03-28 16:56:39 +04:00
|
|
|
struct hlcache_handle;
|
2004-07-17 17:00:38 +04:00
|
|
|
struct gui_window;
|
|
|
|
struct history;
|
2005-04-15 09:52:25 +04:00
|
|
|
struct selection;
|
2010-06-04 13:35:08 +04:00
|
|
|
struct fetch_multipart_data;
|
2014-02-03 21:56:24 +04:00
|
|
|
struct form_control;
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl;
|
2014-08-04 03:36:14 +04:00
|
|
|
enum content_debug;
|
2006-09-02 19:52:41 +04:00
|
|
|
|
2011-06-27 21:29:49 +04:00
|
|
|
typedef enum {
|
|
|
|
DRAGGING_NONE,
|
|
|
|
DRAGGING_SELECTION,
|
|
|
|
DRAGGING_PAGE_SCROLL,
|
|
|
|
DRAGGING_FRAME,
|
2011-07-06 00:13:28 +04:00
|
|
|
DRAGGING_SCR_X,
|
|
|
|
DRAGGING_SCR_Y,
|
2012-01-11 18:20:26 +04:00
|
|
|
DRAGGING_CONTENT_SCROLLBAR,
|
2011-06-27 21:29:49 +04:00
|
|
|
DRAGGING_OTHER
|
|
|
|
} browser_drag_type;
|
|
|
|
|
2013-02-22 16:19:35 +04:00
|
|
|
typedef enum {
|
|
|
|
BW_EDITOR_NONE = 0, /**< No selection, no editing */
|
|
|
|
BW_EDITOR_CAN_COPY = (1 << 0), /**< Have selection */
|
|
|
|
BW_EDITOR_CAN_CUT = (1 << 1), /**< Selection not read-only */
|
|
|
|
BW_EDITOR_CAN_PASTE = (1 << 2) /**< Can paste, input */
|
|
|
|
} browser_editor_flags;
|
|
|
|
|
2014-10-25 15:04:11 +04:00
|
|
|
typedef enum {
|
|
|
|
BW_SCROLLING_AUTO,
|
|
|
|
BW_SCROLLING_YES,
|
|
|
|
BW_SCROLLING_NO
|
|
|
|
} browser_scrolling;
|
|
|
|
|
2014-02-10 18:08:45 +04:00
|
|
|
/** flags to browser_window_create */
|
|
|
|
enum browser_window_create_flags {
|
|
|
|
/** No flags set */
|
|
|
|
BW_CREATE_NONE = 0,
|
|
|
|
|
|
|
|
/** this will form a new history node (don't set for back/reload/etc) */
|
|
|
|
BW_CREATE_HISTORY = (1 << 0),
|
|
|
|
|
|
|
|
/** New gui_window to be tab in same window as "existing" gui_window */
|
|
|
|
BW_CREATE_TAB = (1 << 1),
|
|
|
|
|
|
|
|
/** New gui_window to be clone of "existing" gui_window */
|
|
|
|
BW_CREATE_CLONE = (1 << 2),
|
|
|
|
|
2014-02-11 02:40:04 +04:00
|
|
|
/** Window not opened by user interaction (e.g. JS popup)
|
|
|
|
*
|
|
|
|
* rfc2965:
|
|
|
|
* A transaction is verifiable if the user, or a
|
|
|
|
* user-designated agent, has the option to review
|
|
|
|
* the request-URI prior to its use in the transaction.
|
|
|
|
* A transaction is unverifiable if the user does not
|
|
|
|
* have that option.
|
|
|
|
*/
|
2014-02-10 18:08:45 +04:00
|
|
|
BW_CREATE_UNVERIFIABLE = (1 << 3),
|
|
|
|
};
|
|
|
|
|
|
|
|
/** flags to browser_window_navigate */
|
2013-02-14 19:09:28 +04:00
|
|
|
enum browser_window_nav_flags {
|
2014-02-09 17:26:09 +04:00
|
|
|
/** No flags set */
|
2014-02-10 18:08:45 +04:00
|
|
|
BW_NAVIGATE_NONE = 0,
|
2014-02-09 17:26:09 +04:00
|
|
|
|
2013-03-04 19:12:58 +04:00
|
|
|
/** this will form a new history node (don't set for back/reload/etc) */
|
2014-02-10 18:08:45 +04:00
|
|
|
BW_NAVIGATE_HISTORY = (1 << 0),
|
2014-02-09 17:26:09 +04:00
|
|
|
|
2013-02-14 19:09:28 +04:00
|
|
|
/** download rather than render the uri */
|
2014-02-10 18:08:45 +04:00
|
|
|
BW_NAVIGATE_DOWNLOAD = (1 << 1),
|
2014-02-09 17:26:09 +04:00
|
|
|
|
2014-02-11 02:40:04 +04:00
|
|
|
/** Transation not caused by user interaction (e.g. JS-caused)
|
|
|
|
*
|
|
|
|
* rfc2965:
|
|
|
|
* A transaction is verifiable if the user, or a
|
|
|
|
* user-designated agent, has the option to review
|
|
|
|
* the request-URI prior to its use in the transaction.
|
|
|
|
* A transaction is unverifiable if the user does not
|
|
|
|
* have that option.
|
|
|
|
*/
|
|
|
|
BW_NAVIGATE_UNVERIFIABLE = (1 << 2)
|
2013-02-14 19:09:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create and open a new root browser window with the given page.
|
|
|
|
*
|
2014-02-10 18:08:45 +04:00
|
|
|
* \param flags Flags to control operation
|
|
|
|
* \param url URL to fetch in the new window or NULL for blank
|
2014-10-19 22:12:55 +04:00
|
|
|
* \param referrer The referring uri or NULL if none
|
2014-02-10 18:08:45 +04:00
|
|
|
* \param existing The an existing bw or NULL, required for some flags.
|
|
|
|
* \param bw Updated to created browser window or untouched on error.
|
|
|
|
* \return NSERROR_OK, or appropriate error otherwise.
|
2013-02-14 19:09:28 +04:00
|
|
|
*/
|
2014-02-10 18:08:45 +04:00
|
|
|
nserror browser_window_create(enum browser_window_create_flags flags,
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl *url, struct nsurl *referrer,
|
2014-02-10 18:08:45 +04:00
|
|
|
struct browser_window *existing,
|
|
|
|
struct browser_window **bw);
|
2013-02-14 19:09:28 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Start fetching a page in a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param url URL to start fetching
|
2013-02-14 22:21:11 +04:00
|
|
|
* \param flags Flags to control operation
|
2013-02-14 19:09:28 +04:00
|
|
|
* \param referrer The referring uri or NULL if none
|
|
|
|
* \param post_urlenc url encoded post data or NULL if none
|
|
|
|
* \param post_multipart multipart post data or NULL if none
|
|
|
|
* \param parent Parent content or NULL if none
|
|
|
|
*
|
|
|
|
* Any existing fetches in the window are aborted.
|
|
|
|
*
|
|
|
|
* If post_urlenc and post_multipart are NULL the url is fetched using
|
|
|
|
* GET rather than POST.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
nserror browser_window_navigate(struct browser_window *bw,
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl *url,
|
|
|
|
struct nsurl *referrer,
|
2013-02-14 19:09:28 +04:00
|
|
|
enum browser_window_nav_flags flags,
|
|
|
|
char *post_urlenc,
|
|
|
|
struct fetch_multipart_data *post_multipart,
|
2014-02-03 21:56:24 +04:00
|
|
|
struct hlcache_handle *parent);
|
2013-02-14 19:09:28 +04:00
|
|
|
|
2014-10-18 13:16:00 +04:00
|
|
|
/**
|
|
|
|
* Return true if a browser window can navigate upwards.
|
|
|
|
*
|
|
|
|
* \param bw the browser window to test.
|
|
|
|
* \return true if navigation up is possible otherwise false.
|
|
|
|
*/
|
|
|
|
bool browser_window_up_available(struct browser_window *bw);
|
|
|
|
|
2014-10-17 12:51:10 +04:00
|
|
|
/**
|
|
|
|
* Navigate to a browser_window's parent URL.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param new_window whether to open parent in a new window, or existing
|
|
|
|
*/
|
|
|
|
nserror browser_window_navigate_up(struct browser_window *bw, bool new_window);
|
|
|
|
|
2014-02-08 19:00:08 +04:00
|
|
|
/**
|
|
|
|
* Get a browser window's URL.
|
|
|
|
*
|
2014-10-20 00:49:46 +04:00
|
|
|
* \param bw browser window
|
|
|
|
* \return pointer to nsurl. Doesn't create a ref for caller.
|
2014-02-08 19:00:08 +04:00
|
|
|
*
|
2014-10-19 22:12:55 +04:00
|
|
|
* \note guaranteed to return a valid nsurl ptr, never returns NULL.
|
2014-02-08 19:00:08 +04:00
|
|
|
*/
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl* browser_window_get_url(struct browser_window *bw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the title of a browser_window.
|
|
|
|
*
|
|
|
|
* \param bw The browser window.
|
|
|
|
*/
|
|
|
|
const char* browser_window_get_title(struct browser_window *bw);
|
2014-02-08 19:00:08 +04:00
|
|
|
|
2014-02-09 17:07:39 +04:00
|
|
|
/**
|
|
|
|
* Get a browser window's history object.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return pointer browser window's history object
|
|
|
|
*
|
|
|
|
* Clients need history object to make use of the history_* functions.
|
|
|
|
*/
|
|
|
|
struct history * browser_window_get_history(struct browser_window *bw);
|
|
|
|
|
2014-02-08 20:03:06 +04:00
|
|
|
/**
|
|
|
|
* Get a browser window's content extents.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param scaled whether to apply current browser window scale
|
|
|
|
* \param width updated to content width extent in px
|
|
|
|
* \param width updated to content height extent in px
|
|
|
|
* \return NSERROR_OK, or appropriate error otherwise.
|
|
|
|
*/
|
|
|
|
nserror browser_window_get_extents(struct browser_window *bw, bool scaled,
|
|
|
|
int *width, int *height);
|
|
|
|
|
2014-02-08 19:31:44 +04:00
|
|
|
/**
|
|
|
|
* Find out if a browser window is currently showing a content.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true iff browser window is showing a content, else false.
|
|
|
|
*/
|
|
|
|
bool browser_window_has_content(struct browser_window *bw);
|
|
|
|
|
2014-07-21 04:13:10 +04:00
|
|
|
/**
|
|
|
|
* Get a cache handle for the content within a browser window.
|
|
|
|
*/
|
|
|
|
struct hlcache_handle *browser_window_get_content(struct browser_window *bw);
|
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Set the dimensions of the area a browser window occupies
|
|
|
|
*
|
|
|
|
* \param bw The browser window to set dimensions of
|
|
|
|
* \param width Width in pixels
|
|
|
|
* \param height Height in pixels
|
|
|
|
*/
|
2011-06-24 13:30:33 +04:00
|
|
|
void browser_window_set_dimensions(struct browser_window *bw,
|
|
|
|
int width, int height);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Redraw browser window, set extent to content, and update title.
|
|
|
|
*
|
|
|
|
* \param bw browser_window
|
|
|
|
* \param scroll_to_top move view to top of page
|
|
|
|
*/
|
2009-04-05 23:17:24 +04:00
|
|
|
void browser_window_update(struct browser_window *bw, bool scroll_to_top);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* update an area of a browser window.
|
|
|
|
*
|
|
|
|
* \param bw The browser window to update.
|
|
|
|
* \param rect The area to redraw
|
|
|
|
*/
|
2011-07-06 19:34:49 +04:00
|
|
|
void browser_window_update_box(struct browser_window *bw, struct rect *rect);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop all fetching activity in a browser window.
|
|
|
|
*
|
|
|
|
* \param bw The browser window to stop activity in.
|
|
|
|
*/
|
2004-02-25 18:12:58 +03:00
|
|
|
void browser_window_stop(struct browser_window *bw);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reload the page in a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param all whether to reload all objects associated with the page
|
|
|
|
*/
|
2004-06-29 23:08:19 +04:00
|
|
|
void browser_window_reload(struct browser_window *bw, bool all);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Close and destroy a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
*/
|
2004-02-25 18:12:58 +03:00
|
|
|
void browser_window_destroy(struct browser_window *bw);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reformat a browser window contents to a new width or height.
|
|
|
|
*
|
|
|
|
* \param bw the browser window to reformat
|
|
|
|
* \param width new width
|
|
|
|
* \param height new height
|
|
|
|
*/
|
2011-06-24 13:30:33 +04:00
|
|
|
void browser_window_reformat(struct browser_window *bw, bool background,
|
|
|
|
int width, int height);
|
2014-07-06 21:34:34 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the scale of a browser window.
|
|
|
|
*
|
|
|
|
* \param bw The browser window to scale.
|
|
|
|
* \param scale The new scale.
|
2014-10-20 00:49:46 +04:00
|
|
|
* \param all Scale all windows in the tree (ie work up as well as down)
|
2014-07-06 21:34:34 +04:00
|
|
|
*/
|
2006-09-08 20:57:26 +04:00
|
|
|
void browser_window_set_scale(struct browser_window *bw, float scale, bool all);
|
2014-07-06 21:34:34 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the scale of a browser window
|
|
|
|
*
|
|
|
|
* \param bw The browser window to get the scale of.
|
|
|
|
* \return The scale of teh window.
|
|
|
|
*/
|
2012-02-28 02:43:25 +04:00
|
|
|
float browser_window_get_scale(struct browser_window *bw);
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2011-09-06 22:11:10 +04:00
|
|
|
/**
|
|
|
|
* Get access to any content, link URLs and objects (images) currently
|
|
|
|
* at the given (x, y) coordinates.
|
|
|
|
*
|
|
|
|
* \param bw browser window to look inside
|
|
|
|
* \param x x-coordinate of point of interest
|
|
|
|
* \param y y-coordinate of point of interest
|
|
|
|
* \param data pointer to contextual_content struct. Its fields are updated
|
|
|
|
* with pointers to any relevent content, or set to NULL if none.
|
|
|
|
*/
|
|
|
|
void browser_window_get_contextual_content(struct browser_window *bw,
|
|
|
|
int x, int y, struct contextual_content *data);
|
|
|
|
|
2011-11-29 18:20:25 +04:00
|
|
|
/**
|
|
|
|
* Send a scroll request to a browser window at a particular point. The
|
|
|
|
* 'deepest' scrollable object which can be scrolled in the requested
|
|
|
|
* direction at the given point will consume the scroll.
|
|
|
|
*
|
|
|
|
* \param bw browser window to look inside
|
|
|
|
* \param x x-coordinate of point of interest
|
|
|
|
* \param y y-coordinate of point of interest
|
|
|
|
* \param scrx number of px try to scroll something in x direction
|
|
|
|
* \param scry number of px try to scroll something in y direction
|
|
|
|
* \return true iff scroll request has been consumed
|
|
|
|
*/
|
|
|
|
bool browser_window_scroll_at_point(struct browser_window *bw,
|
|
|
|
int x, int y, int scrx, int scry);
|
|
|
|
|
2011-12-02 01:51:04 +04:00
|
|
|
/**
|
2012-08-20 15:12:10 +04:00
|
|
|
* Drop a file onto a browser window at a particular point, or determine if a
|
|
|
|
* file may be dropped onto the content at given point.
|
2011-12-02 01:51:04 +04:00
|
|
|
*
|
|
|
|
* \param bw browser window to look inside
|
|
|
|
* \param x x-coordinate of point of interest
|
|
|
|
* \param y y-coordinate of point of interest
|
2012-08-20 15:12:10 +04:00
|
|
|
* \param file path to file to be dropped, or NULL to know if drop allowed
|
|
|
|
* \return true iff file drop has been handled, or if drop possible (NULL file)
|
2011-12-02 01:51:04 +04:00
|
|
|
*/
|
|
|
|
bool browser_window_drop_file_at_point(struct browser_window *bw,
|
|
|
|
int x, int y, char *file);
|
|
|
|
|
2014-10-20 00:49:46 +04:00
|
|
|
/**
|
|
|
|
* set filename on form control.
|
|
|
|
*
|
|
|
|
* \param bw browser window to look inside.
|
|
|
|
* \param gadget form control.
|
|
|
|
* \param fn filename to set.
|
|
|
|
*/
|
2014-01-05 20:04:35 +04:00
|
|
|
void browser_window_set_gadget_filename(struct browser_window *bw,
|
|
|
|
struct form_control *gadget, const char *fn);
|
2014-10-20 00:49:46 +04:00
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Update URL bar for a given browser window to bw's content's URL
|
|
|
|
*
|
2014-10-20 00:49:46 +04:00
|
|
|
* \param bw Browser window to update URL bar for.
|
2014-10-19 22:12:55 +04:00
|
|
|
*/
|
2014-10-29 03:17:11 +03:00
|
|
|
nserror browser_window_refresh_url_bar(struct browser_window *bw);
|
2009-03-30 19:46:26 +04:00
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Handle mouse clicks in a browser window.
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
|
|
|
*/
|
2004-07-18 03:32:09 +04:00
|
|
|
void browser_window_mouse_click(struct browser_window *bw,
|
2010-03-28 16:56:39 +04:00
|
|
|
browser_mouse_state mouse, int x, int y);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle non-click mouse action in a browser window. (drag ends, movements)
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param mouse state of mouse buttons and modifier keys
|
|
|
|
* \param x coordinate of mouse
|
|
|
|
* \param y coordinate of mouse
|
|
|
|
*/
|
2005-04-15 09:52:25 +04:00
|
|
|
void browser_window_mouse_track(struct browser_window *bw,
|
2010-03-28 16:56:39 +04:00
|
|
|
browser_mouse_state mouse, int x, int y);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Locate a browser window in the specified stack according.
|
|
|
|
*
|
|
|
|
* \param bw the browser_window to search all relatives of
|
|
|
|
* \param target the target to locate
|
|
|
|
* \param mouse The current mouse state
|
|
|
|
* \return The browser window the mouse is in
|
|
|
|
*/
|
2010-06-04 13:35:08 +04:00
|
|
|
struct browser_window *browser_window_find_target(
|
|
|
|
struct browser_window *bw, const char *target,
|
|
|
|
browser_mouse_state mouse);
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2014-06-30 19:40:56 +04:00
|
|
|
/**
|
|
|
|
* Cause the frontends reformat entry to be called in safe context.
|
|
|
|
*
|
|
|
|
* The browser_window_reformat call cannot safely be called from some
|
|
|
|
* contexts, this call allows for the reformat to happen from a safe
|
|
|
|
* top level context.
|
|
|
|
*
|
|
|
|
* The callback is frontend provided as the context information (size
|
|
|
|
* etc.) about the windowing toolkit is only available to the
|
|
|
|
* frontend.
|
|
|
|
*/
|
|
|
|
nserror browser_window_schedule_reformat(struct browser_window *bw);
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-14 14:37:33 +04:00
|
|
|
void browser_select_menu_callback(void *client_data,
|
2010-03-28 16:56:39 +04:00
|
|
|
int x, int y, int width, int height);
|
2010-02-11 13:58:26 +03:00
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
2014-10-20 00:49:46 +04:00
|
|
|
* Redraw a rectangular region of a browser window.
|
2014-10-19 22:12:55 +04:00
|
|
|
*
|
|
|
|
* \param bw browser window to be redrawn
|
|
|
|
* \param x x co-ord of top-left
|
|
|
|
* \param y y co-ord of top-left
|
|
|
|
* \param width width of rectangle
|
|
|
|
* \param height height of rectangle
|
|
|
|
*/
|
2005-04-15 09:52:25 +04:00
|
|
|
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
|
2010-03-28 16:56:39 +04:00
|
|
|
int width, int height);
|
2005-04-15 09:52:25 +04:00
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Change the shape of the mouse pointer
|
|
|
|
*
|
|
|
|
* \param bw Browser window to set shape in
|
|
|
|
* \param shape The pointer shape to use
|
|
|
|
*/
|
2011-06-15 00:00:18 +04:00
|
|
|
void browser_window_set_pointer(struct browser_window *bw,
|
2012-08-17 01:21:08 +04:00
|
|
|
browser_pointer_shape shape);
|
2014-10-19 22:12:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Start drag scrolling the contents of the browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \param x x ordinate of initial mouse position
|
|
|
|
* \param y y ordinate
|
|
|
|
*/
|
2010-06-04 13:35:08 +04:00
|
|
|
void browser_window_page_drag_start(struct browser_window *bw, int x, int y);
|
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Check availability of Back action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Back action is available
|
|
|
|
*/
|
2009-03-24 01:22:30 +03:00
|
|
|
bool browser_window_back_available(struct browser_window *bw);
|
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Check availability of Forward action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Forward action is available
|
|
|
|
*/
|
|
|
|
bool browser_window_forward_available(struct browser_window *bw);
|
2011-07-07 21:50:04 +04:00
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Check availability of Reload action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Reload action is available
|
|
|
|
*/
|
|
|
|
bool browser_window_reload_available(struct browser_window *bw);
|
2011-07-07 21:50:04 +04:00
|
|
|
|
2014-10-19 22:12:55 +04:00
|
|
|
/**
|
|
|
|
* Check availability of Stop action for a given browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window
|
|
|
|
* \return true if Stop action is available
|
|
|
|
*/
|
|
|
|
bool browser_window_stop_available(struct browser_window *bw);
|
2011-07-07 21:50:04 +04:00
|
|
|
|
2011-02-11 01:35:41 +03:00
|
|
|
/**
|
2014-10-20 00:49:46 +04:00
|
|
|
* Redraw an area of a window.
|
2011-02-11 01:35:41 +03:00
|
|
|
*
|
2014-10-20 00:49:46 +04:00
|
|
|
* Calls the redraw function for the content.
|
2011-02-11 01:35:41 +03:00
|
|
|
*
|
2011-02-11 22:36:33 +03:00
|
|
|
* \param bw The window to redraw
|
|
|
|
* \param x coordinate for top-left of redraw
|
|
|
|
* \param y coordinate for top-left of redraw
|
|
|
|
* \param clip clip rectangle coordinates
|
2011-06-30 19:48:07 +04:00
|
|
|
* \param ctx redraw context
|
2011-02-11 01:35:41 +03:00
|
|
|
* \return true if successful, false otherwise
|
|
|
|
*
|
2011-02-13 20:06:40 +03:00
|
|
|
* The clip rectangle is guaranteed to be filled to its extents, so there is
|
|
|
|
* no need to render a solid background first.
|
2011-02-11 01:35:41 +03:00
|
|
|
*
|
2011-02-13 20:06:40 +03:00
|
|
|
* x, y and clip are coordinates from the top left of the canvas area.
|
|
|
|
*
|
|
|
|
* The top left corner of the clip rectangle is (x0, y0) and
|
|
|
|
* the bottom right corner of the clip rectangle is (x1, y1).
|
|
|
|
* Units for x, y and clip are pixels.
|
2011-02-11 01:35:41 +03:00
|
|
|
*/
|
2011-02-11 22:36:33 +03:00
|
|
|
bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
2011-06-30 19:48:07 +04:00
|
|
|
const struct rect *clip, const struct redraw_context *ctx);
|
2011-02-11 01:35:41 +03:00
|
|
|
|
2011-02-13 19:44:32 +03:00
|
|
|
/**
|
|
|
|
* Check whether browser window is ready for redraw
|
|
|
|
*
|
|
|
|
* \param bw The window to redraw
|
|
|
|
* \return true if browser window is ready for redraw
|
|
|
|
*/
|
|
|
|
bool browser_window_redraw_ready(struct browser_window *bw);
|
2011-06-15 00:00:18 +04:00
|
|
|
|
2014-01-30 03:36:59 +04:00
|
|
|
/**
|
2011-06-15 00:00:18 +04:00
|
|
|
* Get the position of the current browser window with respect to the root or
|
|
|
|
* parent browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window to get the position of
|
|
|
|
* \param root true if we want position wrt root bw, false if wrt parent bw
|
|
|
|
* \param pos_x updated to x position of bw
|
|
|
|
* \param pos_y updated to y position of bw
|
|
|
|
*/
|
|
|
|
void browser_window_get_position(struct browser_window *bw, bool root,
|
|
|
|
int *pos_x, int *pos_y);
|
|
|
|
|
2014-01-30 03:36:59 +04:00
|
|
|
/**
|
2011-06-24 13:30:33 +04:00
|
|
|
* Set the position of the current browser window with respect to the parent
|
|
|
|
* browser window
|
|
|
|
*
|
2011-06-27 21:29:49 +04:00
|
|
|
* \param bw browser window to set the position of
|
2011-06-24 13:30:33 +04:00
|
|
|
* \param x x position of bw
|
|
|
|
* \param y y position of bw
|
|
|
|
*/
|
|
|
|
void browser_window_set_position(struct browser_window *bw, int x, int y);
|
|
|
|
|
2014-01-30 03:36:59 +04:00
|
|
|
/**
|
2011-07-14 14:27:24 +04:00
|
|
|
* Scroll the browser window to display the passed area
|
|
|
|
*
|
|
|
|
* \param bw browser window to scroll
|
|
|
|
* \param rect area to display
|
|
|
|
*/
|
|
|
|
void browser_window_scroll_visible(struct browser_window *bw,
|
|
|
|
const struct rect *rect);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set scroll offsets for a browser window.
|
|
|
|
*
|
|
|
|
* \param bw The browser window
|
|
|
|
* \param x The x scroll offset to set
|
|
|
|
* \param y The y scroll offset to set
|
|
|
|
*
|
2014-10-19 22:12:55 +04:00
|
|
|
* \todo Do we really need this and browser_window_scroll_visible?
|
2011-07-14 14:27:24 +04:00
|
|
|
* Ditto for gui_window_* variants.
|
|
|
|
*/
|
|
|
|
void browser_window_set_scroll(struct browser_window *bw, int x, int y);
|
|
|
|
|
2014-01-30 03:36:59 +04:00
|
|
|
/**
|
2012-02-28 16:20:49 +04:00
|
|
|
* Set drag type for a browser window, and inform front end
|
2011-06-27 21:29:49 +04:00
|
|
|
*
|
|
|
|
* \param bw browser window to set the type of the current drag for
|
|
|
|
* \param type drag type
|
2012-01-11 02:02:19 +04:00
|
|
|
* \param rect area pointer may be confined to, during drag, or NULL
|
2011-06-27 21:29:49 +04:00
|
|
|
*/
|
|
|
|
void browser_window_set_drag_type(struct browser_window *bw,
|
2012-01-11 20:48:59 +04:00
|
|
|
browser_drag_type type, const struct rect *rect);
|
2011-06-27 21:29:49 +04:00
|
|
|
|
2014-01-30 03:36:59 +04:00
|
|
|
/**
|
2012-02-28 16:20:49 +04:00
|
|
|
* Get type of any current drag for a browser window
|
|
|
|
*
|
|
|
|
* \param bw browser window to set the type of the current drag for
|
|
|
|
* \return drag type
|
|
|
|
*/
|
|
|
|
browser_drag_type browser_window_get_drag_type(struct browser_window *bw);
|
|
|
|
|
2011-07-02 20:43:20 +04:00
|
|
|
/**
|
2013-02-22 16:19:35 +04:00
|
|
|
* Check whether browser window can accept a cut/copy/paste, or has a selection
|
|
|
|
* that could be saved.
|
2011-07-13 17:20:26 +04:00
|
|
|
*
|
|
|
|
* \param bw The browser window
|
2013-02-22 16:19:35 +04:00
|
|
|
* \return flags indicating editor flags
|
2011-07-13 17:20:26 +04:00
|
|
|
*/
|
2013-02-22 16:19:35 +04:00
|
|
|
browser_editor_flags browser_window_get_editor_flags(struct browser_window *bw);
|
2011-07-13 17:20:26 +04:00
|
|
|
|
2014-10-18 21:53:50 +04:00
|
|
|
/**
|
|
|
|
* Find out if given browser window content is selectable
|
|
|
|
*
|
|
|
|
* \param bw browser window to look at
|
|
|
|
* \return true iff browser window is selectable
|
|
|
|
*/
|
|
|
|
bool browser_window_can_select(struct browser_window *bw);
|
|
|
|
|
2011-07-13 17:20:26 +04:00
|
|
|
/**
|
2013-02-22 16:19:35 +04:00
|
|
|
* Get the current selection from a root browser window, ownership passed to
|
|
|
|
* caller, who must free() it.
|
2011-07-13 17:20:26 +04:00
|
|
|
*
|
|
|
|
* \param bw The browser window
|
2013-02-22 16:19:35 +04:00
|
|
|
* \return the selected text string, or NULL
|
2011-07-13 17:20:26 +04:00
|
|
|
*/
|
2013-02-22 16:19:35 +04:00
|
|
|
char * browser_window_get_selection(struct browser_window *bw);
|
2011-07-13 17:20:26 +04:00
|
|
|
|
2014-10-18 20:39:03 +04:00
|
|
|
/**
|
|
|
|
* Find out if given browser window can be searched
|
|
|
|
*
|
|
|
|
* \param bw browser window to look at
|
|
|
|
* \return true iff browser window is searchable
|
|
|
|
*/
|
|
|
|
bool browser_window_can_search(struct browser_window *bw);
|
|
|
|
|
2014-10-25 15:00:34 +04:00
|
|
|
/**
|
|
|
|
* Find out if a browser window contains a frameset
|
|
|
|
*
|
|
|
|
* \param bw browser window to look at
|
|
|
|
* \return true iff browser window contains a frameset
|
|
|
|
*/
|
|
|
|
bool browser_window_is_frameset(struct browser_window *bw);
|
|
|
|
|
2014-10-25 15:04:11 +04:00
|
|
|
/**
|
2014-10-25 16:01:43 +04:00
|
|
|
* Get the browser window's scrollbar details.
|
|
|
|
*
|
|
|
|
* Vertical and horizontal scrollbars may be {YES|NO|AUTO}, although
|
|
|
|
* it is entirely up to the front end whether this is implemented.
|
|
|
|
* e.g. if the gui toolkit style-guide says all windows must have
|
|
|
|
* scrollbars then this API can be ignored.
|
2014-10-25 15:04:11 +04:00
|
|
|
*
|
|
|
|
* \param bw browser window to look at
|
2014-10-25 16:01:43 +04:00
|
|
|
* \param h Updated to indicate horizontal scrollbar type
|
|
|
|
* \param h Updated to indicate vertical scrollbar type
|
2014-10-25 15:04:11 +04:00
|
|
|
* \return NSERROR_OK, or appropriate error otherwise
|
|
|
|
*/
|
|
|
|
nserror browser_window_get_scrollbar_type(struct browser_window *bw,
|
|
|
|
browser_scrolling *h, browser_scrolling *v);
|
|
|
|
|
2011-06-15 00:00:18 +04:00
|
|
|
|
2012-08-20 19:05:30 +04:00
|
|
|
/**
|
|
|
|
* Dump debug info concerning the browser window's contents to file
|
|
|
|
*
|
|
|
|
* \param bw The browser window
|
2012-10-08 17:51:48 +04:00
|
|
|
* \param f The file to dump to
|
2012-08-20 19:05:30 +04:00
|
|
|
*/
|
2014-08-04 03:36:14 +04:00
|
|
|
nserror browser_window_debug_dump(struct browser_window *bw, FILE *f, enum content_debug op);
|
2012-08-20 19:05:30 +04:00
|
|
|
|
2005-01-14 01:42:39 +03:00
|
|
|
/* In platform specific theme_install.c. */
|
|
|
|
#ifdef WITH_THEME_INSTALL
|
2010-03-28 16:56:39 +04:00
|
|
|
void theme_install_start(struct hlcache_handle *c);
|
2005-01-14 01:42:39 +03:00
|
|
|
#endif
|
|
|
|
|
2014-10-13 05:34:10 +04:00
|
|
|
/**
|
|
|
|
* Set the DPI of the browser.
|
|
|
|
*
|
|
|
|
* \param dpi The DPI to set.
|
|
|
|
*/
|
|
|
|
nserror browser_set_dpi(int dpi);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the browser DPI.
|
|
|
|
*
|
|
|
|
* \return The DPI in use.
|
|
|
|
*/
|
|
|
|
int browser_get_dpi(void);
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
#endif
|