Mercurial > pidgin.yaz
annotate console/libgnt/gntbindable.h @ 15559:dad51c0e3bc6
context menu cleanup
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 05 Feb 2007 10:04:31 +0000 |
parents | 065e7ac30338 |
children | 233c4a2f7b77 |
rev | line source |
---|---|
14900
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #ifndef GNT_BINDABLE_H |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #define GNT_BINDABLE_H |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include <stdio.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include <glib.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include <glib-object.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include <ncurses.h> |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 #define GNT_TYPE_BINDABLE (gnt_bindable_get_gtype()) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #define GNT_BINDABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BINDABLE, GntBindable)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 #define GNT_BINDABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BINDABLE, GntBindableClass)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 #define GNT_IS_BINDABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BINDABLE)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 #define GNT_IS_BINDABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BINDABLE)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 #define GNT_BINDABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BINDABLE, GntBindableClass)) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 #define GNTDEBUG fprintf(stderr, "%s\n", __FUNCTION__) |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 typedef struct _GnBindable GntBindable; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 typedef struct _GnBindableClass GntBindableClass; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 struct _GnBindable |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 GObject inherit; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 struct _GnBindableClass |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 GObjectClass parent; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 GHashTable *remaps; /* Key remaps */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 GHashTable *actions; /* name -> Action */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 GHashTable *bindings; /* key -> ActionParam */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 void (*gnt_reserved1)(void); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 void (*gnt_reserved2)(void); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 void (*gnt_reserved3)(void); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 void (*gnt_reserved4)(void); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 G_BEGIN_DECLS |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GType gnt_bindable_get_gtype(void); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 /******************/ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 /* Key Remaps */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 /******************/ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 const char * gnt_bindable_remap_keys(GntBindable *bindable, const char *text); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 /******************/ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 /* Bindable Actions */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 /******************/ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 typedef gboolean (*GntBindableActionCallback) (GntBindable *bindable, GList *params); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 typedef gboolean (*GntBindableActionCallbackNoParam)(GntBindable *bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 typedef struct _GnBindableAction GntBindableAction; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 typedef struct _GnBindableActionParam GntBindableActionParam; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 struct _GnBindableAction |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 char *name; /* The name of the action */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 union { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 gboolean (*action)(GntBindable *bindable, GList *params); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 gboolean (*action_noparam)(GntBindable *bindable); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 } u; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 struct _GnBindableActionParam |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 { |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 GntBindableAction *action; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 GList *list; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 }; |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 /*GntBindableAction *gnt_bindable_action_parse(const char *name);*/ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 void gnt_bindable_action_free(GntBindableAction *action); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 void gnt_bindable_action_param_free(GntBindableActionParam *param); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 void gnt_bindable_class_register_action(GntBindableClass *klass, const char *name, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 GntBindableActionCallback callback, const char *trigger, ...); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 void gnt_bindable_register_binding(GntBindableClass *klass, const char *name, |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 const char *trigger, ...); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 gboolean gnt_bindable_perform_action_key(GntBindable *bindable, const char *keys); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 gboolean gnt_bindable_perform_action_named(GntBindable *bindable, const char *name, ...); |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 G_END_DECLS |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 #endif /* GNT_BINDABLE_H */ |
065e7ac30338
[gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 |