![]() |
![]() |
![]() |
Glade UI Builder Reference Manual | ![]() |
---|---|---|---|---|
#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);
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. */ 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;
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;
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.
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, 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 : |
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 : |
#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
|
... : |
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
|
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()
|
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. |
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 : |