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