NetSurf
ctxmenu.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 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/** \file
20 * Interface to Intuition-based context menu operations
21 */
22
23#ifndef AMIGA_CTXMENU_H
24#define AMIGA_CTXMENU_H 1
25struct Hook;
26struct Menu;
27struct gui_window_2;
28
29enum {
32};
33
34#ifdef __amigaos4__
35/**
36 * Initialise context menus code (allocate label text, etc)
37 * Must be called *after* NetSurf's screen pointer is obtained.
38 */
39void ami_ctxmenu_init(void);
40
41/**
42 * Cleanup context menus code
43 */
44void ami_ctxmenu_free(void);
45
46/**
47 * Get a Hook for WA_ContextMenuHook
48 *
49 * \param data ptr for the hook to use (struct gui_window_2 *)
50 * \returns pointer to a struct Hook
51 */
52struct Hook *ami_ctxmenu_get_hook(APTR data);
53
54/**
55 * Release a Hook for WA_ContextMenuHook
56 *
57 * \param hook ptr to hook
58 */
59void ami_ctxmenu_release_hook(struct Hook *hook);
60
61/**
62 * Create history context menu
63 * The first time this is run it will create an empty menu,
64 * Subsequent runs will (re-)populate with the history.
65 * This is to allow the pointer to be obtained before the browser_window is opened.
66 *
67 * \param direction AMI_CTXMENU_HISTORY_(BACK|FORWARD)
68 * \param gwin struct gui_window_2 *
69 * \returns pointer to menu (for convenience, is also stored in gwin structure)
70 * The returned pointer MUST be disposed of with DisposeObject before program exit.
71 */
72struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin);
73
74/**
75 * Create ClickTab context menu
76 *
77 * \param gwin struct gui_window_2 *
78 * \param clicktab_obj ptr to memory to hold clicktab menu object
79 * \returns pointer to menu (for convenience)
80 * The returned pointer MUST be disposed of with DisposeObject before program exit.
81 */
82struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin, Object **clicktab_obj);
83
84#else //__amigaos4__
85inline void ami_ctxmenu_init(void) {}
86inline void ami_ctxmenu_free(void) {}
87inline struct Hook *ami_ctxmenu_get_hook(APTR data) {return NULL;}
88inline void ami_ctxmenu_release_hook(struct Hook *hook) {}
89inline struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin) {return NULL;}
90inline struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin, Object **clicktab_obj) {return NULL;}
91#endif //__amigaos4__
92#endif //AMIGA_CTXMENU_H
93
struct Menu * ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin, Object **clicktab_obj)
Definition: ctxmenu.h:90
struct Menu * ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin)
Definition: ctxmenu.h:89
struct Hook * ami_ctxmenu_get_hook(APTR data)
Definition: ctxmenu.h:87
void ami_ctxmenu_init(void)
Definition: ctxmenu.h:85
void ami_ctxmenu_release_hook(struct Hook *hook)
Definition: ctxmenu.h:88
@ AMI_CTXMENU_HISTORY_BACK
Definition: ctxmenu.h:30
@ AMI_CTXMENU_HISTORY_FORWARD
Definition: ctxmenu.h:31
void ami_ctxmenu_free(void)
Definition: ctxmenu.h:86