22#include <gdk/gdkkeysyms.h>
51 const char *accelerator_desc;
59 if (accelerator_desc != NULL) {
60 gtk_accelerator_parse(accelerator_desc, &key, &mod);
62 gtk_widget_add_accelerator(item,
70 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
71 gtk_widget_show(item);
78#define NEW_MENU(n, m) \
79 n = malloc(sizeof(*n)); \
83 n->m##_menu = GTK_MENU(gtk_menu_new())
85#define IMAGE_ITEM(p, q, r, s, t)\
86 nsgtk_menu_add_image_item(s->p##_menu, &(s->q##_menuitem), #r, t)
88#define CHECK_ITEM(p, q, r, s) \
90 s->q##_menuitem = GTK_CHECK_MENU_ITEM( \
91 gtk_check_menu_item_new_with_mnemonic(\
93 if ((s->q##_menuitem != NULL) && (s->p##_menu != NULL)) { \
94 gtk_menu_shell_append(GTK_MENU_SHELL(s->p##_menu), \
95 GTK_WIDGET(s->q##_menuitem)); \
96 gtk_widget_show(GTK_WIDGET(s->q##_menuitem)); \
100#define SET_SUBMENU(q, r) \
102 r->q##_submenu = nsgtk_menu_##q##_submenu(group); \
103 if ((r->q##_submenu != NULL) && \
104 (r->q##_submenu->q##_menu != NULL) && \
105 (r->q##_menuitem != NULL)) { \
106 gtk_menu_item_set_submenu(GTK_MENU_ITEM(r->q##_menuitem), \
107 GTK_WIDGET(r->q##_submenu->q##_menu)); \
111#define ADD_NAMED_SEP(q, r, s) \
113 s->r##_separator = gtk_separator_menu_item_new(); \
114 if ((s->r##_separator != NULL) && (s->q##_menu != NULL)) { \
115 gtk_menu_shell_append(GTK_MENU_SHELL(s->q##_menu), s->r##_separator); \
116 gtk_widget_show(s->r##_separator); \
120#define ADD_SEP(q, r) \
122 GtkWidget *w = gtk_separator_menu_item_new(); \
123 if ((w != NULL) && (r->q##_menu != NULL)) { \
124 gtk_menu_shell_append(GTK_MENU_SHELL(r->q##_menu), w); \
125 gtk_widget_show(w); \
129#define ATTACH_PARENT(parent, msgname, menuv, group) \
132 menuv = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(messages_get(#msgname))); \
133 gtk_menu_shell_append(parent, GTK_WIDGET(menuv)); \
134 gtk_widget_show(GTK_WIDGET(menuv)); \
136 gtk_menu_item_set_submenu(menuv, GTK_WIDGET(menuv##_menu)); \
137 gtk_menu_set_accel_group(menuv##_menu, group); \
162 IMAGE_ITEM(export, savepage, gtkSavePage, ret, group);
163 IMAGE_ITEM(export, plaintext, gtkPlainText, ret, group);
188 IMAGE_ITEM(scaleview, zoomplus, gtkZoomPlus, ret, group);
189 IMAGE_ITEM(scaleview, zoomnormal, gtkZoomNormal, ret, group);
190 IMAGE_ITEM(scaleview, zoomminus, gtkZoomMinus, ret, group);
207 ret->
tabs_menu = GTK_MENU(gtk_menu_new());
282 IMAGE_ITEM(developer, viewsource, gtkPageSource, dmenu, group);
283 IMAGE_ITEM(developer, toggledebugging, gtkToggleDebugging, dmenu, group);
284 IMAGE_ITEM(developer, debugboxtree, gtkDebugBoxTree, dmenu, group);
285 IMAGE_ITEM(developer, debugdomtree, gtkDebugDomTree, dmenu, group);
306 fmenu->
file_menu = GTK_MENU(gtk_menu_new());
341 ret->
edit_menu = GTK_MENU(gtk_menu_new());
373 ret->
view_menu = GTK_MENU(gtk_menu_new());
405 ret->
nav_menu = GTK_MENU(gtk_menu_new());
419 IMAGE_ITEM(
nav, globalhistory, gtkGlobalHistory, ret, group);
422 IMAGE_ITEM(
nav, showbookmarks, gtkShowBookMarks, ret, group);
466 ret->
help_menu = GTK_MENU(gtk_menu_new());
505 if (menubar != NULL) {
506 nmenu->
bar_menu = GTK_MENU_BAR(menubar);
528 IMAGE_ITEM(burger, file, gtkFile, nmenu, group);
531 IMAGE_ITEM(burger, edit, gtkEdit, nmenu, group);
537 IMAGE_ITEM(burger, nav, gtkNavigate, nmenu, group);
540 IMAGE_ITEM(burger, tools, gtkTools, nmenu, group);
543 IMAGE_ITEM(burger, help, gtkHelp, nmenu, group);
557 IMAGE_ITEM(popup, back, gtkBack, nmenu, group);
558 IMAGE_ITEM(popup, forward, gtkForward, nmenu, group);
559 IMAGE_ITEM(popup, stop, gtkStop, nmenu, group);
565 IMAGE_ITEM(popup, copy, gtkCopy, nmenu, group);
566 IMAGE_ITEM(popup, paste, gtkPaste, nmenu, group);
573 IMAGE_ITEM(popup, tools, gtkTools, nmenu, group);
588 IMAGE_ITEM(link, opentab, gtkOpentab, nmenu, group);
589 IMAGE_ITEM(link, openwin, gtkOpenwin, nmenu, group);
593 IMAGE_ITEM(link, save, gtkSavelink, nmenu, group);
594 IMAGE_ITEM(link, bookmark, gtkBookmarklink, nmenu, group);
595 IMAGE_ITEM(link, copy, gtkCopylink, nmenu, group);
604 gtk_widget_destroy(GTK_WIDGET(menu->
bar_menu));
647 gtk_widget_destroy(GTK_WIDGET(menu->
popup_menu));
661 gtk_widget_destroy(GTK_WIDGET(menu->
link_menu));
const char * nsgtk_accelerator_get_desc(const char *key)
static struct s_view view
GtkWidget * nsgtk_image_menu_item_new_with_mnemonic(const gchar *label)
Creates a new GtkImageMenuItem containing a label.
Compatibility functions for older GTK versions (interface)
static struct toolbar_display * toolbars
nserror
Enumeration of error codes.
nserror nsgtk_warning(const char *warning, const char *detail)
Warn the user of an event.
static CONST_STRPTR tabs[OPTS_MAX_TABS]
struct fbtk_bitmap reload
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).