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>
|
|
|
|
* Copyright 2003 James Bursa <bursa@users.sourceforge.net>
|
2002-09-11 18:24:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_DESKTOP_BROWSER_H_
|
|
|
|
#define _NETSURF_DESKTOP_BROWSER_H_
|
|
|
|
|
2003-02-28 14:49:13 +03:00
|
|
|
#include <time.h>
|
2003-02-09 15:58:15 +03:00
|
|
|
#include "netsurf/content/content.h"
|
2002-09-11 18:24:02 +04:00
|
|
|
#include "netsurf/desktop/gui.h"
|
2003-02-09 15:58:15 +03:00
|
|
|
#include "netsurf/render/box.h"
|
2002-09-11 18:24:02 +04:00
|
|
|
|
|
|
|
typedef int browser_window_flags;
|
|
|
|
#define browser_TOOLBAR ((browser_window_flags) 1)
|
|
|
|
#define browser_TITLE ((browser_window_flags) 2)
|
|
|
|
#define browser_SCROLL_X_NONE ((browser_window_flags) 4)
|
|
|
|
#define browser_SCROLL_X_AUTO ((browser_window_flags) 8)
|
|
|
|
#define browser_SCROLL_X_ALWAYS ((browser_window_flags) 16)
|
|
|
|
#define browser_SCROLL_Y_NONE ((browser_window_flags) 32)
|
|
|
|
#define browser_SCROLL_Y_AUTO ((browser_window_flags) 64)
|
|
|
|
#define browser_SCROLL_Y_ALWAYS ((browser_window_flags) 128)
|
|
|
|
|
|
|
|
typedef int action_buttons;
|
|
|
|
#define act_BUTTON_NORMAL ((action_buttons) 4)
|
|
|
|
#define act_BUTTON_ALTERNATIVE ((action_buttons) 1)
|
|
|
|
#define act_BUTTON_CONTEXT_MENU ((action_buttons) 2)
|
|
|
|
|
|
|
|
struct history
|
|
|
|
{
|
|
|
|
struct history* earlier;
|
|
|
|
struct history* later;
|
|
|
|
char* description;
|
|
|
|
char* url;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct history* history_create(char* desc, char* url);
|
|
|
|
void history_remember(struct history* current, char* desc, char* url);
|
|
|
|
|
|
|
|
|
|
|
|
struct browser_window
|
|
|
|
{
|
2003-03-04 01:40:39 +03:00
|
|
|
unsigned long format_width;
|
|
|
|
unsigned long format_height;
|
2002-09-11 18:24:02 +04:00
|
|
|
struct { int mult; int div; } scale;
|
|
|
|
|
|
|
|
struct content* current_content;
|
2003-07-15 02:57:45 +04:00
|
|
|
void *current_content_state;
|
2003-06-17 23:24:21 +04:00
|
|
|
struct content* loading_content;
|
2002-09-11 18:24:02 +04:00
|
|
|
struct history* history;
|
2003-02-28 14:49:13 +03:00
|
|
|
clock_t time0;
|
2002-09-11 18:24:02 +04:00
|
|
|
|
|
|
|
char* url;
|
|
|
|
|
|
|
|
browser_window_flags flags;
|
|
|
|
gui_window* window;
|
2002-10-15 14:41:12 +04:00
|
|
|
|
|
|
|
int throbbing;
|
2003-09-23 01:55:08 +04:00
|
|
|
|
|
|
|
void (*caret_callback)(struct browser_window *bw, char key, void *p);
|
|
|
|
void *caret_p;
|
2002-09-11 18:24:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct browser_action
|
|
|
|
{
|
|
|
|
enum { act_UNKNOWN,
|
|
|
|
act_MOUSE_AT, act_MOUSE_CLICK, act_START_NEW_SELECTION,
|
|
|
|
act_ALTER_SELECTION, act_CLEAR_SELECTION,
|
2002-12-31 01:56:30 +03:00
|
|
|
act_FOLLOW_LINK, act_FOLLOW_LINK_NEW_WINDOW,
|
|
|
|
act_GADGET_SELECT
|
2002-09-11 18:24:02 +04:00
|
|
|
} type;
|
|
|
|
union {
|
|
|
|
struct {
|
2003-03-04 01:40:39 +03:00
|
|
|
unsigned long x;
|
|
|
|
unsigned long y;
|
2002-09-11 18:24:02 +04:00
|
|
|
action_buttons buttons;
|
|
|
|
} mouse;
|
2002-12-31 01:56:30 +03:00
|
|
|
struct {
|
|
|
|
struct gui_gadget* g;
|
|
|
|
int item;
|
|
|
|
} gadget_select;
|
2002-09-11 18:24:02 +04:00
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
2002-12-31 01:56:30 +03:00
|
|
|
struct box_selection
|
|
|
|
{
|
|
|
|
struct box* box;
|
|
|
|
int actual_x;
|
|
|
|
int actual_y;
|
|
|
|
int plot_index;
|
|
|
|
};
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
struct browser_window* create_browser_window(int flags, int width, int height);
|
|
|
|
void browser_window_destroy(struct browser_window* bw);
|
2003-03-04 14:59:36 +03:00
|
|
|
void browser_window_open_location(struct browser_window* bw, const char* url);
|
|
|
|
void browser_window_open_location_historical(struct browser_window* bw, const char* url);
|
2002-09-11 18:24:02 +04:00
|
|
|
int browser_window_action(struct browser_window* bw, struct browser_action* act);
|
2003-02-09 22:33:32 +03:00
|
|
|
void browser_window_set_status(struct browser_window* bw, const char* text);
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2002-10-15 14:41:12 +04:00
|
|
|
void browser_window_back(struct browser_window* bw);
|
|
|
|
void browser_window_forward(struct browser_window* bw);
|
|
|
|
|
2003-03-04 14:59:36 +03:00
|
|
|
void box_under_area(struct box* box, unsigned long x, unsigned long y, unsigned long ox, unsigned long oy,
|
|
|
|
struct box_selection** found, int* count, int* plot_index);
|
2002-10-15 14:41:12 +04:00
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
int box_position_lt(struct box_position* x, struct box_position* y);
|
|
|
|
int box_position_gt(struct box_position* x, struct box_position* y);
|
|
|
|
int box_position_eq(struct box_position* x, struct box_position* y);
|
|
|
|
int box_position_distance(struct box_position* x, struct box_position* y);
|
|
|
|
|
2003-03-04 14:59:36 +03:00
|
|
|
void gui_redraw_gadget(struct browser_window* bw, struct gui_gadget* g);
|
2002-09-11 18:24:02 +04:00
|
|
|
|
2003-04-15 21:53:00 +04:00
|
|
|
void browser_window_stop_throbber(struct browser_window* bw);
|
2003-07-15 02:57:45 +04:00
|
|
|
void browser_window_reformat(struct browser_window* bw, int scroll_to_top);
|
2003-04-15 21:53:00 +04:00
|
|
|
|
2003-09-23 01:55:08 +04:00
|
|
|
void browser_window_key_press(struct browser_window *bw, char key);
|
|
|
|
|
2002-09-11 18:24:02 +04:00
|
|
|
#endif
|