Blame gobject/gbinding.h

Packit ae235b
/* gbinding.h: Binding for object properties
Packit ae235b
 *
Packit ae235b
 * Copyright (C) 2010  Intel Corp.
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General
Packit ae235b
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 *
Packit ae235b
 * Author: Emmanuele Bassi <ebassi@linux.intel.com>
Packit ae235b
 */
Packit ae235b
Packit ae235b
#ifndef __G_BINDING_H__
Packit ae235b
#define __G_BINDING_H__
Packit ae235b
Packit ae235b
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
Packit ae235b
#error "Only <glib-object.h> can be included directly."
Packit ae235b
#endif
Packit ae235b
Packit ae235b
#include <glib.h>
Packit ae235b
#include <gobject/gobject.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
#define G_TYPE_BINDING_FLAGS    (g_binding_flags_get_type ())
Packit ae235b
Packit ae235b
#define G_TYPE_BINDING          (g_binding_get_type ())
Packit ae235b
#define G_BINDING(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_BINDING, GBinding))
Packit ae235b
#define G_IS_BINDING(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_BINDING))
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GBinding:
Packit ae235b
 *
Packit ae235b
 * GBinding is an opaque structure whose members
Packit ae235b
 * cannot be accessed directly.
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
typedef struct _GBinding        GBinding;
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GBindingTransformFunc:
Packit ae235b
 * @binding: a #GBinding
Packit ae235b
 * @from_value: the #GValue containing the value to transform
Packit ae235b
 * @to_value: the #GValue in which to store the transformed value
Packit ae235b
 * @user_data: data passed to the transform function
Packit ae235b
 *
Packit ae235b
 * A function to be called to transform @from_value to @to_value. If
Packit ae235b
 * this is the @transform_to function of a binding, then @from_value
Packit ae235b
 * is the @source_property on the @source object, and @to_value is the
Packit ae235b
 * @target_property on the @target object. If this is the
Packit ae235b
 * @transform_from function of a %G_BINDING_BIDIRECTIONAL binding,
Packit ae235b
 * then those roles are reversed.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE if the transformation was successful, and %FALSE
Packit ae235b
 *   otherwise
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
typedef gboolean (* GBindingTransformFunc) (GBinding     *binding,
Packit ae235b
                                            const GValue *from_value,
Packit ae235b
                                            GValue       *to_value,
Packit ae235b
                                            gpointer      user_data);
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GBindingFlags:
Packit ae235b
 * @G_BINDING_DEFAULT: The default binding; if the source property
Packit ae235b
 *   changes, the target property is updated with its value.
Packit ae235b
 * @G_BINDING_BIDIRECTIONAL: Bidirectional binding; if either the
Packit ae235b
 *   property of the source or the property of the target changes,
Packit ae235b
 *   the other is updated.
Packit ae235b
 * @G_BINDING_SYNC_CREATE: Synchronize the values of the source and
Packit ae235b
 *   target properties when creating the binding; the direction of
Packit ae235b
 *   the synchronization is always from the source to the target.
Packit ae235b
 * @G_BINDING_INVERT_BOOLEAN: If the two properties being bound are
Packit ae235b
 *   booleans, setting one to %TRUE will result in the other being
Packit ae235b
 *   set to %FALSE and vice versa. This flag will only work for
Packit ae235b
 *   boolean properties, and cannot be used when passing custom
Packit ae235b
 *   transformation functions to g_object_bind_property_full().
Packit ae235b
 *
Packit ae235b
 * Flags to be passed to g_object_bind_property() or
Packit ae235b
 * g_object_bind_property_full().
Packit ae235b
 *
Packit ae235b
 * This enumeration can be extended at later date.
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
typedef enum { /*< prefix=G_BINDING >*/
Packit ae235b
  G_BINDING_DEFAULT        = 0,
Packit ae235b
Packit ae235b
  G_BINDING_BIDIRECTIONAL  = 1 << 0,
Packit ae235b
  G_BINDING_SYNC_CREATE    = 1 << 1,
Packit ae235b
  G_BINDING_INVERT_BOOLEAN = 1 << 2
Packit ae235b
} GBindingFlags;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType                 g_binding_flags_get_type      (void) G_GNUC_CONST;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType                 g_binding_get_type            (void) G_GNUC_CONST;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GBindingFlags         g_binding_get_flags           (GBinding *binding);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GObject *             g_binding_get_source          (GBinding *binding);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GObject *             g_binding_get_target          (GBinding *binding);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const gchar *         g_binding_get_source_property (GBinding *binding);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const gchar *         g_binding_get_target_property (GBinding *binding);
Packit ae235b
GLIB_AVAILABLE_IN_2_38
Packit ae235b
void                  g_binding_unbind              (GBinding *binding);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GBinding *g_object_bind_property               (gpointer               source,
Packit ae235b
                                                const gchar           *source_property,
Packit ae235b
                                                gpointer               target,
Packit ae235b
                                                const gchar           *target_property,
Packit ae235b
                                                GBindingFlags          flags);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GBinding *g_object_bind_property_full          (gpointer               source,
Packit ae235b
                                                const gchar           *source_property,
Packit ae235b
                                                gpointer               target,
Packit ae235b
                                                const gchar           *target_property,
Packit ae235b
                                                GBindingFlags          flags,
Packit ae235b
                                                GBindingTransformFunc  transform_to,
Packit ae235b
                                                GBindingTransformFunc  transform_from,
Packit ae235b
                                                gpointer               user_data,
Packit ae235b
                                                GDestroyNotify         notify);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GBinding *g_object_bind_property_with_closures (gpointer               source,
Packit ae235b
                                                const gchar           *source_property,
Packit ae235b
                                                gpointer               target,
Packit ae235b
                                                const gchar           *target_property,
Packit ae235b
                                                GBindingFlags          flags,
Packit ae235b
                                                GClosure              *transform_to,
Packit ae235b
                                                GClosure              *transform_from);
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __G_BINDING_H__ */