Mercurial > pidgin.yaz
comparison console/libgnt/gntmenuitem.h @ 14613:62bb53609a36
[gaim-migrate @ 17341]
Menus and windows. I have added a test-app test/menu.c to show how to use it.
Pressing Ctrl+o brings up the menu for the window (if it has one).
It should now be possible to add menus for account-actions and all that stuff.
Patches are very welcome.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 24 Sep 2006 07:14:26 +0000 |
parents | |
children | f1f1dcb26d89 |
comparison
equal
deleted
inserted
replaced
14612:1f46715c08d9 | 14613:62bb53609a36 |
---|---|
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 struct _GnMenuItemPriv | |
23 { | |
24 /* These will be used to determine the position of the submenu */ | |
25 int x; | |
26 int y; | |
27 }; | |
28 | |
29 typedef void (*GntMenuItemCallback)(GntMenuItem *item, gpointer data); | |
30 | |
31 struct _GnMenuItem | |
32 { | |
33 GObject parent; | |
34 GntMenuItemPriv priv; | |
35 | |
36 char *text; | |
37 | |
38 /* A GntMenuItem can have a callback associated with it. | |
39 * The callback will be activated whenever the suer selects it and presses enter (or clicks). | |
40 * However, if the GntMenuItem has some child, then the callback and callbackdata will be ignored. */ | |
41 gpointer callbackdata; | |
42 GntMenuItemCallback callback; | |
43 | |
44 GntMenu *submenu; | |
45 }; | |
46 | |
47 struct _GnMenuItemClass | |
48 { | |
49 GObjectClass parent; | |
50 | |
51 void (*gnt_reserved1)(void); | |
52 void (*gnt_reserved2)(void); | |
53 void (*gnt_reserved3)(void); | |
54 void (*gnt_reserved4)(void); | |
55 }; | |
56 | |
57 G_BEGIN_DECLS | |
58 | |
59 GType gnt_menuitem_get_gtype(void); | |
60 | |
61 GObject *gnt_menuitem_new(const char *text); | |
62 | |
63 void gnt_menuitem_set_callback(GntMenuItem *item, GntMenuItemCallback callback, gpointer data); | |
64 | |
65 void gnt_menuitem_set_submenu(GntMenuItem *item, GntMenu *menu); | |
66 | |
67 G_END_DECLS | |
68 | |
69 #endif /* GNT_MENUITEM_H */ |