Debian Codegraph @

gtk/gtkconstraint.c

raw symbols SCIP
1 /* gtkconstraint.c: Constraint between two widgets
2 * Copyright 2019 GNOME Foundation
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author: Emmanuele Bassi
18 */
19
20 /**
21 * GtkConstraint:
22 *
23 * Describes a constraint between attributes of two widgets,
24 * expressed as a linear equation.
25 *
26 * The typical equation for a constraint is:
27 *
28 * ```
29 * target.target_attr = source.source_attr × multiplier + constant
30 * ```
31 *
32 * Each `GtkConstraint` is part of a system that will be solved by a
33 * [[email protected]] in order to allocate and position each
34 * child widget or guide.
35 *
36 * The source and target, as well as their attributes, of a `GtkConstraint`
37 * instance are immutable after creation.
38 */
39
40 #include "config.h"cxx . . $ `<file>/build/config.h`/
41
42 #include "gtkconstraintprivate.h"cxx . . $ `<file>/gtk/gtkconstraintprivate.h`/
43 #include "gtkconstraintsolverprivate.h"cxx . . $ `<file>/gtk/gtkconstraintsolverprivate.h`/
44 #include "gtktypebuiltins.h"cxx . . $ `<file>/build/gtk/gtktypebuiltins.h`/
45 #include "gtkwidget.h"cxx . . $ `<file>/gtk/gtkwidget.h`/
46
47 enumcxx . . $ $anonymous_type_44ad538a34d03054_0# {
48 PROP_TARGETcxx . . $ PROP_TARGET. = 1,
49 PROP_TARGET_ATTRIBUTEcxx . . $ PROP_TARGET_ATTRIBUTE.,
50 PROP_RELATIONcxx . . $ PROP_RELATION.,
51 PROP_SOURCEcxx . . $ PROP_SOURCE.,
52 PROP_SOURCE_ATTRIBUTEcxx . . $ PROP_SOURCE_ATTRIBUTE.,
53 PROP_MULTIPLIERcxx . . $ PROP_MULTIPLIER.,
54 PROP_CONSTANTcxx . . $ PROP_CONSTANT.,
55 PROP_STRENGTHcxx . . $ PROP_STRENGTH.,
56
57 N_PROPERTIEScxx . . $ N_PROPERTIES.
58 };
59
60 static GParamSpeccxx . . $ GParamSpec# *obj_propscxx . . $ obj_props.[N_PROPERTIEScxx . . $ N_PROPERTIES.];
61
62 G_DEFINE_TYPEcxx . . $ `<external>/9567554376676449156/gtype.h:1834:9`! (GtkConstraint, gtk_constraint, G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!)
63
64 static void
65 gtk_constraint_set_propertycxx . . $ gtk_constraint_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *gobject,
66 guintcxx . . $ guint# prop_id,
67 const GValuecxx . . $ GValue# *value,
68 GParamSpeccxx . . $ GParamSpec# *pspec)
69 {
70 GtkConstraintcxx . . $ GtkConstraint# *self = GTK_CONSTRAINTcxx . . $ GTK_CONSTRAINT(5b920f6aeefbcd77). (gobject);
71
72 switch (prop_id)
73 {
74 case PROP_TARGETcxx . . $ PROP_TARGET.:
75 self->targetcxx . . $ _GtkConstraint#target. = g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value);
76 break;
77
78 case PROP_TARGET_ATTRIBUTEcxx . . $ PROP_TARGET_ATTRIBUTE.:
79 self->target_attributecxx . . $ _GtkConstraint#target_attribute. = g_value_get_enumcxx . . $ g_value_get_enum(f890c5c75ead5b21). (value);
80 break;
81
82 case PROP_RELATIONcxx . . $ PROP_RELATION.:
83 self->relationcxx . . $ _GtkConstraint#relation. = g_value_get_enumcxx . . $ g_value_get_enum(f890c5c75ead5b21). (value);
84 break;
85
86 case PROP_SOURCEcxx . . $ PROP_SOURCE.:
87 self->sourcecxx . . $ _GtkConstraint#source. = g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value);
88 break;
89
90 case PROP_SOURCE_ATTRIBUTEcxx . . $ PROP_SOURCE_ATTRIBUTE.:
91 self->source_attributecxx . . $ _GtkConstraint#source_attribute. = g_value_get_enumcxx . . $ g_value_get_enum(f890c5c75ead5b21). (value);
92 break;
93
94 case PROP_MULTIPLIERcxx . . $ PROP_MULTIPLIER.:
95 self->multipliercxx . . $ _GtkConstraint#multiplier. = g_value_get_doublecxx . . $ g_value_get_double(5c6b000bff87b62c). (value);
96 break;
97
98 case PROP_CONSTANTcxx . . $ PROP_CONSTANT.:
99 self->constantcxx . . $ _GtkConstraint#constant. = g_value_get_doublecxx . . $ g_value_get_double(5c6b000bff87b62c). (value);
100 break;
101
102 case PROP_STRENGTHcxx . . $ PROP_STRENGTH.:
103 self->strengthcxx . . $ _GtkConstraint#strength. = g_value_get_intcxx . . $ g_value_get_int(f890c5c75ead5b21). (value);
104 break;
105
106 default:
107 G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (gobject, prop_id, pspec);
108 break;
109 }
110 }
111
112 static void
113 gtk_constraint_get_propertycxx . . $ gtk_constraint_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *gobject,
114 guintcxx . . $ guint# prop_id,
115 GValuecxx . . $ GValue# *value,
116 GParamSpeccxx . . $ GParamSpec# *pspec)
117 {
118 GtkConstraintcxx . . $ GtkConstraint# *self = GTK_CONSTRAINTcxx . . $ GTK_CONSTRAINT(5b920f6aeefbcd77). (gobject);
119
120 switch (prop_id)
121 {
122 case PROP_TARGETcxx . . $ PROP_TARGET.:
123 g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, self->targetcxx . . $ _GtkConstraint#target.);
124 break;
125
126 case PROP_TARGET_ATTRIBUTEcxx . . $ PROP_TARGET_ATTRIBUTE.:
127 g_value_set_enumcxx . . $ g_value_set_enum(b698c61e8e30c4ea). (value, self->target_attributecxx . . $ _GtkConstraint#target_attribute.);
128 break;
129
130 case PROP_RELATIONcxx . . $ PROP_RELATION.:
131 g_value_set_enumcxx . . $ g_value_set_enum(b698c61e8e30c4ea). (value, self->relationcxx . . $ _GtkConstraint#relation.);
132 break;
133
134 case PROP_SOURCEcxx . . $ PROP_SOURCE.:
135 g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, self->sourcecxx . . $ _GtkConstraint#source.);
136 break;
137
138 case PROP_SOURCE_ATTRIBUTEcxx . . $ PROP_SOURCE_ATTRIBUTE.:
139 g_value_set_enumcxx . . $ g_value_set_enum(b698c61e8e30c4ea). (value, self->source_attributecxx . . $ _GtkConstraint#source_attribute.);
140 break;
141
142 case PROP_MULTIPLIERcxx . . $ PROP_MULTIPLIER.:
143 g_value_set_doublecxx . . $ g_value_set_double(994eddfdeb9c9cc0). (value, self->multipliercxx . . $ _GtkConstraint#multiplier.);
144 break;
145
146 case PROP_CONSTANTcxx . . $ PROP_CONSTANT.:
147 g_value_set_doublecxx . . $ g_value_set_double(994eddfdeb9c9cc0). (value, self->constantcxx . . $ _GtkConstraint#constant.);
148 break;
149
150 case PROP_STRENGTHcxx . . $ PROP_STRENGTH.:
151 g_value_set_intcxx . . $ g_value_set_int(b698c61e8e30c4ea). (value, self->strengthcxx . . $ _GtkConstraint#strength.);
152 break;
153
154 default:
155 G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (gobject, prop_id, pspec);
156 break;
157 }
158 }
159
160 static void
161 gtk_constraint_finalizecxx . . $ gtk_constraint_finalize(6087475fa43034d3). (GObjectcxx . . $ GObject# *gobject)
162 {
163 GtkConstraintcxx . . $ GtkConstraint# *self = GTK_CONSTRAINTcxx . . $ GTK_CONSTRAINT(5b920f6aeefbcd77). (gobject);
164
165 gtk_constraint_detachcxx . . $ gtk_constraint_detach(5f37018eb6640293). (self);
166
167 G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_constraint_parent_class)->finalizecxx . . $ _GObjectClass#finalize. (gobject);
168 }
169
170 static void
171 gtk_constraint_class_initcxx . . $ gtk_constraint_class_init(dbbd703f2ba6ae5e). (GtkConstraintClasscxx . . $ GtkConstraintClass# *klass)
172 {
173 GObjectClasscxx . . $ GObjectClass# *gobject_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass);
174
175 gobject_class->set_propertycxx . . $ _GObjectClass#set_property. = gtk_constraint_set_propertycxx . . $ gtk_constraint_set_property(d7c4bb29f36c0dc4).;
176 gobject_class->get_propertycxx . . $ _GObjectClass#get_property. = gtk_constraint_get_propertycxx . . $ gtk_constraint_get_property(cee2c52f22407c66).;
177 gobject_class->finalizecxx . . $ _GObjectClass#finalize. = gtk_constraint_finalizecxx . . $ gtk_constraint_finalize(6087475fa43034d3).;
178
179 /**
180 * GtkConstraint:target:
181 *
182 * The target of the constraint.
183 *
184 * The constraint will set the [[email protected]:target-attribute]
185 * property of the target using the [[email protected]:source-attribute]
186 * property of the source widget.
187 *
188 *
189 */
190 obj_propscxx . . $ obj_props.[PROP_TARGETcxx . . $ PROP_TARGET.] =
191 g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("target", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
192 GTK_TYPE_CONSTRAINT_TARGETcxx . . $ `gtk/gtkconstraint.h:29:9`!,
193 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
194 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
195 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
196
197 /**
198 * GtkConstraint:target-attribute:
199 *
200 * The attribute of the [[email protected]:target] set by the constraint.
201 */
202 obj_propscxx . . $ obj_props.[PROP_TARGET_ATTRIBUTEcxx . . $ PROP_TARGET_ATTRIBUTE.] =
203 g_param_spec_enumcxx . . $ g_param_spec_enum(bfeb217b5dc6c0ac). ("target-attribute", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
204 GTK_TYPE_CONSTRAINT_ATTRIBUTEcxx . . $ `build/gtk/gtktypebuiltins.h:216:9`!,
205 GTK_CONSTRAINT_ATTRIBUTE_NONEcxx . . $ GTK_CONSTRAINT_ATTRIBUTE_NONE.,
206 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
207 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
208 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
209
210 /**
211 * GtkConstraint:relation:
212 *
213 * The order relation between the terms of the constraint.
214 */
215 obj_propscxx . . $ obj_props.[PROP_RELATIONcxx . . $ PROP_RELATION.] =
216 g_param_spec_enumcxx . . $ g_param_spec_enum(bfeb217b5dc6c0ac). ("relation", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
217 GTK_TYPE_CONSTRAINT_RELATIONcxx . . $ `build/gtk/gtktypebuiltins.h:212:9`!,
218 GTK_CONSTRAINT_RELATION_EQcxx . . $ GTK_CONSTRAINT_RELATION_EQ.,
219 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
220 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
221 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
222
223 /**
224 * GtkConstraint:source:
225 *
226 * The source of the constraint.
227 *
228 * The constraint will set the [[email protected]:target-attribute]
229 * property of the target using the [[email protected]:source-attribute]
230 * property of the source.
231 */
232 obj_propscxx . . $ obj_props.[PROP_SOURCEcxx . . $ PROP_SOURCE.] =
233 g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("source", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
234 GTK_TYPE_CONSTRAINT_TARGETcxx . . $ `gtk/gtkconstraint.h:29:9`!,
235 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
236 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
237 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
238 /**
239 * GtkConstraint:source-attribute:
240 *
241 * The attribute of the [[email protected]:source] read by the
242 * constraint.
243 */
244 obj_propscxx . . $ obj_props.[PROP_SOURCE_ATTRIBUTEcxx . . $ PROP_SOURCE_ATTRIBUTE.] =
245 g_param_spec_enumcxx . . $ g_param_spec_enum(bfeb217b5dc6c0ac). ("source-attribute", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
246 GTK_TYPE_CONSTRAINT_ATTRIBUTEcxx . . $ `build/gtk/gtktypebuiltins.h:216:9`!,
247 GTK_CONSTRAINT_ATTRIBUTE_NONEcxx . . $ GTK_CONSTRAINT_ATTRIBUTE_NONE.,
248 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
249 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
250 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
251
252 /**
253 * GtkConstraint:multiplier:
254 *
255 * The multiplication factor to be applied to
256 * the [[email protected]:source-attribute].
257 */
258 obj_propscxx . . $ obj_props.[PROP_MULTIPLIERcxx . . $ PROP_MULTIPLIER.] =
259 g_param_spec_doublecxx . . $ g_param_spec_double(7074fc8ad37faddb). ("multiplier", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
260 -G_MAXDOUBLEcxx . . $ `<external>/10505296616216143549/glibconfig.h:34:9`!, G_MAXDOUBLEcxx . . $ `<external>/10505296616216143549/glibconfig.h:34:9`!, 1.0,
261 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
262 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
263 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
264
265 /**
266 * GtkConstraint:constant:
267 *
268 * The constant value to be added to the [[email protected]:source-attribute].
269 */
270 obj_propscxx . . $ obj_props.[PROP_CONSTANTcxx . . $ PROP_CONSTANT.] =
271 g_param_spec_doublecxx . . $ g_param_spec_double(7074fc8ad37faddb). ("constant", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
272 -G_MAXDOUBLEcxx . . $ `<external>/10505296616216143549/glibconfig.h:34:9`!, G_MAXDOUBLEcxx . . $ `<external>/10505296616216143549/glibconfig.h:34:9`!, 0.0,
273 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
274 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
275 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
276
277 /**
278 * GtkConstraint:strength:
279 *
280 * The strength of the constraint.
281 *
282 * The strength can be expressed either using one of the symbolic values
283 * of the [[email protected]] enumeration, or any positive integer
284 * value.
285 */
286 obj_propscxx . . $ obj_props.[PROP_STRENGTHcxx . . $ PROP_STRENGTH.] =
287 g_param_spec_intcxx . . $ g_param_spec_int(eedf0a930522f60e). ("strength", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
288 0, GTK_CONSTRAINT_STRENGTH_REQUIREDcxx . . $ GTK_CONSTRAINT_STRENGTH_REQUIRED.,
289 GTK_CONSTRAINT_STRENGTH_REQUIREDcxx . . $ GTK_CONSTRAINT_STRENGTH_REQUIRED.,
290 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
291 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! |
292 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY.);
293
294 g_object_class_install_propertiescxx . . $ g_object_class_install_properties(569d03e6a4088541). (gobject_class, N_PROPERTIEScxx . . $ N_PROPERTIES., obj_propscxx . . $ obj_props.);
295 }
296
297 static void
298 gtk_constraint_initcxx . . $ gtk_constraint_init(5f37018eb6640293). (GtkConstraintcxx . . $ GtkConstraint# *self)
299 {
300 self->multipliercxx . . $ _GtkConstraint#multiplier. = 1.0;
301 self->constantcxx . . $ _GtkConstraint#constant. = 0.0;
302
303 self->target_attributecxx . . $ _GtkConstraint#target_attribute. = GTK_CONSTRAINT_ATTRIBUTE_NONEcxx . . $ GTK_CONSTRAINT_ATTRIBUTE_NONE.;
304 self->source_attributecxx . . $ _GtkConstraint#source_attribute. = GTK_CONSTRAINT_ATTRIBUTE_NONEcxx . . $ GTK_CONSTRAINT_ATTRIBUTE_NONE.;
305 self->relationcxx . . $ _GtkConstraint#relation. = GTK_CONSTRAINT_RELATION_EQcxx . . $ GTK_CONSTRAINT_RELATION_EQ.;
306 self->strengthcxx . . $ _GtkConstraint#strength. = GTK_CONSTRAINT_STRENGTH_REQUIREDcxx . . $ GTK_CONSTRAINT_STRENGTH_REQUIRED.;
307 }
308
309 /**
310 * gtk_constraint_new: (constructor)
311 * @target: (nullable) (type GtkConstraintTarget): the target of the constraint
312 * @target_attribute: the attribute of `target` to be set
313 * @relation: the relation equivalence between `target_attribute` and `source_attribute`
314 * @source: (nullable) (type GtkConstraintTarget): the source of the constraint
315 * @source_attribute: the attribute of `source` to be read
316 * @multiplier: a multiplication factor to be applied to `source_attribute`
317 * @constant: a constant factor to be added to `source_attribute`
318 * @strength: the strength of the constraint
319 *
320 * Creates a new constraint representing a relation between a layout
321 * attribute on a source and a layout attribute on a target.
322 *
323 * Returns: (transfer full): the newly created constraint
324 */
325 GtkConstraintcxx . . $ GtkConstraint# *
326 gtk_constraint_newcxx . . $ gtk_constraint_new(608a1832a004292b). (gpointercxx . . $ gpointer# target,
327 GtkConstraintAttributecxx . . $ GtkConstraintAttribute# target_attribute,
328 GtkConstraintRelationcxx . . $ GtkConstraintRelation# relation,
329 gpointercxx . . $ gpointer# source,
330 GtkConstraintAttributecxx . . $ GtkConstraintAttribute# source_attribute,
331 double multiplier,
332 double constant,
333 int strength)
334 {
335 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (target == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || GTK_IS_CONSTRAINT_TARGET (target), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
336 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || GTK_IS_CONSTRAINT_TARGET (source), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
337
338 return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_CONSTRAINTcxx . . $ `gtk/gtkconstraint.h:43:9`!,
339 "target", target,
340 "target-attribute", target_attribute,
341 "relation", relation,
342 "source", source,
343 "source-attribute", source_attribute,
344 "multiplier", multiplier,
345 "constant", constant,
346 "strength", strength,
347 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
348 }
349
350 /**
351 * gtk_constraint_new_constant: (constructor)
352 * @target: (nullable) (type GtkConstraintTarget): a the target of the constraint
353 * @target_attribute: the attribute of `target` to be set
354 * @relation: the relation equivalence between `target_attribute` and `constant`
355 * @constant: a constant factor to be set on `target_attribute`
356 * @strength: the strength of the constraint
357 *
358 * Creates a new constraint representing a relation between a layout
359 * attribute on a target and a constant value.
360 *
361 * Returns: (transfer full): the newly created constraint
362 */
363 GtkConstraintcxx . . $ GtkConstraint# *
364 gtk_constraint_new_constantcxx . . $ gtk_constraint_new_constant(319750a80641c365). (gpointercxx . . $ gpointer# target,
365 GtkConstraintAttributecxx . . $ GtkConstraintAttribute# target_attribute,
366 GtkConstraintRelationcxx . . $ GtkConstraintRelation# relation,
367 double constant,
368 int strength)
369 {
370 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (target == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || GTK_IS_CONSTRAINT_TARGET (target), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
371
372 return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_CONSTRAINTcxx . . $ `gtk/gtkconstraint.h:43:9`!,
373 "target", target,
374 "target-attribute", target_attribute,
375 "relation", relation,
376 "source-attribute", GTK_CONSTRAINT_ATTRIBUTE_NONEcxx . . $ GTK_CONSTRAINT_ATTRIBUTE_NONE.,
377 "constant", constant,
378 "strength", strength,
379 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
380 }
381
382 /**
383 * gtk_constraint_get_target:
384 * @constraint: a `GtkConstraint`
385 *
386 * Retrieves the [[email protected]] used as the target for
387 * the constraint.
388 *
389 * If the targe is set to `NULL` at creation, the constraint will use
390 * the widget using the [[email protected]] as the target.
391 *
392 * Returns: (transfer none) (nullable): a `GtkConstraintTarget`
393 */
394 GtkConstraintTargetcxx . . $ GtkConstraintTarget# *
395 gtk_constraint_get_targetcxx . . $ gtk_constraint_get_target(f78b9dee59db8d6f). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
396 {
397 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
398
399 return constraint->targetcxx . . $ _GtkConstraint#target.;
400 }
401
402 /**
403 * gtk_constraint_get_target_attribute:
404 * @constraint: a `GtkConstraint`
405 *
406 * Retrieves the attribute of the target to be set by the constraint.
407 *
408 * Returns: the target's attribute
409 */
410 GtkConstraintAttributecxx . . $ GtkConstraintAttribute#
411 gtk_constraint_get_target_attributecxx . . $ gtk_constraint_get_target_attribute(53fa4b71b9893c94). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
412 {
413 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), GTK_CONSTRAINT_ATTRIBUTE_NONE);
414
415 return constraint->target_attributecxx . . $ _GtkConstraint#target_attribute.;
416 }
417
418 /**
419 * gtk_constraint_get_source:
420 * @constraint: a `GtkConstraint`
421 *
422 * Retrieves the [[email protected]] used as the source for the
423 * constraint.
424 *
425 * If the source is set to `NULL` at creation, the constraint will use
426 * the widget using the [[email protected]] as the source.
427 *
428 * Returns: (transfer none) (nullable): the source of the constraint
429 */
430 GtkConstraintTargetcxx . . $ GtkConstraintTarget# *
431 gtk_constraint_get_sourcecxx . . $ gtk_constraint_get_source(f78b9dee59db8d6f). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
432 {
433 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
434
435 return constraint->sourcecxx . . $ _GtkConstraint#source.;
436 }
437
438 /**
439 * gtk_constraint_get_source_attribute:
440 * @constraint: a `GtkConstraint`
441 *
442 * Retrieves the attribute of the source to be read by the constraint.
443 *
444 * Returns: the source's attribute
445 */
446 GtkConstraintAttributecxx . . $ GtkConstraintAttribute#
447 gtk_constraint_get_source_attributecxx . . $ gtk_constraint_get_source_attribute(53fa4b71b9893c94). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
448 {
449 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), GTK_CONSTRAINT_ATTRIBUTE_NONE);
450
451 return constraint->source_attributecxx . . $ _GtkConstraint#source_attribute.;
452 }
453
454 /**
455 * gtk_constraint_get_relation:
456 * @constraint: a `GtkConstraint`
457 *
458 * The order relation between the terms of the constraint.
459 *
460 * Returns: a relation type
461 */
462 GtkConstraintRelationcxx . . $ GtkConstraintRelation#
463 gtk_constraint_get_relationcxx . . $ gtk_constraint_get_relation(355d933cf4d50d95). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
464 {
465 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), GTK_CONSTRAINT_RELATION_EQ);
466
467 return constraint->relationcxx . . $ _GtkConstraint#relation.;
468 }
469
470 /**
471 * gtk_constraint_get_multiplier:
472 * @constraint: a `GtkConstraint`
473 *
474 * Retrieves the multiplication factor applied to the source
475 * attribute's value.
476 *
477 * Returns: a multiplication factor
478 */
479 double
480 gtk_constraint_get_multipliercxx . . $ gtk_constraint_get_multiplier(119c59dba91d2bca). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
481 {
482 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), 1.0);
483
484 return constraint->multipliercxx . . $ _GtkConstraint#multiplier.;
485 }
486
487 /**
488 * gtk_constraint_get_constant:
489 * @constraint: a `GtkConstraint`
490 *
491 * Retrieves the constant factor added to the source attributes' value.
492 *
493 * Returns: a constant factor
494 */
495 double
496 gtk_constraint_get_constantcxx . . $ gtk_constraint_get_constant(119c59dba91d2bca). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
497 {
498 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), 0.0);
499
500 return constraint->constantcxx . . $ _GtkConstraint#constant.;
501 }
502
503 /**
504 * gtk_constraint_get_strength:
505 * @constraint: a `GtkConstraint`
506 *
507 * Retrieves the strength of the constraint.
508 *
509 * Returns: the strength value
510 */
511 int
512 gtk_constraint_get_strengthcxx . . $ gtk_constraint_get_strength(741f613ad6737b72). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
513 {
514 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), GTK_CONSTRAINT_STRENGTH_REQUIRED);
515
516 return constraint->strengthcxx . . $ _GtkConstraint#strength.;
517 }
518
519 /**
520 * gtk_constraint_is_required:
521 * @constraint: a `GtkConstraint`
522 *
523 * Checks whether the constraint is a required relation for solving the
524 * constraint layout.
525 *
526 * Returns: %TRUE if the constraint is required
527 */
528 gbooleancxx . . $ gboolean#
529 gtk_constraint_is_requiredcxx . . $ gtk_constraint_is_required(741f613ad6737b72). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
530 {
531 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
532
533 return constraint->strengthcxx . . $ _GtkConstraint#strength. == GTK_CONSTRAINT_STRENGTH_REQUIREDcxx . . $ GTK_CONSTRAINT_STRENGTH_REQUIRED.;
534 }
535
536 /**
537 * gtk_constraint_is_attached:
538 * @constraint: a `GtkConstraint`
539 *
540 * Checks whether the constraint is attached to a [[email protected]],
541 * and it is contributing to the layout.
542 *
543 * Returns: `TRUE` if the constraint is attached
544 */
545 gbooleancxx . . $ gboolean#
546 gtk_constraint_is_attachedcxx . . $ gtk_constraint_is_attached(741f613ad6737b72). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
547 {
548 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
549
550 return constraint->constraint_refcxx . . $ _GtkConstraint#constraint_ref. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
551 }
552
553 /**
554 * gtk_constraint_is_constant:
555 * @constraint: a `GtkConstraint`
556 *
557 * Checks whether the constraint describes a relation between an attribute
558 * on the [[email protected]:target] and a constant value.
559 *
560 * Returns: `TRUE` if the constraint is a constant relation
561 */
562 gbooleancxx . . $ gboolean#
563 gtk_constraint_is_constantcxx . . $ gtk_constraint_is_constant(741f613ad6737b72). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
564 {
565 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CONSTRAINT (constraint), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
566
567 return constraint->sourcecxx . . $ _GtkConstraint#source. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! &&
568 constraint->source_attributecxx . . $ _GtkConstraint#source_attribute. == GTK_CONSTRAINT_ATTRIBUTE_NONEcxx . . $ GTK_CONSTRAINT_ATTRIBUTE_NONE.;
569 }
570
571 void
572 gtk_constraint_attachcxx . . $ gtk_constraint_attach(80f46819a98d57d9). (GtkConstraintcxx . . $ GtkConstraint# *constraint,
573 GtkConstraintSolvercxx . . $ GtkConstraintSolver# *solver,
574 GtkConstraintRefcxx . . $ GtkConstraintRef# *ref)
575 {
576 g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CONSTRAINT (constraint));
577 g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CONSTRAINT_SOLVER (solver));
578 g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (ref != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
579
580 constraint->constraint_refcxx . . $ _GtkConstraint#constraint_ref. = ref;
581 constraint->solvercxx . . $ _GtkConstraint#solver. = solver;
582 }
583
584 void
585 gtk_constraint_detachcxx . . $ gtk_constraint_detach(5f37018eb6640293). (GtkConstraintcxx . . $ GtkConstraint# *constraint)
586 {
587 g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CONSTRAINT (constraint));
588
589 if (constraint->constraint_refcxx . . $ _GtkConstraint#constraint_ref. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
590 return;
591
592 gtk_constraint_solver_remove_constraintcxx . . $ gtk_constraint_solver_remove_constraint(95b20abe41df78d5). (constraint->solvercxx . . $ _GtkConstraint#solver., constraint->constraint_refcxx . . $ _GtkConstraint#constraint_ref.);
593 constraint->constraint_refcxx . . $ _GtkConstraint#constraint_ref. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
594 constraint->solvercxx . . $ _GtkConstraint#solver. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
595 }
596
597 typedef struct _GtkConstraintTargetInterfacecxx . . $ _GtkConstraintTargetInterface# GtkConstraintTargetInterfacecxx . . $ GtkConstraintTargetInterface#;
598
599 struct _GtkConstraintTargetInterfacecxx . . $ _GtkConstraintTargetInterface#
600 {
601 GTypeInterfacecxx . . $ GTypeInterface# g_ifacecxx . . $ _GtkConstraintTargetInterface#g_iface.;
602 };
603
604 G_DEFINE_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2078:9`! (GtkConstraintTarget, gtk_constraint_target, G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!)
605
606 static void
607 gtk_constraint_target_default_initcxx . . $ gtk_constraint_target_default_init(8fa27978d890633). (GtkConstraintTargetInterfacecxx . . $ GtkConstraintTargetInterface# *iface)
608 {
609 }