summaryrefslogtreecommitdiff
path: root/frontends/amiga/menu.h
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/amiga/menu.h')
-rw-r--r--frontends/amiga/menu.h153
1 files changed, 17 insertions, 136 deletions
diff --git a/frontends/amiga/menu.h b/frontends/amiga/menu.h
index ad0e96d93..358faa486 100644
--- a/frontends/amiga/menu.h
+++ b/frontends/amiga/menu.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2009,2013 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -23,156 +23,37 @@
#include <intuition/intuition.h>
#include <libraries/gadtools.h>
-struct hlcache_handle;
-struct ami_menu_data;
+struct ami_menu_data {
+ char *restrict menulab;
+ Object *restrict menuobj;
+ char *restrict menukey;
+ char *restrict menuicon;
+ struct Hook menu_hook;
+ UBYTE menutype;
+ UWORD flags;
+};
/** empty space */
#define NSA_SPACE "blankspace.png"
-/** Maximum number of hotlist items (somewhat arbitrary value) */
-#define AMI_HOTLIST_ITEMS 60
-
-/** Maximum number of ARexx menu items (somewhat arbitrary value) */
-#define AMI_MENU_AREXX_ITEMS 20
-
-/** enum menu structure, has to be here as we need it below. */
-enum {
- /* Project menu */
- M_PROJECT = 0,
- M_NEWWIN,
- M_NEWTAB,
- M_BAR_P1,
- M_OPEN,
- M_SAVEAS,
- M_SAVESRC,
- M_SAVETXT,
- M_SAVECOMP,
- M_SAVEIFF,
-#ifdef WITH_PDF_EXPORT
- M_SAVEPDF,
-#endif
- M_BAR_P2,
- M_PRINT,
- M_BAR_P3,
- M_CLOSETAB,
- M_CLOSEWIN,
- M_BAR_P4,
- M_ABOUT,
- M_BAR_P5,
- M_QUIT,
- /* Edit menu */
- M_EDIT,
- M_CUT,
- M_COPY,
- M_PASTE,
- M_BAR_E1,
- M_SELALL,
- M_CLEAR,
- M_BAR_E2,
- M_UNDO,
- M_REDO,
- /* Browser menu */
- M_BROWSER,
- M_FIND,
- M_BAR_B1,
- M_HISTLOCL,
- M_HISTGLBL,
- M_BAR_B2,
- M_COOKIES,
- M_BAR_B3,
- M_SCALE,
- M_SCALEDEC,
- M_SCALENRM,
- M_SCALEINC,
- M_IMAGES,
- M_IMGFORE,
- M_IMGBACK,
- M_JS,
- M_BAR_B4,
- M_REDRAW,
- /* Hotlist menu */
- M_HOTLIST,
- M_HLADD,
- M_HLSHOW,
- M_BAR_H1, // 47
- AMI_MENU_HOTLIST, /* Where the hotlist entries start */
- AMI_MENU_HOTLIST_MAX = AMI_MENU_HOTLIST + AMI_HOTLIST_ITEMS,
- /* Settings menu */
- M_PREFS,
- M_PREDIT,
- M_BAR_S1,
- M_SNAPSHOT,
- M_PRSAVE,
- /* ARexx menu */
- M_AREXX,
- M_AREXXEX,
- M_BAR_A1,
- AMI_MENU_AREXX,
- AMI_MENU_AREXX_MAX = AMI_MENU_AREXX + AMI_MENU_AREXX_ITEMS
-};
-
-/* We can get away with AMI_MENU_MAX falling short as it is
- * only used for freeing the UTF-8 converted menu labels */
-#define AMI_MENU_MAX AMI_MENU_AREXX
-
-/* The Intuition menu numbers of some menus we might need to modify */
-#define AMI_MENU_SAVEAS_TEXT FULLMENUNUM(0,4,1)
-#define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2)
-#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3)
-#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4)
-#define AMI_MENU_CLOSETAB FULLMENUNUM(0,8,0)
-#define AMI_MENU_CUT FULLMENUNUM(1,0,0)
-#define AMI_MENU_COPY FULLMENUNUM(1,1,0)
-#define AMI_MENU_PASTE FULLMENUNUM(1,2,0)
-#define AMI_MENU_SELECTALL FULLMENUNUM(1,4,0)
-#define AMI_MENU_CLEAR FULLMENUNUM(1,5,0)
-#define AMI_MENU_UNDO FULLMENUNUM(1,8,0)
-#define AMI_MENU_REDO FULLMENUNUM(1,9,0)
-#define AMI_MENU_FIND FULLMENUNUM(2,0,0)
-#define AMI_MENU_FOREIMG FULLMENUNUM(2,8,0)
-#define AMI_MENU_BACKIMG FULLMENUNUM(2,8,1)
-#define AMI_MENU_JS FULLMENUNUM(2,9,0)
-
-struct gui_window;
-struct gui_window_2;
-
/* cleanup */
void ami_menu_free_glyphs(void);
/* generic menu alloc/free/layout */
void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type,
- const char *restrict label, char key, const char *restrict icon,
+ const char *restrict label, const char *restrict key, const char *restrict icon,
void *restrict func, void *restrict hookdata, UWORD flags);
struct Menu *ami_menu_layout(struct ami_menu_data **md, int max);
void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu);
+void ami_menu_free_lab_item(struct ami_menu_data **md, int i);
-/* specific to browser windows */
-void ami_free_menulabs(struct ami_menu_data **md);
-struct Menu *ami_menu_create(struct gui_window_2 *gwin);
-void ami_menu_refresh(struct gui_window_2 *gwin);
-void ami_menu_update_checked(struct gui_window_2 *gwin);
-void ami_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c);
-void ami_menu_free(struct gui_window_2 *gwin);
+/* refresh a menu's children */
+void ami_menu_refresh(struct Menu *menu, struct ami_menu_data **md, int menu_item, int max,
+ nserror (*cb)(struct ami_menu_data **md));
/**
- * Sets that an item linked to a toggle menu item has been changed.
- */
-void ami_menu_set_check_toggled(void);
-
-/**
- * Gets if the menu needs updating because an item linked
- * to a toggle menu item has been changed.
- * NB: This also *clears* the state
- *
- * \return true if the menus need refreshing
- */
-bool ami_menu_get_check_toggled(void);
-
-/**
- * Gets if NetSurf has been quit from the menu
- *
- * \return true if NetSurf has been quit
+ * Get the selected state of a menu item
*/
-bool ami_menu_quit_selected(void);
+bool ami_menu_get_selected(struct Menu *menu, struct IntuiMessage *msg);
#endif