move set title, set url, start and stop throbber window operations to gui table
This commit is contained in:
parent
c8496df3df
commit
56bb9582b1
10
amiga/gui.c
10
amiga/gui.c
|
@ -3896,7 +3896,7 @@ static void gui_window_destroy(struct gui_window *g)
|
|||
win_destroyed = true;
|
||||
}
|
||||
|
||||
void gui_window_set_title(struct gui_window *g, const char *title)
|
||||
static void gui_window_set_title(struct gui_window *g, const char *title)
|
||||
{
|
||||
struct Node *node;
|
||||
ULONG cur_tab = 0;
|
||||
|
@ -4592,7 +4592,7 @@ void gui_window_set_status(struct gui_window *g, const char *text)
|
|||
}
|
||||
}
|
||||
|
||||
void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
static void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
{
|
||||
ULONG cur_tab = 0;
|
||||
|
||||
|
@ -5095,8 +5095,14 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
|||
static struct gui_table ami_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
/** Normal entry point from OS */
|
||||
|
|
|
@ -41,4 +41,9 @@ void ami_reset_pointer(struct gui_window_2 *gwin);
|
|||
* and ALWAYS in preference to SetWindowPointer(), as it features more pointers and uses
|
||||
* the correct ones specified in user preferences. */
|
||||
void ami_update_pointer(struct Window *win, gui_pointer_shape shape);
|
||||
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
14
atari/gui.c
14
atari/gui.c
|
@ -288,7 +288,7 @@ void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
|
|||
*height = rect.g_h;
|
||||
}
|
||||
|
||||
void gui_window_set_title(struct gui_window *gw, const char *title)
|
||||
static void gui_window_set_title(struct gui_window *gw, const char *title)
|
||||
{
|
||||
|
||||
if (gw == NULL)
|
||||
|
@ -540,7 +540,7 @@ void gui_window_hide_pointer(struct gui_window *w)
|
|||
}
|
||||
|
||||
|
||||
void gui_window_set_url(struct gui_window *w, const char *url)
|
||||
static void gui_window_set_url(struct gui_window *w, const char *url)
|
||||
{
|
||||
int l;
|
||||
|
||||
|
@ -594,7 +594,7 @@ static void throbber_advance( void * data )
|
|||
schedule(100, throbber_advance, gw );
|
||||
}
|
||||
|
||||
void gui_window_start_throbber(struct gui_window *w)
|
||||
static void gui_window_start_throbber(struct gui_window *w)
|
||||
{
|
||||
GRECT work;
|
||||
if (w == NULL)
|
||||
|
@ -605,7 +605,7 @@ void gui_window_start_throbber(struct gui_window *w)
|
|||
rendering = true;
|
||||
}
|
||||
|
||||
void gui_window_stop_throbber(struct gui_window *w)
|
||||
static void gui_window_stop_throbber(struct gui_window *w)
|
||||
{
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
@ -1108,8 +1108,14 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
|||
static struct gui_table atari_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
/* #define WITH_DBG_LOGFILE 1 */
|
||||
|
|
|
@ -1089,8 +1089,15 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
|||
static struct gui_table beos_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -200,5 +200,10 @@ void nsbeos_scaffolding_destroy(nsbeos_scaffolding *scaffold);
|
|||
|
||||
void nsbeos_scaffolding_popup_menu(nsbeos_scaffolding *g, BPoint where);
|
||||
|
||||
void gui_window_set_title(struct gui_window *_g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *_g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window* _g);
|
||||
void gui_window_stop_throbber(struct gui_window* _g);
|
||||
|
||||
|
||||
#endif /* NETSURF_BEOS_SCAFFOLDING_H */
|
||||
|
|
14
cocoa/gui.m
14
cocoa/gui.m
|
@ -102,7 +102,7 @@ static void gui_window_destroy(struct gui_window *g)
|
|||
[vc release];
|
||||
}
|
||||
|
||||
void gui_window_set_title(struct gui_window *g, const char *title)
|
||||
static void gui_window_set_title(struct gui_window *g, const char *title)
|
||||
{
|
||||
[(BrowserViewController *)g setTitle: [NSString stringWithUTF8String: title]];
|
||||
}
|
||||
|
@ -209,18 +209,18 @@ void gui_window_hide_pointer(struct gui_window *g)
|
|||
{
|
||||
}
|
||||
|
||||
void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
static void gui_window_set_url(struct gui_window *g, const char *url)
|
||||
{
|
||||
[(BrowserViewController *)g setUrl: [NSString stringWithUTF8String: url]];
|
||||
}
|
||||
|
||||
void gui_window_start_throbber(struct gui_window *g)
|
||||
static void gui_window_start_throbber(struct gui_window *g)
|
||||
{
|
||||
[(BrowserViewController *)g setIsProcessing: YES];
|
||||
[(BrowserViewController *)g updateBackForward];
|
||||
}
|
||||
|
||||
void gui_window_stop_throbber(struct gui_window *g)
|
||||
static void gui_window_stop_throbber(struct gui_window *g)
|
||||
{
|
||||
[(BrowserViewController *)g setIsProcessing: NO];
|
||||
[(BrowserViewController *)g updateBackForward];
|
||||
|
@ -330,8 +330,14 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
|||
|
||||
static struct gui_table gui_table = {
|
||||
.poll = &gui_poll,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_table *cocoa_gui_table = &gui_table;
|
||||
|
|
|
@ -866,7 +866,7 @@ static void browser_window_start_throbber(struct browser_window *bw)
|
|||
while (bw->parent)
|
||||
bw = bw->parent;
|
||||
|
||||
gui_window_start_throbber(bw->window);
|
||||
guit->window_start_throbber(bw->window);
|
||||
}
|
||||
|
||||
|
||||
|
@ -883,8 +883,9 @@ static void browser_window_stop_throbber(struct browser_window *bw)
|
|||
while (bw->parent)
|
||||
bw = bw->parent;
|
||||
|
||||
if (!browser_window_check_throbber(bw))
|
||||
gui_window_stop_throbber(bw->window);
|
||||
if (!browser_window_check_throbber(bw)) {
|
||||
guit->window_stop_throbber(bw->window);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1958,7 +1959,7 @@ void browser_window_update(struct browser_window *bw, bool scroll_to_top)
|
|||
|
||||
case BROWSER_WINDOW_NORMAL:
|
||||
/* Root browser window, constituting a front end window/tab */
|
||||
gui_window_set_title(bw->window,
|
||||
guit->window_set_title(bw->window,
|
||||
content_get_title(bw->current_content));
|
||||
|
||||
browser_window_update_extent(bw);
|
||||
|
@ -2358,7 +2359,7 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
|
|||
/* With no fragment, we may as well pass url straight through
|
||||
* saving a malloc, copy, free cycle.
|
||||
*/
|
||||
gui_window_set_url(bw->window, nsurl_access(url));
|
||||
guit->window_set_url(bw->window, nsurl_access(url));
|
||||
} else {
|
||||
nsurl *display_url;
|
||||
nserror error;
|
||||
|
@ -2369,7 +2370,7 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
|
|||
return;
|
||||
}
|
||||
|
||||
gui_window_set_url(bw->window, nsurl_access(display_url));
|
||||
guit->window_set_url(bw->window, nsurl_access(display_url));
|
||||
nsurl_unref(display_url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,28 +70,42 @@ struct form_control;
|
|||
* function table implementing GUI interface to browser core
|
||||
*/
|
||||
struct gui_table {
|
||||
|
||||
/* Mandantory entries */
|
||||
|
||||
/** called to let the frontend update its state and run any
|
||||
* I/O operations.
|
||||
*/
|
||||
void (*poll)(bool active); /* Mandantory */
|
||||
void (*poll)(bool active);
|
||||
|
||||
/** create a gui window for a browser window */
|
||||
struct gui_window *(*window_create)(struct browser_window *bw,
|
||||
struct browser_window *clone,
|
||||
bool new_tab); /* Mandantory */
|
||||
/** create a gui window for a browsing context */
|
||||
struct gui_window *(*window_create)(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
|
||||
/** destroy previously created gui window */
|
||||
void (*window_destroy)(struct gui_window *g); /* Mandantory */
|
||||
void (*window_destroy)(struct gui_window *g);
|
||||
|
||||
|
||||
/* Optional entries */
|
||||
|
||||
/** called to allow the gui to cleanup */
|
||||
void (*quit)(void); /* Optional */
|
||||
void (*quit)(void);
|
||||
|
||||
/** set the window title. */
|
||||
void (*window_set_title)(struct gui_window *g, const char *title);
|
||||
|
||||
/** set the navigation url. */
|
||||
void (*window_set_url)(struct gui_window *g, const char *url);
|
||||
|
||||
/** start the navigation throbber. */
|
||||
void (*window_start_throbber)(struct gui_window *g);
|
||||
|
||||
/** stop the navigation throbber. */
|
||||
void (*window_stop_throbber)(struct gui_window *g);
|
||||
|
||||
};
|
||||
|
||||
extern struct gui_table *guit; /* the gui vtable */
|
||||
|
||||
void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
void gui_window_redraw_window(struct gui_window *g);
|
||||
void gui_window_update_box(struct gui_window *g,
|
||||
const struct rect *rect);
|
||||
|
@ -105,9 +119,6 @@ void gui_window_update_extent(struct gui_window *g);
|
|||
void gui_window_set_status(struct gui_window *g, const char *text);
|
||||
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
|
||||
void gui_window_hide_pointer(struct gui_window *g);
|
||||
void gui_window_set_url(struct gui_window *g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon);
|
||||
void gui_window_set_search_ico(hlcache_handle *ico);
|
||||
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
|
||||
|
@ -119,12 +130,12 @@ bool gui_window_scroll_start(struct gui_window *g);
|
|||
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
|
||||
const struct rect *rect);
|
||||
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
void gui_window_save_link(struct gui_window *g, const char *url,
|
||||
const char *title);
|
||||
|
||||
struct gui_download_window *gui_download_window_create(download_context *ctx,
|
||||
struct gui_window *parent);
|
||||
nserror gui_download_window_data(struct gui_download_window *dw,
|
||||
nserror gui_download_window_data(struct gui_download_window *dw,
|
||||
const char *data, unsigned int size);
|
||||
void gui_download_window_error(struct gui_download_window *dw,
|
||||
const char *error_msg);
|
||||
|
@ -172,7 +183,7 @@ void gui_launch_url(const char *url);
|
|||
|
||||
struct ssl_cert_info;
|
||||
|
||||
void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
|
||||
void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
|
||||
unsigned long num, nserror (*cb)(bool proceed, void *pw),
|
||||
void *cbpw);
|
||||
|
||||
|
|
|
@ -9,6 +9,22 @@ static void gui_default_quit(void)
|
|||
{
|
||||
}
|
||||
|
||||
static void gui_default_window_set_title(struct gui_window *g, const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
static void gui_default_window_set_url(struct gui_window *g, const char *url)
|
||||
{
|
||||
}
|
||||
|
||||
static void gui_default_window_start_throbber(struct gui_window *g)
|
||||
{
|
||||
}
|
||||
|
||||
static void gui_default_window_stop_throbber(struct gui_window *g)
|
||||
{
|
||||
}
|
||||
|
||||
nserror gui_factory_register(struct gui_table *gt)
|
||||
{
|
||||
/* ensure not already initialised */
|
||||
|
@ -31,7 +47,19 @@ nserror gui_factory_register(struct gui_table *gt)
|
|||
|
||||
/* fill in the optional entries with defaults */
|
||||
if (gt->quit == NULL) {
|
||||
gt->quit = &gui_default_quit;
|
||||
gt->quit = gui_default_quit;
|
||||
}
|
||||
if (gt->window_set_title == NULL) {
|
||||
gt->window_set_title = gui_default_window_set_title;
|
||||
}
|
||||
if (gt->window_set_url == NULL) {
|
||||
gt->window_set_url = gui_default_window_set_url;
|
||||
}
|
||||
if (gt->window_start_throbber == NULL) {
|
||||
gt->window_start_throbber = gui_default_window_start_throbber;
|
||||
}
|
||||
if (gt->window_stop_throbber == NULL) {
|
||||
gt->window_stop_throbber = gui_default_window_stop_throbber;
|
||||
}
|
||||
|
||||
guit = gt;
|
||||
|
|
|
@ -1535,12 +1535,6 @@ gui_window_destroy(struct gui_window *gw)
|
|||
free(gw);
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_set_title(struct gui_window *g, const char *title)
|
||||
{
|
||||
LOG(("%p, %s", g, title));
|
||||
}
|
||||
|
||||
void
|
||||
gui_window_redraw_window(struct gui_window *g)
|
||||
{
|
||||
|
@ -1657,7 +1651,7 @@ gui_window_hide_pointer(struct gui_window *g)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_set_url(struct gui_window *g, const char *url)
|
||||
{
|
||||
fbtk_set_text(g->url, url);
|
||||
|
@ -1720,14 +1714,14 @@ throbber_advance(void *pw)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_start_throbber(struct gui_window *g)
|
||||
{
|
||||
g->throbber_index = 0;
|
||||
schedule(10, throbber_advance, g);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_stop_throbber(struct gui_window *gw)
|
||||
{
|
||||
gw->throbber_index = -1;
|
||||
|
@ -1903,8 +1897,13 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
|||
static struct gui_table framebuffer_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
/** Entry point from OS.
|
||||
|
|
|
@ -1135,8 +1135,14 @@ bool path_add_part(char *path, int length, const char *newpart)
|
|||
static struct gui_table nsgtk_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -177,4 +177,11 @@ gboolean nsgtk_window_url_changed(GtkWidget *, GdkEventKey *, gpointer);
|
|||
|
||||
nserror nsgtk_scaffolding_new_tab(struct gui_window *gw);
|
||||
|
||||
/* core acessors */
|
||||
void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
|
||||
#endif /* NETSURF_GTK_SCAFFOLDING_H */
|
||||
|
|
|
@ -46,5 +46,9 @@ void monkey_kill_browser_windows(void);
|
|||
|
||||
struct gui_window *gui_window_create(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
void gui_window_destroy(struct gui_window *g);
|
||||
void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
#endif /* NETSURF_MONKEY_BROWSER_H */
|
||||
|
|
|
@ -116,8 +116,14 @@ static bool nslog_stream_configure(FILE *fptr)
|
|||
static struct gui_table monkey_gui_table = {
|
||||
.poll = monkey_poll,
|
||||
.quit = monkey_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -840,8 +840,14 @@ static bool nslog_stream_configure(FILE *fptr)
|
|||
static struct gui_table riscos_gui_table = {
|
||||
.poll = gui_poll,
|
||||
.quit = gui_quit,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -29,9 +29,15 @@ void ro_gui_window_initialise(void);
|
|||
|
||||
bool ro_gui_window_check_menu(wimp_menu *menu);
|
||||
|
||||
/* core acessors */
|
||||
struct gui_window *gui_window_create(struct browser_window *bw, struct browser_window *clone, bool new_tab);
|
||||
void gui_window_destroy(struct gui_window *g);
|
||||
|
||||
void gui_window_set_title(struct gui_window *g, const char *title);
|
||||
void gui_window_set_url(struct gui_window *g, const char *url);
|
||||
void gui_window_start_throbber(struct gui_window *g);
|
||||
void gui_window_stop_throbber(struct gui_window *g);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1422,7 +1422,7 @@ static void gui_window_destroy(struct gui_window *w)
|
|||
* set window title
|
||||
* \param title the [url]
|
||||
*/
|
||||
void gui_window_set_title(struct gui_window *w, const char *title)
|
||||
static void gui_window_set_title(struct gui_window *w, const char *title)
|
||||
{
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
@ -1654,7 +1654,7 @@ void gui_window_hide_pointer(struct gui_window *w)
|
|||
{
|
||||
}
|
||||
|
||||
void gui_window_set_url(struct gui_window *w, const char *url)
|
||||
static void gui_window_set_url(struct gui_window *w, const char *url)
|
||||
{
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
@ -1662,7 +1662,7 @@ void gui_window_set_url(struct gui_window *w, const char *url)
|
|||
}
|
||||
|
||||
|
||||
void gui_window_start_throbber(struct gui_window *w)
|
||||
static void gui_window_start_throbber(struct gui_window *w)
|
||||
{
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
@ -1687,7 +1687,7 @@ void gui_window_start_throbber(struct gui_window *w)
|
|||
Animate_Play(w->throbber, 0, -1, -1);
|
||||
}
|
||||
|
||||
void gui_window_stop_throbber(struct gui_window *w)
|
||||
static void gui_window_stop_throbber(struct gui_window *w)
|
||||
{
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
@ -1886,8 +1886,14 @@ nsws_create_main_class(HINSTANCE hinstance) {
|
|||
|
||||
static struct gui_table gui_table = {
|
||||
.poll = gui_poll,
|
||||
|
||||
.window_create = gui_window_create,
|
||||
.window_destroy = gui_window_destroy,
|
||||
|
||||
.window_set_title = gui_window_set_title,
|
||||
.window_set_url = gui_window_set_url,
|
||||
.window_start_throbber = gui_window_start_throbber,
|
||||
.window_stop_throbber = gui_window_stop_throbber,
|
||||
};
|
||||
|
||||
struct gui_table *win32_gui_table = &gui_table;
|
||||
|
|
Loading…
Reference in New Issue