2008-08-02 18:31:32 +04:00
|
|
|
/*
|
2014-01-03 22:17:25 +04:00
|
|
|
* Copyright 2008-2014 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
|
2014-10-18 02:18:58 +04:00
|
|
|
|
2008-08-09 02:38:13 +04:00
|
|
|
#include <graphics/rastport.h>
|
2008-08-09 19:19:04 +04:00
|
|
|
#include "amiga/object.h"
|
|
|
|
#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>
|
2010-12-30 03:53:11 +03:00
|
|
|
#include "amiga/os3support.h"
|
2009-07-09 22:52:55 +04:00
|
|
|
#include "amiga/plotters.h"
|
2010-10-05 23:14:46 +04:00
|
|
|
#include "amiga/menu.h"
|
2008-08-09 02:38:13 +04:00
|
|
|
|
2008-08-09 19:19:04 +04:00
|
|
|
enum
|
|
|
|
{
|
2010-02-13 21:03:05 +03:00
|
|
|
OID_MAIN = 0,
|
|
|
|
OID_VSCROLL,
|
|
|
|
OID_HSCROLL,
|
|
|
|
OID_LAST, /* for compatibility */
|
|
|
|
GID_MAIN,
|
2008-10-05 17:17:18 +04:00
|
|
|
GID_TABLAYOUT,
|
2008-08-09 19:19:04 +04:00
|
|
|
GID_BROWSER,
|
|
|
|
GID_STATUS,
|
|
|
|
GID_URL,
|
2009-12-19 03:39:52 +03:00
|
|
|
GID_ICON,
|
2008-08-09 19:19:04 +04:00
|
|
|
GID_STOP,
|
|
|
|
GID_RELOAD,
|
|
|
|
GID_HOME,
|
|
|
|
GID_BACK,
|
|
|
|
GID_FORWARD,
|
2008-09-14 02:39:48 +04:00
|
|
|
GID_THROBBER,
|
2009-12-22 02:25:35 +03:00
|
|
|
GID_SEARCH_ICON,
|
2013-11-23 16:23:56 +04:00
|
|
|
GID_FAVE,
|
2013-11-23 17:11:30 +04:00
|
|
|
GID_FAVE_ADD,
|
|
|
|
GID_FAVE_RMV,
|
2008-10-06 01:20:12 +04:00
|
|
|
GID_CLOSETAB,
|
2010-02-14 03:46:53 +03:00
|
|
|
GID_CLOSETAB_BM,
|
2010-02-14 17:00:33 +03:00
|
|
|
GID_ADDTAB,
|
|
|
|
GID_ADDTAB_BM,
|
2008-10-05 03:29:17 +04:00
|
|
|
GID_TABS,
|
2010-02-14 03:46:53 +03:00
|
|
|
GID_TABS_FLAG,
|
2008-08-31 01:32:05 +04:00
|
|
|
GID_USER,
|
|
|
|
GID_PASS,
|
|
|
|
GID_LOGIN,
|
|
|
|
GID_CANCEL,
|
2008-12-14 02:23:24 +03:00
|
|
|
GID_NEXT,
|
|
|
|
GID_PREV,
|
|
|
|
GID_SEARCHSTRING,
|
2009-12-18 02:55:02 +03:00
|
|
|
GID_SHOWALL,
|
|
|
|
GID_CASE,
|
2009-12-23 02:04:59 +03:00
|
|
|
GID_TOOLBARLAYOUT,
|
2012-11-28 23:29:43 +04:00
|
|
|
GID_HOTLIST,
|
|
|
|
GID_HOTLISTLAYOUT,
|
2012-11-29 02:42:23 +04:00
|
|
|
GID_HOTLISTSEPBAR,
|
2009-08-29 03:12:18 +04:00
|
|
|
GID_HSCROLL,
|
2014-10-26 19:35:05 +03:00
|
|
|
GID_HSCROLLLAYOUT,
|
2014-10-25 18:08:04 +04:00
|
|
|
GID_VSCROLL,
|
|
|
|
GID_VSCROLLLAYOUT,
|
2010-02-13 21:03:05 +03:00
|
|
|
GID_LAST
|
2008-08-09 19:19:04 +04:00
|
|
|
};
|
|
|
|
|
2008-12-14 02:23:24 +03:00
|
|
|
struct find_window;
|
2009-03-15 14:21:46 +03:00
|
|
|
struct history_window;
|
2008-12-14 02:23:24 +03:00
|
|
|
|
2012-11-28 23:29:43 +04:00
|
|
|
#define AMI_GUI_TOOLBAR_MAX 20
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
struct gui_window_2 {
|
2010-04-10 02:38:51 +04:00
|
|
|
struct nsObject *node;
|
2008-08-02 18:31:32 +04:00
|
|
|
struct Window *win;
|
2010-02-14 03:46:53 +03:00
|
|
|
Object *objects[GID_LAST];
|
2014-11-16 17:24:18 +03:00
|
|
|
struct gui_window *gw; /* currently-displayed gui_window */
|
2008-08-23 20:17:51 +04:00
|
|
|
bool redraw_required;
|
2008-09-21 02:07:11 +04:00
|
|
|
int throbber_frame;
|
2008-10-05 03:29:17 +04:00
|
|
|
struct List tab_list;
|
2008-10-05 17:17:18 +04:00
|
|
|
ULONG tabs;
|
|
|
|
ULONG next_tab;
|
2008-08-11 21:53:45 +04:00
|
|
|
struct Hook scrollerhook;
|
2008-08-18 23:07:12 +04:00
|
|
|
struct form_control *control;
|
|
|
|
browser_mouse_state mouse_state;
|
2008-09-01 22:03:40 +04:00
|
|
|
browser_mouse_state key_state;
|
2008-09-14 02:39:48 +04:00
|
|
|
ULONG throbber_update_count;
|
2008-12-14 02:23:24 +03:00
|
|
|
struct find_window *searchwin;
|
2009-01-11 00:31:21 +03:00
|
|
|
ULONG oldh;
|
|
|
|
ULONG oldv;
|
2011-03-01 02:46:49 +03:00
|
|
|
int temp;
|
2009-05-31 19:05:26 +04:00
|
|
|
bool redraw_scroll;
|
2009-06-03 23:44:43 +04:00
|
|
|
bool new_content;
|
2010-10-05 23:14:46 +04:00
|
|
|
char *menulab[AMI_MENU_AREXX_MAX + 1];
|
2013-05-18 18:34:25 +04:00
|
|
|
Object *menuobj[AMI_MENU_AREXX_MAX + 1];
|
2010-10-05 23:14:46 +04:00
|
|
|
char menukey[AMI_MENU_AREXX_MAX + 1];
|
2013-08-18 18:15:12 +04:00
|
|
|
char *menuicon[AMI_MENU_AREXX_MAX + 1];
|
2012-04-29 19:59:37 +04:00
|
|
|
struct Hook menu_hook[AMI_MENU_AREXX_MAX + 1];
|
2010-10-05 23:14:46 +04:00
|
|
|
UBYTE *menutype;
|
|
|
|
struct NewMenu *menu;
|
|
|
|
ULONG hotlist_items;
|
2012-11-28 23:29:43 +04:00
|
|
|
char *hotlist_toolbar_lab[AMI_GUI_TOOLBAR_MAX];
|
|
|
|
struct List hotlist_toolbar_list;
|
2014-06-15 18:39:49 +04:00
|
|
|
struct List *web_search_list;
|
|
|
|
Object *search_bm;
|
2009-07-23 15:23:34 +04:00
|
|
|
char *svbuffer;
|
2009-08-29 14:16:19 +04:00
|
|
|
char *status;
|
2009-09-16 02:49:33 +04:00
|
|
|
char *wintitle;
|
2010-03-17 02:55:39 +03:00
|
|
|
char *helphints[GID_LAST];
|
2013-02-12 23:12:14 +04:00
|
|
|
browser_mouse_state prev_mouse_state;
|
2010-12-17 02:28:33 +03:00
|
|
|
struct timeval lastclick;
|
2011-02-28 22:31:35 +03:00
|
|
|
BOOL rmbtrapped;
|
2011-07-03 15:05:18 +04:00
|
|
|
struct AppIcon *appicon; /* iconify appicon */
|
|
|
|
struct DiskObject *dobj; /* iconify appicon */
|
2012-04-29 19:59:37 +04:00
|
|
|
struct Hook favicon_hook;
|
|
|
|
struct Hook throbber_hook;
|
2012-01-12 01:41:55 +04:00
|
|
|
gui_drag_type drag_op;
|
|
|
|
struct IBox *ptr_lock;
|
2012-04-28 23:43:46 +04:00
|
|
|
struct AppWindow *appwin;
|
2012-08-05 14:28:48 +04:00
|
|
|
struct MinList shared_pens;
|
2013-01-06 04:21:15 +04:00
|
|
|
gui_pointer_shape mouse_pointer;
|
2015-01-29 22:18:49 +03:00
|
|
|
#ifndef __amigaos4__
|
2015-01-29 22:31:47 +03:00
|
|
|
struct NewMenu *menu_os3;
|
2015-01-29 22:18:49 +03:00
|
|
|
struct VisualInfo *vi;
|
|
|
|
#endif
|
2008-08-02 18:31:32 +04:00
|
|
|
};
|
|
|
|
|
2008-10-05 03:29:17 +04:00
|
|
|
struct gui_window
|
|
|
|
{
|
|
|
|
struct gui_window_2 *shared;
|
|
|
|
int tab;
|
|
|
|
struct Node *tab_node;
|
2011-07-03 02:40:45 +04:00
|
|
|
struct Node *last_new_tab;
|
2011-03-19 16:00:45 +03:00
|
|
|
int c_x; /* Caret X posn */
|
|
|
|
int c_y; /* Caret Y posn */
|
|
|
|
int c_w; /* Caret width */
|
|
|
|
int c_h; /* Caret height */
|
2010-03-15 22:00:21 +03:00
|
|
|
int c_h_temp;
|
2008-11-09 02:08:55 +03:00
|
|
|
int scrollx;
|
|
|
|
int scrolly;
|
2009-03-15 14:21:46 +03:00
|
|
|
struct history_window *hw;
|
2009-03-28 15:50:19 +03:00
|
|
|
struct List dllist;
|
2010-03-28 19:51:05 +04:00
|
|
|
hlcache_handle *favicon;
|
2009-09-06 14:48:14 +04:00
|
|
|
bool throbbing;
|
2010-03-18 01:15:03 +03:00
|
|
|
char *tabtitle;
|
2013-02-03 18:01:48 +04:00
|
|
|
struct MinList *deferred_rects;
|
2014-11-16 17:24:18 +03:00
|
|
|
struct browser_window *bw;
|
2014-12-04 14:42:12 +03:00
|
|
|
float scale;
|
2008-10-05 03:29:17 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
void ami_get_msg(void);
|
2008-10-06 11:07:33 +04:00
|
|
|
void ami_close_all_tabs(struct gui_window_2 *gwin);
|
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);
|
2009-06-22 02:12:52 +04:00
|
|
|
STRPTR ami_locale_langs(void);
|
2010-10-05 23:14:46 +04:00
|
|
|
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
|
2012-10-11 23:13:38 +04:00
|
|
|
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *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-06-30 01:35:52 +04:00
|
|
|
char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail);
|
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);
|
2010-07-24 20:39:37 +04:00
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
2008-08-31 01:32:05 +04:00
|
|
|
struct MinList *window_list;
|
|
|
|
struct Screen *scrn;
|
2008-09-21 20:28:45 +04:00
|
|
|
struct MsgPort *sport;
|
2014-11-16 19:01:59 +03:00
|
|
|
struct gui_window *cur_gw;
|
2009-07-07 23:28:34 +04:00
|
|
|
struct gui_globals browserglob;
|
2010-10-24 21:51:00 +04:00
|
|
|
BOOL ami_autoscroll;
|
2014-01-11 00:32:20 +04:00
|
|
|
BOOL popupmenu_lib_ok;
|
2008-08-02 18:31:32 +04:00
|
|
|
#endif
|
2014-01-11 00:32:20 +04:00
|
|
|
|