Top | ![]() |
![]() |
![]() |
![]() |
GladeWidgetAdaptorGladeWidgetAdaptor — Adaptor base class to add runtime support for each widget class. |
The GladeWidgetAdaptor object is a proxy for widget class support in Glade. it is automatically generated from the xml and allows you to override its methods in the plugin library for fine grained support on how you load/save widgets and handle thier properties in the runtime and more.
#define GWA_IS_FIXED(obj)
Checks whether this widget adaptor should be handled as a free-form container
#define GWA_IS_TOPLEVEL(obj)
Checks whether this widget class has been marked as a toplevel one.
#define GWA_USE_PLACEHOLDERS(obj)
Checks whether this widget class has been marked to use placeholders in child widget operations
#define GWA_GET_CLASS(type)
Shorthand for referencing glade adaptor classes from the plugin eg. GWA_GET_CLASS (GTK_TYPE_CONTAINER)->post_create (adaptor...
#define GWA_GET_OCLASS(type) ((GObjectClass*)GWA_GET_CLASS(type))
Same as GWA_GET_CLASS but casted to GObjectClass
#define GLADE_VALID_CREATE_REASON(reason) (reason >= 0 && reason < GLADE_CREATE_REASONS)
void (*GladeSetPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,const GValue *value
);
This delagate function is used to apply the property value on the runtime object.
Sets value
on object
for a given GladePropertyClass
void (*GladeGetPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,GValue *value
);
Gets value
on object
for a given GladePropertyClass
gboolean (*GladeVerifyPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,const GValue *value
);
This delagate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basicly the two places where we recreate a hierarchy that we already know "works") its basicly an optional backend provided boundry checker for properties.
void (*GladeChildSetPropertyFunc) (GladeWidgetAdaptor *adaptor
,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) (GladeWidgetAdaptor *adaptor
,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
.
gboolean (*GladeChildVerifyPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
,const gchar *property_name
,const GValue *value
);
This delagate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basicly the two places where we recreate a hierarchy that we already know "works") its basicly an optional backend provided boundry checker for properties.
GList * (*GladeGetChildrenFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
);
A function called to get containers
children.
void (*GladeAddChildFunc) (GladeWidgetAdaptor *adaptor
,GObject *parent
,GObject *child
);
Called to add child
to parent
.
void (*GladeRemoveChildFunc) (GladeWidgetAdaptor *adaptor
,GObject *parent
,GObject *child
);
Called to remove child
from parent
.
void (*GladeReplaceChildFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *old_obj
,GObject *new_obj
);
Called to swap placeholders with project objects in containers.
void (*GladePostCreateFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,GladeCreateReason reason
);
This function is called exactly once for any project object instance and can be for any GladeCreateReason.
GObject * (*GladeGetInternalFunc) (GladeWidgetAdaptor *adaptor
,GObject *parent
,const gchar *name
);
Called to lookup child
in composite object parent
by name
.
void (*GladeActionActivateFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *action_path
);
This delagate function is used to catch actions from the core.
void (*GladeChildActionActivateFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *object
,const gchar *action_path
);
This delagate function is used to catch packing actions from the core.
void (*GladeReadWidgetFunc) (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlNode *node
);
This function is called to update widget
from node
.
void (*GladeWriteWidgetFunc) (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlContext *context
,GladeXmlNode *node
);
This function is called to fill in node
from widget
.
GladeEditorProperty * (*GladeCreateEPropFunc) (GladeWidgetAdaptor *adaptor
,GladePropertyClass *klass
,gboolean use_command
);
Creates a GladeEditorProperty to edit klass
adaptor |
||
klass |
The GladePropertyClass to be edited |
|
use_command |
whether to use the GladeCommand interface to commit property changes |
gchar * (*GladeStringFromValueFunc) (GladeWidgetAdaptor *adaptor
,GladePropertyClass *klass
,const GValue *value
,GladeProjectFormat fmt
);
For normal properties this is used to serialize property values, for custom properties (only when new pspecs are introduced) its needed for value comparisons in boxed pspecs and also to update the UI for undo/redo items etc.
adaptor |
||
klass |
||
value |
The GValue to convert to a string |
|
fmt |
The GladeProjectFormat the string should conform to |
#define glade_widget_adaptor_create_widget(adaptor, 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
adaptor |
||
query |
whether to display query dialogs if applicable to the class |
|
... |
a |
GladeEditorProperty * glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor
,GladePropertyClass *klass
,gboolean use_command
);
Creates a GladeEditorProperty to edit klass
adaptor |
||
klass |
The GladePropertyClass to be edited |
|
use_command |
whether to use the GladeCommand interface to commit property changes |
GladeWidgetAdaptor * glade_widget_adaptor_from_pspec (GladeWidgetAdaptor *adaptor
,GParamSpec *spec
);
Assumes pspec
is a property in an object class wrapped by adaptor
,
this function will search for the specific parent adaptor class which
originally introduced pspec
.
the closest GladeWidgetAdaptor in the ancestry to adaptor
which is responsable for introducing pspec
.
GladeWidgetAdaptor * glade_widget_adaptor_from_catalog (GladeCatalog *catalog
,GladeXmlNode *class_node
,GModule *module
);
Dynamicly creates a subclass of GladeWidgetAdaptor and subclasses the closest parent adaptor (parent class adapters must be creates/registerd prior to child classes, otherwise inheritance wont work) and parses in the relevent catalog info.
void
glade_widget_adaptor_register (GladeWidgetAdaptor *adaptor
);
Registers adaptor
into the Glade core (every supported
object type must have a registered adaptor).
GladeWidget * glade_widget_adaptor_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 |
|
internal_object |
the GObject |
|
internal_name |
a string identifier for this internal widget. |
|
parent_name |
the generic name of the parent used for fancy child names. |
|
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). |
GladeWidget * glade_widget_adaptor_create_widget_real (gboolean query
,const gchar *first_property
,...
);
GladeWidgetAdaptor *
glade_widget_adaptor_get_by_name (const gchar *name
);
an existing GladeWidgetAdaptor with the name equaling name
,
or NULL
if such a class doesn't exist
GladeWidgetAdaptor *
glade_widget_adaptor_get_by_type (GType type
);
an existing GladeWidgetAdaptor with the type equaling type
,
or NULL
if such a class doesn't exist
GladePropertyClass * glade_widget_adaptor_get_property_class (GladeWidgetAdaptor *adaptor
,const gchar *name
);
Retrieves the GladePropertyClass for name
in adaptor
GladePropertyClass * glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor *adaptor
,const gchar *name
);
Retrieves the GladePropertyClass for name
in
adaptor
's child properties
GParameter * glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor
,gboolean construct
,guint *n_params
);
void glade_widget_adaptor_post_create (GladeWidgetAdaptor *adaptor
,GObject *object
,GladeCreateReason reason
);
An adaptor function to be called after the object is created
GObject * glade_widget_adaptor_get_internal_child (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *internal_name
);
Retrieves the internal object internal_name
from object
void glade_widget_adaptor_set_property (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,const GValue *value
);
This delagate function is used to apply the property value on the runtime object.
void glade_widget_adaptor_get_property (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,GValue *value
);
Gets value
of property_name
on object
.
gboolean glade_widget_adaptor_verify_property (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,const GValue *value
);
This delagate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basicly the two places where we recreate a hierarchy that we already know "works") its basicly an optional backend provided boundry checker for properties.
void glade_widget_adaptor_add (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
);
Adds child
to container
.
void glade_widget_adaptor_remove (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
);
Removes child
from container
.
GList * glade_widget_adaptor_get_children (GladeWidgetAdaptor *adaptor
,GObject *container
);
Lists the children of container
.
gboolean glade_widget_adaptor_has_child (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
);
void glade_widget_adaptor_child_set_property (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
,const gchar *property_name
,const GValue *value
);
Sets child
's packing property identified by property_name
to value
.
void glade_widget_adaptor_child_get_property (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
,const gchar *property_name
,GValue *value
);
Gets child
's packing property identified by property_name
.
gboolean glade_widget_adaptor_child_verify_property (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
,const gchar *property_name
,const GValue *value
);
This delagate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basicly the two places where we recreate a hierarchy that we already know "works") its basicly an optional backend provided boundry checker for properties.
void glade_widget_adaptor_replace_child (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *old_obj
,GObject *new_obj
);
Replaces old_obj
with new_obj
in container
while positioning
new_obj
where old_obj
was and assigning it appropriate packing
property values.
void glade_widget_adaptor_read_child (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlNode *node
);
This function is called to update load a child widget
from node
when loading xml files (will recurse into
glade_widget_read()
)
void glade_widget_adaptor_read_widget (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlNode *node
);
This function is called to update widget
from node
when loading xml files.
void glade_widget_adaptor_write_child (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlContext *context
,GladeXmlNode *node
);
This function is called to write the child widget
to node
when writing xml files (takes care of packing and recurses
into glade_widget_write()
)
void glade_widget_adaptor_write_widget (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlContext *context
,GladeXmlNode *node
);
This function is called to write widget
to node
when writing xml files.
gchar * glade_widget_adaptor_get_packing_default (GladeWidgetAdaptor *child_adaptor
,GladeWidgetAdaptor *container_adaptor
,const gchar *id
);
Gets the default value for property_id
on a widget governed by
child_adaptor
when parented in a widget governed by parent_adaptor
child_adaptor |
||
container_adaptor |
The GladeWidgetAdaptor for the parent object |
|
id |
The string property identifier |
gboolean
glade_widget_adaptor_is_container (GladeWidgetAdaptor *adaptor
);
Checks whether or not this adaptor has support to interface with child objects.
gboolean glade_widget_adaptor_action_add (GladeWidgetAdaptor *adaptor
,const gchar *action_path
,const gchar *label
,const gchar *stock
,gboolean important
);
Add an action to adaptor
.
If the action is present then it overrides label and stock
gboolean glade_widget_adaptor_pack_action_add (GladeWidgetAdaptor *adaptor
,const gchar *action_path
,const gchar *label
,const gchar *stock
,gboolean important
);
Add a packing action to adaptor
.
If the action is present then it overrides label and stock
gboolean glade_widget_adaptor_action_remove (GladeWidgetAdaptor *adaptor
,const gchar *action_path
);
Remove an adaptor
's action.
gboolean glade_widget_adaptor_pack_action_remove (GladeWidgetAdaptor *adaptor
,const gchar *action_path
);
Remove an adaptor
's packing action.
GList *
glade_widget_adaptor_pack_actions_new (GladeWidgetAdaptor *adaptor
);
Create a list of packing actions.
void glade_widget_adaptor_action_activate (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *action_path
);
An adaptor function to be called on widget actions.
void glade_widget_adaptor_child_action_activate (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *object
,const gchar *action_path
);
An adaptor function to be called on widget actions.
gchar * glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor
,GladePropertyClass *klass
,const GValue *value
,GladeProjectFormat fmt
);
For normal properties this is used to serialize property values, for custom properties its still needed to update the UI for undo/redo items etc.
adaptor |
||
klass |
||
value |
The GValue to convert to a string |
|
fmt |
The GladeProjectFormat the string should conform to |
These are the reasons your GladePostCreateFunc can be called.
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). |
||
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. |
||
Was created during the load process. |
||
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. |
||
Never used. |
struct GladeWidgetAdaptor { GObject parent_instance; GType type; /* GType of the widget */ gchar *name; /* Name of the widget, for example GtkButton */ gchar *generic_name; /* Used to generate names of new widgets, for * example "button" so that we generate button1, * button2, buttonX .. */ gchar *icon_name; /* icon name to use for widget class */ gchar *missing_icon; /* the name of the missing icon if it was not found */ gchar *title; /* Translated class name used in the UI */ 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 *packing_props; /* List of GladePropertyClass objects that describe * properties for child objects packing definition - * note there may be more than one type of child supported * by a widget and thus they may have different sets * of properties for each type - this association is * managed on the GladePropertyClass proper. */ GList *signals; /* List of GladeSignalClass objects */ GList *child_packings; /* Default packing property values */ GList *actions; /* A list of GWActionClass */ GList *packing_actions;/* A list of GWActionClass for child objects */ GladeWidgetAdaptorPrivate *priv; };