2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
2004-02-25 18:12:58 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \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>
|
2004-08-14 16:16:45 +04:00
|
|
|
#include <stddef.h>
|
2003-02-28 14:49:13 +03:00
|
|
|
#include <time.h>
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
struct box;
|
2004-07-18 21:38:01 +04:00
|
|
|
struct content;
|
|
|
|
struct form_control;
|
2004-06-21 19:09:59 +04:00
|
|
|
struct form_successful_control;
|
2004-07-17 17:00:38 +04:00
|
|
|
struct gui_window;
|
|
|
|
struct history;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/** Browser window data. */
|
2004-10-18 01:11:29 +04:00
|
|
|
struct browser_window {
|
2004-02-25 18:12:58 +03: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 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/** Window history structure. */
|
|
|
|
struct history *history;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/** Handler for keyboard input, or 0. */
|
2004-07-19 18:31:31 +04:00
|
|
|
void (*caret_callback)(struct browser_window *bw,
|
2004-08-14 16:16:45 +04:00
|
|
|
wchar_t key, void *p);
|
2004-02-25 18:12:58 +03:00
|
|
|
/** User parameter for caret_callback. */
|
|
|
|
void *caret_p;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-07-17 17:00:38 +04:00
|
|
|
/** Platform specific window data. */
|
|
|
|
struct gui_window *window;
|
2004-02-25 18:12:58 +03:00
|
|
|
|
|
|
|
/** Busy indicator is active. */
|
|
|
|
bool throbbing;
|
|
|
|
/** Add loading_content to the window history when it loads. */
|
|
|
|
bool history_add;
|
|
|
|
/** Start time of fetching loading_content. */
|
|
|
|
clock_t time0;
|
2004-08-07 02:19:13 +04:00
|
|
|
|
2004-10-18 01:11:29 +04:00
|
|
|
/** Fragment identifier for current_content. */
|
2004-08-07 02:19:13 +04:00
|
|
|
char *frag_id;
|
2004-08-26 03:56:49 +04:00
|
|
|
|
2004-10-18 01:11:29 +04:00
|
|
|
/** Current drag status. */
|
|
|
|
enum { DRAGGING_NONE, DRAGGING_VSCROLL, DRAGGING_HSCROLL } drag_type;
|
|
|
|
|
2004-08-26 03:56:49 +04:00
|
|
|
/** Box currently being scrolled, or 0. */
|
|
|
|
struct box *scrolling_box;
|
2004-11-20 03:02:56 +03:00
|
|
|
/** Mouse position at start of current scroll drag. */
|
|
|
|
int scrolling_start_x;
|
|
|
|
int scrolling_start_y;
|
|
|
|
/** Scroll offsets at start of current scroll draw. */
|
|
|
|
int scrolling_start_scroll_x;
|
|
|
|
int scrolling_start_scroll_y;
|
|
|
|
/** Well dimensions for current scroll drag. */
|
|
|
|
int scrolling_well_width;
|
|
|
|
int scrolling_well_height;
|
2004-10-02 03:19:08 +04:00
|
|
|
|
|
|
|
/** Referer for current fetch, or 0. */
|
|
|
|
char *referer;
|
2002-09-11 18:24:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
typedef enum {
|
|
|
|
BROWSER_MOUSE_CLICK_1,
|
|
|
|
BROWSER_MOUSE_CLICK_2,
|
|
|
|
BROWSER_MOUSE_HOVER,
|
2004-08-26 03:56:49 +04:00
|
|
|
BROWSER_MOUSE_DRAG, /**< CLICK is continuing as a drag. */
|
2004-07-18 03:32:09 +04:00
|
|
|
} browser_mouse_click;
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-10-02 01:31:55 +04:00
|
|
|
void browser_window_create(const char *url, struct browser_window *clone,
|
|
|
|
char *referer);
|
2004-10-01 04:06:49 +04:00
|
|
|
void browser_window_go(struct browser_window *bw, const char *url,
|
2004-10-02 01:31:55 +04:00
|
|
|
char *referer);
|
2004-02-25 18:12:58 +03:00
|
|
|
void browser_window_go_post(struct browser_window *bw, const char *url,
|
|
|
|
char *post_urlenc,
|
|
|
|
struct form_successful_control *post_multipart,
|
2004-10-02 01:31:55 +04:00
|
|
|
bool history_add, char *referer);
|
2004-02-25 18:12:58 +03:00
|
|
|
void browser_window_stop(struct browser_window *bw);
|
2004-06-29 23:08:19 +04:00
|
|
|
void browser_window_reload(struct browser_window *bw, bool all);
|
2004-02-25 18:12:58 +03:00
|
|
|
void browser_window_destroy(struct browser_window *bw);
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2004-07-18 03:32:09 +04:00
|
|
|
void browser_window_mouse_click(struct browser_window *bw,
|
|
|
|
browser_mouse_click click, int x, int y);
|
2004-08-14 16:16:45 +04:00
|
|
|
bool browser_window_key_press(struct browser_window *bw, wchar_t key);
|
2004-07-18 03:32:09 +04:00
|
|
|
void browser_window_form_select(struct browser_window *bw,
|
|
|
|
struct form_control *control, int item);
|
2004-02-25 18:12:58 +03:00
|
|
|
|
2004-07-03 21:30:28 +04:00
|
|
|
/* In platform specific hotlist.c. */
|
|
|
|
void hotlist_visited(struct content *content);
|
|
|
|
|
2004-02-25 18:12:58 +03:00
|
|
|
/* In platform specific history.c. */
|
|
|
|
struct history *history_create(void);
|
2004-08-07 02:19:13 +04:00
|
|
|
void history_add(struct history *history, struct content *content,
|
|
|
|
char *frag_id);
|
2004-02-25 18:12:58 +03:00
|
|
|
void history_update(struct history *history, struct content *content);
|
|
|
|
void history_destroy(struct history *history);
|
2004-02-26 20:52:10 +03:00
|
|
|
void history_back(struct browser_window *bw, struct history *history);
|
|
|
|
void history_forward(struct browser_window *bw, struct history *history);
|
2004-06-27 02:31:34 +04:00
|
|
|
bool history_back_available(struct history *history);
|
|
|
|
bool history_forward_available(struct history *history);
|
2003-11-15 03:26:42 +03:00
|
|
|
|
2004-09-04 02:44:48 +04: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);
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
#endif
|