BEAST - Free Software Audio Synthesizer and Tracker  0.9.2
gxkaction.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __GXK_ACTION_H__
3 #define __GXK_ACTION_H__
4 
5 #include "gxkutils.hh"
6 
7 G_BEGIN_DECLS
8 
9 
10 #define GXK_ACTION_PRIORITY (G_PRIORITY_HIGH - 10)
11 
12 
13 /* --- structures --- */
14 typedef gboolean (*GxkActionCheck) (gpointer user_data,
15  size_t action_id,
16  guint64 action_stamp);
17 typedef void (*GxkActionExec) (gpointer user_data,
18  size_t action_id);
19 typedef struct GxkActionGroup GxkActionGroup; /* prototyped */
20 typedef struct GxkActionList GxkActionList;
21 typedef struct {
22  const gchar *key; /* untranslated name (used for accel paths) */
23  gconstpointer action_data; /* for gxk_action_activate_callback() */
24  const gchar *name;
25  const gchar *accelerator;
26  const gchar *tooltip;
27  size_t action_id;
28  const gchar *stock_icon; /* stock_id for the icon or NULL */
29 } GxkAction;
30 
31 typedef struct {
32  const gchar *name; /* subject to i18n (key) */
33  const gchar *accelerator;
34  const gchar *tooltip; /* subject to i18n */
35  size_t action_id;
36  const gchar *stock_icon; /* stock_id for the icon */
38 
39 /* --- public API --- */
40 guint64 gxk_action_inc_cache_stamp (void);
41 GxkActionList* gxk_action_list_create (void);
42 GxkActionList* gxk_action_list_create_grouped (GxkActionGroup *agroup);
43 void gxk_action_list_add_actions (GxkActionList *alist,
44  guint n_actions,
45  const GxkStockAction *actions,
46  const gchar *i18n_domain,
47  GxkActionCheck acheck,
48  GxkActionExec aexec,
49  gpointer user_data);
50 void gxk_action_list_add_translated (GxkActionList *alist,
51  const gchar *key, /* untranslated name */
52  const gchar *name, /* translated (key) */
53  const gchar *accelerator,
54  const gchar *tooltip, /* translated */
55  size_t action_id,
56  const gchar *stock_icon,
57  GxkActionCheck acheck,
58  GxkActionExec aexec,
59  gpointer user_data);
60 GxkActionList* gxk_action_list_sort (GxkActionList *alist);
61 GxkActionList* gxk_action_list_merge (GxkActionList *alist1,
62  GxkActionList *alist2);
63 GxkActionList* gxk_action_list_copy (GxkActionList *alist);
64 guint gxk_action_list_get_n_actions (GxkActionList *alist);
65 void gxk_action_list_get_action (GxkActionList *alist,
66  guint nth,
67  GxkAction *action);
68 void gxk_action_list_regulate_widget (GxkActionList *alist,
69  guint nth,
70  GtkWidget *widget);
71 void gxk_action_list_force_regulate (GtkWidget *widget);
72 void gxk_action_list_free (GxkActionList *alist);
73 void gxk_action_activate_callback (gconstpointer action_data);
74 void gxk_widget_update_actions_upwards (gpointer widget);
75 void gxk_widget_update_actions_downwards (gpointer widget);
76 void gxk_widget_update_actions (gpointer widget);
77 
78 /* --- publishing --- */
79 void gxk_widget_publish_action_list (gpointer widget,
80  const gchar *prefix,
81  GxkActionList *alist);
82 GSList* gxk_widget_peek_action_widgets (gpointer widget,
83  const gchar *prefix,
84  size_t action_id);
85 void gxk_widget_publish_actions (gpointer widget,
86  const gchar *prefix,
87  guint n_actions,
88  const GxkStockAction *actions,
89  const gchar *i18n_domain,
90  GxkActionCheck acheck,
91  GxkActionExec aexec);
92 void gxk_widget_publish_actions_grouped (gpointer widget,
93  GxkActionGroup *group,
94  const gchar *prefix,
95  guint n_actions,
96  const GxkStockAction *actions,
97  const gchar *i18n_domain,
98  GxkActionCheck acheck,
99  GxkActionExec aexec);
100 void gxk_widget_publish_translated (gpointer widget,
101  const gchar *prefix,
102  const gchar *key, /* untranslated name */
103  const gchar *name, /* translated (key) */
104  const gchar *accelerator,
105  const gchar *tooltip, /* translated */
106  size_t action_id,
107  const gchar *stock_icon,
108  GxkActionCheck acheck,
109  GxkActionExec aexec);
110 void gxk_widget_publish_grouped_translated (gpointer widget,
111  GxkActionGroup *group,
112  const gchar *prefix,
113  const gchar *key, /* untranslated name */
114  const gchar *name, /* translated (key) */
115  const gchar *accelerator,
116  const gchar *tooltip, /* translated */
117  size_t action_id,
118  const gchar *stock_icon,
119  GxkActionCheck acheck,
120  GxkActionExec aexec);
121 void gxk_widget_republish_actions (gpointer widget,
122  const gchar *prefix,
123  gpointer source_widget);
124 typedef void (*GxkActionClient) (gpointer client_data,
125  GtkWindow *window,
126  const gchar *prefix,
127  GxkActionList *action_list,
128  GtkWidget *publisher);
129 void gxk_window_add_action_client (GtkWindow *window,
130  GxkActionClient added_func,
131  gpointer client_data);
132 void gxk_window_remove_action_client (GtkWindow *window,
133  gpointer client_data);
134 
135 
136 /* --- action groups --- */
137 #define GXK_TYPE_ACTION_GROUP (gxk_action_group_get_type ())
138 #define GXK_ACTION_GROUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GXK_TYPE_ACTION_GROUP, GxkActionGroup))
139 #define GXK_ACTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXK_TYPE_ACTION_GROUP, GxkActionGroupClass))
140 #define GXK_IS_ACTION_GROUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GXK_TYPE_ACTION_GROUP))
141 #define GXK_IS_ACTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXK_TYPE_ACTION_GROUP))
142 #define GXK_ACTION_GROUP_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GXK_TYPE_ACTION_GROUP, GxkActionGroupClass))
144  GObject parent_instance;
145  size_t action_id;
146  guint lock_count;
147  guint invert_dups : 1;
148 };
149 typedef struct {
150  GObjectClass parent_class;
151  void (*changed) (GxkActionGroup *self);
153 GType gxk_action_group_get_type (void);
154 GxkActionGroup* gxk_action_group_new (void);
155 void gxk_action_group_select (GxkActionGroup *agroup,
156  size_t action_id);
157 void gxk_action_group_lock (GxkActionGroup *agroup);
158 void gxk_action_group_unlock (GxkActionGroup *agroup);
159 void gxk_action_group_dispose (GxkActionGroup *agroup);
160 GxkActionGroup* gxk_action_toggle_new (void);
161 
162 
163 G_END_DECLS
164 
165 #endif /* __GXK_ACTION_H__ */
Definition: gxkaction.hh:31
Definition: gxkaction.hh:149
Definition: gxkaction.hh:21
Definition: gxkaction.hh:143