glade-project.h 15.1 KB
Newer Older
Jose Maria Celorio's avatar
Jose Maria Celorio committed
1 2 3
#ifndef __GLADE_PROJECT_H__
#define __GLADE_PROJECT_H__

4 5
#include <gladeui/glade-widget.h>
#include <gladeui/glade-command.h>
6 7
#include <gladeui/glade-xml-utils.h>

Tristan Van Berkom's avatar
Tristan Van Berkom committed
8
G_BEGIN_DECLS
9

10 11 12 13 14 15
#define GLADE_TYPE_PROJECT            (glade_project_get_type ())
#define GLADE_PROJECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_PROJECT, GladeProject))
#define GLADE_PROJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_PROJECT, GladeProjectClass))
#define GLADE_IS_PROJECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_PROJECT))
#define GLADE_IS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROJECT))
#define GLADE_PROJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_PROJECT, GladeProjectClass))
Jose Maria Celorio's avatar
Jose Maria Celorio committed
16

17 18
typedef struct _GladeProjectPrivate  GladeProjectPrivate;
typedef struct _GladeProjectClass    GladeProjectClass;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
19

20 21 22 23 24 25
/**
 * GladePointerMode:
 * @GLADE_POINTER_SELECT:      Mouse pointer used for selecting widgets
 * @GLADE_POINTER_ADD_WIDGET:  Mouse pointer used for adding widgets
 * @GLADE_POINTER_DRAG_RESIZE: Mouse pointer used for dragging and 
 *                             resizing widgets in containers
26 27
 * @GLADE_POINTER_MARGIN_EDIT: Mouse pointer used to edit widget margins
 * @GLADE_POINTER_ALIGN_EDIT:  Mouse pointer used to edit widget alignment
28 29 30
 *
 * Indicates what the pointer is used for in the workspace.
 */
31
typedef enum
32
{
33 34
  GLADE_POINTER_SELECT = 0,
  GLADE_POINTER_ADD_WIDGET,
35 36 37
  GLADE_POINTER_DRAG_RESIZE,
  GLADE_POINTER_MARGIN_EDIT,
  GLADE_POINTER_ALIGN_EDIT
38
} GladePointerMode;
39

40
typedef enum
41 42 43 44
{
  GLADE_SUPPORT_OK                   = 0,
  GLADE_SUPPORT_DEPRECATED           = (0x01 << 0),
  GLADE_SUPPORT_MISMATCH             = (0x01 << 1)
45
} GladeSupportMask;
46

47 48
/**
 * GladeProjectModelColumns:
49 50 51 52 53
 * @GLADE_PROJECT_MODEL_COLUMN_ICON_NAME: name of the icon for the widget
 * @GLADE_PROJECT_MODEL_COLUMN_NAME: Name of the widget
 * @GLADE_PROJECT_MODEL_COLUMN_TYPE_NAME: The type name of the widget
 * @GLADE_PROJECT_MODEL_COLUMN_OBJECT: the GObject of the widget
 * @GLADE_PROJECT_MODEL_COLUMN_MISC: the auxilary text describing a widget's role
54
 * @GLADE_PROJECT_MODEL_COLUMN_WARNING: the support warning text for this widget
55
 * @GLADE_PROJECT_MODEL_N_COLUMNS: Number of columns
56 57 58 59 60 61 62
 *
 * The tree view columns provided by the GtkTreeModel implemented
 * by GladeProject
 *
 **/
typedef enum
{
63 64 65 66 67
  GLADE_PROJECT_MODEL_COLUMN_ICON_NAME,
  GLADE_PROJECT_MODEL_COLUMN_NAME,
  GLADE_PROJECT_MODEL_COLUMN_TYPE_NAME,
  GLADE_PROJECT_MODEL_COLUMN_OBJECT,
  GLADE_PROJECT_MODEL_COLUMN_MISC,
68
  GLADE_PROJECT_MODEL_COLUMN_WARNING,
69
  GLADE_PROJECT_MODEL_N_COLUMNS
70 71
} GladeProjectModelColumns;

72 73 74 75 76 77 78 79
/**
 * GladeVerifyFlags:
 * @GLADE_VERIFY_VERSIONS: Verify version mismatches
 * @GLADE_VERIFY_DEPRECATIONS: Verify deprecations
 * @GLADE_VERIFY_UNRECOGNIZED: Verify unrecognized types
 *
 */
typedef enum {
80 81 82
  GLADE_VERIFY_VERSIONS      = (1 << 0),
  GLADE_VERIFY_DEPRECATIONS  = (1 << 1),
  GLADE_VERIFY_UNRECOGNIZED  = (1 << 2)
83 84
} GladeVerifyFlags;

Jose Maria Celorio's avatar
Jose Maria Celorio committed
85 86
struct _GladeProject
{
87
  GObject parent_instance;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
88

89
  GladeProjectPrivate *priv;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
90 91 92 93
};

struct _GladeProjectClass
{
94 95 96
  GObjectClass parent_class;

  void          (*add_object)          (GladeProject *project,
97
                                        GladeWidget  *widget);
98
  void          (*remove_object)       (GladeProject *project,
99
                                        GladeWidget  *widget);
100 101 102 103 104 105

  void          (*undo)                (GladeProject *project);
  void          (*redo)                (GladeProject *project);
  GladeCommand *(*next_undo_item)      (GladeProject *project);
  GladeCommand *(*next_redo_item)      (GladeProject *project);
  void          (*push_undo)           (GladeProject *project,
106
                                        GladeCommand *command);
107 108

  void          (*changed)             (GladeProject *project,
109 110
                                        GladeCommand *command,
                                        gboolean      forward);
111 112

  void          (*widget_name_changed) (GladeProject *project,
113
                                        GladeWidget  *widget);
114 115 116 117
  void          (*selection_changed)   (GladeProject *project); 
  void          (*close)               (GladeProject *project);

  void          (*parse_finished)      (GladeProject *project);
118
  
119 120 121 122 123 124 125 126
  void   (* glade_reserved1)   (void);
  void   (* glade_reserved2)   (void);
  void   (* glade_reserved3)   (void);
  void   (* glade_reserved4)   (void);
  void   (* glade_reserved5)   (void);
  void   (* glade_reserved6)   (void);
  void   (* glade_reserved7)   (void);
  void   (* glade_reserved8)   (void);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
127 128
};

129

130 131 132 133 134
GType               glade_project_get_type            (void) G_GNUC_CONST;

GladeProject       *glade_project_new                 (void);
GladeProject       *glade_project_load                (const gchar         *path);
gboolean            glade_project_load_from_file      (GladeProject        *project, 
135
                                                       const gchar         *path);
136 137 138
gboolean            glade_project_save                (GladeProject        *project,
                                                       const gchar         *path, 
                                                       GError             **error);
139 140 141 142
gboolean            glade_project_save_verify         (GladeProject        *project,
                                                       const gchar         *path,
						       GladeVerifyFlags     flags,
                                                       GError             **error);
143 144 145
gboolean            glade_project_autosave            (GladeProject        *project,
                                                       GError             **error);
gboolean            glade_project_backup              (GladeProject        *project,
146 147
                                                       const gchar         *path, 
                                                       GError             **error);
148 149 150 151 152
void                glade_project_push_progress        (GladeProject       *project);
gboolean            glade_project_load_cancelled       (GladeProject       *project);
void                glade_project_cancel_load          (GladeProject       *project);

void                glade_project_preview              (GladeProject       *project, 
153
                                                        GladeWidget        *gwidget);
154
void                glade_project_properties           (GladeProject       *project);
155
gchar              *glade_project_resource_fullpath    (GladeProject       *project,
156
                                                        const gchar        *resource);
157 158 159
void                glade_project_set_resource_path    (GladeProject       *project,
                                                        const gchar        *path);
const gchar        *glade_project_get_resource_path    (GladeProject       *project);
160 161 162 163

void                glade_project_widget_visibility_changed (GladeProject  *project,
                                                             GladeWidget   *widget,
                                                             gboolean       visible);
164
void                glade_project_check_reordered      (GladeProject       *project,
165 166
                                                        GladeWidget        *parent,
                                                        GList              *old_order);
167

168 169 170 171
void                glade_project_set_template         (GladeProject       *project,
							GladeWidget        *widget);
GladeWidget        *glade_project_get_template         (GladeProject       *project);

172 173 174 175 176
void                glade_project_set_license          (GladeProject       *project,
                                                        const gchar        *license);

const gchar        *glade_project_get_license          (GladeProject       *project);

177 178 179 180 181
/* Commands */
void                glade_project_undo                 (GladeProject       *project);
void                glade_project_redo                 (GladeProject       *project);
GladeCommand       *glade_project_next_undo_item       (GladeProject       *project);
GladeCommand       *glade_project_next_redo_item       (GladeProject       *project);
182 183
void                glade_project_push_undo            (GladeProject       *project,
                                                        GladeCommand       *cmd);
184 185 186 187 188
GtkWidget          *glade_project_undo_items           (GladeProject       *project);
GtkWidget          *glade_project_redo_items           (GladeProject       *project);

/* Add/Remove Objects */
const GList        *glade_project_get_objects          (GladeProject       *project);
189 190 191 192 193 194
void                glade_project_add_object           (GladeProject       *project,
                                                        GObject            *object);
void                glade_project_remove_object        (GladeProject       *project,
                                                        GObject            *object);
gboolean            glade_project_has_object           (GladeProject       *project,
                                                        GObject            *object);
195
void                glade_project_widget_changed       (GladeProject       *project,
196
                                                        GladeWidget        *gwidget);
197 198

/* Widget names */
199 200 201 202
GladeWidget        *glade_project_get_widget_by_name   (GladeProject       *project,
                                                        const gchar        *name);
void                glade_project_set_widget_name      (GladeProject       *project,
                                                        GladeWidget        *widget, 
203
							const gchar        *name);
204 205 206 207 208 209
gchar              *glade_project_new_widget_name      (GladeProject       *project,
                                                        GladeWidget        *widget,
                                                        const gchar        *base_name);
gboolean            glade_project_available_widget_name(GladeProject       *project,
                                                        GladeWidget        *widget,
                                                        const gchar        *name);
210

211
/* Selection */
212
gboolean            glade_project_is_selected          (GladeProject       *project,
213
                                                        GObject            *object);
214
void                glade_project_selection_set        (GladeProject       *project,
215 216
                                                        GObject            *object,
                                                        gboolean            emit_signal);
217
void                glade_project_selection_add        (GladeProject       *project,
218 219
                                                        GObject            *object,
                                                        gboolean            emit_signal);
220
void                glade_project_selection_remove     (GladeProject       *project,
221 222
                                                        GObject            *object,
                                                        gboolean            emit_signal);
223
void                glade_project_selection_clear      (GladeProject       *project,
224
                                                        gboolean            emit_signal);
225 226 227 228 229 230 231 232 233 234 235 236 237 238
void                glade_project_selection_changed    (GladeProject       *project);
void                glade_project_queue_selection_changed (GladeProject    *project);
GList              *glade_project_selection_get        (GladeProject       *project);
gboolean            glade_project_get_has_selection    (GladeProject       *project);

/* Accessors */ 
const gchar        *glade_project_get_path             (GladeProject       *project);
gchar              *glade_project_get_name             (GladeProject       *project);
void                glade_project_reset_path           (GladeProject       *project);
gboolean            glade_project_is_loading           (GladeProject       *project);
time_t              glade_project_get_file_mtime       (GladeProject       *project);
gboolean            glade_project_get_readonly         (GladeProject       *project);
gboolean            glade_project_get_modified         (GladeProject       *project);
void                glade_project_set_pointer_mode     (GladeProject       *project,
239
                                                        GladePointerMode    mode);
240 241
GladePointerMode    glade_project_get_pointer_mode     (GladeProject       *project);
void                glade_project_set_add_item         (GladeProject       *project,
242
                                                        GladeWidgetAdaptor *adaptor);
243
GladeWidgetAdaptor *glade_project_get_add_item         (GladeProject       *project);
244 245 246 247
void                glade_project_set_target_version   (GladeProject       *project,
							const gchar        *catalog,
							gint                major,
							gint                minor);
248
void                glade_project_get_target_version   (GladeProject       *project,
249 250 251
                                                        const gchar        *catalog,
                                                        gint               *major,
                                                        gint               *minor);
252 253 254
GList              *glade_project_required_libs        (GladeProject       *project);
gchar              *glade_project_display_dependencies (GladeProject       *project);

255 256
GList              *glade_project_toplevels            (GladeProject       *project);

257 258 259 260
void                glade_project_set_translation_domain (GladeProject *project,
                                                          const gchar *domain);
const gchar        *glade_project_get_translation_domain (GladeProject *project);

261 262 263 264 265
void                glade_project_set_css_provider_path  (GladeProject *project,
                                                          const gchar  *path);

const gchar        *glade_project_get_css_provider_path  (GladeProject *project);

266
/* Verifications */
267 268 269
gboolean            glade_project_verify               (GladeProject       *project,
							gboolean            saving,
							GladeVerifyFlags    flags);
270
gchar              *glade_project_verify_widget_adaptor(GladeProject       *project,
271 272
                                                        GladeWidgetAdaptor *adaptor,
                                                        GladeSupportMask   *mask);
273 274
void                glade_project_verify_property      (GladeProperty      *property);
void                glade_project_verify_signal        (GladeWidget        *widget,
275
                                                        GladeSignal        *signal);
276
gboolean            glade_project_writing_preview      (GladeProject       *project);
277 278 279 280

/* General selection driven commands */
void                glade_project_copy_selection       (GladeProject       *project);
void                glade_project_command_cut          (GladeProject       *project); 
281 282
void                glade_project_command_paste        (GladeProject       *project,
                                                        GladePlaceholder   *placeholder);
283
void                glade_project_command_delete       (GladeProject       *project);
284

Jose Maria Celorio's avatar
Jose Maria Celorio committed
285 286 287
G_END_DECLS

#endif /* __GLADE_PROJECT_H__ */