GladeWidgetClass

GladeWidgetClass — Object Class-wide metadata

Synopsis


#include <glade.h>


            GladeWidgetClass;
            GladeSignalClass;
enum        GladeCreateReason;
void        (*GladePostCreateFunc)          (GObject *object,
                                             GladeCreateReason reason);
void        (*GladeChildSetPropertyFunc)    (GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             const GValue *value);
void        (*GladeChildGetPropertyFunc)    (GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             GValue *value);
GList*      (*GladeGetChildrenFunc)         (GObject *container);
void        (*GladeAddChildFunc)            (GObject *parent,
                                             GObject *child);
void        (*GladeRemoveChildFunc)         (GObject *parent,
                                             GObject *child);
void        (*GladeReplaceChildFunc)        (GObject *container,
                                             GObject *old,
                                             GObject *new);
void        (*GladeGetInternalFunc)         (GObject *parent,
                                             const gchar *name,
                                             GObject **child);
void        (*GladeEditorLaunchFunc)        (GObject *object);
GladeWidgetClass* glade_widget_class_new    (GladeXmlNode *class_node,
                                             const gchar *catname,
                                             const gchar *library,
                                             const gchar *domain,
                                             const gchar *book);
void        glade_widget_class_free         (GladeWidgetClass *widget_class);
GladeWidgetClass* glade_widget_class_get_by_name
                                            (const char *name);
GladeWidgetClass* glade_widget_class_get_by_type
                                            (GType type);
#define     glade_widget_class_from_pclass  (pclass)
#define     glade_widget_class_create_widget(class, query, ...)
GladeWidget* glade_widget_class_create_internal
                                            (GladeWidget *parent,
                                             GObject *internal_object,
                                             const gchar *internal_name,
                                             const gchar *parent_name,
                                             gboolean anarchist,
                                             GladeCreateReason reason);
GParameter* glade_widget_class_default_params
                                            (GladeWidgetClass *class,
                                             gboolean construct,
                                             guint *n_params);
gboolean    glade_widget_class_query        (GladeWidgetClass *class);
GList*      glade_widget_class_get_derived_types
                                            (GType type);
void        glade_widget_class_dump_param_specs
                                            (GladeWidgetClass *class);
GladePropertyClass* glade_widget_class_get_property_class
                                            (GladeWidgetClass *class,
                                             const gchar *name);
GladeSupportedChild* glade_widget_class_get_child_support
                                            (GladeWidgetClass *class,
                                             GType child_type);
void        glade_widget_class_container_add
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child);
void        glade_widget_class_container_remove
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child);
gboolean    glade_widget_class_container_has_child
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child);
GList*      glade_widget_class_container_get_children
                                            (GladeWidgetClass *class,
                                             GObject *container);
void        glade_widget_class_container_set_property
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             const GValue *value);
void        glade_widget_class_container_get_property
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             GValue *value);
void        glade_widget_class_container_replace_child
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *old,
                                             GObject *new);
gboolean    glade_widget_class_contains_extra
                                            (GladeWidgetClass *class);
GladePackingDefault* glade_widget_class_get_packing_default
                                            (GladeWidgetClass *child_class,
                                             GladeWidgetClass *container_class,
                                             const gchar *propert_id);


Description

GladeWidgetClass is a structure based on a GType and parameters from the Glade catalog files and is the central metadata for object classes; it also provides an abstraction later to container apis.

Details

GladeWidgetClass

typedef struct {
	GType type;          /* GType of the widget */

	gchar *name;         /* Name of the widget, for example GtkButton */

	gchar *catalog;      /* The name of the widget catalog this class
			      * was declared by.
			      */

	gchar *book;         /* Devhelp search namespace
			      */

	GdkPixbuf *large_icon;     /* The 22x22 icon for the widget */

	GdkPixbuf *small_icon;     /* The 16x16 icon for the widget */


	GdkCursor *cursor;         /* a cursor for inserting widgets */


	gboolean fixed;      /* If this is a GtkContainer, use free-form
			      * placement with drag/resize/paste at mouse...
			      */

	gchar *generic_name; /* Use to generate names of new widgets, for
			      * example "button" so that we generate button1,
			      * button2, buttonX ..
			      */

	gchar *palette_name; /* Name used in the palette */

	GList *properties;   /* List of GladePropertyClass objects.
			      * [see glade-property.h ] this list contains
			      * properties about the widget that we are going
			      * to modify. Like "title", "label", "rows" .
			      * Each property creates an input in the propety
			      * editor.
			      */

	GList *signals;     /* List of GladeSignalClass objects */


	GList *children;    /* List of GladeSupportedChild objects */

        GList *child_packings; /* Default packing property values */

	GModule *module;	/* Module with the (optional) special functions
				 * needed for placeholder_replace, post_create_function
				 * and the set & get functions of the properties
				 * of this class.
				 */
				 
	gboolean toplevel;	/* If this class is toplevel */
	
	/* Executed after widget creation: it takes care of creating the
	 * GladeWidgets associated with internal children. It's also the place
	 * to set sane defaults, e.g. set the size of a window.
	 */
	GladePostCreateFunc           post_create_function;

	/* Retrieves the the internal child of the given name.
	 */
	GladeGetInternalFunc          get_internal_child;

	/* Entry point for custom editors.
	 */
	GladeEditorLaunchFunc         launch_editor;
} GladeWidgetClass;


GladeSignalClass

typedef struct {
	GSignalQuery query;

	const gchar *name;         /* Name of the signal, eg clicked */
	gchar       *type;         /* Name of the object class that this signal belongs to
				    * eg GtkButton */
} GladeSignalClass;


enum GladeCreateReason

typedef enum _GladeCreateReason 
{
	GLADE_CREATE_USER = 0,
	GLADE_CREATE_COPY,
	GLADE_CREATE_LOAD,
	GLADE_CREATE_REBUILD,
	GLADE_CREATE_REASONS
} GladeCreateReason;

These are the reasons your GladePostCreateFunc can be called.

GLADE_CREATE_USER Was created at the user's request (this is a good time to set any properties or add children to the project; like GtkFrame's label for example).
GLADE_CREATE_COPY Was created as a result of the copy/paste mechanism, at this point you can count on glade to follow up with properties and children on its own.
GLADE_CREATE_LOAD Was created during the load process.
GLADE_CREATE_REBUILD Was created as a replacement for another project object; this only happens when the user is changing a property that is marked by the type system as G_PARAM_SPEC_CONSTRUCT_ONLY.
GLADE_CREATE_REASONS Never used.

GladePostCreateFunc ()

void        (*GladePostCreateFunc)          (GObject *object,
                                             GladeCreateReason reason);

This function is called exactly once for any project object instance and can be for any GladeCreateReason.

object : a GObject
reason : a GladeCreateReason

GladeChildSetPropertyFunc ()

void        (*GladeChildSetPropertyFunc)    (GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             const GValue *value);

Called to set the packing property property_name to value on the child object of container.

container : A GObject container
child : The GObject child
property_name : The property name
value : The GValue

GladeChildGetPropertyFunc ()

void        (*GladeChildGetPropertyFunc)    (GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             GValue *value);

Called to get the packing property property_name on the child object of container into value.

container : A GObject container
child : The GObject child
property_name : The property name
value : The GValue

GladeGetChildrenFunc ()

GList*      (*GladeGetChildrenFunc)         (GObject *container);

A function called to get containers children.

container : A GObject container
Returns : A GList of GObject children.

GladeAddChildFunc ()

void        (*GladeAddChildFunc)            (GObject *parent,
                                             GObject *child);

Called to add child to parent.

parent : A GObject container
child : A GObject child

GladeRemoveChildFunc ()

void        (*GladeRemoveChildFunc)         (GObject *parent,
                                             GObject *child);

Called to remove child from parent.

parent : A GObject container
child : A GObject child

GladeReplaceChildFunc ()

void        (*GladeReplaceChildFunc)        (GObject *container,
                                             GObject *old,
                                             GObject *new);

Called to swap placeholders with project objects in containers.

container : A GObject container
old : The old GObject child
new : The new GObject child to take its place

GladeGetInternalFunc ()

void        (*GladeGetInternalFunc)         (GObject *parent,
                                             const gchar *name,
                                             GObject **child);

Called to lookup child in composite object parent by name.

parent : A GObject composite object
name : A string identifier
child : A return location for a GObject

GladeEditorLaunchFunc ()

void        (*GladeEditorLaunchFunc)        (GObject *object);

Called to launch a custom editor for object

object : A GObject

glade_widget_class_new ()

GladeWidgetClass* glade_widget_class_new    (GladeXmlNode *class_node,
                                             const gchar *catname,
                                             const gchar *library,
                                             const gchar *domain,
                                             const gchar *book);

Merges the contents of the parent_class on the widget_class. The properties of the parent_class will be prepended to those of widget_class.

class_node : A GladeXmlNode
catname : the name of the owning catalog
library : the name of the library used to load class methods from
domain : the domain to translate strings from this plugin from
book : the devhelp search domain for the owning catalog.
Returns :

glade_widget_class_free ()

void        glade_widget_class_free         (GladeWidgetClass *widget_class);

Frees widget_class and its associated memory.

widget_class : a GladeWidgetClass

glade_widget_class_get_by_name ()

GladeWidgetClass* glade_widget_class_get_by_name
                                            (const char *name);

name : name of the widget class (for instance: GtkButton)
Returns : an existing GladeWidgetClass with the name equaling name, or NULL if such a class doesn't exist

glade_widget_class_get_by_type ()

GladeWidgetClass* glade_widget_class_get_by_type
                                            (GType type);

type :
Returns :

glade_widget_class_from_pclass()

#define     glade_widget_class_from_pclass(pclass)

pclass :

glade_widget_class_create_widget()

#define     glade_widget_class_create_widget(class, query, ...)

This factory function returns a new GladeWidget of the correct type/class with the properties defined in @... and queries the user if nescisary.

The resulting object will have all default properties applied to it including the overrides specified in the catalog, unless the catalog has specified 'ignore' for that property.

Note that the widget class must be fed twice; once as the leading arg... and also as the property for the GladeWidget

this macro returns the newly created GladeWidget

class : a GladeWidgetClass
query : whether to display query dialogs if applicable to the class
... : a NULL terminated list of string/value pairs of GladeWidget properties
... :

glade_widget_class_create_internal ()

GladeWidget* glade_widget_class_create_internal
                                            (GladeWidget *parent,
                                             GObject *internal_object,
                                             const gchar *internal_name,
                                             const gchar *parent_name,
                                             gboolean anarchist,
                                             GladeCreateReason reason);

A convenienve function to create a GladeWidget of the prescribed type for internal widgets.

parent : The parent GladeWidget, or NULL for children outside of the hierarchy.
internal_object : the GObject
internal_name : a string identifier for this internal widget.
parent_name :
anarchist : Whether or not this widget is a widget outside of the parent's hierarchy (like a popup window)
reason : The GladeCreateReason for which this internal widget was created (usually just pass the reason from the post_create function; note also this is used only by the plugin code so pass something usefull here).
Returns : a freshly created GladeWidget wrapper object for the internal_object of name internal_name

glade_widget_class_default_params ()

GParameter* glade_widget_class_default_params
                                            (GladeWidgetClass *class,
                                             gboolean construct,
                                             guint *n_params);

class : a GladeWidgetClass
construct : whether to return construct params or not construct params
n_params : return location if any defaults are specified for this class.
Returns : A list of params for use in g_object_newv()

glade_widget_class_query ()

gboolean    glade_widget_class_query        (GladeWidgetClass *class);

class : A GladeWidgetClass
Returns : whether the user needs to be queried for certain properties upon creation of this class.

glade_widget_class_get_derived_types ()

GList*      glade_widget_class_get_derived_types
                                            (GType type);

type :
Returns :

glade_widget_class_dump_param_specs ()

void        glade_widget_class_dump_param_specs
                                            (GladeWidgetClass *class);

Dump to the console the properties of class as specified by gtk+. You can also run glade3 with : "glade-3 --dump GtkWindow" to get dump a widget class properties.

class : a GladeWidgetClass

glade_widget_class_get_property_class ()

GladePropertyClass* glade_widget_class_get_property_class
                                            (GladeWidgetClass *class,
                                             const gchar *name);

class : a GladeWidgetClass
name : a string
Returns : The GladePropertyClass object if there is one associated to this widget class.

glade_widget_class_get_child_support ()

GladeSupportedChild* glade_widget_class_get_child_support
                                            (GladeWidgetClass *class,
                                             GType child_type);

class : a GladeWidgetClass
child_type : a GType
Returns : The GladeSupportedChild object appropriate to use for container vfuncs for this child_type if this child type is supported, otherwise NULL.

glade_widget_class_container_add ()

void        glade_widget_class_container_add
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child);

class :
container :
child :

glade_widget_class_container_remove ()

void        glade_widget_class_container_remove
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child);

class :
container :
child :

glade_widget_class_container_has_child ()

gboolean    glade_widget_class_container_has_child
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child);

class :
container :
child :
Returns :

glade_widget_class_container_get_children ()

GList*      glade_widget_class_container_get_children
                                            (GladeWidgetClass *class,
                                             GObject *container);

class :
container :
Returns :

glade_widget_class_container_set_property ()

void        glade_widget_class_container_set_property
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             const GValue *value);

class :
container :
child :
property_name :
value :

glade_widget_class_container_get_property ()

void        glade_widget_class_container_get_property
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *child,
                                             const gchar *property_name,
                                             GValue *value);

class :
container :
child :
property_name :
value :

glade_widget_class_container_replace_child ()

void        glade_widget_class_container_replace_child
                                            (GladeWidgetClass *class,
                                             GObject *container,
                                             GObject *old,
                                             GObject *new);

class :
container :
old :
new :

glade_widget_class_contains_extra ()

gboolean    glade_widget_class_contains_extra
                                            (GladeWidgetClass *class);

class :
Returns :

glade_widget_class_get_packing_default ()

GladePackingDefault* glade_widget_class_get_packing_default
                                            (GladeWidgetClass *child_class,
                                             GladeWidgetClass *container_class,
                                             const gchar *propert_id);

child_class :
container_class :
propert_id :
Returns :