![]() |
![]() |
![]() |
Glade UI Builder Reference Manual | ![]() |
---|---|---|---|---|
#include <glade.h> GladeWidgetClass; 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); 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); 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);
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.
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. */ GdkPixbuf *icon; /* The GdkPixbuf icon for the widget */ 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 GladeWidgetClassSignal 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. */ /* 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;
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. |
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 |
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
.
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
.
GList* (*GladeGetChildrenFunc) (GObject *container);
A function called to get containers
children.
void (*GladeAddChildFunc) (GObject *parent, GObject *child);
Called to add child
to parent
.
void (*GladeRemoveChildFunc) (GObject *parent, GObject *child);
Called to remove child
from parent
.
void (*GladeReplaceChildFunc) (GObject *container, GObject *old, GObject *new);
Called to swap placeholders with project objects in containers.
void (*GladeGetInternalFunc) (GObject *parent, const gchar *name, GObject **child);
Called to lookup child
in composite object parent
by name
.
void (*GladeEditorLaunchFunc) (GObject *object);
Called to launch a custom editor for object
object : |
A GObject |
GladeWidgetClass* glade_widget_class_new (GladeXmlNode *class_node, const gchar *catname, const gchar *library, const gchar *domain);
class_node : |
|
catname : |
|
library : |
|
domain : |
|
Returns : |
void glade_widget_class_free (GladeWidgetClass *widget_class);
Frees widget_class
and its associated memory.
widget_class : |
a GladeWidgetClass |
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
|
GladeWidgetClass* glade_widget_class_get_by_type (GType type);
type : |
|
Returns : |
GList* glade_widget_class_get_derived_types (GType type);
type : |
|
Returns : |
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 |
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. |
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. |
void glade_widget_class_container_add (GladeWidgetClass *class, GObject *container, GObject *child);
class : |
|
container : |
|
child : |
void glade_widget_class_container_remove (GladeWidgetClass *class, GObject *container, GObject *child);
class : |
|
container : |
|
child : |
gboolean glade_widget_class_container_has_child (GladeWidgetClass *class, GObject *container, GObject *child);
class : |
|
container : |
|
child : |
|
Returns : |
GList* glade_widget_class_container_get_children (GladeWidgetClass *class, GObject *container);
class : |
|
container : |
|
Returns : |
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 : |
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 : |
void glade_widget_class_container_replace_child (GladeWidgetClass *class, GObject *container, GObject *old, GObject *new);
class : |
|
container : |
|
old : |
|
new : |
gboolean glade_widget_class_contains_extra (GladeWidgetClass *class);
class : |
|
Returns : |
GladePackingDefault* glade_widget_class_get_packing_default (GladeWidgetClass *child_class, GladeWidgetClass *container_class, const gchar *propert_id);
child_class : |
|
container_class : |
|
propert_id : |
|
Returns : |