2003-06-30 12:44:03 +00:00
|
|
|
/*
|
2006-11-27 15:35:18 +00:00
|
|
|
* This file is part of NetSurf, http://netsurf-browser.org/
|
2003-06-30 12:44:03 +00:00
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2006-03-25 20:30:35 +00:00
|
|
|
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
|
2004-02-25 15:12:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Browser window creation and manipulation (interface).
|
2002-09-11 14:24:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_DESKTOP_BROWSER_H_
|
|
|
|
#define _NETSURF_DESKTOP_BROWSER_H_
|
|
|
|
|
2003-11-15 00:26:42 +00:00
|
|
|
#include <stdbool.h>
|
2004-08-14 12:16:45 +00:00
|
|
|
#include <stddef.h>
|
2003-02-28 11:49:13 +00:00
|
|
|
#include <time.h>
|
2006-09-02 15:52:41 +00:00
|
|
|
#include "netsurf/render/html.h"
|
2002-09-11 14:24:02 +00:00
|
|
|
|
2004-02-25 15:12:58 +00:00
|
|
|
struct box;
|
2004-07-18 17:38:01 +00:00
|
|
|
struct content;
|
2005-04-15 18:00:21 +00:00
|
|
|
struct form;
|
2004-07-18 17:38:01 +00:00
|
|
|
struct form_control;
|
2004-06-21 15:09:59 +00:00
|
|
|
struct form_successful_control;
|
2004-07-17 13:00:38 +00:00
|
|
|
struct gui_window;
|
|
|
|
struct history;
|
2005-04-15 05:52:25 +00:00
|
|
|
struct selection;
|
2005-04-20 12:24:41 +00:00
|
|
|
struct browser_window;
|
2006-04-09 23:21:13 +00:00
|
|
|
struct url_data;
|
|
|
|
struct bitmap;
|
2006-06-02 07:48:13 +00:00
|
|
|
struct _gesturer_state;
|
2005-04-20 12:24:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef void (*browser_caret_callback)(struct browser_window *bw,
|
|
|
|
wchar_t key, void *p);
|
|
|
|
typedef bool (*browser_paste_callback)(struct browser_window *bw,
|
|
|
|
const char *utf8, unsigned utf8_len, bool last, void *p);
|
2006-08-13 03:05:55 +00:00
|
|
|
typedef void (*browser_move_callback)(struct browser_window *bw,
|
|
|
|
void *p);
|
2002-09-11 14:24:02 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
|
|
|
|
|
2004-02-25 15:12:58 +00:00
|
|
|
/** Browser window data. */
|
2004-10-17 21:11:29 +00:00
|
|
|
struct browser_window {
|
2004-02-25 15:12:58 +00:00
|
|
|
/** Page currently displayed, or 0. Must have status READY or DONE. */
|
|
|
|
struct content *current_content;
|
|
|
|
/** Page being loaded, or 0. */
|
|
|
|
struct content *loading_content;
|
2002-09-11 14:24:02 +00:00
|
|
|
|
2004-02-25 15:12:58 +00:00
|
|
|
/** Window history structure. */
|
|
|
|
struct history *history;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-06-02 07:48:13 +00:00
|
|
|
/** Gesturer for this browser window */
|
|
|
|
struct _gesturer_state *gesturer;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2005-04-15 05:52:25 +00:00
|
|
|
/** Selection state */
|
|
|
|
struct selection *sel;
|
|
|
|
|
2004-02-25 15:12:58 +00:00
|
|
|
/** Handler for keyboard input, or 0. */
|
2005-04-20 12:24:41 +00:00
|
|
|
browser_caret_callback caret_callback;
|
|
|
|
/** Handler for pasting text, or 0. */
|
|
|
|
browser_paste_callback paste_callback;
|
2006-08-13 03:05:55 +00:00
|
|
|
/** Handler for repositioning caret, or 0. */
|
|
|
|
browser_move_callback move_callback;
|
2005-04-20 12:24:41 +00:00
|
|
|
|
|
|
|
/** User parameter for caret_callback and paste_callback */
|
2004-02-25 15:12:58 +00:00
|
|
|
void *caret_p;
|
2002-09-11 14:24:02 +00:00
|
|
|
|
2004-07-17 13:00:38 +00:00
|
|
|
/** Platform specific window data. */
|
|
|
|
struct gui_window *window;
|
2004-02-25 15:12:58 +00:00
|
|
|
|
|
|
|
/** Busy indicator is active. */
|
|
|
|
bool throbbing;
|
|
|
|
/** Add loading_content to the window history when it loads. */
|
|
|
|
bool history_add;
|
2004-08-06 22:19:13 +00:00
|
|
|
|
2004-10-17 21:11:29 +00:00
|
|
|
/** Fragment identifier for current_content. */
|
2004-08-06 22:19:13 +00:00
|
|
|
char *frag_id;
|
2004-08-25 23:56:49 +00:00
|
|
|
|
2004-10-17 21:11:29 +00:00
|
|
|
/** Current drag status. */
|
2005-04-15 05:52:25 +00:00
|
|
|
enum {
|
|
|
|
DRAGGING_NONE,
|
|
|
|
DRAGGING_VSCROLL,
|
|
|
|
DRAGGING_HSCROLL,
|
|
|
|
DRAGGING_SELECTION,
|
2005-07-20 23:27:28 +00:00
|
|
|
DRAGGING_PAGE_SCROLL,
|
2006-09-02 15:52:41 +00:00
|
|
|
DRAGGING_2DSCROLL,
|
|
|
|
DRAGGING_FRAME
|
2005-04-15 05:52:25 +00:00
|
|
|
} drag_type;
|
2004-10-17 21:11:29 +00:00
|
|
|
|
2004-08-25 23:56:49 +00:00
|
|
|
/** Box currently being scrolled, or 0. */
|
|
|
|
struct box *scrolling_box;
|
2004-11-20 00:02:56 +00:00
|
|
|
/** Mouse position at start of current scroll drag. */
|
2006-09-02 15:52:41 +00:00
|
|
|
int drag_start_x;
|
|
|
|
int drag_start_y;
|
2004-11-20 00:02:56 +00:00
|
|
|
/** Scroll offsets at start of current scroll draw. */
|
2006-09-02 15:52:41 +00:00
|
|
|
int drag_start_scroll_x;
|
|
|
|
int drag_start_scroll_y;
|
2004-11-20 00:02:56 +00:00
|
|
|
/** Well dimensions for current scroll drag. */
|
2006-09-02 15:52:41 +00:00
|
|
|
int drag_well_width;
|
|
|
|
int drag_well_height;
|
|
|
|
/** Frame resize directions for current frame resize drag. */
|
|
|
|
unsigned int drag_resize_left : 1;
|
|
|
|
unsigned int drag_resize_right : 1;
|
|
|
|
unsigned int drag_resize_up : 1;
|
|
|
|
unsigned int drag_resize_down : 1;
|
2004-10-01 23:19:08 +00:00
|
|
|
|
|
|
|
/** Referer for current fetch, or 0. */
|
|
|
|
char *referer;
|
2005-01-03 02:09:20 +00:00
|
|
|
|
|
|
|
/** Current fetch is download */
|
|
|
|
bool download;
|
2006-04-09 23:21:13 +00:00
|
|
|
|
2006-03-27 00:19:19 +00:00
|
|
|
/** Refresh interval (-1 if undefined) */
|
|
|
|
int refresh_interval;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** Window dimensions */
|
|
|
|
int x0;
|
|
|
|
int y0;
|
|
|
|
int x1;
|
|
|
|
int y1;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** Window characteristics */
|
|
|
|
enum {
|
2007-01-27 20:58:20 +00:00
|
|
|
BROWSER_WINDOW_NORMAL,
|
|
|
|
BROWSER_WINDOW_IFRAME,
|
|
|
|
BROWSER_WINDOW_FRAME,
|
|
|
|
BROWSER_WINDOW_FRAMESET,
|
|
|
|
} browser_window_type;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** frameset characteristics */
|
|
|
|
int rows;
|
|
|
|
int cols;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** frame dimensions */
|
|
|
|
struct frame_dimension frame_width;
|
|
|
|
struct frame_dimension frame_height;
|
|
|
|
int margin_width;
|
|
|
|
int margin_height;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** frame name for targetting */
|
|
|
|
char *name;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** frame characteristics */
|
|
|
|
bool no_resize;
|
|
|
|
frame_scrolling scrolling;
|
|
|
|
bool border;
|
|
|
|
colour border_colour;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** iframe parent box */
|
|
|
|
struct box *box;
|
|
|
|
|
|
|
|
/** [cols * rows] children */
|
|
|
|
struct browser_window *children;
|
|
|
|
struct browser_window *parent;
|
2006-11-27 15:35:18 +00:00
|
|
|
|
2006-09-02 15:52:41 +00:00
|
|
|
/** [iframe_count] iframes */
|
|
|
|
int iframe_count;
|
|
|
|
struct browser_window *iframes;
|
2002-09-11 14:24:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-07-17 23:32:09 +00:00
|
|
|
typedef enum {
|
2005-04-15 05:52:25 +00:00
|
|
|
BROWSER_MOUSE_CLICK_1 = 1, /* primary mouse button down (eg. Select) */
|
|
|
|
BROWSER_MOUSE_CLICK_2 = 2,
|
|
|
|
|
|
|
|
BROWSER_MOUSE_DRAG_1 = 8, /* start of drag operation */
|
|
|
|
BROWSER_MOUSE_DRAG_2 = 16,
|
|
|
|
|
|
|
|
BROWSER_MOUSE_HOLDING_1 = 64, /* whilst drag is in progress */
|
|
|
|
BROWSER_MOUSE_HOLDING_2 = 128,
|
|
|
|
|
|
|
|
BROWSER_MOUSE_MOD_1 = 512, /* primary modifier key pressed (eg. Shift) */
|
|
|
|
BROWSER_MOUSE_MOD_2 = 1024
|
|
|
|
} browser_mouse_state;
|
2004-07-17 23:32:09 +00:00
|
|
|
|
2002-09-11 14:24:02 +00:00
|
|
|
|
2005-04-15 05:52:25 +00:00
|
|
|
extern struct browser_window *current_redraw_browser;
|
|
|
|
|
2006-07-05 01:23:25 +00:00
|
|
|
struct browser_window * browser_window_create(const char *url,
|
2007-01-27 20:58:20 +00:00
|
|
|
struct browser_window *clone, const char *referer,
|
|
|
|
bool history_add);
|
2004-10-01 00:06:49 +00:00
|
|
|
void browser_window_go(struct browser_window *bw, const char *url,
|
2007-01-27 20:58:20 +00:00
|
|
|
const char *referer, bool history_add);
|
|
|
|
void browser_window_go_unverifiable(struct browser_window *bw,
|
|
|
|
const char *url, const char *referer, bool history_add);
|
2006-11-26 20:11:20 +00:00
|
|
|
void browser_window_update(struct browser_window *bw, bool scroll_to_top);
|
2004-02-25 15:12:58 +00:00
|
|
|
void browser_window_stop(struct browser_window *bw);
|
2004-06-29 19:08:19 +00:00
|
|
|
void browser_window_reload(struct browser_window *bw, bool all);
|
2004-02-25 15:12:58 +00:00
|
|
|
void browser_window_destroy(struct browser_window *bw);
|
2006-11-26 20:11:20 +00:00
|
|
|
struct browser_window * browser_window_owner(struct browser_window *bw);
|
2006-11-26 21:04:42 +00:00
|
|
|
void browser_window_reformat(struct browser_window *bw, int width, int height);
|
2006-09-08 16:57:26 +00:00
|
|
|
void browser_window_set_scale(struct browser_window *bw, float scale, bool all);
|
2002-09-11 14:24:02 +00:00
|
|
|
|
2004-07-17 23:32:09 +00:00
|
|
|
void browser_window_mouse_click(struct browser_window *bw,
|
2005-04-15 05:52:25 +00:00
|
|
|
browser_mouse_state mouse, int x, int y);
|
|
|
|
void browser_window_mouse_track(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
|
|
|
void browser_window_mouse_drag_end(struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
|
|
|
|
2004-08-14 12:16:45 +00:00
|
|
|
bool browser_window_key_press(struct browser_window *bw, wchar_t key);
|
2005-04-20 12:24:41 +00:00
|
|
|
bool browser_window_paste_text(struct browser_window *bw, const char *utf8,
|
|
|
|
unsigned utf8_len, bool last);
|
2004-07-17 23:32:09 +00:00
|
|
|
void browser_window_form_select(struct browser_window *bw,
|
|
|
|
struct form_control *control, int item);
|
2005-04-15 18:00:21 +00:00
|
|
|
void browser_redraw_box(struct content *c, struct box *box);
|
2006-12-30 00:34:26 +00:00
|
|
|
void browser_form_submit(struct browser_window *bw, const char *target,
|
|
|
|
struct form *form, struct form_control *submit_button);
|
2004-02-25 15:12:58 +00:00
|
|
|
|
2005-04-15 05:52:25 +00:00
|
|
|
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
|
|
|
|
int width, int height);
|
|
|
|
|
2004-07-03 17:30:28 +00:00
|
|
|
/* In platform specific hotlist.c. */
|
|
|
|
void hotlist_visited(struct content *content);
|
|
|
|
|
2005-02-07 14:28:43 +00:00
|
|
|
/* In platform specific global_history.c. */
|
2006-04-09 23:21:13 +00:00
|
|
|
void global_history_add(const char *url);
|
2005-02-07 14:28:43 +00:00
|
|
|
void global_history_add_recent(const char *url);
|
|
|
|
char **global_history_get_recent(int *count);
|
|
|
|
|
2006-03-25 20:30:35 +00:00
|
|
|
/* In platform specific thumbnail.c. */
|
|
|
|
bool thumbnail_create(struct content *content, struct bitmap *bitmap,
|
|
|
|
const char *url);
|
2005-02-07 14:28:43 +00:00
|
|
|
|
2004-09-03 22:44:48 +00:00
|
|
|
/* In platform specific schedule.c. */
|
|
|
|
void schedule(int t, void (*callback)(void *p), void *p);
|
|
|
|
void schedule_remove(void (*callback)(void *p), void *p);
|
|
|
|
void schedule_run(void);
|
|
|
|
|
2005-01-13 22:42:39 +00:00
|
|
|
/* In platform specific theme_install.c. */
|
|
|
|
#ifdef WITH_THEME_INSTALL
|
|
|
|
void theme_install_start(struct content *c);
|
|
|
|
#endif
|
|
|
|
|
2002-09-11 14:24:02 +00:00
|
|
|
#endif
|