BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __GXK_ACTION_H__ 00003 #define __GXK_ACTION_H__ 00004 00005 #include "gxkutils.hh" 00006 00007 G_BEGIN_DECLS 00008 00009 00010 #define GXK_ACTION_PRIORITY (G_PRIORITY_HIGH - 10) 00011 00012 00013 /* --- structures --- */ 00014 typedef gboolean (*GxkActionCheck) (gpointer user_data, 00015 gulong action_id, 00016 guint64 action_stamp); 00017 typedef void (*GxkActionExec) (gpointer user_data, 00018 gulong action_id); 00019 typedef struct GxkActionGroup GxkActionGroup; /* prototyped */ 00020 typedef struct GxkActionList GxkActionList; 00021 typedef struct { 00022 const gchar *key; /* untranslated name (used for accel paths) */ 00023 gconstpointer action_data; /* for gxk_action_activate_callback() */ 00024 const gchar *name; 00025 const gchar *accelerator; 00026 const gchar *tooltip; 00027 gulong action_id; 00028 const gchar *stock_icon; /* stock_id for the icon or NULL */ 00029 } GxkAction; 00030 00031 typedef struct { 00032 const gchar *name; /* subject to i18n (key) */ 00033 const gchar *accelerator; 00034 const gchar *tooltip; /* subject to i18n */ 00035 gulong action_id; 00036 const gchar *stock_icon; /* stock_id for the icon */ 00037 } GxkStockAction; 00038 00039 /* --- public API --- */ 00040 guint64 gxk_action_inc_cache_stamp (void); 00041 GxkActionList* gxk_action_list_create (void); 00042 GxkActionList* gxk_action_list_create_grouped (GxkActionGroup *agroup); 00043 void gxk_action_list_add_actions (GxkActionList *alist, 00044 guint n_actions, 00045 const GxkStockAction *actions, 00046 const gchar *i18n_domain, 00047 GxkActionCheck acheck, 00048 GxkActionExec aexec, 00049 gpointer user_data); 00050 void gxk_action_list_add_translated (GxkActionList *alist, 00051 const gchar *key, /* untranslated name */ 00052 const gchar *name, /* translated (key) */ 00053 const gchar *accelerator, 00054 const gchar *tooltip, /* translated */ 00055 gulong action_id, 00056 const gchar *stock_icon, 00057 GxkActionCheck acheck, 00058 GxkActionExec aexec, 00059 gpointer user_data); 00060 GxkActionList* gxk_action_list_sort (GxkActionList *alist); 00061 GxkActionList* gxk_action_list_merge (GxkActionList *alist1, 00062 GxkActionList *alist2); 00063 GxkActionList* gxk_action_list_copy (GxkActionList *alist); 00064 guint gxk_action_list_get_n_actions (GxkActionList *alist); 00065 void gxk_action_list_get_action (GxkActionList *alist, 00066 guint nth, 00067 GxkAction *action); 00068 void gxk_action_list_regulate_widget (GxkActionList *alist, 00069 guint nth, 00070 GtkWidget *widget); 00071 void gxk_action_list_force_regulate (GtkWidget *widget); 00072 void gxk_action_list_free (GxkActionList *alist); 00073 void gxk_action_activate_callback (gconstpointer action_data); 00074 void gxk_widget_update_actions_upwards (gpointer widget); 00075 void gxk_widget_update_actions_downwards (gpointer widget); 00076 void gxk_widget_update_actions (gpointer widget); 00077 00078 /* --- publishing --- */ 00079 void gxk_widget_publish_action_list (gpointer widget, 00080 const gchar *prefix, 00081 GxkActionList *alist); 00082 GSList* gxk_widget_peek_action_widgets (gpointer widget, 00083 const gchar *prefix, 00084 gulong action_id); 00085 void gxk_widget_publish_actions (gpointer widget, 00086 const gchar *prefix, 00087 guint n_actions, 00088 const GxkStockAction *actions, 00089 const gchar *i18n_domain, 00090 GxkActionCheck acheck, 00091 GxkActionExec aexec); 00092 void gxk_widget_publish_actions_grouped (gpointer widget, 00093 GxkActionGroup *group, 00094 const gchar *prefix, 00095 guint n_actions, 00096 const GxkStockAction *actions, 00097 const gchar *i18n_domain, 00098 GxkActionCheck acheck, 00099 GxkActionExec aexec); 00100 void gxk_widget_publish_translated (gpointer widget, 00101 const gchar *prefix, 00102 const gchar *key, /* untranslated name */ 00103 const gchar *name, /* translated (key) */ 00104 const gchar *accelerator, 00105 const gchar *tooltip, /* translated */ 00106 gulong action_id, 00107 const gchar *stock_icon, 00108 GxkActionCheck acheck, 00109 GxkActionExec aexec); 00110 void gxk_widget_publish_grouped_translated (gpointer widget, 00111 GxkActionGroup *group, 00112 const gchar *prefix, 00113 const gchar *key, /* untranslated name */ 00114 const gchar *name, /* translated (key) */ 00115 const gchar *accelerator, 00116 const gchar *tooltip, /* translated */ 00117 gulong action_id, 00118 const gchar *stock_icon, 00119 GxkActionCheck acheck, 00120 GxkActionExec aexec); 00121 void gxk_widget_republish_actions (gpointer widget, 00122 const gchar *prefix, 00123 gpointer source_widget); 00124 typedef void (*GxkActionClient) (gpointer client_data, 00125 GtkWindow *window, 00126 const gchar *prefix, 00127 GxkActionList *action_list, 00128 GtkWidget *publisher); 00129 void gxk_window_add_action_client (GtkWindow *window, 00130 GxkActionClient added_func, 00131 gpointer client_data); 00132 void gxk_window_remove_action_client (GtkWindow *window, 00133 gpointer client_data); 00134 00135 00136 /* --- action groups --- */ 00137 #define GXK_TYPE_ACTION_GROUP (gxk_action_group_get_type ()) 00138 #define GXK_ACTION_GROUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GXK_TYPE_ACTION_GROUP, GxkActionGroup)) 00139 #define GXK_ACTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXK_TYPE_ACTION_GROUP, GxkActionGroupClass)) 00140 #define GXK_IS_ACTION_GROUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GXK_TYPE_ACTION_GROUP)) 00141 #define GXK_IS_ACTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXK_TYPE_ACTION_GROUP)) 00142 #define GXK_ACTION_GROUP_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GXK_TYPE_ACTION_GROUP, GxkActionGroupClass)) 00143 struct GxkActionGroup { 00144 GObject parent_instance; 00145 gulong action_id; 00146 guint lock_count; 00147 guint invert_dups : 1; 00148 }; 00149 typedef struct { 00150 GObjectClass parent_class; 00151 void (*changed) (GxkActionGroup *self); 00152 } GxkActionGroupClass; 00153 GType gxk_action_group_get_type (void); 00154 GxkActionGroup* gxk_action_group_new (void); 00155 void gxk_action_group_select (GxkActionGroup *agroup, 00156 gulong action_id); 00157 void gxk_action_group_lock (GxkActionGroup *agroup); 00158 void gxk_action_group_unlock (GxkActionGroup *agroup); 00159 void gxk_action_group_dispose (GxkActionGroup *agroup); 00160 GxkActionGroup* gxk_action_toggle_new (void); 00161 00162 00163 G_END_DECLS 00164 00165 #endif /* __GXK_ACTION_H__ */