GladePropertyClass

GladePropertyClass — Property Class-wide metadata

Synopsis


#include <glade.h>


            GladePropertyClass;
enum        GPCType;
gboolean    (*GladeVerifyPropertyFunc)      (GladeWidgetAdaptor *adaptor,
                                             GObject *object,
                                             const gchar *property_name,
                                             const GValue *value);
void        (*GladeGetPropertyFunc)         (GladeWidgetAdaptor *adaptor,
                                             GObject *object,
                                             const gchar *property_name,
                                             GValue *value);
void        (*GladeSetPropertyFunc)         (GladeWidgetAdaptor *adaptor,
                                             GObject *object,
                                             const gchar *property_name,
                                             const GValue *value);
GladePropertyClass* glade_property_class_new
                                            (gpointer handle);
GladePropertyClass* glade_property_class_new_from_spec
                                            (gpointer handle,
                                             GParamSpec *spec);
GladePropertyClass* glade_property_class_clone
                                            (GladePropertyClass *property_class);
void        glade_property_class_free       (GladePropertyClass *property_class);
gboolean    glade_property_class_is_visible (GladePropertyClass *property_class);
gboolean    glade_property_class_is_object  (GladePropertyClass *property_class);
GValue*     glade_property_class_make_gvalue_from_string
                                            (GladePropertyClass *property_class,
                                             const gchar *string,
                                             GladeProject *project);
gchar*      glade_property_class_make_string_from_gvalue
                                            (GladePropertyClass *property_class,
                                             const GValue *value);
GValue*     glade_property_class_make_gvalue_from_vl
                                            (GladePropertyClass *property_class,
                                             va_list vl);
void        glade_property_class_set_vl_from_gvalue
                                            (GladePropertyClass *class,
                                             GValue *value,
                                             va_list vl);
void        glade_property_class_get_from_gvalue
                                            (GladePropertyClass *class,
                                             GValue *value,
                                             ...);
GValue*     glade_property_class_make_gvalue
                                            (GladePropertyClass *class,
                                             ...);
gboolean    glade_property_class_update_from_node
                                            (GladeXmlNode *node,
                                             GModule *module,
                                             GType object_type,
                                             GladePropertyClass **property_class,
                                             const gchar *domain);
const gchar* glade_property_class_get_displayable_value
                                            (GladePropertyClass *class,
                                             gint value);
GtkAdjustment* glade_property_class_make_adjustment
                                            (GladePropertyClass *property_class);
gboolean    glade_property_class_match      (GladePropertyClass *class,
                                             GladePropertyClass *comp);
gboolean    glade_property_class_void_value (GladePropertyClass *class,
                                             GValue *value);
const gchar* glade_property_class_atk_realname
                                            (const gchar *atk_name);
GList*      glade_property_class_list_atk_relations
                                            (gpointer handle,
                                             GType owner_type);
GladePropertyClass* glade_property_class_accel_property
                                            (gpointer handle,
                                             GType owner_type);


Description

GladePropertyClass is a structure based on a GParamSpec and parameters from the Glade catalog files and describes how properties are to be handled in Glade; it also provides an interface to convert GValue to strings and va_lists etc (back and forth).

Details

GladePropertyClass

typedef struct {
	GPCType type; /* A symbolic type used to load/save properties differently
		       */

	gpointer    handle; /* The GladeWidgetClass that this property class
			     * was created for.
			     */

	GParamSpec *pspec; /* The Parameter Specification for this property.
			    */

	gchar *id;       /* The id of the property. Like "label" or "xpad"
			  * this is a non-translatable string
			  */

	gchar *name;     /* The name of the property. Like "Label" or "X Pad"
			  * this is a translatable string
			  */

	gchar *tooltip; /* The default tooltip for the property editor rows.
			 */

	gboolean virtual; /* Whether this is a virtual property with its pspec supplied
			   * via the catalog (or hard code-paths); or FALSE if its a real
			   * GObject introspected property
			   */

	GValue *def;      /* The default value for this property (this will exist
			   * as a copy of orig_def if not specified by the catalog)
			   */

	GValue *orig_def; /* The real default value obtained through introspection.
			   * (used to decide whether we should write to the
			   * glade file or not, or to restore the loaded property
			   * correctly); all property classes have and orig_def.
			   */

	GList *parameters; /* list of GladeParameter objects. This list
			    * provides with an extra set of key-value
			    * pairs to specify aspects of this property.
			    *
			    * This is unused by glade and only maintained
			    * to be of possible use in plugin code.
			    */

	GArray *displayable_values; /* If this property's value is an enumeration/flags and 
				     * there is some value name overridden in a catalog
				     * then it will point to a GEnumValue array with the
				     * modified names, otherwise NULL.
				     */

	gboolean query; /* Whether we should explicitly ask the user about this property
			 * when instantiating a widget with this property (through a popup
			 * dialog).
			 */

	gboolean optional; /* Some properties are optional by nature like
			    * default width. It can be set or not set. A
			    * default property has a check box in the
			    * left that enables/disables the input
			    */

	gboolean optional_default; /* For optional values, what the default is */

	gboolean construct_only; /* Whether this property is G_PARAM_CONSTRUCT_ONLY or not */
	
	gboolean common; /* Common properties go in the common tab */
	gboolean packing; /* Packing properties go in the packing tab */

	
	gboolean translatable; /* The property should be translatable, which
				* means that it needs extra parameters in the
				* UI.
				*/

	gint  visible_lines; /* When this pspec calls for a text editor, how many
			      * lines should be visible in the editor.
			      */

	/* These three are the master switches for the glade-file output,
	 * property editor availability & live object updates in the glade environment.
	 */
	gboolean save;      /* Whether we should save to the glade file or not
			     * (mostly just for custom glade properties)
			     */
	gboolean visible;   /* Whether or not to show this property in the editor
			     */
	gboolean ignore;    /* When true, we will not sync the object when the property
			     * changes.
			     */


	gboolean is_modified; /* If true, this property_class has been "modified" from the
			       * the standard property by a xml file. */

	gboolean resource;  /* Some property types; such as some file specifying
			     * string properties or GDK_TYPE_PIXBUF properties; are
			     * resource files and are treated specialy (a filechooser
			     * popup is used and the resource is copied to the project
			     * directory).
			     */
	
	gboolean transfer_on_paste; /* If this is a packing prop, 
				     * wether we should transfer it on paste.
				     */
	
	gdouble weight;	/* This will determine the position of this property in 
			 * the editor.
			 */
} GladePropertyClass;


enum GPCType

typedef enum {
	GPC_NORMAL,
	GPC_ATK_PROPERTY,
	GPC_ATK_RELATION,
	GPC_ATK_ACTION,
	GPC_ACCEL_PROPERTY
} GPCType;

GPC_NORMAL is not an atk property
GPC_ATK_PROPERTY is a property of an AtkImplementor object
GPC_ATK_RELATION is an atk relation set property
GPC_ATK_ACTION is an atk action property
GPC_ACCEL_PROPERTY is an accelerator key property

GladeVerifyPropertyFunc ()

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.

adaptor : A GladeWidgetAdaptor
object : The GObject
property_name : The property identifier
value : The GValue
Returns : whether or not its OK to set value on object

GladeGetPropertyFunc ()

void        (*GladeGetPropertyFunc)         (GladeWidgetAdaptor *adaptor,
                                             GObject *object,
                                             const gchar *property_name,
                                             GValue *value);

Gets value on object for a given GladePropertyClass

adaptor : A GladeWidgetAdaptor
object : The GObject
property_name : The property identifier
value : The GValue

GladeSetPropertyFunc ()

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

adaptor : A GladeWidgetAdaptor
object : The GObject
property_name : The property identifier
value : The GValue

glade_property_class_new ()

GladePropertyClass* glade_property_class_new
                                            (gpointer handle);

handle : A generic pointer (i.e. a GladeWidgetClass)
Returns : a new GladePropertyClass

glade_property_class_new_from_spec ()

GladePropertyClass* glade_property_class_new_from_spec
                                            (gpointer handle,
                                             GParamSpec *spec);

handle : A generic pointer (i.e. a GladeWidgetClass)
spec : A GParamSpec
Returns : a newly created GladePropertyClass based on spec or NULL if its unsupported.

glade_property_class_clone ()

GladePropertyClass* glade_property_class_clone
                                            (GladePropertyClass *property_class);

property_class : a GladePropertyClass
Returns : a new GladePropertyClass cloned from property_class

glade_property_class_free ()

void        glade_property_class_free       (GladePropertyClass *property_class);

Frees class and its associated memory.

property_class : a GladePropertyClass

glade_property_class_is_visible ()

gboolean    glade_property_class_is_visible (GladePropertyClass *property_class);

property_class : A GladePropertyClass
Returns : whether or not to show this property in the editor

glade_property_class_is_object ()

gboolean    glade_property_class_is_object  (GladePropertyClass *property_class);

property_class : A GladePropertyClass
Returns : whether or not this is an object property that refers to another object in this project.

glade_property_class_make_gvalue_from_string ()

GValue*     glade_property_class_make_gvalue_from_string
                                            (GladePropertyClass *property_class,
                                             const gchar *string,
                                             GladeProject *project);

property_class : A GladePropertyClass
string : a string representation of this property
project : the glade project that the associated property belongs to.
Returns : A GValue created based on the property_class and string criteria.

glade_property_class_make_string_from_gvalue ()

gchar*      glade_property_class_make_string_from_gvalue
                                            (GladePropertyClass *property_class,
                                             const GValue *value);

property_class : A GladePropertyClass
value : A GValue
Returns : A newly allocated string representation of value

glade_property_class_make_gvalue_from_vl ()

GValue*     glade_property_class_make_gvalue_from_vl
                                            (GladePropertyClass *property_class,
                                             va_list vl);

property_class : A GladePropertyClass
vl : a va_list holding one argument of the correct type specified by property_class
Returns : A GValue created based on the property_class and a vl arg of the correct type.

glade_property_class_set_vl_from_gvalue ()

void        glade_property_class_set_vl_from_gvalue
                                            (GladePropertyClass *class,
                                             GValue *value,
                                             va_list vl);

Sets vl from value based on class criteria.

class : A GladePropertyClass
value : A GValue to set
vl : a va_list holding one argument of the correct type specified by class

glade_property_class_get_from_gvalue ()

void        glade_property_class_get_from_gvalue
                                            (GladePropertyClass *class,
                                             GValue *value,
                                             ...);

Assignes the provided return location to value

class : A GladePropertyClass
value : A GValue to set
... : a return location of the correct type

glade_property_class_make_gvalue ()

GValue*     glade_property_class_make_gvalue
                                            (GladePropertyClass *class,
                                             ...);

class : A GladePropertyClass
... : an argument of the correct type specified by property_class
Returns : A GValue created based on the property_class and the provided argument.

glade_property_class_update_from_node ()

gboolean    glade_property_class_update_from_node
                                            (GladeXmlNode *node,
                                             GModule *module,
                                             GType object_type,
                                             GladePropertyClass **property_class,
                                             const gchar *domain);

Updates the property_class with the contents of the node in the xml file. Only the values found in the xml file are overridden.

node : the property node
module : a GModule to lookup symbols from the plugin
object_type : the GType of the owning object
property_class : a pointer to the property class
domain : the domain to translate catalog strings from
Returns : TRUE on success. property_class is set to NULL if the property has Disabled="TRUE".

glade_property_class_get_displayable_value ()

const gchar* glade_property_class_get_displayable_value
                                            (GladePropertyClass *class,
                                             gint value);

Search a displayable values for value in this property class.

class : the property class to search in
value : the value to search
Returns : a (gchar *) if a diplayable value was found, otherwise NULL.

glade_property_class_make_adjustment ()

GtkAdjustment* glade_property_class_make_adjustment
                                            (GladePropertyClass *property_class);

Creates and appropriate GtkAdjustment for use in the editor

property_class : a pointer to the property class
Returns : An appropriate GtkAdjustment for use in the Property editor

glade_property_class_match ()

gboolean    glade_property_class_match      (GladePropertyClass *class,
                                             GladePropertyClass *comp);

class : a GladePropertyClass
comp : a GladePropertyClass
Returns : whether class and comp are a match or not (properties in seperate decendant heirarchies that have the same name are not matches).

glade_property_class_void_value ()

gboolean    glade_property_class_void_value (GladePropertyClass *class,
                                             GValue *value);

class : a GladePropertyClass
value :
Returns : Whether value for this class is voided; a voided value can be a NULL value for boxed or object type param specs.

glade_property_class_atk_realname ()

const gchar* glade_property_class_atk_realname
                                            (const gchar *atk_name);

Translates a GladePropertyClass->id to the name that should be saved into the glade file.

atk_name : The id of the atk property
Returns : a pointer to a constant string.

glade_property_class_list_atk_relations ()

GList*      glade_property_class_list_atk_relations
                                            (gpointer handle,
                                             GType owner_type);

handle : A generic pointer (i.e. a GladeWidgetClass)
owner_type : The GType of the owning widget class.
Returns : a GList of newly created atk relation GladePropertyClass.

glade_property_class_accel_property ()

GladePropertyClass* glade_property_class_accel_property
                                            (gpointer handle,
                                             GType owner_type);

handle : A generic pointer (i.e. a GladeWidgetClass)
owner_type : The GType of the owning widget class.
Returns : a newly created GladePropertyClass for accelerators of the prescribed owner_type.