BtChildProxy: Buzztrax Bt-Core Reference Manual

## BtChildProxy BtChildProxy — Interface for multi child elements. |

## Functions

void | bt_child_proxy_get ()
GObject * | bt_child_proxy_get_child_by_index ()
GObject * | bt_child_proxy_get_child_by_name ()
guint | bt_child_proxy_get_children_count ()
void | bt_child_proxy_get_property ()
void | bt_child_proxy_get_valist ()
gboolean | bt_child_proxy_lookup ()
void | bt_child_proxy_set ()
void | bt_child_proxy_set_property ()
void | bt_child_proxy_set_valist ()

## Types and Values

| BtChildProxy
struct | BtChildProxyInterface

## Object Hierarchy

        GInterface
        ╰── BtChildProxy

## Includes

    #include <libbtcore/core.h>

## Description

This interface abstracts handling of property sets for elements with children. Imagine elements such as mixers or polyphonic generators. They all have multiple GstPad or some kind of voice objects. Another use case are container elements like GstBin. The element implementing the interface acts as a parent for those child objects.

By implementing this interface the child properties can be accessed from the parent element by using `bt_child_proxy_get()` and `bt_child_proxy_set()`.

Property names are written as "child-name::property-name". The whole naming scheme is recursive. Thus "child1::child2::property" is valid too, if "child1" and "child2" are objects that implement the interface or are properties that return a GObject. The later is a convenient way to set or get properties a few hops down the hierarchy in one go (without being able to forget the unrefs of the intermediate objects).

## Functions

### bt_child_proxy_get ()

    void
    bt_child_proxy_get (gpointer object,
                        const gchar *first_property_name,
                        ...);

Gets properties of the parent object and its children.

#### Parameters

object | the parent object |
first_property_name | name of the first property to get |
... | return location for the first property, followed optionally by more name/return location pairs, followed by NULL |

### bt_child_proxy_get_child_by_index ()

    GObject *
    bt_child_proxy_get_child_by_index (BtChildProxy *parent,
                                       guint index);

Fetches a child by its number.

#### Parameters

parent | the parent object to get the child from |
index | the childs position in the child list |

#### Returns

the child object or `NULL` if not found (index too high). Unref after usage.

[transfer full]

### bt_child_proxy_get_child_by_name ()

    GObject *
    bt_child_proxy_get_child_by_name (BtChildProxy *parent,
                                      const gchar *name);

Looks up a child element by the given name.

#### Parameters

parent | the parent object to get the child from |
name | the childs name |

#### Returns

the child object or `NULL` if not found. Unref after usage.

[transfer full]

### bt_child_proxy_get_children_count ()

    guint
    bt_child_proxy_get_children_count (BtChildProxy *parent);

Gets the number of child objects this parent contains.

#### Parameters

parent | the parent object |

#### Returns

the number of child objects

### bt_child_proxy_get_property ()

    void
    bt_child_proxy_get_property (GObject *object,
                                 const gchar *name,
                                 GValue *value);

Gets a single property using the BtChildProxy mechanism. You are responsible for for freeing it by calling `g_value_unset()`

#### Parameters

object | object to query |
name | name of the property |
value | a GValue that should take the result. |

### bt_child_proxy_get_valist ()

    void
    bt_child_proxy_get_valist (GObject *object,
                               const gchar *first_property_name,
                               va_list var_args);

Gets properties of the parent object and its children.

#### Parameters

object | the object to query |
first_property_name | name of the first property to get |
var_args | return location for the first property, followed optionally by more name/return location pairs, followed by NULL |

### bt_child_proxy_lookup ()

    gboolean
    bt_child_proxy_lookup (GObject *object,
                           const gchar *name,
                           GObject **target,
                           GParamSpec **pspec);

Looks up which object and GParamSpec would be effected by the given `name` .

#### Parameters

object | object to lookup the property in |
name | name of the property to look up |
target | pointer to a GObject that takes the real object to set property on |
pspec | pointer to take the GParamSpec describing the property |

#### Returns

TRUE if `target` and `pspec` could be found. FALSE otherwise. In that case the values for `pspec` and `target` are not modified. Unref `target` after usage.

### bt_child_proxy_set ()

    void
    bt_child_proxy_set (gpointer object,
                        const gchar *first_property_name,
                        ...);

Sets properties of the parent object and its children.

#### Parameters

object | the parent object |
first_property_name | name of the first property to set |
... | value for the first property, followed optionally by more name/value pairs, followed by NULL |

### bt_child_proxy_set_property ()

    void
    bt_child_proxy_set_property (GObject *object,
                                 const gchar *name,
                                 const GValue *value);

Sets a single property using the BtChildProxy mechanism.

#### Parameters

object | the parent object |
name | name of the property to set |
value | new GValue for the property |

### bt_child_proxy_set_valist ()

    void
    bt_child_proxy_set_valist (GObject *object,
                               const gchar *first_property_name,
                               va_list var_args);

Sets properties of the parent object and its children.

#### Parameters

object | the parent object |
first_property_name | name of the first property to set |
var_args | value for the first property, followed optionally by more name/value pairs, followed by NULL |

## Types and Values

### BtChildProxy

    typedef struct _BtChildProxy BtChildProxy;

Opaque interface handle.

### struct BtChildProxyInterface

    struct BtChildProxyInterface {
      /* virtual methods */
      GObject *(*get_child_by_name)(BtChildProxy *parent,const gchar *name);
      GObject *(*get_child_by_index) (BtChildProxy *parent,guint index);
      guint (*get_children_count) (BtChildProxy *parent);
    };

BtChildProxy interface.

#### Members

`get_child_by_name` () | virtual method to fetch the child by name |
`get_child_by_index` () | virtual method to fetch the child by index |
`get_children_count` () | virtual method to get the children count |