2008-08-02 18:31:32 +04:00
|
|
|
/*
|
2019-05-10 22:32:40 +03:00
|
|
|
* Copyright 2008-2019 Chris Young <chris@unsatisfactorysoftware.co.uk>
|
2008-08-02 18:31:32 +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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AMIGA_GUI_H
|
|
|
|
#define AMIGA_GUI_H
|
2016-04-20 17:54:18 +03:00
|
|
|
|
2015-09-03 02:24:04 +03:00
|
|
|
#include <stdbool.h>
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <graphics/rastport.h>
|
2008-08-09 19:19:04 +04:00
|
|
|
#include <intuition/classusr.h>
|
2008-08-23 20:17:51 +04:00
|
|
|
#include <dos/dos.h>
|
2010-10-05 23:14:46 +04:00
|
|
|
#include <devices/inputevent.h>
|
2016-04-20 17:54:18 +03:00
|
|
|
|
2016-05-30 13:01:40 +03:00
|
|
|
#include "netsurf/window.h"
|
2016-05-30 14:07:16 +03:00
|
|
|
#include "netsurf/mouse.h"
|
2016-04-20 17:54:18 +03:00
|
|
|
|
2017-01-15 19:05:07 +03:00
|
|
|
#include "amiga/gui_menu.h"
|
2015-09-03 02:24:04 +03:00
|
|
|
#include "amiga/object.h"
|
2010-12-30 03:53:11 +03:00
|
|
|
#include "amiga/os3support.h"
|
2008-08-09 02:38:13 +04:00
|
|
|
|
2015-02-24 01:58:57 +03:00
|
|
|
#ifdef __amigaos4__
|
|
|
|
#define HOOKF(ret,func,type,ptr,msgtype) static ret func(struct Hook *hook, type ptr, msgtype msg)
|
|
|
|
#else
|
2015-02-24 02:16:34 +03:00
|
|
|
#define HOOKF(ret,func,type,ptr,msgtype) static ASM ret func(REG(a0, struct Hook *hook),REG(a2, type ptr), REG(a1, msgtype msg))
|
2015-02-24 01:58:57 +03:00
|
|
|
#endif
|
|
|
|
|
2019-05-08 02:56:07 +03:00
|
|
|
/* valid options for ami_gui_get_object */
|
|
|
|
enum {
|
|
|
|
AMI_GAD_THROBBER = 0,
|
2019-05-08 03:44:44 +03:00
|
|
|
AMI_GAD_TABS,
|
|
|
|
AMI_GAD_URL,
|
2019-05-08 19:48:50 +03:00
|
|
|
AMI_GAD_SEARCH,
|
|
|
|
AMI_WIN_MAIN
|
2019-05-08 02:56:07 +03:00
|
|
|
};
|
|
|
|
|
2008-12-14 02:23:24 +03:00
|
|
|
struct find_window;
|
2017-06-11 00:21:46 +03:00
|
|
|
struct ami_history_local_window;
|
|
|
|
struct ami_menu_data;
|
2019-05-08 03:44:44 +03:00
|
|
|
struct gui_window;
|
|
|
|
struct gui_window_2;
|
|
|
|
struct IBox;
|
2008-12-14 02:23:24 +03:00
|
|
|
|
2012-11-28 23:29:43 +04:00
|
|
|
#define AMI_GUI_TOOLBAR_MAX 20
|
|
|
|
|
2016-12-30 03:59:12 +03:00
|
|
|
struct ami_win_event_table {
|
|
|
|
/* callback to handle events when using a shared msgport
|
|
|
|
*
|
|
|
|
* @param pointer to our window structure (must start with ami_generic_window)
|
|
|
|
* @return TRUE if window was destroyed during event processing
|
|
|
|
*/
|
|
|
|
BOOL (*event)(void *w);
|
|
|
|
|
|
|
|
/* callback for explicit window closure
|
|
|
|
* some windows are implicitly closed by the browser and should set this to NULL
|
|
|
|
*/
|
|
|
|
void (*close)(void *w);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ami_generic_window {
|
2010-04-10 02:38:51 +04:00
|
|
|
struct nsObject *node;
|
2016-12-30 16:06:42 +03:00
|
|
|
const struct ami_win_event_table *tbl;
|
2016-12-30 03:59:12 +03:00
|
|
|
};
|
|
|
|
|
2019-05-08 02:08:35 +03:00
|
|
|
#define IS_CURRENT_GW(GWIN,GW) (ami_gui2_get_gui_window(GWIN) == GW)
|
|
|
|
|
2016-11-20 00:40:32 +03:00
|
|
|
/* The return value for these functions must be deallocated using FreeVec() */
|
2016-11-20 00:02:42 +03:00
|
|
|
STRPTR ami_locale_langs(int *codeset);
|
2016-11-20 00:40:32 +03:00
|
|
|
char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
|
2016-11-20 00:02:42 +03:00
|
|
|
|
2016-11-20 00:40:32 +03:00
|
|
|
/* Functions lacking documentation */
|
2008-10-05 03:29:17 +04:00
|
|
|
void ami_get_msg(void);
|
2014-02-11 00:40:08 +04:00
|
|
|
void ami_try_quit(void);
|
2008-10-06 21:47:31 +04:00
|
|
|
void ami_quit_netsurf(void);
|
2013-04-04 22:46:33 +04:00
|
|
|
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw);
|
2010-10-05 23:14:46 +04:00
|
|
|
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
|
2016-07-03 20:48:46 +03:00
|
|
|
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y);
|
|
|
|
bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y,
|
2015-09-03 21:57:04 +03:00
|
|
|
int mouse_x, int mouse_y);
|
2011-02-28 22:31:35 +03:00
|
|
|
BOOL ami_gadget_hit(Object *obj, int x, int y);
|
2011-06-03 22:20:56 +04:00
|
|
|
void ami_gui_history(struct gui_window_2 *gwin, bool back);
|
2014-07-01 01:37:05 +04:00
|
|
|
void ami_gui_hotlist_update_all(void);
|
2012-12-10 00:39:10 +04:00
|
|
|
void ami_gui_tabs_toggle_all(void);
|
2013-08-15 23:10:55 +04:00
|
|
|
bool ami_locate_resource(char *fullpath, const char *file);
|
2013-11-23 16:23:56 +04:00
|
|
|
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
|
2014-01-03 22:17:25 +04:00
|
|
|
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
|
2014-10-26 18:41:44 +03:00
|
|
|
int ami_gui_count_windows(int window, int *tabs);
|
2014-12-04 14:42:12 +03:00
|
|
|
void ami_gui_set_scale(struct gui_window *gw, float scale);
|
2019-05-08 02:59:04 +03:00
|
|
|
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update);
|
|
|
|
void ami_reset_pointer(struct gui_window_2 *gwin);
|
2019-05-10 23:49:00 +03:00
|
|
|
void *ami_window_at_pointer(int type);
|
2016-01-31 20:58:27 +03:00
|
|
|
|
2019-05-10 22:59:30 +03:00
|
|
|
/**
|
|
|
|
* Beep
|
|
|
|
*/
|
|
|
|
void ami_gui_beep(void);
|
|
|
|
|
2016-01-31 20:58:27 +03:00
|
|
|
/**
|
|
|
|
* Close a window and all tabs attached to it.
|
|
|
|
*
|
2016-12-30 03:59:12 +03:00
|
|
|
* @param w gui_window_2 to act upon.
|
2016-01-31 20:58:27 +03:00
|
|
|
*/
|
2016-12-30 03:59:12 +03:00
|
|
|
void ami_gui_close_window(void *w);
|
2016-01-31 20:58:27 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Close all tabs in a window except the active one.
|
|
|
|
*
|
|
|
|
* @param gwin gui_window_2 to act upon.
|
|
|
|
*/
|
|
|
|
void ami_gui_close_inactive_tabs(struct gui_window_2 *gwin);
|
|
|
|
|
2014-11-15 16:52:06 +03:00
|
|
|
/**
|
|
|
|
* Compatibility function to get space.gadget render area.
|
|
|
|
*
|
|
|
|
* @param obj A space.gadget object.
|
|
|
|
* @param bbox A pointer to a struct IBox *.
|
|
|
|
* @return error status.
|
|
|
|
*/
|
|
|
|
nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free any data obtained via ami_gui_get_space_box().
|
|
|
|
*
|
|
|
|
* @param bbox A pointer to a struct IBox.
|
|
|
|
*/
|
|
|
|
void ami_gui_free_space_box(struct IBox *bbox);
|
|
|
|
|
2019-05-10 23:59:03 +03:00
|
|
|
/**
|
|
|
|
* Get shared message port
|
|
|
|
*
|
|
|
|
* @return Pointer to an initialised MsgPort
|
|
|
|
*/
|
|
|
|
struct MsgPort *ami_gui_get_shared_msgport(void);
|
|
|
|
|
2014-11-16 17:06:12 +03:00
|
|
|
/**
|
|
|
|
* Get the application.library ID NetSurf is registered as.
|
|
|
|
*
|
|
|
|
* @return App ID.
|
|
|
|
*/
|
|
|
|
uint32 ami_gui_get_app_id(void);
|
|
|
|
|
2019-05-10 22:59:30 +03:00
|
|
|
/**
|
|
|
|
* Get a pointer to the screen NetSurf is running on.
|
|
|
|
*
|
|
|
|
* @return Pointer to struct Screen.
|
|
|
|
*/
|
|
|
|
struct Screen *ami_gui_get_screen(void);
|
|
|
|
|
2014-11-16 19:40:41 +03:00
|
|
|
/**
|
|
|
|
* Get the string for NetSurf's screen titlebar.
|
|
|
|
*
|
|
|
|
* @return String to use as the screen's titlebar text.
|
|
|
|
*/
|
|
|
|
STRPTR ami_gui_get_screen_title(void);
|
|
|
|
|
2016-09-10 22:36:11 +03:00
|
|
|
/**
|
|
|
|
* Switch to the most-recently-opened tab
|
|
|
|
*/
|
|
|
|
void ami_gui_switch_to_new_tab(struct gui_window_2 *gwin);
|
2016-12-30 03:59:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a window to the NetSurf window list (to enable event processing)
|
|
|
|
*/
|
2016-12-30 16:06:42 +03:00
|
|
|
nserror ami_gui_win_list_add(void *win, int type, const struct ami_win_event_table *table);
|
2016-12-30 03:59:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a window from the NetSurf window list
|
|
|
|
*/
|
|
|
|
void ami_gui_win_list_remove(void *win);
|
2017-01-01 19:45:27 +03:00
|
|
|
|
2019-05-10 23:49:00 +03:00
|
|
|
/**
|
|
|
|
* Get the window list.
|
|
|
|
*
|
|
|
|
*\TODO: Nothing should be poking around in this list, but we aren't
|
|
|
|
* assigning unique IDs to windows (ARexx interface needs this)
|
|
|
|
* ami_find_gwin_by_id() is close but not ARexx-friendly
|
|
|
|
*/
|
|
|
|
struct MinList *ami_gui_get_window_list(void);
|
|
|
|
|
2017-01-01 19:45:27 +03:00
|
|
|
/**
|
|
|
|
* Get which qualifier keys are being pressed
|
|
|
|
*/
|
|
|
|
int ami_gui_get_quals(Object *win_obj);
|
2017-01-02 02:57:35 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check rect is not already queued for redraw
|
|
|
|
*/
|
|
|
|
bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects,
|
|
|
|
const struct rect *restrict new_rect, APTR mempool);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Adjust scale by specified amount
|
|
|
|
*/
|
|
|
|
void ami_gui_adjust_scale(struct gui_window *gw, float adjustment);
|
|
|
|
|
2019-05-10 22:32:40 +03:00
|
|
|
/**
|
|
|
|
* Get a pointer to the gui_window which NetSurf considers
|
|
|
|
* to be the current/active one
|
|
|
|
*/
|
|
|
|
struct gui_window *ami_gui_get_active_gw(void);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Get browser window from gui_window
|
|
|
|
*/
|
|
|
|
struct browser_window *ami_gui_get_browser_window(struct gui_window *gw);
|
|
|
|
|
2019-05-08 02:08:35 +03:00
|
|
|
/**
|
|
|
|
* Get browser window from gui_window_2
|
|
|
|
*/
|
|
|
|
struct browser_window *ami_gui2_get_browser_window(struct gui_window_2 *gwin);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Get gui_window_2 from gui_window
|
|
|
|
*/
|
|
|
|
struct gui_window_2 *ami_gui_get_gui_window_2(struct gui_window *gw);
|
|
|
|
|
2019-05-08 02:08:35 +03:00
|
|
|
/**
|
|
|
|
* Get gui_window from gui_window_2
|
|
|
|
*/
|
|
|
|
struct gui_window *ami_gui2_get_gui_window(struct gui_window_2 *gwin);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Get download list from gui_window
|
|
|
|
*/
|
|
|
|
struct List *ami_gui_get_download_list(struct gui_window *gw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get tab title from gui_window
|
|
|
|
*/
|
|
|
|
const char *ami_gui_get_tab_title(struct gui_window *gw);
|
|
|
|
|
2019-05-08 02:35:09 +03:00
|
|
|
/**
|
|
|
|
* Get window title from gui_window
|
|
|
|
*/
|
|
|
|
const char *ami_gui_get_win_title(struct gui_window *gw);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Get tab node from gui_window
|
|
|
|
*/
|
|
|
|
struct Node *ami_gui_get_tab_node(struct gui_window *gw);
|
|
|
|
|
2019-05-08 03:44:44 +03:00
|
|
|
/**
|
|
|
|
* Get tabs from gui_window_2
|
|
|
|
*/
|
|
|
|
ULONG ami_gui2_get_tabs(struct gui_window_2 *gwin);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get tab list from gui_window_2
|
|
|
|
*/
|
|
|
|
struct List *ami_gui2_get_tab_list(struct gui_window_2 *gwin);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Get favicon from gui_window
|
|
|
|
*/
|
|
|
|
struct hlcache_handle *ami_gui_get_favicon(struct gui_window *gw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get local history window from gui_window
|
|
|
|
*/
|
|
|
|
struct ami_history_local_window *ami_gui_get_history_window(struct gui_window *gw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set local history window in gui_window
|
|
|
|
*/
|
|
|
|
void ami_gui_set_history_window(struct gui_window *gw, struct ami_history_local_window *hw);
|
|
|
|
|
2019-05-08 02:30:51 +03:00
|
|
|
/**
|
|
|
|
* Set search window in gui_window
|
|
|
|
*/
|
|
|
|
void ami_gui_set_find_window(struct gui_window *gw, struct find_window *fw);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Get throbbing status from gui_window
|
|
|
|
*/
|
|
|
|
bool ami_gui_get_throbbing(struct gui_window *gw);
|
|
|
|
|
2019-05-08 02:56:07 +03:00
|
|
|
/**
|
|
|
|
* Get throbbing frame from gui_window
|
|
|
|
*/
|
|
|
|
int ami_gui_get_throbber_frame(struct gui_window *gw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set throbbing frame in gui_window
|
|
|
|
*/
|
|
|
|
void ami_gui_set_throbber_frame(struct gui_window *gw, int frame);
|
|
|
|
|
2019-05-07 23:45:40 +03:00
|
|
|
/**
|
|
|
|
* Set throbbing status in gui_window
|
|
|
|
*/
|
|
|
|
void ami_gui_set_throbbing(struct gui_window *gw, bool throbbing);
|
|
|
|
|
2019-05-08 02:56:07 +03:00
|
|
|
/**
|
|
|
|
* Get object from gui_window
|
|
|
|
*/
|
2019-05-08 03:44:44 +03:00
|
|
|
Object *ami_gui2_get_object(struct gui_window_2 *gwin, int object_type);
|
2019-05-08 02:56:07 +03:00
|
|
|
|
2019-05-07 23:58:09 +03:00
|
|
|
/**
|
|
|
|
* Get window from gui_window
|
|
|
|
*/
|
|
|
|
struct Window *ami_gui_get_window(struct gui_window *gw);
|
|
|
|
|
2019-05-08 01:43:15 +03:00
|
|
|
/**
|
|
|
|
* Get window from gui_window_2
|
|
|
|
*/
|
|
|
|
struct Window *ami_gui2_get_window(struct gui_window_2 *gwin);
|
|
|
|
|
2019-05-08 00:07:57 +03:00
|
|
|
/**
|
|
|
|
* Get imenu from gui_window
|
|
|
|
*/
|
|
|
|
struct Menu *ami_gui_get_menu(struct gui_window *gw);
|
|
|
|
|
2019-05-08 00:22:12 +03:00
|
|
|
/**
|
2019-05-08 19:48:50 +03:00
|
|
|
* Set imenu to gui_window_2. A value of NULL will free the menu (and menu_data!)
|
2019-05-08 00:22:12 +03:00
|
|
|
*/
|
|
|
|
void ami_gui2_set_menu(struct gui_window_2 *gwin, struct Menu *menu);
|
|
|
|
|
2019-05-08 19:48:50 +03:00
|
|
|
/**
|
|
|
|
* Get menu_data from gui_window_2
|
|
|
|
*/
|
|
|
|
struct ami_menu_data **ami_gui2_get_menu_data(struct gui_window_2 *gwin);
|
|
|
|
|
2019-05-08 03:44:44 +03:00
|
|
|
/**
|
|
|
|
* Set ctxmenu history tmp in gui_window_2
|
|
|
|
*/
|
|
|
|
void ami_gui2_set_ctxmenu_history_tmp(struct gui_window_2 *gwin, int temp);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get ctxmenu history tmp from gui_window_2
|
|
|
|
*/
|
|
|
|
int ami_gui2_get_ctxmenu_history_tmp(struct gui_window_2 *gwin);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get ctxmenu history from gui_window_2
|
|
|
|
*/
|
|
|
|
Object *ami_gui2_get_ctxmenu_history(struct gui_window_2 *gwin, ULONG direction);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set ctxmenu history in gui_window_2
|
|
|
|
*/
|
|
|
|
void ami_gui2_set_ctxmenu_history(struct gui_window_2 *gwin, ULONG direction, Object *ctx_hist);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set closed in gui_window_2
|
|
|
|
*/
|
|
|
|
void ami_gui2_set_closed(struct gui_window_2 *gwin, bool closed);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set new_content in gui_window_2
|
2019-05-10 23:59:03 +03:00
|
|
|
* Indicates the window needs redrawing
|
2019-05-08 03:44:44 +03:00
|
|
|
*/
|
|
|
|
void ami_gui2_set_new_content(struct gui_window_2 *gwin, bool new_content);
|
|
|
|
|
2008-08-02 18:31:32 +04:00
|
|
|
#endif
|
2014-01-11 00:32:20 +04:00
|
|
|
|