2 * @file gntmenu.h Menu API
6 * GNT - The GLib Ncurses Toolkit
8 * GNT is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
31 #include "gntcolors.h"
34 #define GNT_TYPE_MENU (gnt_menu_get_gtype())
35 #define GNT_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_MENU, GntMenu))
36 #define GNT_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_MENU, GntMenuClass))
37 #define GNT_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_MENU))
38 #define GNT_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_MENU))
39 #define GNT_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_MENU, GntMenuClass))
41 #define GNT_MENU_FLAGS(obj) (GNT_MENU(obj)->priv.flags)
42 #define GNT_MENU_SET_FLAGS(obj, flags) (GNT_MENU_FLAGS(obj) |= flags)
43 #define GNT_MENU_UNSET_FLAGS(obj, flags) (GNT_MENU_FLAGS(obj) &= ~(flags))
45 typedef struct _GntMenu GntMenu
;
46 typedef struct _GntMenuPriv GntMenuPriv
;
47 typedef struct _GntMenuClass GntMenuClass
;
49 #include "gntmenuitem.h"
52 * A toplevel-menu is displayed at the top of the screen, and it spans accross
53 * the entire width of the screen.
54 * A popup-menu could be displayed, for example, as a context menu for widgets.
58 GNT_MENU_TOPLEVEL
= 1, /* Menu for a toplevel window */
59 GNT_MENU_POPUP
, /* A popup menu */
70 /* This will keep track of its immediate submenu which is visible so that
71 * keystrokes can be passed to it. */
80 void (*gnt_reserved1
)(void);
81 void (*gnt_reserved2
)(void);
82 void (*gnt_reserved3
)(void);
83 void (*gnt_reserved4
)(void);
89 * @return The GType for GntMenu.
91 GType
gnt_menu_get_gtype(void);
96 * @param type The type of the menu, whether it's a toplevel menu or a popup menu.
98 * @return The newly created menu.
100 GntWidget
* gnt_menu_new(GntMenuType type
);
103 * Add an item to the menu.
105 * @param menu The menu.
106 * @param item The item to add to the menu.
108 void gnt_menu_add_item(GntMenu
*menu
, GntMenuItem
*item
);
111 * Return the GntMenuItem with the given ID.
113 * @param menu The menu.
114 * @param id The ID for an item.
116 * @return The menuitem with the given ID, or @c NULL.
120 GntMenuItem
*gnt_menu_get_item(GntMenu
*menu
, const char *id
);
124 #endif /* GNT_MENU_H */