1 #ifndef __GLADE_COMMAND_H__ 2 #define __GLADE_COMMAND_H__ 3 4 #include <gladeui/glade-placeholder.h> 5 #include <gladeui/glade-widget.h> 6 #include <gladeui/glade-signal.h> 7 #include <gladeui/glade-property.h> 8 #include <gladeui/glade-project.h> 9 #include <glib-object.h> 10 11 G_BEGIN_DECLS 12 13 14 #define GLADE_TYPE_COMMAND (glade_command_get_type ()) 15 #define GLADE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_COMMAND, GladeCommand)) 16 #define GLADE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_COMMAND, GladeCommandClass)) 17 #define GLADE_IS_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_COMMAND)) 18 #define GLADE_IS_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_COMMAND)) 19 #define GLADE_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_COMMAND, GladeCommandClass)) 20 21 typedef struct _GladeCommand GladeCommand; 22 typedef struct _GladeCommandClass GladeCommandClass; 23 typedef struct _GladeCommandPrivate GladeCommandPrivate; 24 typedef struct _GCSetPropData GCSetPropData; 25 26 /** 27 * GCSetPropData 28 * @property: A #GladeProperty to set 29 * @new_value: The new #GValue to assign to @property 30 * @old_value: The old #GValue of @property 31 * 32 * #GladeProperties can be set in a list as one command, 33 * for Undo purposes; we store the list of #GCSetPropData with 34 * their old and new #GValue. 35 */ 36 struct _GCSetPropData { 37 GladeProperty *property; 38 GValue *new_value; 39 GValue *old_value; 40 }; 41 42 struct _GladeCommand 43 { 44 GObject parent; 45 46 GladeCommandPrivate *priv; 47 }; 48 49 struct _GladeCommandClass 50 { 51 GObjectClass parent_class; 52 53 gboolean (* execute) (GladeCommand *this_cmd); 54 gboolean (* undo) (GladeCommand *this_cmd); 55 gboolean (* unifies) (GladeCommand *this_cmd, GladeCommand *other_cmd); 56 void (* collapse) (GladeCommand *this_cmd, GladeCommand *other_cmd); 57 58 void (* glade_reserved1) (void); 59 void (* glade_reserved2) (void); 60 void (* glade_reserved3) (void); 61 void (* glade_reserved4) (void); 62 }; 63 64 65 66 GType glade_command_get_type (void); 67 68 void glade_command_push_group (const gchar *fmt, 69 ...) G_GNUC_PRINTF (1, 2); 70 void glade_command_pop_group (void); 71 gint glade_command_get_group_depth (void); 72 73 G_CONST_RETURN gchar *glade_command_description (GladeCommand *command); 74 gint glade_command_group_id (GladeCommand *command); 75 gboolean glade_command_execute (GladeCommand *command); 76 gboolean glade_command_undo (GladeCommand *command); 77 gboolean glade_command_unifies (GladeCommand *command, 78 GladeCommand *other); 79 void glade_command_collapse (GladeCommand *command, 80 GladeCommand *other); 81 82 /************************ project ******************************/ 83 void glade_command_set_project_target (GladeProject *project, 84 const gchar *catalog, 85 gint major, 86 gint minor); 87 88 void glade_command_set_project_domain (GladeProject *project, 89 const gchar *domain); 90 91 void glade_command_set_project_template(GladeProject *project, 92 GladeWidget *widget); 93 94 void glade_command_set_project_license (GladeProject *project, 95 const gchar *license); 96 97 void glade_command_set_project_resource_path (GladeProject *project, 98 const gchar *path); 99 100 /************************** properties *********************************/ 101 102 void glade_command_set_property_enabled(GladeProperty *property, 103 gboolean enabled); 104 105 void glade_command_set_property (GladeProperty *property, 106 ...); 107 108 void glade_command_set_property_value (GladeProperty *property, 109 const GValue *value); 110 111 void glade_command_set_properties (GladeProperty *property, 112 const GValue *old_value, 113 const GValue *new_value, 114 ...); 115 116 void glade_command_set_properties_list (GladeProject *project, 117 GList *props); /* list of GCSetPropData */ 118 119 /************************** name ******************************/ 120 121 void glade_command_set_name (GladeWidget *glade_widget, const gchar *name); 122 123 124 /************************ protection ******************************/ 125 126 void glade_command_lock_widget (GladeWidget *widget, 127 GladeWidget *lock); 128 129 void glade_command_unlock_widget (GladeWidget *widget); 130 131 132 /************************ create/add/delete ******************************/ 133 134 void glade_command_add (GList *widgets, 135 GladeWidget *parent, 136 GladePlaceholder *placeholder, 137 GladeProject *project, 138 gboolean pasting); 139 140 void glade_command_delete (GList *widgets); 141 142 GladeWidget *glade_command_create (GladeWidgetAdaptor *adaptor, 143 GladeWidget *parent, 144 GladePlaceholder *placeholder, 145 GladeProject *project); 146 147 /************************ cut/paste/dnd ******************************/ 148 149 void glade_command_cut (GList *widgets); 150 151 void glade_command_paste (GList *widgets, 152 GladeWidget *parent, 153 GladePlaceholder *placeholder, 154 GladeProject *project); 155 156 void glade_command_dnd (GList *widgets, 157 GladeWidget *parent, 158 GladePlaceholder *placeholder); 159 160 /************************ signals ******************************/ 161 162 void glade_command_add_signal (GladeWidget *glade_widget, 163 const GladeSignal *signal); 164 165 void glade_command_remove_signal (GladeWidget *glade_widget, 166 const GladeSignal *signal); 167 168 void glade_command_change_signal (GladeWidget *glade_widget, 169 const GladeSignal *old_signal, 170 const GladeSignal *new_signal); 171 172 /************************ set i18n ******************************/ 173 174 void glade_command_set_i18n (GladeProperty *property, 175 gboolean translatable, 176 const gchar *context, 177 const gchar *comment); 178 179 180 G_END_DECLS 181 182 #endif /* __GLADE_COMMAND_H__ */ 183