gntbindable.h
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef GNT_BINDABLE_H
00028 #define GNT_BINDABLE_H
00029
00030 #include <stdio.h>
00031 #include <glib.h>
00032 #include <glib-object.h>
00033 #include <ncurses.h>
00034
00035 #define GNT_TYPE_BINDABLE (gnt_bindable_get_gtype())
00036 #define GNT_BINDABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BINDABLE, GntBindable))
00037 #define GNT_BINDABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BINDABLE, GntBindableClass))
00038 #define GNT_IS_BINDABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BINDABLE))
00039 #define GNT_IS_BINDABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BINDABLE))
00040 #define GNT_BINDABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BINDABLE, GntBindableClass))
00041
00042 #define GNTDEBUG
00043
00044 typedef struct _GntBindable GntBindable;
00045 typedef struct _GntBindableClass GntBindableClass;
00046
00047 struct _GntBindable
00048 {
00049 GObject inherit;
00050 };
00051
00052 struct _GntBindableClass
00053 {
00054 GObjectClass parent;
00055
00056 GHashTable *remaps;
00057 GHashTable *actions;
00058 GHashTable *bindings;
00059
00060 GntBindable * help_window;
00061
00062 void (*gnt_reserved2)(void);
00063 void (*gnt_reserved3)(void);
00064 void (*gnt_reserved4)(void);
00065 };
00066
00067 G_BEGIN_DECLS
00068
00074 GType gnt_bindable_get_gtype(void);
00075
00076
00077
00078
00079 const char * gnt_bindable_remap_keys(GntBindable *bindable, const char *text);
00080
00081
00082
00083
00084 typedef gboolean (*GntBindableActionCallback) (GntBindable *bindable, GList *params);
00085 typedef gboolean (*GntBindableActionCallbackNoParam)(GntBindable *bindable);
00086
00087 typedef struct _GntBindableAction GntBindableAction;
00088 typedef struct _GntBindableActionParam GntBindableActionParam;
00089
00090 struct _GntBindableAction
00091 {
00092 char *name;
00093 union {
00094 gboolean (*action)(GntBindable *bindable, GList *params);
00095 gboolean (*action_noparam)(GntBindable *bindable);
00096 } u;
00097 };
00098
00099 struct _GntBindableActionParam
00100 {
00101 GntBindableAction *action;
00102 GList *list;
00103 };
00104
00105
00106
00112 void gnt_bindable_action_free(GntBindableAction *action);
00113
00119 void gnt_bindable_action_param_free(GntBindableActionParam *param);
00120
00130 void gnt_bindable_class_register_action(GntBindableClass *klass, const char *name, GntBindableActionCallback callback, const char *trigger, ...);
00131
00139 void gnt_bindable_register_binding(GntBindableClass *klass, const char *name, const char *trigger, ...);
00140
00149 gboolean gnt_bindable_perform_action_key(GntBindable *bindable, const char *keys);
00150
00159 gboolean gnt_bindable_check_key(GntBindable *bindable, const char *keys);
00160
00169 gboolean gnt_bindable_perform_action_named(GntBindable *bindable, const char *name, ...);
00170
00178 GntBindable * gnt_bindable_bindings_view(GntBindable *bind);
00179
00189 gboolean gnt_bindable_build_help_window(GntBindable *bindable);
00190
00191 G_END_DECLS
00192
00193 #endif
00194