## SwamiControlFunc SwamiControlFunc |

## Synopsis

    void                (*SwamiControlFuncDestroy)          (SwamiControlFunc *control);
                        SwamiControlFunc;
    #define             SWAMI_CONTROL_FUNC_DATA             (ctrl)
    SwamiControlFunc *  swami_control_func_new              (void);
    void                swami_control_func_assign_funcs     (SwamiControlFunc *ctrlfunc,
                                                             SwamiControlGetValueFunc get_func,
                                                             SwamiControlSetValueFunc set_func,
                                                             SwamiControlFuncDestroy destroy_func,
                                                             gpointer user_data);

## Object Hierarchy

      GObject
       +----SwamiLock
             +----SwamiControl
                   +----SwamiControlFunc
                         +----SwamiControlMidi

## Description

## Details

### SwamiControlFuncDestroy ()

    void                (*SwamiControlFuncDestroy)          (SwamiControlFunc *control);

A function to call when the function control is destroyed or when the function callbacks are changed. This function should handle all cleanup for the callback functions. This function is called with `control` multi-thread write locked.

`control` : | Function control object

### SwamiControlFunc

    typedef struct _SwamiControlFunc SwamiControlFunc;

### SWAMI_CONTROL_FUNC_DATA()

    #define SWAMI_CONTROL_FUNC_DATA(ctrl)  (SWAMI_CONTROL_FUNC (ctrl)->user_data)

### swami_control_func_new ()

    SwamiControlFunc *  swami_control_func_new              (void);

Create a new function callback control. Function controls are useful for easily creating custom controls using callback functions.

Returns : | New function control with a refcount of 1 which the caller owns.

### swami_control_func_assign_funcs ()

    void                swami_control_func_assign_funcs     (SwamiControlFunc *ctrlfunc,
                                                             SwamiControlGetValueFunc get_func,
                                                             SwamiControlSetValueFunc set_func,
                                                             SwamiControlFuncDestroy destroy_func,
                                                             gpointer user_data);

Assigns callback functions to a Swami function control object. These callback functions should handle the getting and setting of the control's value. The value passed to these callback functions is initialized to the type of the control's parameter spec and this type should not be changed. The `destroy_func` callback is called when the control is destroyed or when the callback functions are changed and should do any needed cleanup. The control is not locked for any of these callbacks and so must be done in the callback if there are any thread sensitive operations.

`ctrlfunc` : | Swami function control object
`get_func` : | Function to call to get control value or `NULL` if not a readable value control (may still send events)
`set_func` : | Function to call to set control value or `NULL` if not a writable value control
`destroy_func` : | Function to call when control is destroyed or function callbacks are changed or `NULL` if no cleanup is needed.
`user_data` : | User defined pointer (set in `ctrlfunc` instance).