Blame gobject/gbinding.h

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