1 #ifndef _GLADE_WIDGET_ADAPTOR_H_
2 #define _GLADE_WIDGET_ADAPTOR_H_
3 
4 #include <gladeui/glade-xml-utils.h>
5 #include <gladeui/glade-property-class.h>
6 #include <gladeui/glade-editor-property.h>
7 #include <gladeui/glade-signal-class.h>
8 #include <gladeui/glade-catalog.h>
9 #include <gladeui/glade-editable.h>
10 #include <glib-object.h>
11 #include <gmodule.h>
12 #include <gtk/gtk.h>
13 
14 G_BEGIN_DECLS
15 
16 #define GLADE_TYPE_WIDGET_ADAPTOR            (glade_widget_adaptor_get_type())
17 #define GLADE_WIDGET_ADAPTOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_WIDGET_ADAPTOR, GladeWidgetAdaptor))
18 #define GLADE_WIDGET_ADAPTOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_WIDGET_ADAPTOR, GladeWidgetAdaptorClass))
19 #define GLADE_IS_WIDGET_ADAPTOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_WIDGET_ADAPTOR))
20 #define GLADE_IS_WIDGET_ADAPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_WIDGET_ADAPTOR))
21 #define GLADE_WIDGET_ADAPTOR_GET_CLASS(o)    (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_WIDGET_ADAPTOR, GladeWidgetAdaptorClass))
22 
23 typedef struct _GladeWidgetAdaptorPrivate GladeWidgetAdaptorPrivate;
24 typedef struct _GladeWidgetAdaptorClass   GladeWidgetAdaptorClass;
25 
26 /**
27  * GWA_DEPRECATED:
28  * @obj: A #GladeWidgetAdaptor
29  *
30  * Checks whether this widget class is marked as deprecated
31  */
32 #define GWA_DEPRECATED(obj) \
33   ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->deprecated : FALSE)
34 
35 /**
36  * GWA_VERSION_SINCE_MAJOR:
37  * @obj: A #GladeWidgetAdaptor
38  *
39  * Checks major version in which this widget was introduced
40  */
41 #define GWA_VERSION_SINCE_MAJOR(obj) \
42   ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->version_since_major : 0)
43 
44 /**
45  * GWA_VERSION_SINCE_MINOR:
46  * @obj: A #GladeWidgetAdaptor
47  *
48  * Checks minor version in which this widget was introduced
49  */
50 #define GWA_VERSION_SINCE_MINOR(obj) \
51   ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->version_since_minor : 0)
52 
53 /**
54  * GWA_VERSION_CHECK:
55  * @adaptor: A #GladeWidgetAdaptor
56  * @major_version: The major version to check
57  * @minor_version: The minor version to check
58  *
59  * Evaluates to %TRUE if @adaptor is available in its owning library version-@major_verion.@minor_version.
60  *
61  */
62 #define GWA_VERSION_CHECK(adaptor, major_version, minor_version)	\
63   ((GWA_VERSION_SINCE_MAJOR (adaptor) == major_version) ?		\
64    (GWA_VERSION_SINCE_MINOR (adaptor) <= minor_version) :		\
65    (GWA_VERSION_SINCE_MAJOR (adaptor) <= major_version))
66 
67 /**
68  * GWA_IS_TOPLEVEL:
69  * @obj: A #GladeWidgetAdaptor
70  *
71  * Checks whether this widget class has been marked as
72  * a toplevel one.
73  */
74 #define GWA_IS_TOPLEVEL(obj) \
75   ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->toplevel : FALSE)
76 
77 /**
78  * GWA_USE_PLACEHOLDERS:
79  * @obj: A #GladeWidgetAdaptor
80  *
81  * Checks whether this widget class has been marked to
82  * use placeholders in child widget operations
83  */
84 #define GWA_USE_PLACEHOLDERS(obj) \
85   ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->use_placeholders : FALSE)
86 
87 
88 /**
89  * GWA_DEFAULT_WIDTH:
90  * @obj: A #GladeWidgetAdaptor
91  *
92  * Returns: the default width to be used when this widget
93  * is toplevel in the GladeDesignLayout
94  */
95 #define GWA_DEFAULT_WIDTH(obj) \
96   ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_width : -1)
97 
98 
99 /**
100  * GWA_DEFAULT_HEIGHT:
101  * @obj: A #GladeWidgetAdaptor
102  *
103  * Returns: the default width to be used when this widget
104  * is toplevel in the GladeDesignLayout
105  */
106 #define GWA_DEFAULT_HEIGHT(obj) \
107   ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_height : -1)
108 
109 
110 /**
111  * GWA_SCROLLABLE_WIDGET:
112  * @obj: A #GladeWidgetAdaptor
113  *
114  * Checks whether this is a GtkWidgetClass with scrolling capabilities.
115  */
116 #define GWA_SCROLLABLE_WIDGET(obj)					\
117   ((obj) ?								\
118    g_type_is_a (glade_widget_adaptor_get_object_type			\
119 		(GLADE_WIDGET_ADAPTOR (obj)),				\
120 		GTK_TYPE_SCROLLABLE) : FALSE)
121 
122 /**
123  * GWA_GET_CLASS:
124  * @type: A #GType
125  *
126  * Shorthand for referencing glade adaptor classes from
127  * the plugin eg. GWA_GET_CLASS (GTK_TYPE_CONTAINER)->post_create (adaptor...
128  */
129 #define GWA_GET_CLASS(type)                                                      \
130   (((type) == G_TYPE_OBJECT) ?						\
131    (GladeWidgetAdaptorClass *)g_type_class_peek (GLADE_TYPE_WIDGET_ADAPTOR) : \
132    GLADE_WIDGET_ADAPTOR_GET_CLASS (glade_widget_adaptor_get_by_type(type)))
133 
134 /**
135  * GWA_GET_OCLASS:
136  * @type: A #GType.
137  *
138  * Same as GWA_GET_CLASS but casted to GObjectClass
139  */
140 #define GWA_GET_OCLASS(type) ((GObjectClass*)GWA_GET_CLASS(type))
141 
142 
143 #define GLADE_VALID_CREATE_REASON(reason) (reason >= 0 && reason < GLADE_CREATE_REASONS)
144 
145 /**
146  * GladeCreateReason:
147  * @GLADE_CREATE_USER: Was created at the user's request
148  *                     (this is a good time to set any properties
149  *                     or add children to the project; like GtkFrame's
150  *                     label for example).
151  * @GLADE_CREATE_COPY: Was created as a result of the copy/paste
152  *                     mechanism, at this point you can count on glade
153  *                     to follow up with properties and children on
154  *                     its own.
155  * @GLADE_CREATE_LOAD: Was created during the load process.
156  * @GLADE_CREATE_REBUILD: Was created as a replacement for another project
157  *                        object; this only happens when the user is
158  *                        changing a property that is marked by the type
159  *                        system as G_PARAM_SPEC_CONSTRUCT_ONLY.
160  * @GLADE_CREATE_REASONS: Never used.
161  *
162  * These are the reasons your #GladePostCreateFunc can be called.
163  */
164 typedef enum
165 {
166 	GLADE_CREATE_USER = 0,
167 	GLADE_CREATE_COPY,
168 	GLADE_CREATE_LOAD,
169 	GLADE_CREATE_REBUILD,
170 	GLADE_CREATE_REASONS
171 } GladeCreateReason;
172 
173 /**
174  * GladeCreateWidgetFunc:
175  * @adaptor: A #GladeWidgetAdaptor
176  * @first_property_name: the name of the first property
177  * @var_args: the value of the first property, followed optionally by more
178  *  name/value pairs, followed by %NULL
179  *
180  * This entry point allows the backend to create a specialized GladeWidget
181  * derived object for handling instances in the core.
182  *
183  * Returns: A newly created #GladeWidget for the said adaptor.
184  */
185 typedef GladeWidget * (* GladeCreateWidgetFunc) (GladeWidgetAdaptor *adaptor,
186 						 const gchar        *first_property_name,
187 						 va_list             var_args);
188 
189 /**
190  * GladeSetPropertyFunc:
191  * @adaptor: A #GladeWidgetAdaptor
192  * @object: The #GObject
193  * @property_name: The property identifier
194  * @value: The #GValue
195  *
196  * This delagate function is used to apply the property value on
197  * the runtime object.
198  *
199  * Sets @value on @object for a given #GladePropertyClass
200  */
201 typedef void     (* GladeSetPropertyFunc)    (GladeWidgetAdaptor *adaptor,
202 					      GObject            *object,
203 					      const gchar        *property_name,
204 					      const GValue       *value);
205 
206 /**
207  * GladeGetPropertyFunc:
208  * @adaptor: A #GladeWidgetAdaptor
209  * @object: The #GObject
210  * @property_name: The property identifier
211  * @value: The #GValue
212  *
213  * Gets @value on @object for a given #GladePropertyClass
214  */
215 typedef void     (* GladeGetPropertyFunc)    (GladeWidgetAdaptor *adaptor,
216 					      GObject            *object,
217 					      const gchar        *property_name,
218 					      GValue             *value);
219 
220 /**
221  * GladeVerifyPropertyFunc:
222  * @adaptor: A #GladeWidgetAdaptor
223  * @object: The #GObject
224  * @property_name: The property identifier
225  * @value: The #GValue
226  *
227  * This delagate function is always called whenever setting any
228  * properties with the exception of load time, and copy/paste time
229  * (basicly the two places where we recreate a hierarchy that we
230  * already know "works") its basicly an optional backend provided
231  * boundry checker for properties.
232  *
233  * Returns: whether or not its OK to set @value on @object
234  */
235 typedef gboolean (* GladeVerifyPropertyFunc)      (GladeWidgetAdaptor *adaptor,
236 						   GObject            *object,
237 						   const gchar        *property_name,
238 						   const GValue       *value);
239 
240 /**
241  * GladeChildSetPropertyFunc:
242  * @adaptor: A #GladeWidgetAdaptor
243  * @container: The #GObject container
244  * @child: The #GObject child
245  * @property_name: The property name
246  * @value: The #GValue
247  *
248  * Called to set the packing property @property_name to @value
249  * on the @child object of @container.
250  */
251 typedef void   (* GladeChildSetPropertyFunc)      (GladeWidgetAdaptor *adaptor,
252 						   GObject            *container,
253 						   GObject            *child,
254 						   const gchar        *property_name,
255 						   const GValue       *value);
256 
257 /**
258  * GladeChildGetPropertyFunc:
259  * @adaptor: A #GladeWidgetAdaptor
260  * @container: The #GObject container
261  * @child: The #GObject child
262  * @property_name: The property name
263  * @value: The #GValue
264  *
265  * Called to get the packing property @property_name
266  * on the @child object of @container into @value.
267  */
268 typedef void   (* GladeChildGetPropertyFunc)      (GladeWidgetAdaptor *adaptor,
269 						   GObject            *container,
270 						   GObject            *child,
271 						   const gchar        *property_name,
272 						   GValue             *value);
273 
274 /**
275  * GladeChildVerifyPropertyFunc:
276  * @adaptor: A #GladeWidgetAdaptor
277  * @container: The #GObject container
278  * @child: The #GObject child
279  * @property_name: The property name
280  * @value: The #GValue
281  *
282  * This delagate function is always called whenever setting any
283  * properties with the exception of load time, and copy/paste time
284  * (basicly the two places where we recreate a hierarchy that we
285  * already know "works") its basicly an optional backend provided
286  * boundry checker for properties.
287  *
288  * Returns: whether or not its OK to set @value on @object
289  */
290 typedef gboolean (* GladeChildVerifyPropertyFunc) (GladeWidgetAdaptor *adaptor,
291 						   GObject            *container,
292 						   GObject            *child,
293 						   const gchar        *property_name,
294 						   const GValue       *value);
295 
296 /**
297  * GladeAddChildVerifyFunc:
298  * @adaptor: A #GladeWidgetAdaptor
299  * @parent: A #GObject container
300  * @child: A #GObject child
301  * @user_feedback: whether a notification dialog should be
302  * presented in the case that the child cannot not be added.
303  *
304  * Checks whether @child can be added to @parent.
305  *
306  * If @user_feedback is %TRUE and @child cannot be
307  * added then this shows a notification dialog to the user
308  * explaining why.
309  *
310  * Returns: whether @child can be added to @parent.
311  */
312 typedef gboolean (* GladeAddChildVerifyFunc)      (GladeWidgetAdaptor *adaptor,
313 						   GObject            *parent,
314 						   GObject            *child,
315 						   gboolean            user_feedback);
316 
317 /**
318  * GladeGetChildrenFunc:
319  * @adaptor: A #GladeWidgetAdaptor
320  * @container: A #GObject container
321  *
322  * A function called to get @containers children.
323  *
324  * Returns: A #GList of #GObject children.
325  */
326 typedef GList   *(* GladeGetChildrenFunc)         (GladeWidgetAdaptor *adaptor,
327 						   GObject            *container);
328 
329 /**
330  * GladeAddChildFunc:
331  * @adaptor: A #GladeWidgetAdaptor
332  * @parent: A #GObject container
333  * @child: A #GObject child
334  *
335  * Called to add @child to @parent.
336  */
337 typedef void     (* GladeAddChildFunc)            (GladeWidgetAdaptor *adaptor,
338 						   GObject            *parent,
339 						   GObject            *child);
340 
341 /**
342  * GladeRemoveChildFunc:
343  * @adaptor: A #GladeWidgetAdaptor
344  * @parent: A #GObject container
345  * @child: A #GObject child
346  *
347  * Called to remove @child from @parent.
348  */
349 typedef void     (* GladeRemoveChildFunc)         (GladeWidgetAdaptor *adaptor,
350 						   GObject            *parent,
351 						   GObject            *child);
352 
353 /**
354  * GladeReplaceChildFunc:
355  * @adaptor: A #GladeWidgetAdaptor
356  * @container: A #GObject container
357  * @old_obj: The old #GObject child
358  * @new_obj: The new #GObject child to take its place
359  *
360  * Called to swap placeholders with project objects
361  * in containers.
362  */
363 typedef void     (* GladeReplaceChildFunc)        (GladeWidgetAdaptor *adaptor,
364 						   GObject            *container,
365 						   GObject            *old_obj,
366 						   GObject            *new_obj);
367 
368 
369 /**
370  * GladeConstructObjectFunc:
371  * @adaptor: A #GladeWidgetAdaptor
372  * @n_parameters: amount of construct parameters
373  * @parameters: array of construct #GParameter args to create
374  *              the new object with.
375  *
376  * This function is called to construct a GObject instance.
377  * (for language bindings that may need to construct a wrapper
378  * object).
379  *
380  * Returns: A newly created #GObject
381  */
382 typedef GObject *(* GladeConstructObjectFunc)     (GladeWidgetAdaptor *adaptor,
383 						   guint               n_parameters,
384 						   GParameter         *parameters);
385 
386 /**
387  * GladeDestroyObjectFunc:
388  * @adaptor: A #GladeWidgetAdaptor
389  * @object: The #GObject to destroy
390  *
391  * This function is called to break any additional references to
392  * a GObject instance. Note that this function is not responsible
393  * for calling g_object_unref() on @object, the reference count
394  * of @object belongs to it's #GladeWidget wrapper.
395  *
396  * The #GtkWidget adaptor will call gtk_widget_destroy() before
397  * chaining up in this function.
398  *
399  * If your adaptor adds any references in any way at
400  * #GladePostCreateFunc time or #GladeConstructObjectFunc
401  * time, then this function must be implemented to also
402  * remove that reference.
403  *
404  */
405 typedef void (* GladeDestroyObjectFunc) (GladeWidgetAdaptor *adaptor,
406 					 GObject            *object);
407 
408 
409 /**
410  * GladePostCreateFunc:
411  * @adaptor: A #GladeWidgetAdaptor
412  * @object: a #GObject
413  * @reason: a #GladeCreateReason
414  *
415  * This function is called exactly once for any project object
416  * instance and can be for any #GladeCreateReason.
417  */
418 typedef void     (* GladePostCreateFunc)          (GladeWidgetAdaptor *adaptor,
419 						   GObject            *object,
420 						   GladeCreateReason   reason);
421 
422 /**
423  * GladeGetInternalFunc:
424  * @adaptor: A #GladeWidgetAdaptor
425  * @parent: A #GObject composite object
426  * @name: A string identifier
427  *
428  * Called to lookup @child in composite object @parent by @name.
429  *
430  * Returns: The specified internal widget.
431  */
432 typedef GObject *(* GladeGetInternalFunc)         (GladeWidgetAdaptor *adaptor,
433 						   GObject            *parent,
434 						   const gchar        *name);
435 
436 /**
437  * GladeActionActivateFunc:
438  * @adaptor: A #GladeWidgetAdaptor
439  * @object: The #GObject
440  * @action_path: The action path
441  *
442  * This delagate function is used to catch actions from the core.
443  *
444  */
445 typedef void     (* GladeActionActivateFunc)  (GladeWidgetAdaptor *adaptor,
446 					       GObject            *object,
447 					       const gchar        *action_path);
448 
449 /**
450  * GladeChildActionActivateFunc:
451  * @adaptor: A #GladeWidgetAdaptor
452  * @container: The #GtkContainer
453  * @object: The #GObject
454  * @action_path: The action path
455  *
456  * This delagate function is used to catch packing actions from the core.
457  *
458  */
459 typedef void     (* GladeChildActionActivateFunc) (GladeWidgetAdaptor *adaptor,
460 						   GObject            *container,
461 						   GObject            *object,
462 						   const gchar        *action_path);
463 
464 
465 /**
466  * GladeActionSubmenuFunc:
467  * @adaptor: A #GladeWidgetAdaptor
468  * @object: The #GObject
469  * @action_path: The action path
470  *
471  * This delagate function is used to create dynamically customized
472  * submenus. Called only for actions that dont have children.
473  *
474  */
475 typedef GtkWidget  *(* GladeActionSubmenuFunc)  (GladeWidgetAdaptor *adaptor,
476 						 GObject            *object,
477 						 const gchar        *action_path);
478 
479 
480 /**
481  * GladeDependsFunc:
482  * @adaptor: A #GladeWidgetAdaptor
483  * @widget: A #GladeWidget of the adaptor
484  * @another: another #GladeWidget
485  *
486  * Checks whether @widget depends on @another to be placed earlier in
487  * the glade file.
488  *
489  * Returns: whether @widget depends on @another being parsed first in
490  * the resulting glade file.
491  */
492 typedef gboolean (* GladeDependsFunc) (GladeWidgetAdaptor *adaptor,
493 				       GladeWidget        *widget,
494 				       GladeWidget        *another);
495 
496 
497 
498 /**
499  * GladeReadWidgetFunc:
500  * @adaptor: A #GladeWidgetAdaptor
501  * @widget: The #GladeWidget
502  * @node: The #GladeXmlNode
503  *
504  * This function is called to update @widget from @node.
505  *
506  */
507 typedef void     (* GladeReadWidgetFunc) (GladeWidgetAdaptor *adaptor,
508 					  GladeWidget        *widget,
509 					  GladeXmlNode       *node);
510 
511 /**
512  * GladeWriteWidgetFunc:
513  * @adaptor: A #GladeWidgetAdaptor
514  * @widget: The #GladeWidget
515  * @node: The #GladeXmlNode
516  *
517  * This function is called to fill in @node from @widget.
518  *
519  */
520 typedef void     (* GladeWriteWidgetFunc) (GladeWidgetAdaptor *adaptor,
521 					   GladeWidget        *widget,
522 					   GladeXmlContext    *context,
523 					   GladeXmlNode       *node);
524 
525 
526 /**
527  * GladeCreateEPropFunc:
528  * @adaptor: A #GladeWidgetAdaptor
529  * @klass: The #GladePropertyClass to be edited
530  * @use_command: whether to use the GladeCommand interface
531  * to commit property changes
532  *
533  * Creates a GladeEditorProperty to edit @klass
534  *
535  * Returns: A newly created #GladeEditorProperty
536  */
537 typedef GladeEditorProperty *(* GladeCreateEPropFunc) (GladeWidgetAdaptor *adaptor,
538 						       GladePropertyClass *klass,
539 						       gboolean            use_command);
540 
541 /**
542  * GladeStringFromValueFunc:
543  * @adaptor: A #GladeWidgetAdaptor
544  * @klass: The #GladePropertyClass
545  * @value: The #GValue to convert to a string
546  *
547  * For normal properties this is used to serialize
548  * property values, for custom properties (only when new pspecs are
549  * introduced) its needed for value comparisons in boxed pspecs
550  * and also to update the UI for undo/redo items etc.
551  *
552  * Returns: A newly allocated string representation of @value
553  */
554 typedef gchar   *(* GladeStringFromValueFunc) (GladeWidgetAdaptor *adaptor,
555 					       GladePropertyClass *klass,
556 					       const GValue       *value);
557 
558 
559 
560 /**
561  * GladeCreateEditableFunc:
562  * @adaptor: A #GladeWidgetAdaptor
563  * @type: The #GladeEditorPageType
564  *
565  * This is used to allow the backend to override the way an
566  * editor page is layed out (note that editor widgets are created
567  * on demand and not at startup).
568  *
569  * Returns: A new #GladeEditable widget
570  */
571 typedef GladeEditable *(* GladeCreateEditableFunc) (GladeWidgetAdaptor   *adaptor,
572 						    GladeEditorPageType   type);
573 
574 
575 /* Note that everything that must be processed at the creation of
576  * every instance is managed on the instance structure, and everywhere
577  * that we want to take advantage of inheritance is handled in the class
578  * structure.
579  */
580 struct _GladeWidgetAdaptor
581 {
582   GObject      parent_instance;
583 
584   GladeWidgetAdaptorPrivate *priv;
585 
586 };
587 
588 struct _GladeWidgetAdaptorClass
589 {
590   GObjectClass               parent_class;
591 
592   guint16                    version_since_major; /* Version in which this widget was */
593   guint16                    version_since_minor; /* introduced.                      */
594 
595   gint16                     default_width;       /* Default width in GladeDesignLayout */
596   gint16                     default_height;      /* Default height in GladeDesignLayout */
597 
598   guint                      deprecated : 1;          /* If this widget is currently
599 						       * deprecated
600 						       */
601   guint                      toplevel : 1;             /* If this class is toplevel */
602 
603   guint                      use_placeholders : 1;     /* Whether or not to use placeholders
604 							* to interface with child widgets.
605 							*/
606 
607   GladeCreateWidgetFunc      create_widget;  /* Creates a GladeWidget for this adaptor */
608 
609   GladeConstructObjectFunc   construct_object;  /* Object constructor
610 						 */
611 
612   GladePostCreateFunc        deep_post_create;   /* Executed after widget creation:
613 						  * plugins use this to setup various
614 						  * support codes (adaptors must always
615 						  * chain up in this stage of instantiation).
616 						  */
617 
618   GladePostCreateFunc        post_create;   /* Executed after widget creation:
619 					     * plugins use this to setup various
620 					     * support codes (adaptors are free here
621 					     * to chain up or not in this stage of
622 					     * instantiation).
623 					     */
624 
625   GladeGetInternalFunc       get_internal_child; /* Retrieves the the internal child
626 						  * of the given name.
627 						  */
628 
629   /* Delagate to verify if this is a valid value for this property,
630    * if this function exists and returns FALSE, then glade_property_set
631    * will abort before making any changes
632    */
633   GladeVerifyPropertyFunc verify_property;
634 
635   /* An optional backend function used instead of g_object_set()
636    * virtual properties must be handled with this function.
637    */
638   GladeSetPropertyFunc set_property;
639 
640   /* An optional backend function used instead of g_object_get()
641    * virtual properties must be handled with this function.
642    *
643    * Note that since glade knows what the property values are
644    * at all times regardless of the objects copy, this is currently
645    * only used to obtain the values of packing properties that are
646    * set by the said object's parent at "container_add" time.
647    */
648   GladeGetPropertyFunc get_property;
649 
650   GladeAddChildVerifyFunc    add_verify;       /* Checks if a child can be added */
651   GladeAddChildFunc          add;              /* Adds a new child of this type */
652   GladeRemoveChildFunc       remove;           /* Removes a child from the container */
653   GladeGetChildrenFunc       get_children;     /* Returns a list of direct children for
654 						* this support type.
655 						*/
656 
657   GladeChildVerifyPropertyFunc child_verify_property; /* A boundry checker for
658 						       * packing properties
659 						       */
660   GladeChildSetPropertyFunc    child_set_property; /* Sets/Gets a packing property */
661   GladeChildGetPropertyFunc    child_get_property; /* for this child */
662   GladeReplaceChildFunc        replace_child;  /* This method replaces a
663 						* child widget with
664 						* another one: it's used to
665 						* replace a placeholder with
666 						* a widget and viceversa.
667 						*/
668 
669   GladeActionActivateFunc      action_activate;       /* This method is used to catch actions */
670   GladeChildActionActivateFunc child_action_activate; /* This method is used to catch packing actions */
671   GladeActionSubmenuFunc       action_submenu;        /* Delagate function to create dynamic submenus
672 						       * in action menus. */
673   GladeDependsFunc             depends;           /* Periodically sort widgets in the project */
674   GladeReadWidgetFunc          read_widget;       /* Reads widget attributes from xml */
675   GladeWriteWidgetFunc         write_widget;      /* Writes widget attributes to the xml */
676   GladeReadWidgetFunc          read_child;        /* Reads widget attributes from xml */
677   GladeWriteWidgetFunc         write_child;       /* Writes widget attributes to the xml */
678   GladeCreateEPropFunc         create_eprop;      /* Creates a GladeEditorProperty */
679   GladeStringFromValueFunc     string_from_value; /* Creates a string for a value */
680   GladeCreateEditableFunc      create_editable;   /* Creates a page for the editor */
681 
682   GladeDestroyObjectFunc       destroy_object;    /* Object destructor */
683   GladeWriteWidgetFunc         write_widget_after;/* Writes widget attributes to the xml (after children) */
684 
685   void   (* glade_reserved1)   (void);
686   void   (* glade_reserved2)   (void);
687   void   (* glade_reserved3)   (void);
688   void   (* glade_reserved4)   (void);
689   void   (* glade_reserved5)   (void);
690   void   (* glade_reserved6)   (void);
691 };
692 
693 #define glade_widget_adaptor_create_widget(adaptor, query, ...) \
694     (glade_widget_adaptor_create_widget_real (query, "adaptor", adaptor, __VA_ARGS__));
695 
696 
697 GType                 glade_widget_adaptor_get_type         (void) G_GNUC_CONST;
698 
699 GType                 glade_widget_adaptor_get_object_type  (GladeWidgetAdaptor   *adaptor);
700 G_CONST_RETURN gchar *glade_widget_adaptor_get_name         (GladeWidgetAdaptor   *adaptor);
701 G_CONST_RETURN gchar *glade_widget_adaptor_get_generic_name (GladeWidgetAdaptor   *adaptor);
702 G_CONST_RETURN gchar *glade_widget_adaptor_get_title        (GladeWidgetAdaptor   *adaptor);
703 G_CONST_RETURN gchar *glade_widget_adaptor_get_icon_name    (GladeWidgetAdaptor   *adaptor);
704 G_CONST_RETURN gchar *glade_widget_adaptor_get_missing_icon (GladeWidgetAdaptor   *adaptor);
705 G_CONST_RETURN gchar *glade_widget_adaptor_get_catalog      (GladeWidgetAdaptor   *adaptor);
706 G_CONST_RETURN gchar *glade_widget_adaptor_get_book         (GladeWidgetAdaptor   *adaptor);
707 G_CONST_RETURN GList *glade_widget_adaptor_get_properties   (GladeWidgetAdaptor   *adaptor);
708 G_CONST_RETURN GList *glade_widget_adaptor_get_packing_props(GladeWidgetAdaptor   *adaptor);
709 G_CONST_RETURN GList *glade_widget_adaptor_get_signals      (GladeWidgetAdaptor   *adaptor);
710 
711 GList                *glade_widget_adaptor_list_adaptors    (void);
712 
713 GladeWidgetAdaptor   *glade_widget_adaptor_from_catalog     (GladeCatalog         *catalog,
714 							     GladeXmlNode         *class_node,
715 							     GModule              *module);
716 
717 void                  glade_widget_adaptor_register         (GladeWidgetAdaptor   *adaptor);
718 
719 GladeWidget          *glade_widget_adaptor_create_internal  (GladeWidget          *parent,
720 							     GObject              *internal_object,
721 							     const gchar          *internal_name,
722 							     const gchar          *parent_name,
723 							     gboolean              anarchist,
724 							     GladeCreateReason     reason);
725 
726 GladeWidget          *glade_widget_adaptor_create_widget_real (gboolean            query,
727 							       const gchar        *first_property,
728 							       ...);
729 
730 
731 GladeWidgetAdaptor   *glade_widget_adaptor_get_by_name        (const gchar        *name);
732 GladeWidgetAdaptor   *glade_widget_adaptor_get_by_type        (GType               type);
733 GladeWidgetAdaptor   *glade_widget_adaptor_from_pspec         (GladeWidgetAdaptor *adaptor,
734 							       GParamSpec         *spec);
735 
736 GladePropertyClass   *glade_widget_adaptor_get_property_class (GladeWidgetAdaptor *adaptor,
737 							       const gchar        *name);
738 GladePropertyClass   *glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor *adaptor,
739 								    const gchar        *name);
740 
741 GParameter           *glade_widget_adaptor_default_params     (GladeWidgetAdaptor *adaptor,
742 							       gboolean            construct,
743 							       guint              *n_params);
744 GObject              *glade_widget_adaptor_construct_object   (GladeWidgetAdaptor *adaptor,
745 							       guint               n_parameters,
746 							       GParameter         *parameters);
747 void                  glade_widget_adaptor_destroy_object     (GladeWidgetAdaptor *adaptor,
748 							       GObject            *object);
749 void                  glade_widget_adaptor_post_create        (GladeWidgetAdaptor *adaptor,
750 							       GObject            *object,
751 							       GladeCreateReason   reason);
752 GObject              *glade_widget_adaptor_get_internal_child (GladeWidgetAdaptor *adaptor,
753 							       GObject            *object,
754 							       const gchar        *internal_name);
755 void                  glade_widget_adaptor_set_property       (GladeWidgetAdaptor *adaptor,
756 							       GObject            *object,
757 							       const gchar        *property_name,
758 							       const GValue       *value);
759 void                  glade_widget_adaptor_get_property       (GladeWidgetAdaptor *adaptor,
760 							       GObject            *object,
761 							       const gchar        *property_name,
762 							       GValue             *value);
763 gboolean              glade_widget_adaptor_verify_property    (GladeWidgetAdaptor *adaptor,
764 							       GObject            *object,
765 							       const gchar        *property_name,
766 							       const GValue       *value);
767 gboolean              glade_widget_adaptor_add_verify         (GladeWidgetAdaptor *adaptor,
768 							       GObject            *container,
769 							       GObject            *child,
770 							       gboolean            user_feedback);
771 void                  glade_widget_adaptor_add                (GladeWidgetAdaptor *adaptor,
772 							       GObject            *container,
773 							       GObject            *child);
774 void                  glade_widget_adaptor_remove             (GladeWidgetAdaptor *adaptor,
775 							       GObject            *container,
776 							       GObject            *child);
777 GList                *glade_widget_adaptor_get_children       (GladeWidgetAdaptor *adaptor,
778 							       GObject            *container);
779 gboolean              glade_widget_adaptor_has_child          (GladeWidgetAdaptor *adaptor,
780 							       GObject            *container,
781 							       GObject            *child);
782 void                  glade_widget_adaptor_child_set_property (GladeWidgetAdaptor *adaptor,
783 							       GObject            *container,
784 							       GObject            *child,
785 							       const gchar        *property_name,
786 							       const GValue       *value);
787 void                  glade_widget_adaptor_child_get_property (GladeWidgetAdaptor *adaptor,
788 							       GObject            *container,
789 							       GObject            *child,
790 							       const gchar        *property_name,
791 							       GValue             *value);
792 gboolean              glade_widget_adaptor_child_verify_property (GladeWidgetAdaptor *adaptor,
793 								  GObject            *container,
794 								  GObject            *child,
795 								  const gchar        *property_name,
796 								  const GValue       *value);
797 void                  glade_widget_adaptor_replace_child      (GladeWidgetAdaptor *adaptor,
798 							       GObject            *container,
799 							       GObject            *old_obj,
800 							       GObject            *new_obj);
801 gboolean              glade_widget_adaptor_query              (GladeWidgetAdaptor *adaptor);
802 
803 G_CONST_RETURN gchar *glade_widget_adaptor_get_packing_default(GladeWidgetAdaptor *child_adaptor,
804 							       GladeWidgetAdaptor *container_adaptor,
805 							       const gchar        *id);
806 gboolean              glade_widget_adaptor_is_container       (GladeWidgetAdaptor *adaptor);
807 gboolean              glade_widget_adaptor_action_add         (GladeWidgetAdaptor *adaptor,
808 							       const gchar *action_path,
809 							       const gchar *label,
810 							       const gchar *stock,
811 							       gboolean important);
812 gboolean              glade_widget_adaptor_pack_action_add    (GladeWidgetAdaptor *adaptor,
813 							       const gchar *action_path,
814 							       const gchar *label,
815 							       const gchar *stock,
816 							       gboolean important);
817 gboolean              glade_widget_adaptor_action_remove      (GladeWidgetAdaptor *adaptor,
818 							       const gchar *action_path);
819 gboolean              glade_widget_adaptor_pack_action_remove (GladeWidgetAdaptor *adaptor,
820 							       const gchar *action_path);
821 GList                *glade_widget_adaptor_actions_new        (GladeWidgetAdaptor *adaptor);
822 GList                *glade_widget_adaptor_pack_actions_new   (GladeWidgetAdaptor *adaptor);
823 void                  glade_widget_adaptor_action_activate    (GladeWidgetAdaptor *adaptor,
824 							       GObject            *object,
825 							       const gchar        *action_path);
826 void                  glade_widget_adaptor_child_action_activate (GladeWidgetAdaptor *adaptor,
827 								  GObject            *container,
828 								  GObject            *object,
829 								  const gchar        *action_path);
830 GtkWidget            *glade_widget_adaptor_action_submenu        (GladeWidgetAdaptor *adaptor,
831 								  GObject            *object,
832 								  const gchar        *action_path);
833 
834 G_DEPRECATED
835 gboolean              glade_widget_adaptor_depends            (GladeWidgetAdaptor *adaptor,
836 							       GladeWidget        *widget,
837 							       GladeWidget        *another);
838 
839 void                  glade_widget_adaptor_read_widget        (GladeWidgetAdaptor *adaptor,
840 							       GladeWidget        *widget,
841 							       GladeXmlNode       *node);
842 void                  glade_widget_adaptor_write_widget       (GladeWidgetAdaptor *adaptor,
843 							       GladeWidget        *widget,
844 							       GladeXmlContext    *context,
845 							       GladeXmlNode       *node);
846 void                  glade_widget_adaptor_write_widget_after (GladeWidgetAdaptor *adaptor,
847 							       GladeWidget        *widget,
848 							       GladeXmlContext    *context,
849 							       GladeXmlNode       *node);
850 void                  glade_widget_adaptor_read_child         (GladeWidgetAdaptor *adaptor,
851 							       GladeWidget        *widget,
852 							       GladeXmlNode       *node);
853 void                  glade_widget_adaptor_write_child        (GladeWidgetAdaptor *adaptor,
854 							       GladeWidget        *widget,
855 							       GladeXmlContext    *context,
856 							       GladeXmlNode       *node);
857 
858 GladeEditorProperty  *glade_widget_adaptor_create_eprop       (GladeWidgetAdaptor *adaptor,
859 							       GladePropertyClass *klass,
860 							       gboolean            use_command);
861 GladeEditorProperty  *glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor,
862 								 const gchar        *property_id,
863 								 gboolean            packing,
864 								 gboolean            use_command);
865 
866 gchar                *glade_widget_adaptor_string_from_value  (GladeWidgetAdaptor *adaptor,
867 							       GladePropertyClass *klass,
868 							       const GValue       *value);
869 GladeEditable        *glade_widget_adaptor_create_editable    (GladeWidgetAdaptor *adaptor,
870 							       GladeEditorPageType type);
871 GladeSignalClass     *glade_widget_adaptor_get_signal_class   (GladeWidgetAdaptor *adaptor,
872 							       const gchar        *name);
873 GladeWidgetAdaptor   *glade_widget_adaptor_get_parent_adaptor (GladeWidgetAdaptor *adaptor);
874 
875 gboolean              glade_widget_adaptor_has_internal_children (GladeWidgetAdaptor *adaptor);
876 
877 G_END_DECLS
878 
879 #endif /* _GLADE_WIDGET_ADAPTOR_H_ */
880