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 their properties in the runtime and more.
#define GLADE_VALID_CREATE_REASON(reason) (reason >= 0 && reason < GLADE_CREATE_REASONS)
void (*GladeActionActivateFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *action_path
);
This delegate function is used to catch actions from the core.
GtkWidget * (*GladeActionSubmenuFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *action_path
);
This delegate function is used to create dynamically customized submenus. Called only for actions that don't have children.
void (*GladeAddChildFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
);
Called to add child
to container
.
gboolean (*GladeAddChildVerifyFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
,gboolean user_feedback
);
Checks whether child
can be added to container
.
If user_feedback
is TRUE
and child
cannot be
added then this shows a notification dialog to the user
explaining why.
void (*GladeChildActionActivateFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *object
,const gchar *action_path
);
This delegate function is used to catch packing actions from the core.
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
.
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
.
gboolean (*GladeChildVerifyPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
,const gchar *property_name
,const GValue *value
);
This delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know "works") its basically an optional backend provided boundary checker for properties.
GObject * (*GladeConstructObjectFunc) (GladeWidgetAdaptor *adaptor
,guint n_parameters
,GParameter *parameters
);
This function is called to construct a GObject instance. (for language bindings that may need to construct a wrapper object).
adaptor |
||
n_parameters |
amount of construct parameters |
|
parameters |
array of construct GParameter args to create the new object with. |
GladeEditable * (*GladeCreateEditableFunc) (GladeWidgetAdaptor *adaptor
,GladeEditorPageType type
);
This is used to allow the backend to override the way an editor page is layed out (note that editor widgets are created on demand and not at startup).
GladeEditorProperty * (*GladeCreateEPropFunc) (GladeWidgetAdaptor *adaptor
,GladePropertyDef *def
,gboolean use_command
);
Creates a GladeEditorProperty to edit klass
adaptor |
||
def |
The GladePropertyDef to be edited |
|
use_command |
whether to use the GladeCommand interface to commit property changes |
GladeWidget * (*GladeCreateWidgetFunc) (GladeWidgetAdaptor *adaptor
,const gchar *first_property_name
,va_list var_args
);
This entry point allows the backend to create a specialized GladeWidget derived object for handling instances in the core.
adaptor |
||
first_property_name |
the name of the first property |
|
var_args |
the value of the first property, followed optionally by more
name/value pairs, followed by |
gboolean (*GladeDependsFunc) (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeWidget *another
);
Checks whether widget
depends on another
to be placed earlier in
the glade file.
void (*GladeDestroyObjectFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
);
This function is called to break any additional references to
a GObject instance. Note that this function is not responsible
for calling g_object_unref()
on object
, the reference count
of object
belongs to it's GladeWidget wrapper.
The GtkWidget adaptor will call gtk_widget_destroy()
before
chaining up in this function.
If your adaptor adds any references in any way at GladePostCreateFunc time or GladeConstructObjectFunc time, then this function must be implemented to also remove that reference.
GList * (*GladeGetChildrenFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
);
A function called to get containers
children.
GObject * (*GladeGetInternalFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *internal_name
);
Called to lookup child in composite object
parent by internal_name
.
void (*GladeGetPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,GValue *value
);
Gets value
on object
for a given GladePropertyDef
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.
void (*GladeReadWidgetFunc) (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlNode *node
);
This function is called to update widget
from node
.
void (*GladeRemoveChildFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
);
Called to remove child
from container
.
void (*GladeReplaceChildFunc) (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *old_obj
,GObject *new_obj
);
Called to swap placeholders with project objects in containers.
void (*GladeSetPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,const GValue *value
);
This delegate function is used to apply the property value on the runtime object.
Sets value
on object
for a given GladePropertyDef
gchar * (*GladeStringFromValueFunc) (GladeWidgetAdaptor *adaptor
,GladePropertyDef *def
,const GValue *value
);
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.
gboolean (*GladeVerifyPropertyFunc) (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *property_name
,const GValue *value
);
This delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know "works") its basically an optional backend provided boundary checker for properties.
void (*GladeWriteWidgetFunc) (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlContext *context
,GladeXmlNode *node
);
This function is called to fill in node
from widget
.
#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
adaptor |
||
query |
whether to display query dialogs if applicable to the class |
|
... |
a |
GladeEditorProperty * glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor
,GladePropertyDef *def
,gboolean use_command
);
Creates a GladeEditorProperty to edit def
adaptor |
||
def |
The GladePropertyDef to be edited |
|
use_command |
whether to use the GladeCommand interface to commit property changes |
GladeWidgetAdaptor * glade_widget_adaptor_from_pspec (GladeWidgetAdaptor *adaptor
,GParamSpec *pspec
);
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
.
[transfer none]
GladeWidgetAdaptor * glade_widget_adaptor_from_catalog (GladeCatalog *catalog
,GladeXmlNode *class_node
,GModule *module
);
Dynamically creates a subclass of GladeWidgetAdaptor and subclasses the closest parent adaptor (parent class adapters must be created/registered prior to child classes, otherwise inheritance wont work) and parses in the relevant 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 convenience 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 useful here). |
a freshly created GladeWidget wrapper object for the
internal_object
of name internal_name
.
[transfer full]
GladeWidget * glade_widget_adaptor_create_widget_real (gboolean query
,const gchar *first_property
,...
);
The macro glade_widget_adaptor_create_widget()
uses this function
glade_widget_adaptor_create_widget_real(query
, "adaptor", adaptor, @...)
Use glade_widget_adaptor_create_widget()
in C as this function is mostly
available for languages where macros are not available.
query |
whether to display query dialogs if applicable to the class |
|
first_property |
the first property of @... |
|
... |
a |
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.
[transfer none][nullable]
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.
[transfer none][nullable]
GladePropertyDef * glade_widget_adaptor_get_property_def (GladeWidgetAdaptor *adaptor
,const gchar *name
);
Retrieves the GladePropertyDef for name
in adaptor
GladePropertyDef * glade_widget_adaptor_get_pack_property_def (GladeWidgetAdaptor *adaptor
,const gchar *name
);
Retrieves the GladePropertyDef for name
in adaptor
's child properties
GParameter * glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor
,gboolean construct
,guint *n_params
);
adaptor |
||
construct |
whether to return construct params or not construct params |
|
n_params |
return location if any defaults are specified for this class. |
A list of params for use in g_object_newv()
.
[array length=n_params][element-type GParameter][transfer full]
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 delegate 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 delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know "works") its basically an optional backend provided boundary 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 delegate function is always called whenever setting any properties with the exception of load time, and copy/paste time (basically the two places where we recreate a hierarchy that we already know "works") its basically an optional backend provided boundary 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.
const 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
,GladePropertyDef *def
,const GValue *value
);
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.
GtkWidget * glade_widget_adaptor_action_submenu (GladeWidgetAdaptor *adaptor
,GObject *object
,const gchar *action_path
);
This delegate function is used to create dynamically customized submenus. Called only for actions that don't have children.
GList *
glade_widget_adaptor_actions_new (GladeWidgetAdaptor *adaptor
);
Create a list of actions.
gboolean glade_widget_adaptor_add_verify (GladeWidgetAdaptor *adaptor
,GObject *container
,GObject *child
,gboolean user_feedback
);
Checks whether child
can be added to parent
.
If user_feedback
is TRUE
and child
cannot be
added then this shows a notification dialog to the user
explaining why.
GObject * glade_widget_adaptor_construct_object (GladeWidgetAdaptor *adaptor
,guint n_parameters
,GParameter *parameters
);
This function is called to construct a GObject instance for
a GladeWidget of the said adaptor
. (provided for language
bindings that may need to construct a wrapper object).
adaptor |
||
n_parameters |
amount of construct parameters |
|
parameters |
array of construct GParameter args to create the new object with. |
GladeEditable * glade_widget_adaptor_create_editable (GladeWidgetAdaptor *adaptor
,GladeEditorPageType type
);
This is used to allow the backend to override the way an editor page is layed out (note that editor widgets are created on demand and not at startup).
GladeEditorProperty * glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor
,const gchar *property_id
,gboolean packing
,gboolean use_command
);
Creates a GladeEditorProperty to edit GladePropertyDef name
in adaptor
adaptor |
||
property_id |
the string if of the corresponding GladePropertyDef to be edited |
|
packing |
whether this refers to a packing property |
|
use_command |
whether to use the GladeCommand interface to commit property changes |
gboolean glade_widget_adaptor_depends (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeWidget *another
);
glade_widget_adaptor_depends
has been deprecated since version 3.18 and should not be used in newly-written code.
Checks whether widget
depends on another
to be placed earlier in
the glade file.
void glade_widget_adaptor_destroy_object (GladeWidgetAdaptor *adaptor
,GObject *object
);
This function is called to destroy a GObject instance.
const gchar *
glade_widget_adaptor_get_book (GladeWidgetAdaptor *adaptor
);
const gchar *
glade_widget_adaptor_get_catalog (GladeWidgetAdaptor *adaptor
);
const gchar *
glade_widget_adaptor_get_display_name (GladeWidgetAdaptor *adaptor
);
const gchar *
glade_widget_adaptor_get_generic_name (GladeWidgetAdaptor *adaptor
);
const gchar *
glade_widget_adaptor_get_icon_name (GladeWidgetAdaptor *adaptor
);
const gchar *
glade_widget_adaptor_get_missing_icon (GladeWidgetAdaptor *adaptor
);
const gchar *
glade_widget_adaptor_get_name (GladeWidgetAdaptor *adaptor
);
GType
glade_widget_adaptor_get_object_type (GladeWidgetAdaptor *adaptor
);
const GList *
glade_widget_adaptor_get_packing_props
(GladeWidgetAdaptor *adaptor
);
GladeWidgetAdaptor *
glade_widget_adaptor_get_parent_adaptor
(GladeWidgetAdaptor *adaptor
);
const GList *
glade_widget_adaptor_get_properties (GladeWidgetAdaptor *adaptor
);
GladeSignalDef * glade_widget_adaptor_get_signal_def (GladeWidgetAdaptor *adaptor
,const gchar *name
);
Looks up signal class name
on adaptor
.
const GList *
glade_widget_adaptor_get_signals (GladeWidgetAdaptor *adaptor
);
const gchar *
glade_widget_adaptor_get_title (GladeWidgetAdaptor *adaptor
);
gboolean
glade_widget_adaptor_has_internal_children
(GladeWidgetAdaptor *adaptor
);
GList *
glade_widget_adaptor_list_adaptors (void
);
Compiles a list of all registered adaptors.
A newly allocated GList which
must be freed with g_list_free()
.
[transfer container][element-type GladeWidgetAdaptor]
void glade_widget_adaptor_write_widget_after (GladeWidgetAdaptor *adaptor
,GladeWidget *widget
,GladeXmlContext *context
,GladeXmlNode *node
);
This function is called to write widget
to node
when writing xml files (after writing children)
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. |
#define GLADE_WIDGET_ADAPTOR_INSTANTIABLE_PREFIX "GladeInstantiable"
Class prefix used for abstract classes (ie GtkBin -> GladeInstantiableGtkBin)