Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gbinding.h
Go to the documentation of this file.
1/* gbinding.h: Binding for object properties
2 *
3 * Copyright (C) 2010 Intel Corp.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 *
20 * Author: Emmanuele Bassi <ebassi@linux.intel.com>
21 */
22
23#ifndef __G_BINDING_H__
24#define __G_BINDING_H__
25
26#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
27#error "Only <glib-object.h> can be included directly."
28#endif
29
30#include <glib.h>
31#include <gobject/gobject.h>
32
34
35#define G_TYPE_BINDING_FLAGS (g_binding_flags_get_type ())
36
37#define G_TYPE_BINDING (g_binding_get_type ())
38#define G_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_BINDING, GBinding))
39#define G_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_BINDING))
40
41typedef struct _GBinding GBinding;
42
43/**
44 * GBindingTransformFunc:
45 * @binding: a #GBinding
46 * @from_value: the #GValue containing the value to transform
47 * @to_value: the #GValue in which to store the transformed value
48 * @user_data: data passed to the transform function
49 *
50 * A function to be called to transform @from_value to @to_value.
51 *
52 * If this is the @transform_to function of a binding, then @from_value
53 * is the @source_property on the @source object, and @to_value is the
54 * @target_property on the @target object. If this is the
55 * @transform_from function of a %G_BINDING_BIDIRECTIONAL binding,
56 * then those roles are reversed.
57 *
58 * Returns: %TRUE if the transformation was successful, and %FALSE
59 * otherwise
60 *
61 * Since: 2.26
62 */
64 const GValue *from_value,
65 GValue *to_value,
66 gpointer user_data);
67
68/**
69 * GBindingFlags:
70 * @G_BINDING_DEFAULT: The default binding; if the source property
71 * changes, the target property is updated with its value.
72 * @G_BINDING_BIDIRECTIONAL: Bidirectional binding; if either the
73 * property of the source or the property of the target changes,
74 * the other is updated.
75 * @G_BINDING_SYNC_CREATE: Synchronize the values of the source and
76 * target properties when creating the binding; the direction of
77 * the synchronization is always from the source to the target.
78 * @G_BINDING_INVERT_BOOLEAN: If the two properties being bound are
79 * booleans, setting one to %TRUE will result in the other being
80 * set to %FALSE and vice versa. This flag will only work for
81 * boolean properties, and cannot be used when passing custom
82 * transformation functions to g_object_bind_property_full().
83 *
84 * Flags to be passed to g_object_bind_property() or
85 * g_object_bind_property_full().
86 *
87 * This enumeration can be extended at later date.
88 *
89 * Since: 2.26
90 */
91typedef enum { /*< prefix=G_BINDING >*/
93
98
103
120
123 const gchar *source_property,
124 gpointer target,
125 const gchar *target_property,
126 GBindingFlags flags);
129 const gchar *source_property,
130 gpointer target,
131 const gchar *target_property,
132 GBindingFlags flags,
133 GBindingTransformFunc transform_to,
134 GBindingTransformFunc transform_from,
135 gpointer user_data,
136 GDestroyNotify notify);
139 const gchar *source_property,
140 gpointer target,
141 const gchar *target_property,
142 GBindingFlags flags,
143 GClosure *transform_to,
144 GClosure *transform_from);
145
147
148#endif /* __G_BINDING_H__ */
GOBJECT_AVAILABLE_IN_ALL GType g_binding_flags_get_type(void) G_GNUC_CONST
GOBJECT_AVAILABLE_IN_ALL const gchar * g_binding_get_target_property(GBinding *binding)
GObject * g_binding_get_target(GBinding *binding)
GOBJECT_AVAILABLE_IN_2_68 GObject * g_binding_dup_source(GBinding *binding)
GOBJECT_AVAILABLE_IN_ALL GType g_binding_get_type(void) G_GNUC_CONST
GOBJECT_AVAILABLE_IN_ALL GBinding * g_object_bind_property_with_closures(gpointer source, const gchar *source_property, gpointer target, const gchar *target_property, GBindingFlags flags, GClosure *transform_to, GClosure *transform_from)
GOBJECT_AVAILABLE_IN_ALL GBinding * g_object_bind_property(gpointer source, const gchar *source_property, gpointer target, const gchar *target_property, GBindingFlags flags)
GOBJECT_AVAILABLE_IN_ALL GBindingFlags g_binding_get_flags(GBinding *binding)
GBindingFlags
Definition gbinding.h:91
@ G_BINDING_BIDIRECTIONAL
Definition gbinding.h:94
@ G_BINDING_SYNC_CREATE
Definition gbinding.h:95
@ G_BINDING_INVERT_BOOLEAN
Definition gbinding.h:96
@ G_BINDING_DEFAULT
Definition gbinding.h:92
GOBJECT_AVAILABLE_IN_2_38 void g_binding_unbind(GBinding *binding)
GObject * g_binding_get_source(GBinding *binding)
GOBJECT_AVAILABLE_IN_ALL GBinding * g_object_bind_property_full(gpointer source, const gchar *source_property, gpointer target, const gchar *target_property, GBindingFlags flags, GBindingTransformFunc transform_to, GBindingTransformFunc transform_from, gpointer user_data, GDestroyNotify notify)
struct _GBinding GBinding
Definition gbinding.h:41
gboolean(* GBindingTransformFunc)(GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data)
Definition gbinding.h:63
GOBJECT_AVAILABLE_IN_2_68 GObject * g_binding_dup_target(GBinding *binding)
GOBJECT_AVAILABLE_IN_ALL const gchar * g_binding_get_source_property(GBinding *binding)
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_CONST
Definition gmacros.h:637
#define GOBJECT_AVAILABLE_IN_2_38
#define GOBJECT_AVAILABLE_IN_ALL
#define GOBJECT_DEPRECATED_IN_2_68_FOR(f)
#define GOBJECT_AVAILABLE_IN_2_68
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
void * gpointer
Definition gtypes.h:109
void(* GDestroyNotify)(gpointer data)
Definition gtypes.h:140