gntmenu.h
Go to the documentation of this file.
1
5 /*
6 * GNT - The GLib Ncurses Toolkit
7 *
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.
11 *
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.
16 *
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.
21 *
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
25 */
26
27 #ifndef GNT_MENU_H
28 #define GNT_MENU_H
29
30 #include "gnttree.h"
31 #include "gntcolors.h"
32 #include "gntkeys.h"
33
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))
40
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))
44
45 typedef struct _GntMenu GntMenu;
46 typedef struct _GntMenuPriv GntMenuPriv;
47 typedef struct _GntMenuClass GntMenuClass;
48
49 #include "gntmenuitem.h"
50
56 typedef enum
57 {
58 GNT_MENU_TOPLEVEL = 1, /* Menu for a toplevel window */
59 GNT_MENU_POPUP, /* A popup menu */
60 } GntMenuType;
61
62 struct _GntMenu
63 {
64 GntTree parent;
65 GntMenuType type;
66
67 GList *list;
68 int selected;
69
70 /* This will keep track of its immediate submenu which is visible so that
71 * keystrokes can be passed to it. */
72 GntMenu *submenu;
73 GntMenu *parentmenu;
74 };
75
76 struct _GntMenuClass
77 {
78 GntTreeClass parent;
79
80 void (*gnt_reserved1)(void);
81 void (*gnt_reserved2)(void);
82 void (*gnt_reserved3)(void);
83 void (*gnt_reserved4)(void);
84 };
85
86 G_BEGIN_DECLS
87
91 GType gnt_menu_get_gtype(void);
92
100 GntWidget * gnt_menu_new(GntMenuType type);
101
108 void gnt_menu_add_item(GntMenu *menu, GntMenuItem *item);
109
120 GntMenuItem *gnt_menu_get_item(GntMenu *menu, const char *id);
121
122 G_END_DECLS
123
124 #endif /* GNT_MENU_H */
_GntMenuItem
Definition: gntmenuitem.h:61
gnt_menu_new
GntWidget * gnt_menu_new(GntMenuType type)
Create a new menu.
_GntMenuClass
Definition: gntmenu.h:76
gntcolors.h
Colors API.
gntmenuitem.h
Menuitem API.
GntMenuType
GntMenuType
A toplevel-menu is displayed at the top of the screen, and it spans accross the entire width of the s...
Definition: gntmenu.h:56
gntkeys.h
Keys API.
gnt_menu_add_item
void gnt_menu_add_item(GntMenu *menu, GntMenuItem *item)
Add an item to the menu.
_GntTree
Definition: gnttree.h:57
gnttree.h
Tree API.
_GntTreeClass
Definition: gnttree.h:89
_GntMenu
Definition: gntmenu.h:62
gnt_menu_get_item
GntMenuItem * gnt_menu_get_item(GntMenu *menu, const char *id)
Return the GntMenuItem with the given ID.
gnt_menu_get_gtype
G_BEGIN_DECLS GType gnt_menu_get_gtype(void)
_GntWidget
Definition: gntwidget.h:98