NetSurf
menu.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef AMIGA_MENU_H
20#define AMIGA_MENU_H
21
22#include <exec/types.h>
23#include <intuition/intuition.h>
24#include <libraries/gadtools.h>
25
27 char *restrict menulab;
28 Object *restrict menuobj;
29 char *restrict menukey;
30 char *restrict menuicon;
31 struct Hook menu_hook;
32 UBYTE menutype;
33 UWORD flags;
34};
35
36/** empty space */
37#define NSA_SPACE "blankspace.png"
38
39/* cleanup */
40void ami_menu_free_glyphs(void);
41
42/* generic menu alloc/free/layout */
43void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type,
44 const char *restrict label, const char *restrict key, const char *restrict icon,
45 void *restrict func, void *restrict hookdata, UWORD flags);
46struct Menu *ami_menu_layout(struct ami_menu_data **md, int max);
47void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu);
48void ami_menu_free_lab_item(struct ami_menu_data **md, int i);
49
50/* refresh a menu's children */
51void ami_menu_refresh(struct Menu *menu, struct ami_menu_data **md, int menu_item, int max,
52 nserror (*cb)(struct ami_menu_data **md));
53
54/**
55 * Get the selected state of a menu item
56 */
57bool ami_menu_get_selected(struct Menu *menu, struct IntuiMessage *msg);
58#endif
59
void ami_menu_refresh(struct Menu *menu, struct ami_menu_data **md, int menu_item, int max, nserror(*cb)(struct ami_menu_data **md))
Definition: menu.c:440
struct Menu * ami_menu_layout(struct ami_menu_data **md, int max)
Definition: menu.c:419
void ami_menu_free_menu(struct ami_menu_data **md, int max, struct Menu *imenu)
Definition: menu.c:430
void ami_menu_alloc_item(struct ami_menu_data **md, int num, UBYTE type, const char *restrict label, const char *restrict key, const char *restrict icon, void *restrict func, void *restrict hookdata, UWORD flags)
Definition: menu.c:115
void ami_menu_free_glyphs(void)
Definition: menu.c:182
void ami_menu_free_lab_item(struct ami_menu_data **md, int i)
Definition: menu.c:83
bool ami_menu_get_selected(struct Menu *menu, struct IntuiMessage *msg)
Get the selected state of a menu item.
Definition: menu.c:63
nserror
Enumeration of error codes.
Definition: errors.h:29
const char * type
Definition: filetype.cpp:44
Object *restrict menuobj
Definition: menu.h:28
char *restrict menulab
Definition: menu.h:27
char *restrict menuicon
Definition: menu.h:30
UBYTE menutype
Definition: menu.h:32
char *restrict menukey
Definition: menu.h:29
UWORD flags
Definition: menu.h:33
struct Hook menu_hook
Definition: menu.h:31
#define max(x, y)
Definition: utils.h:50