15818
|
1 #ifndef GNT_MENUITEM_H
|
|
2 #define GNT_MENUITEM_H
|
|
3
|
|
4 #include <glib.h>
|
|
5 #include <glib-object.h>
|
|
6
|
|
7 #define GNT_TYPE_MENUITEM (gnt_menuitem_get_gtype())
|
|
8 #define GNT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_MENUITEM, GntMenuItem))
|
|
9 #define GNT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_MENUITEM, GntMenuItemClass))
|
|
10 #define GNT_IS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_MENUITEM))
|
|
11 #define GNT_IS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_MENUITEM))
|
|
12 #define GNT_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_MENUITEM, GntMenuItemClass))
|
|
13
|
|
14 #define GNT_MENUITEM_FLAGS(obj) (GNT_MENUITEM(obj)->priv.flags)
|
|
15 #define GNT_MENUITEM_SET_FLAGS(obj, flags) (GNT_MENUITEM_FLAGS(obj) |= flags)
|
|
16 #define GNT_MENUITEM_UNSET_FLAGS(obj, flags) (GNT_MENUITEM_FLAGS(obj) &= ~(flags))
|
|
17
|
|
18 typedef struct _GnMenuItem GntMenuItem;
|
|
19 typedef struct _GnMenuItemPriv GntMenuItemPriv;
|
|
20 typedef struct _GnMenuItemClass GntMenuItemClass;
|
|
21
|
|
22 #include "gntmenu.h"
|
|
23
|
|
24 struct _GnMenuItemPriv
|
|
25 {
|
|
26 /* These will be used to determine the position of the submenu */
|
|
27 int x;
|
|
28 int y;
|
|
29 };
|
|
30
|
|
31 typedef void (*GntMenuItemCallback)(GntMenuItem *item, gpointer data);
|
|
32
|
|
33 struct _GnMenuItem
|
|
34 {
|
|
35 GObject parent;
|
|
36 GntMenuItemPriv priv;
|
|
37
|
|
38 char *text;
|
|
39
|
|
40 /* A GntMenuItem can have a callback associated with it.
|
|
41 * The callback will be activated whenever the suer selects it and presses enter (or clicks).
|
|
42 * However, if the GntMenuItem has some child, then the callback and callbackdata will be ignored. */
|
|
43 gpointer callbackdata;
|
|
44 GntMenuItemCallback callback;
|
|
45
|
|
46 GntMenu *submenu;
|
|
47 };
|
|
48
|
|
49 struct _GnMenuItemClass
|
|
50 {
|
|
51 GObjectClass parent;
|
|
52
|
|
53 void (*gnt_reserved1)(void);
|
|
54 void (*gnt_reserved2)(void);
|
|
55 void (*gnt_reserved3)(void);
|
|
56 void (*gnt_reserved4)(void);
|
|
57 };
|
|
58
|
|
59 G_BEGIN_DECLS
|
|
60
|
|
61 GType gnt_menuitem_get_gtype(void);
|
|
62
|
|
63 GntMenuItem *gnt_menuitem_new(const char *text);
|
|
64
|
|
65 void gnt_menuitem_set_callback(GntMenuItem *item, GntMenuItemCallback callback, gpointer data);
|
|
66
|
|
67 void gnt_menuitem_set_submenu(GntMenuItem *item, GntMenu *menu);
|
|
68
|
|
69 G_END_DECLS
|
|
70
|
|
71 #endif /* GNT_MENUITEM_H */
|