22#include <proto/exec.h>
23#include <proto/intuition.h>
24#include <proto/popupmenu.h>
25#include <proto/utility.h>
26#include <reaction/reaction_macros.h>
45#define AMI_SELECTMENU_PAGE_MAX 40
48#define AMI_SELECTMENU_MENU_MAX 10
51#define AMI_SELECTMENU_MAX (AMI_SELECTMENU_PAGE_MAX * AMI_SELECTMENU_MENU_MAX)
57 struct Library *PopupMenuBase;
58 BOOL popupmenu_lib_ok = FALSE;
60 if((PopupMenuBase = OpenLibrary(
"popupmenu.library", 53))) {
61 NSLOG(netsurf, INFO,
"popupmenu.library v%d.%d",
62 PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision);
64 popupmenu_lib_ok = TRUE;
65 CloseLibrary(PopupMenuBase);
68 return popupmenu_lib_ok;
76 if(GetAttr(PMIA_ID, item, &itemid)) {
86 struct Library *PopupMenuBase = NULL;
87 struct PopupMenuIFace *IPopupMenu = NULL;
88 struct Hook selectmenuhook;
89 Object *selectmenuobj;
92 Object *submenu = NULL;
93 char *selectmenu_item[AMI_SELECTMENU_MAX];
101 if((PopupMenuBase = OpenLibrary(
"popupmenu.class", 0))) {
102 IPopupMenu = (
struct PopupMenuIFace *)GetInterface(PopupMenuBase,
"main", 1, NULL);
105 if(IPopupMenu == NULL)
return;
107 ClearMem(selectmenu_item, AMI_SELECTMENU_MAX * 4);
110 selectmenuhook.h_Entry = ami_popup_hook;
111 selectmenuhook.h_SubEntry = NULL;
112 selectmenuhook.h_Data = control;
115 PMA_MenuHandler, &selectmenuhook, End;
117 currentmenu = selectmenuobj;
123 NewObject(POPUPMENU_GetItemClass(), NULL,
124 PMIA_Title, (ULONG)selectmenu_item[i],
135 if(n == AMI_SELECTMENU_PAGE_MAX) {
136 if(submenu != NULL) {
140 PMIA_Title, more_label,
142 PMIA_SubMenu, submenu,
147 submenu =
NewObject(NULL,
"popupmenu.class", TAG_DONE);
149 currentmenu = submenu;
153 if(i >= AMI_SELECTMENU_MAX)
break;
156 if((submenu != NULL) && (n != 0)) {
160 PMIA_Title, more_label,
162 PMIA_SubMenu, submenu,
172 if(selectmenuobj) DisposeObject(selectmenuobj);
175 if(IPopupMenu) DropInterface((
struct Interface *)IPopupMenu);
176 if(PopupMenuBase) CloseLibrary(PopupMenuBase);
180 for(i = 0; i < AMI_SELECTMENU_MAX; i++) {
181 if(selectmenu_item[i] != NULL) {
183 selectmenu_item[i] = NULL;
struct Window * ami_gui_get_window(struct gui_window *gw)
Get window from gui_window.
void ami_set_pointer(struct gui_window_2 *gwin, gui_pointer_shape shape, bool update)
struct gui_window_2 * ami_gui_get_gui_window_2(struct gui_window *gw)
Get gui_window_2 from gui_window.
#define HOOKF(ret, func, type, ptr, msgtype)
void ami_utf8_free(char *ptr)
char * ami_utf8_easy(const char *string)
Core mouse and pointer states.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
APTR NewObject(struct IClass *classPtr, CONST_STRPTR classID, ULONG tagList,...)
#define LIB_IS_AT_LEAST(B, V, R)
first entry in window list