libswami Reference Manual | ||||
---|---|---|---|---|
Top | Description |
SwamiObjectPropBag; enum SwamiRank; enum SwamiObjectFlags; extern GQuark swami_object_propbag_quark; void swami_type_set_rank (GType type
,GType group_type
,int rank
); int swami_type_get_rank (GType type
,GType group_type
); GType * swami_type_get_children (GType group_type
); GType swami_type_get_default (GType group_type
); void swami_object_set_default (GObject *object
,GType type
); GObject * swami_object_get_by_name (GObject *object
,const char *name
); IpatchList * swami_object_find_by_type (GObject *object
,const char *type_name
); GObject * swami_object_get_by_type (GObject *object
,const char *type_name
); void swami_object_get_valist (GObject *object
,const char *first_property_name
,va_list var_args
); void swami_object_get_property (GObject *object
,const char *property_name
,GValue *value
); void swami_object_get (gpointer object
,const char *first_prop_name
,...
); void swami_object_set_valist (GObject *object
,const char *first_property_name
,va_list var_args
); void swami_object_set_property (GObject *object
,const char *property_name
,const GValue *value
); void swami_object_set (gpointer object
,const char *first_prop_name
,...
); GParamSpec * swami_find_object_property (const char *property_name
); GParamSpec ** swami_list_object_properties (guint *n_properties
); guint swami_object_get_flags (GObject *object
); void swami_object_set_flags (GObject *object
,guint flags
); void swami_object_clear_flags (GObject *object
,guint flags
); void swami_object_set_origin (GObject *obj
,GObject *origin
); GObject * swami_object_get_origin (GObject *obj
);
typedef struct { SwamiRoot *root; /* parent swami root object */ char *name; /* Swami object property name */ guint8 rank; /* Swami object rank property */ guint8 flags; /* Swami object flags property */ guint16 reserved; } SwamiObjectPropBag;
typedef enum { SWAMI_RANK_INVALID = 0, SWAMI_RANK_LOWEST = 10, SWAMI_RANK_LOW = 25, SWAMI_RANK_NORMAL = 50, /* NORMAL default value */ SWAMI_RANK_DEFAULT = 60, /* value to elect default objects */ SWAMI_RANK_HIGH = 75, SWAMI_RANK_HIGHEST = 90 } SwamiRank;
typedef enum /*< flags >*/ { SWAMI_OBJECT_SAVE = 1 << 0, /* flags if object state should be saved */ SWAMI_OBJECT_USER = 1 << 1 /* user visable object (in tree view, etc) */ } SwamiObjectFlags;
void swami_type_set_rank (GType type
,GType group_type
,int rank
);
Sets the ranking of instance GTypes derived from an ancestor group_type
.
This is useful to set a default instance type or to define order to types.
An example of use would be to set a higher rank on a plugin wavetable type
to cause it to be used when creating a default wavetable instance.
|
Type to set rank value of |
|
An ancestor type of type
|
|
Rank value (see SwamiRank enum). |
int swami_type_get_rank (GType type
,GType group_type
);
Gets the instance rank of the given type
derived from a group_type
.
See swami_type_set_rank()
for more info.
|
Instance type to get rank of |
|
Ancestor group type |
Returns : |
Rank value (SWAMI_RANK_NORMAL if not explicitly set). |
GType * swami_type_get_children (GType group_type
);
Gets an array of types that are derived from group_type
, sorted by rank.
For types that have not had their rank explicitly set SWAMI_RANK_NORMAL
will be assumed.
|
Group type to get derived types from |
Returns : |
Newly allocated and zero terminated array of GTypes sorted by rank
or NULL if no types found. Should be freed when finished.
|
GType swami_type_get_default (GType group_type
);
Gets the default (highest ranked) type derived from a group_type.
Like swami_type_get_children()
but returns first type instead of an array.
|
Group type to get default (highest ranked) instance type from |
Returns : |
GType of default type or 0 if no types derived from group_type .
|
void swami_object_set_default (GObject *object
,GType type
);
Set an object
as default amongst its peers of the same type
. Uses
the Swami rank system (see "rank" Swami property) to elect a default
object. All other object's registered to the same SwamiRoot and of
the same type
(or derived thereof) are set to SWAMI_RANK_NORMAL and the
object
's rank is set higher.
|
Object to set as default |
|
A type that object is derived from (or its type)
|
GObject * swami_object_get_by_name (GObject *object
,const char *name
);
Finds an object by its Swami name property, searches recursively
through object tree. The object
can be either a SwamiRoot or, as
an added convenience, an object registered to one.
IpatchList * swami_object_find_by_type (GObject *object
,const char *type_name
);
Lookup all objects by type_name
or derived from type_name
recursively. The object
can be either a SwamiRoot or, as an
added convenience, an object registered to one. The returned
iterator list is sorted by Swami rank (see "rank" Swami property).
|
Swami root object (SwamiRoot) or an object added to one |
|
Name of GObject derived GType of objects to search for, objects derived from this type will also match. |
Returns : |
New list of objects of type_name and/or derived
from it or NULL if no matches to that type. The returned list has a
reference count of 1 which the caller owns, remember to unref it when
finished.
|
GObject * swami_object_get_by_type (GObject *object
,const char *type_name
);
Lookup the highest ranking (see "rank" Swami property) object of
the given type_name
or derived from it. The returned object's
reference count is incremented and the caller is responsible for
removing it with g_object_unref when finished with it.
|
Swami root object (SwamiRoot) or an object added to one |
|
Name of GObject derived GType to search for |
Returns : |
The highest ranking object of the given type or NULL if none. Remember to unreference it when done. |
void swami_object_get_valist (GObject *object
,const char *first_property_name
,va_list var_args
);
Get Swami properties from an object.
|
An object |
|
Name of first Swami property to get |
|
Pointer to store first property value in followed by property name pointer pairs, terminated with a NULL property name. |
void swami_object_get_property (GObject *object
,const char *property_name
,GValue *value
);
Get a Swami property from an object.
|
An object |
|
Name of Swami property to get |
|
An initialized value to store the property value in. The value's type must be a type that the property can be transformed to. |
void swami_object_get (gpointer object
,const char *first_prop_name
,...
);
Get multiple Swami properties from an object
.
|
A GObject |
|
Name of first Swami property to get |
|
First value should be a pointer to store the first property value into
followed by property name and pointer pairs, terminated by a NULL
property name.
|
void swami_object_set_valist (GObject *object
,const char *first_property_name
,va_list var_args
);
Set Swami properties of an object.
|
An object |
|
Name of first Swami property to set |
|
Pointer to get first property value from followed by property name pointer pairs, terminated with a NULL property name. |
void swami_object_set_property (GObject *object
,const char *property_name
,const GValue *value
);
Set a Swami property of an object.
|
An object |
|
Name of Swami property to set |
|
Value to set the property to. The value's type must be the same as the property's type. |
void swami_object_set (gpointer object
,const char *first_prop_name
,...
);
Set multiple Swami properties on an object
.
|
A GObject |
|
Name of first Swami property to set |
|
First parameter should be the value to set the first property
value to followed by property name and pointer pairs, terminated
by a NULL property name.
|
GParamSpec * swami_find_object_property (const char *property_name
);
Find a Swami property.
|
Name of Swami property to find |
Returns : |
Parameter spec with property_name or NULL if not found.
Returned parameter spec is internal and should not be modified or freed.
|
GParamSpec ** swami_list_object_properties (guint *n_properties
);
Get the list of Swami properties.
guint swami_object_get_flags (GObject *object
);
Get Swami flags from an object (see SwamiObjectFlags).
|
Object to get Swami flags from |
Returns : |
The flags value. |
void swami_object_set_flags (GObject *object
,guint flags
);
Sets Swami flags
in an object
. Flag bits are only set, not cleared.
|
Object to set Swami flags on |
|
Flags to set |
void swami_object_clear_flags (GObject *object
,guint flags
);
Clears Swami flags
in an object
. Flag bits are only cleared, not set.
|
Object to clear Swami flags on |
|
Flags to clear |
void swami_object_set_origin (GObject *obj
,GObject *origin
);
This is used for associating an origin object to another object. Currently this is only used for GtkList item selections. The current active item selection is assigned to the swamigui_root object. In order to determine what GUI widget is the source, this function can be used to associate the widget object with the GtkList selection (for example the SwamiguiTree or SwamiguiSplits widgets). In this way, only the selection needs to be assigned to the root object and the source widget can be determined.
|
Object to assign origin object value |
|
Value to assign as the origin |
GObject * swami_object_get_origin (GObject *obj
);
See swamigui_object_set_origin()
for more details.
|
Object to get the origin object of |
Returns : |
The origin object of obj or NULL if no origin object assigned.
The caller owns a reference to the returned object and should unref it
when finished.
|