IpatchTypeProp

IpatchTypeProp — GObject style properties for GTypes

Stability Level

Stable, unless otherwise indicated

Synopsis

enum                IpatchSplitsType;
void                (*IpatchTypePropGetFunc)            (GType type,
                                                         GParamSpec *spec,
                                                         GValue *value,
                                                         GObject *object);
void                ipatch_type_install_property        (GParamSpec *prop_spec);
GParamSpec *        ipatch_type_find_property           (const char *name);
GParamSpec **       ipatch_type_list_properties         (guint *n_properties);
GType *             ipatch_type_find_types_with_property
                                                        (const char *name,
                                                         const GValue *value,
                                                         guint *n_types);
void                ipatch_type_set                     (GType type,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_type_set_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);
void                ipatch_type_set_property            (GType type,
                                                         const char *property_name,
                                                         const GValue *value);
void                ipatch_type_get                     (GType type,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_type_get_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);
void                ipatch_type_get_property            (GType type,
                                                         const char *property_name,
                                                         GValue *value);
void                ipatch_type_object_get              (GObject *object,
                                                         const char *first_property_name,
                                                         ...);
void                ipatch_type_object_get_valist       (GObject *object,
                                                         const char *first_property_name,
                                                         va_list args);
void                ipatch_type_object_get_property     (GObject *object,
                                                         const char *property_name,
                                                         GValue *value);
void                ipatch_type_set_dynamic_func        (GType type,
                                                         const char *property_name,
                                                         IpatchTypePropGetFunc func);
IpatchTypePropGetFunc  ipatch_type_get_dynamic_func     (GType type,
                                                         const char *property_name);

Description

Provides a registry system for adding GObject style properties to GTypes. This is used to describe certain properties of different objects, such as "category".

Details

enum IpatchSplitsType

typedef enum
{
  IPATCH_SPLITS_NONE,			/* type does not have splits */
  IPATCH_SPLITS_NORMAL,			/* normal splits */
  IPATCH_SPLITS_NO_OVERLAP		/* splits do not overlap */
} IpatchSplitsType;

IpatchTypePropGetFunc ()

void                (*IpatchTypePropGetFunc)            (GType type,
                                                         GParamSpec *spec,
                                                         GValue *value,
                                                         GObject *object);

A function type used for active type property callbacks. Allows for dynamic type properties that can return values depending on an object's state.

type :

The GType of the type property

spec :

The parameter specification

value :

Initialized value to store the type prop value in

object :

Object instance (might be NULL)

ipatch_type_install_property ()

void                ipatch_type_install_property        (GParamSpec *prop_spec);

Install a new GType property which can be used to associate arbitrary information to GTypes.

prop_spec :

Specification for the new GType property. Ownership of the GParamSpec is taken over by this function. The name field of the GParamSpec should be a static string and is used as the property's ID.

ipatch_type_find_property ()

GParamSpec *        ipatch_type_find_property           (const char *name);

Lookup a GType property by name.

name :

Name of GType property

Returns :

The matching GParamSpec or NULL if not found. The GParamSpec is internal and should NOT be modified or freed.

ipatch_type_list_properties ()

GParamSpec **       ipatch_type_list_properties         (guint *n_properties);

Get a list of all registered GType properties.

n_properties :

Output: Length of returned array

Returns :

An array of GParamSpecs which should be freed when finished.

ipatch_type_find_types_with_property ()

GType *             ipatch_type_find_types_with_property
                                                        (const char *name,
                                                         const GValue *value,
                                                         guint *n_types);

Get an array of types which have the given type property assigned and match value (optional, NULL matches any value).

name :

Name of type property

value :

Optional value to match to type property values (NULL to match any value)

n_types :

Location to store count of types in returned array or NULL to ignore

Returns :

Newly allocated 0 terminated array of types which have the named property set or NULL if type property not found.

ipatch_type_set ()

void                ipatch_type_set                     (GType type,
                                                         const char *first_property_name,
                                                         ...);

Set GType properties. GType properties are used to associate arbitrary information with GTypes.

type :

GType to set properties of

first_property_name :

Name of first property to set

... :

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_set_valist ()

void                ipatch_type_set_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);

Like ipatch_type_set() but uses a va_list.

type :

GType to set properties of

first_property_name :

Name of first property to set

args :

Value of first property to set and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_set_property ()

void                ipatch_type_set_property            (GType type,
                                                         const char *property_name,
                                                         const GValue *value);

Set a single property of a GType.

type :

GType to set property of

property_name :

Name of property to set

value :

Value to set the the property to. The value's type must be the same as the GType property's type.

ipatch_type_get ()

void                ipatch_type_get                     (GType type,
                                                         const char *first_property_name,
                                                         ...);

Get GType property values.

type :

GType to get properties from

first_property_name :

Name of first property to get

... :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_get_valist ()

void                ipatch_type_get_valist              (GType type,
                                                         const char *first_property_name,
                                                         va_list args);

Like ipatch_type_get() but uses a va_list.

type :

GType to get properties from

first_property_name :

Name of first property to get

args :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_get_property ()

void                ipatch_type_get_property            (GType type,
                                                         const char *property_name,
                                                         GValue *value);

Get a single property from a GType.

type :

GType to get property from

property_name :

Name of property to get

value :

An initialized value to store the property value in. The value's type must be a type that the property can be transformed to.

ipatch_type_object_get ()

void                ipatch_type_object_get              (GObject *object,
                                                         const char *first_property_name,
                                                         ...);

Get GType property values. Like ipatch_type_get() but takes an object instance which can be used by any registered dynamic type property functions.

object :

Object instance to get type property from

first_property_name :

Name of first property to get

... :

Pointer to store first property value and optionally followed by more property name/value pairs, terminated with NULL name.

ipatch_type_object_get_valist ()

void                ipatch_type_object_get_valist       (GObject *object,
                                                         const char *first_property_name,
                                                         va_list args);

ipatch_type_object_get_property ()

void                ipatch_type_object_get_property     (GObject *object,
                                                         const char *property_name,
                                                         GValue *value);

Get a single type property from an object instance.

object :

Object instance to get type property from

property_name :

Name of property to get

value :

An initialized value to store the property value in. The value's type must be a type that the property can be transformed to.

ipatch_type_set_dynamic_func ()

void                ipatch_type_set_dynamic_func        (GType type,
                                                         const char *property_name,
                                                         IpatchTypePropGetFunc func);

Registers a callback function for dynamically getting the value of a type property.

Example: A dynamic property is created for SoundFont presets to return a different "virtual-parent-type" depending on if its a percussion or melodic preset (determined from a preset's bank number).

type :

GType of the type property

property_name :

Name of a previously registered type property

func :

Callback function used for getting values for this type property

ipatch_type_get_dynamic_func ()

IpatchTypePropGetFunc  ipatch_type_get_dynamic_func     (GType type,
                                                         const char *property_name);

Get a the dynamic function registered for a given type and property_name with ipatch_type_set_dynamic_func(). Also can be used as an indicator of whether a type property is dynamic or not.

type :

GType of the type property

property_name :

Name of a previously registered type property

Returns :

Pointer to the registered function or NULL if no function registered (not a dynamic type property).