Bug Summary

File:ctk/ctkbbox.c
Warning:line 758, column 24
The left operand of '==' is a garbage value

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name ctkbbox.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/ctk -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I .. -D G_LOG_DOMAIN="Ctk" -D G_LOG_USE_STRUCTURED=1 -D CTK_VERSION="3.25.5" -D CTK_BINARY_VERSION="3.0.0" -D CTK_COMPILATION -D CTK_PRINT_BACKEND_ENABLE_UNSUPPORTED -D CTK_LIBDIR="/usr/lib" -D CTK_LOCALEDIR="/usr/share/locale" -D CTK_DATADIR="/usr/share" -D CTK_DATA_PREFIX="/usr" -D CTK_SYSCONFDIR="/usr/etc" -D CTK_HOST="x86_64-pc-linux-gnu" -D CTK_PRINT_BACKENDS="file,cups" -D X11_DATA_PREFIX="/usr" -D ISO_CODES_PREFIX="" -I .. -I ../ctk -I .. -I ../cdk -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -D G_ENABLE_DEBUG -D G_ENABLE_CONSISTENCY_CHECKS -D GLIB_MIN_REQUIRED_VERSION=GLIB_VERSION_2_66 -D GLIB_MAX_ALLOWED_VERSION=GLIB_VERSION_2_66 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/atk-1.0 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/gio-unix-2.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/pango-1.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -D PIC -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/ctk -ferror-limit 19 -fvisibility=hidden -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-09-19-171836-43636-1 -x c ctkbbox.c
1/* CTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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 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
18/*
19 * Modified by the CTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the CTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * CTK+ at ftp://ftp.ctk.org/pub/ctk/.
23 */
24
25/**
26 * SECTION:ctkbbox
27 * @Short_description: A container for arranging buttons
28 * @Title: CtkButtonBox
29 *
30 * A button box should be used to provide a consistent layout of buttons
31 * throughout your application. The layout/spacing can be altered by the
32 * programmer, or if desired, by the user to alter the “feel” of a
33 * program to a small degree.
34 *
35 * ctk_button_box_get_layout() and ctk_button_box_set_layout() retrieve and
36 * alter the method used to spread the buttons in a button box across the
37 * container, respectively.
38 *
39 * The main purpose of CtkButtonBox is to make sure the children have all the
40 * same size. CtkButtonBox gives all children the same size, but it does allow
41 * 'outliers' to keep their own larger size.
42 *
43 * To exempt individual children from homogeneous sizing regardless of their
44 * 'outlier' status, you can set the non-homogeneous child
45 * property.
46 *
47 * # CSS nodes
48 *
49 * CtkButtonBox uses a single CSS node with name buttonbox.
50 */
51
52#include "config.h"
53
54#include "ctkbbox.h"
55
56#include "ctkboxprivate.h"
57#include "ctkorientable.h"
58#include "ctktypebuiltins.h"
59#include "ctkprivate.h"
60#include "ctksizerequest.h"
61#include "ctkwidgetprivate.h"
62#include "ctkcontainerprivate.h"
63#include "ctkcsscustomgadgetprivate.h"
64#include "ctkintl.h"
65
66
67struct _CtkButtonBoxPrivate
68{
69 CtkButtonBoxStyle layout_style;
70 CtkCssGadget *gadget;
71};
72
73enum {
74 PROP_0,
75 PROP_LAYOUT_STYLE
76};
77
78enum {
79 CHILD_PROP_0,
80 CHILD_PROP_SECONDARY,
81 CHILD_PROP_NONHOMOGENEOUS
82};
83
84#define CTK_BOX_SECONDARY_CHILD"ctk-box-secondary-child" "ctk-box-secondary-child"
85#define CTK_BOX_NON_HOMOGENEOUS"ctk-box-non-homogeneous" "ctk-box-non-homogeneous"
86
87static void ctk_button_box_set_property (GObject *object,
88 guint prop_id,
89 const GValue *value,
90 GParamSpec *pspec);
91static void ctk_button_box_get_property (GObject *object,
92 guint prop_id,
93 GValue *value,
94 GParamSpec *pspec);
95static gboolean ctk_button_box_draw (CtkWidget *widget,
96 cairo_t *cr);
97static void ctk_button_box_get_preferred_width (CtkWidget *widget,
98 gint *minimum,
99 gint *natural);
100static void ctk_button_box_get_preferred_height (CtkWidget *widget,
101 gint *minimum,
102 gint *natural);
103static void ctk_button_box_get_preferred_width_for_height (CtkWidget *widget,
104 gint height,
105 gint *minimum,
106 gint *natural);
107static void ctk_button_box_get_preferred_height_for_width (CtkWidget *widget,
108 gint width,
109 gint *minimum,
110 gint *natural);
111static void ctk_button_box_get_preferred_height_and_baseline_for_width (CtkWidget *widget,
112 gint width,
113 gint *minimum,
114 gint *natural,
115 gint *minimum_baseline,
116 gint *natural_baseline);
117
118static void ctk_button_box_size_allocate (CtkWidget *widget,
119 CtkAllocation *allocation);
120static void ctk_button_box_remove (CtkContainer *container,
121 CtkWidget *widget);
122static void ctk_button_box_set_child_property (CtkContainer *container,
123 CtkWidget *child,
124 guint property_id,
125 const GValue *value,
126 GParamSpec *pspec);
127static void ctk_button_box_get_child_property (CtkContainer *container,
128 CtkWidget *child,
129 guint property_id,
130 GValue *value,
131 GParamSpec *pspec);
132
133static void ctk_button_box_measure (CtkCssGadget *gadget,
134 CtkOrientation orientation,
135 int for_size,
136 int *minimum,
137 int *natural,
138 int *minimum_baseline,
139 int *natural_baseline,
140 gpointer unused);
141static void ctk_button_box_allocate (CtkCssGadget *gadget,
142 const CtkAllocation *allocation,
143 int baseline,
144 CtkAllocation *out_clip,
145 gpointer unused);
146static gboolean ctk_button_box_render (CtkCssGadget *gadget,
147 cairo_t *cr,
148 int x,
149 int y,
150 int width,
151 int height,
152 gpointer data);
153
154#define DEFAULT_CHILD_MIN_WIDTH85 85
155#define DEFAULT_CHILD_MIN_HEIGHT27 27
156#define DEFAULT_CHILD_IPAD_X4 4
157#define DEFAULT_CHILD_IPAD_Y0 0
158#define DEFAULT_LAYOUT_STYLECTK_BUTTONBOX_EDGE CTK_BUTTONBOX_EDGE
159
160G_DEFINE_TYPE_WITH_PRIVATE (CtkButtonBox, ctk_button_box, CTK_TYPE_BOX)static void ctk_button_box_init (CtkButtonBox *self); static void
ctk_button_box_class_init (CtkButtonBoxClass *klass); static
GType ctk_button_box_get_type_once (void); static gpointer ctk_button_box_parent_class
= ((void*)0); static gint CtkButtonBox_private_offset; static
void ctk_button_box_class_intern_init (gpointer klass) { ctk_button_box_parent_class
= g_type_class_peek_parent (klass); if (CtkButtonBox_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &CtkButtonBox_private_offset
); ctk_button_box_class_init ((CtkButtonBoxClass*) klass); } __attribute__
((__unused__)) static inline gpointer ctk_button_box_get_instance_private
(CtkButtonBox *self) { return (((gpointer) ((guint8*) (self)
+ (glong) (CtkButtonBox_private_offset)))); } GType ctk_button_box_get_type
(void) { static GType static_g_define_type_id = 0; if ((__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); (void) (
0 ? (gpointer) * (&static_g_define_type_id) : ((void*)0))
; (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id
) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter_pointer (
&static_g_define_type_id)); })) ) { GType g_define_type_id
= ctk_button_box_get_type_once (); (__extension__ ({ _Static_assert
(sizeof *(&static_g_define_type_id) == sizeof (gpointer)
, "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id
) = (g_define_type_id)) : (void) 0; g_once_init_leave_pointer
((&static_g_define_type_id), (gpointer) (guintptr) (g_define_type_id
)); })) ; } return static_g_define_type_id; } __attribute__ (
(__noinline__)) static GType ctk_button_box_get_type_once (void
) { GType g_define_type_id = g_type_register_static_simple ((
ctk_box_get_type ()), g_intern_static_string ("CtkButtonBox")
, sizeof (CtkButtonBoxClass), (GClassInitFunc)(void (*)(void)
) ctk_button_box_class_intern_init, sizeof (CtkButtonBox), (GInstanceInitFunc
)(void (*)(void)) ctk_button_box_init, (GTypeFlags) 0); { {{ CtkButtonBox_private_offset
= g_type_add_instance_private (g_define_type_id, sizeof (CtkButtonBoxPrivate
)); };} } return g_define_type_id; }
161
162static void
163ctk_button_box_add (CtkContainer *container,
164 CtkWidget *widget)
165{
166 ctk_box_pack_start (CTK_BOX (container)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((container)), ((ctk_box_get_type ()))))))
, widget, TRUE(!(0)), TRUE(!(0)), 0);
167}
168
169static void
170ctk_button_box_finalize (GObject *object)
171{
172 CtkButtonBox *button_box = CTK_BUTTON_BOX (object)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((ctk_button_box_get_type ()))))))
;
173
174 g_clear_object (&button_box->priv->gadget)do { _Static_assert (sizeof *((&button_box->priv->gadget
)) == sizeof (gpointer), "Expression evaluates to false"); __typeof__
(((&button_box->priv->gadget))) _pp = ((&button_box
->priv->gadget)); __typeof__ (*((&button_box->priv
->gadget))) _ptr = *_pp; *_pp = ((void*)0); if (_ptr) (g_object_unref
) (_ptr); } while (0)
;
175
176 G_OBJECT_CLASS (ctk_button_box_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((ctk_button_box_parent_class)), (((GType) ((20) << (
2))))))))
->finalize (object);
177}
178
179static void
180ctk_button_box_class_init (CtkButtonBoxClass *class)
181{
182 CtkWidgetClass *widget_class;
183 GObjectClass *gobject_class;
184 CtkContainerClass *container_class;
185
186 gobject_class = G_OBJECT_CLASS (class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((class)), (((GType) ((20) << (2))))))))
;
187 widget_class = (CtkWidgetClass*) class;
188 container_class = (CtkContainerClass*) class;
189
190 gobject_class->set_property = ctk_button_box_set_property;
191 gobject_class->get_property = ctk_button_box_get_property;
192 gobject_class->finalize = ctk_button_box_finalize;
193
194 widget_class->get_preferred_width = ctk_button_box_get_preferred_width;
195 widget_class->get_preferred_height = ctk_button_box_get_preferred_height;
196 widget_class->get_preferred_width_for_height = ctk_button_box_get_preferred_width_for_height;
197 widget_class->get_preferred_height_for_width = ctk_button_box_get_preferred_height_for_width;
198 widget_class->get_preferred_height_and_baseline_for_width = ctk_button_box_get_preferred_height_and_baseline_for_width;
199 widget_class->size_allocate = ctk_button_box_size_allocate;
200 widget_class->draw = ctk_button_box_draw;
201
202 container_class->remove = ctk_button_box_remove;
203 container_class->add = ctk_button_box_add;
204 container_class->set_child_property = ctk_button_box_set_child_property;
205 container_class->get_child_property = ctk_button_box_get_child_property;
206 ctk_container_class_handle_border_width (container_class);
207
208 /**
209 * CtkButtonBox:child-min-width:
210 *
211 * The minimum width of buttons inside the box.
212 *
213 * Deprecated: 3.20: Use CSS min-width instead.
214 */
215 ctk_widget_class_install_style_property (widget_class,
216 g_param_spec_int ("child-min-width",
217 P_("Minimum child width")g_dgettext("ctk30" "-properties","Minimum child width"),
218 P_("Minimum width of buttons inside the box")g_dgettext("ctk30" "-properties","Minimum width of buttons inside the box"
)
,
219 0,
220 G_MAXINT2147483647,
221 DEFAULT_CHILD_MIN_WIDTH85,
222 CTK_PARAM_READABLEG_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB|G_PARAM_DEPRECATED));
223
224 /**
225 * CtkButtonBox:child-min-height:
226 *
227 * The minimum height of buttons inside the box.
228 *
229 * Deprecated: 3.20: Use CSS min-height instead.
230 */
231 ctk_widget_class_install_style_property (widget_class,
232 g_param_spec_int ("child-min-height",
233 P_("Minimum child height")g_dgettext("ctk30" "-properties","Minimum child height"),
234 P_("Minimum height of buttons inside the box")g_dgettext("ctk30" "-properties","Minimum height of buttons inside the box"
)
,
235 0,
236 G_MAXINT2147483647,
237 DEFAULT_CHILD_MIN_HEIGHT27,
238 CTK_PARAM_READABLEG_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB|G_PARAM_DEPRECATED));
239
240 /**
241 * CtkButtonBox:child-internal-pad-x:
242 *
243 * The amount to increase a child's size on either side.
244 *
245 * Deprecated: 3.20: Use CSS padding instead.
246 */
247 ctk_widget_class_install_style_property (widget_class,
248 g_param_spec_int ("child-internal-pad-x",
249 P_("Child internal width padding")g_dgettext("ctk30" "-properties","Child internal width padding"
)
,
250 P_("Amount to increase child's size on either side")g_dgettext("ctk30" "-properties","Amount to increase child's size on either side"
)
,
251 0,
252 G_MAXINT2147483647,
253 DEFAULT_CHILD_IPAD_X4,
254 CTK_PARAM_READABLEG_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB|G_PARAM_DEPRECATED));
255
256 /**
257 * CtkButtonBox:child-internal-pad-y:
258 *
259 * The amount to increase a child's size on the top and bottom.
260 *
261 * Deprecated: 3.20: Use CSS padding instead.
262 */
263 ctk_widget_class_install_style_property (widget_class,
264 g_param_spec_int ("child-internal-pad-y",
265 P_("Child internal height padding")g_dgettext("ctk30" "-properties","Child internal height padding"
)
,
266 P_("Amount to increase child's size on the top and bottom")g_dgettext("ctk30" "-properties","Amount to increase child's size on the top and bottom"
)
,
267 0,
268 G_MAXINT2147483647,
269 DEFAULT_CHILD_IPAD_Y0,
270 CTK_PARAM_READABLEG_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB|G_PARAM_DEPRECATED));
271
272 g_object_class_install_property (gobject_class,
273 PROP_LAYOUT_STYLE,
274 g_param_spec_enum ("layout-style",
275 P_("Layout style")g_dgettext("ctk30" "-properties","Layout style"),
276 P_("How to lay out the buttons in the box. Possible values are: spread, edge, start and end")g_dgettext("ctk30" "-properties","How to lay out the buttons in the box. Possible values are: spread, edge, start and end"
)
,
277 CTK_TYPE_BUTTON_BOX_STYLE(ctk_button_box_style_get_type ()),
278 DEFAULT_LAYOUT_STYLECTK_BUTTONBOX_EDGE,
279 CTK_PARAM_READWRITEG_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB|G_PARAM_EXPLICIT_NOTIFY));
280
281 ctk_container_class_install_child_property (container_class,
282 CHILD_PROP_SECONDARY,
283 g_param_spec_boolean ("secondary",
284 P_("Secondary")g_dgettext("ctk30" "-properties","Secondary"),
285 P_("If TRUE, the child appears in a secondary group of children, suitable for, e.g., help buttons")g_dgettext("ctk30" "-properties","If TRUE, the child appears in a secondary group of children, suitable for, e.g., help buttons"
)
,
286 FALSE(0),
287 CTK_PARAM_READWRITEG_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
288
289 ctk_container_class_install_child_property (container_class,
290 CHILD_PROP_NONHOMOGENEOUS,
291 g_param_spec_boolean ("non-homogeneous",
292 P_("Non-Homogeneous")g_dgettext("ctk30" "-properties","Non-Homogeneous"),
293 P_("If TRUE, the child will not be subject to homogeneous sizing")g_dgettext("ctk30" "-properties","If TRUE, the child will not be subject to homogeneous sizing"
)
,
294 FALSE(0),
295 CTK_PARAM_READWRITEG_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
296
297 ctk_widget_class_set_css_name (widget_class, "buttonbox");
298}
299
300static gboolean
301ctk_button_box_render (CtkCssGadget *gadget,
302 cairo_t *cr,
303 int x G_GNUC_UNUSED__attribute__ ((__unused__)),
304 int y G_GNUC_UNUSED__attribute__ ((__unused__)),
305 int width G_GNUC_UNUSED__attribute__ ((__unused__)),
306 int height G_GNUC_UNUSED__attribute__ ((__unused__)),
307 gpointer unused G_GNUC_UNUSED__attribute__ ((__unused__)))
308{
309 CtkWidget *widget;
310 GList *children, *l;
311
312 widget = ctk_css_gadget_get_owner (gadget);
313 children = ctk_container_get_children (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_container_get_type ()))))))
);
314
315 for (l = children; l; l = l->next)
316 {
317 CtkWidget *child = l->data;
318
319 ctk_container_propagate_draw (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_container_get_type ()))))))
, child, cr);
320 }
321
322 g_list_free (children);
323
324 return FALSE(0);
325}
326
327
328static gboolean
329ctk_button_box_draw (CtkWidget *widget,
330 cairo_t *cr)
331{
332 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
->priv;
333 CtkCssGadget *gadget;
334
335 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
336 gadget = ctk_box_get_gadget (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
337 else
338 gadget = priv->gadget;
339
340 ctk_css_gadget_draw (gadget, cr);
341
342 return FALSE(0);
343}
344
345static void
346ctk_button_box_init (CtkButtonBox *button_box)
347{
348 button_box->priv = ctk_button_box_get_instance_private (button_box);
349 button_box->priv->layout_style = DEFAULT_LAYOUT_STYLECTK_BUTTONBOX_EDGE;
350
351 ctk_box_set_spacing (CTK_BOX (button_box)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button_box)), ((ctk_box_get_type ()))))))
, 0);
352
353 button_box->priv->gadget = ctk_css_custom_gadget_new_for_node (ctk_widget_get_css_node (CTK_WIDGET (button_box)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button_box)), ((ctk_widget_get_type ()))))))
),
354 CTK_WIDGET (button_box)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((button_box)), ((ctk_widget_get_type ()))))))
,
355 ctk_button_box_measure,
356 ctk_button_box_allocate,
357 ctk_button_box_render,
358 NULL((void*)0),
359 NULL((void*)0));
360}
361
362static void
363ctk_button_box_set_property (GObject *object,
364 guint prop_id,
365 const GValue *value,
366 GParamSpec *pspec)
367{
368 switch (prop_id)
369 {
370 case PROP_LAYOUT_STYLE:
371 ctk_button_box_set_layout (CTK_BUTTON_BOX (object)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((ctk_button_box_get_type ()))))))
,
372 g_value_get_enum (value));
373 break;
374 default:
375 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "ctkbbox.c", 375, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
376 break;
377 }
378}
379
380static void
381ctk_button_box_get_property (GObject *object,
382 guint prop_id,
383 GValue *value,
384 GParamSpec *pspec)
385{
386 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (object)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((object)), ((ctk_button_box_get_type ()))))))
->priv;
387
388 switch (prop_id)
389 {
390 case PROP_LAYOUT_STYLE:
391 g_value_set_enum (value, priv->layout_style);
392 break;
393 default:
394 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "ctkbbox.c", 394, ("property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
395 break;
396 }
397}
398
399static void
400ctk_button_box_set_child_property (CtkContainer *container,
401 CtkWidget *child,
402 guint property_id,
403 const GValue *value,
404 GParamSpec *pspec)
405{
406 switch (property_id)
407 {
408 case CHILD_PROP_SECONDARY:
409 ctk_button_box_set_child_secondary (CTK_BUTTON_BOX (container)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((container)), ((ctk_button_box_get_type ()))))))
, child,
410 g_value_get_boolean (value));
411 break;
412 case CHILD_PROP_NONHOMOGENEOUS:
413 ctk_button_box_set_child_non_homogeneous (CTK_BUTTON_BOX (container)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((container)), ((ctk_button_box_get_type ()))))))
, child,
414 g_value_get_boolean (value));
415 break;
416 default:
417 CTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec)do { GObject *_glib__object = (GObject*) ((container)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((property_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "ctkbbox.c", 417, ("child property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
418 break;
419 }
420}
421
422static void
423ctk_button_box_get_child_property (CtkContainer *container,
424 CtkWidget *child,
425 guint property_id,
426 GValue *value,
427 GParamSpec *pspec)
428{
429 switch (property_id)
430 {
431 case CHILD_PROP_SECONDARY:
432 g_value_set_boolean (value,
433 ctk_button_box_get_child_secondary (CTK_BUTTON_BOX (container)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((container)), ((ctk_button_box_get_type ()))))))
,
434 child));
435 break;
436 case CHILD_PROP_NONHOMOGENEOUS:
437 g_value_set_boolean (value,
438 ctk_button_box_get_child_non_homogeneous (CTK_BUTTON_BOX (container)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((container)), ((ctk_button_box_get_type ()))))))
,
439 child));
440 break;
441 default:
442 CTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec)do { GObject *_glib__object = (GObject*) ((container)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((property_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "ctkbbox.c", 442, ("child property"), _glib__property_id, _glib__pspec
->name, g_type_name ((((((GTypeClass*) (((GTypeInstance*) (
_glib__pspec))->g_class))->g_type)))), (g_type_name (((
(((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
443 break;
444 }
445}
446
447static void
448ctk_button_box_remove (CtkContainer *container,
449 CtkWidget *widget)
450{
451 /* clear is_secondary and nonhomogeneous flag in case the widget
452 * is added to another container
453 */
454 ctk_button_box_set_child_secondary (CTK_BUTTON_BOX (container)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((container)), ((ctk_button_box_get_type ()))))))
, widget, FALSE(0));
455 ctk_button_box_set_child_non_homogeneous (CTK_BUTTON_BOX (container)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((container)), ((ctk_button_box_get_type ()))))))
, widget, FALSE(0));
456
457 CTK_CONTAINER_CLASS (ctk_button_box_parent_class)((((CtkContainerClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((ctk_button_box_parent_class)), ((ctk_container_get_type (
)))))))
->remove (container, widget);
458}
459
460/**
461 * ctk_button_box_set_layout:
462 * @widget: a #CtkButtonBox
463 * @layout_style: the new layout style
464 *
465 * Changes the way buttons are arranged in their container.
466 */
467void
468ctk_button_box_set_layout (CtkButtonBox *widget,
469 CtkButtonBoxStyle layout_style)
470{
471 CtkButtonBoxPrivate *priv;
472
473 g_return_if_fail (CTK_IS_BUTTON_BOX (widget))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((ctk_button_box_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_BUTTON_BOX (widget)"); return; } } while (0)
;
474
475 priv = widget->priv;
476
477 if (priv->layout_style != layout_style)
478 {
479 priv->layout_style = layout_style;
480
481 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
482 {
483 ctk_style_context_add_class (ctk_widget_get_style_context (CTK_WIDGET (widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_widget_get_type ()))))))
), "linked");
484 ctk_box_set_spacing (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
, 0);
485 ctk_box_set_homogeneous (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
, TRUE(!(0)));
486 }
487 else
488 {
489 ctk_style_context_remove_class (ctk_widget_get_style_context (CTK_WIDGET (widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_widget_get_type ()))))))
), "linked");
490 ctk_box_set_homogeneous (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
, FALSE(0));
491 }
492
493 g_object_notify (G_OBJECT (widget)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), (((GType) ((20) << (2))))))))
, "layout-style");
494 ctk_widget_queue_resize (CTK_WIDGET (widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_widget_get_type ()))))))
);
495 }
496}
497
498/**
499 * ctk_button_box_get_layout:
500 * @widget: a #CtkButtonBox
501 *
502 * Retrieves the method being used to arrange the buttons in a button box.
503 *
504 * Returns: the method used to lay out buttons in @widget.
505 */
506CtkButtonBoxStyle
507ctk_button_box_get_layout (CtkButtonBox *widget)
508{
509 g_return_val_if_fail (CTK_IS_BUTTON_BOX (widget), DEFAULT_LAYOUT_STYLE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((ctk_button_box_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_BUTTON_BOX (widget)"); return (CTK_BUTTONBOX_EDGE
); } } while (0)
;
510
511 return widget->priv->layout_style;
512}
513
514/**
515 * ctk_button_box_get_child_secondary:
516 * @widget: a #CtkButtonBox
517 * @child: a child of @widget
518 *
519 * Returns whether @child should appear in a secondary group of children.
520 *
521 * Returns: whether @child should appear in a secondary group of children.
522 *
523 * Since: 2.4
524 **/
525gboolean
526ctk_button_box_get_child_secondary (CtkButtonBox *widget,
527 CtkWidget *child)
528{
529 g_return_val_if_fail (CTK_IS_BUTTON_BOX (widget), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((ctk_button_box_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_BUTTON_BOX (widget)"); return ((0)); } } while (0
)
;
530 g_return_val_if_fail (CTK_IS_WIDGET (child), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((child)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_WIDGET (child)"); return ((0)); } } while (0)
;
531
532 return (g_object_get_data (G_OBJECT (child)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), (((GType) ((20) << (2))))))))
, CTK_BOX_SECONDARY_CHILD"ctk-box-secondary-child") != NULL((void*)0));
533}
534
535/**
536 * ctk_button_box_set_child_secondary:
537 * @widget: a #CtkButtonBox
538 * @child: a child of @widget
539 * @is_secondary: if %TRUE, the @child appears in a secondary group of the
540 * button box.
541 *
542 * Sets whether @child should appear in a secondary group of children.
543 * A typical use of a secondary child is the help button in a dialog.
544 *
545 * This group appears after the other children if the style
546 * is %CTK_BUTTONBOX_START, %CTK_BUTTONBOX_SPREAD or
547 * %CTK_BUTTONBOX_EDGE, and before the other children if the style
548 * is %CTK_BUTTONBOX_END. For horizontal button boxes, the definition
549 * of before/after depends on direction of the widget (see
550 * ctk_widget_set_direction()). If the style is %CTK_BUTTONBOX_START
551 * or %CTK_BUTTONBOX_END, then the secondary children are aligned at
552 * the other end of the button box from the main children. For the
553 * other styles, they appear immediately next to the main children.
554 **/
555void
556ctk_button_box_set_child_secondary (CtkButtonBox *widget,
557 CtkWidget *child,
558 gboolean is_secondary)
559{
560 CtkButtonBox *bbox;
561
562 g_return_if_fail (CTK_IS_BUTTON_BOX (widget))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((ctk_button_box_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_BUTTON_BOX (widget)"); return; } } while (0)
;
563 g_return_if_fail (CTK_IS_WIDGET (child))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((child)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_WIDGET (child)"); return; } } while (0)
;
564 g_return_if_fail (ctk_widget_get_parent (child) == CTK_WIDGET (widget))do { if ((ctk_widget_get_parent (child) == ((((CtkWidget*) (void
*) g_type_check_instance_cast ((GTypeInstance*) ((widget)), (
(ctk_widget_get_type ())))))))) { } else { g_return_if_fail_warning
("Ctk", ((const char*) (__func__)), "ctk_widget_get_parent (child) == CTK_WIDGET (widget)"
); return; } } while (0)
;
565
566 bbox = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
;
567
568 g_object_set_data (G_OBJECT (child)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), (((GType) ((20) << (2))))))))
,
569 CTK_BOX_SECONDARY_CHILD"ctk-box-secondary-child",
570 is_secondary ? GINT_TO_POINTER (1)((gpointer) (glong) (1)) : NULL((void*)0));
571 ctk_widget_child_notify (child, "secondary");
572
573 if (bbox->priv->layout_style == CTK_BUTTONBOX_EXPAND)
574 {
575 ctk_box_reorder_child (CTK_BOX (bbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_box_get_type ()))))))
, child, is_secondary ? 0 : -1);
576 }
577
578 if (ctk_widget_get_visible (CTK_WIDGET (widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_widget_get_type ()))))))
) &&
579 ctk_widget_get_visible (child))
580 ctk_widget_queue_resize (child);
581}
582
583/* Ask children how much space they require and round up
584 * to match minimum size and internal padding.
585 * Returns the size each single child should have.
586 */
587static void
588ctk_button_box_child_requisition (CtkWidget *widget,
589 gint *nvis_children,
590 gint *nvis_secondaries,
591 gint **widths,
592 gint **heights,
593 gint **baselines,
594 gint *baseline,
595 gint *baseline_height)
596{
597 CtkButtonBox *bbox;
598 GList *children, *list;
599 gint nchildren;
600 gint nsecondaries;
601 gint needed_width;
602 gint needed_height;
603 gint needed_above, needed_below;
604 gint avg_w, avg_h;
605 CtkRequisition child_requisition;
606 gint ipad_w;
607 gint ipad_h;
608 gint child_min_width;
609 gint child_min_height;
610 gint ipad_x;
611 gint ipad_y;
612 gboolean homogeneous;
613 gint i;
614 gint max_above, max_below, child_baseline;
615 CtkOrientation orientation;
616 gboolean have_baseline;
617
618 g_return_if_fail (CTK_IS_BUTTON_BOX (widget))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((ctk_button_box_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_BUTTON_BOX (widget)"); return; } } while (0)
;
2
Assuming '__inst' is non-null
3
Taking false branch
4
Assuming field 'g_class' is null
5
Assuming the condition is true
6
Taking true branch
7
Loop condition is false. Exiting loop
619
620 bbox = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
;
621
622 orientation = ctk_orientable_get_orientation (CTK_ORIENTABLE (widget)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_orientable_get_type ()))))))
);
623 homogeneous = ctk_box_get_homogeneous (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
624
625 ctk_widget_style_get (widget,
626 "child-min-width", &child_min_width,
627 "child-min-height", &child_min_height,
628 "child-internal-pad-x", &ipad_x,
629 "child-internal-pad-y", &ipad_y,
630 NULL((void*)0));
631
632 nchildren = 0;
633 nsecondaries = 0;
634 list = children = _ctk_box_get_children (CTK_BOX (bbox)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((bbox)), ((ctk_box_get_type ()))))))
);
635 needed_width = child_min_width;
636 needed_height = child_min_height;
637 needed_above = 0;
638 needed_below = 0;
639 ipad_w = ipad_x * 2;
640 ipad_h = ipad_y * 2;
641
642 have_baseline = FALSE(0);
643 max_above = max_below = 0;
644 avg_w = avg_h = 0;
645 for (children = list; children != NULL((void*)0); children = children->next)
8
Assuming 'children' is not equal to NULL
9
Loop condition is true. Entering loop body
13
Assuming 'children' is equal to NULL
14
Loop condition is false. Execution continues on line 668
646 {
647 CtkWidget *child;
648
649 child = children->data;
650
651 if (ctk_widget_get_visible (child))
10
Assuming the condition is true
11
Taking true branch
652 {
653 nchildren += 1;
654 _ctk_widget_get_preferred_size_and_baseline (child,
655 &child_requisition, NULL((void*)0), &child_baseline, NULL((void*)0));
656 if (orientation == CTK_ORIENTATION_HORIZONTAL &&
12
Assuming 'orientation' is not equal to CTK_ORIENTATION_HORIZONTAL
657 ctk_widget_get_valign_with_baseline (child) == CTK_ALIGN_BASELINE &&
658 child_baseline != -1)
659 {
660 have_baseline = TRUE(!(0));
661 max_above = MAX (max_above, child_baseline + ipad_y)(((max_above) > (child_baseline + ipad_y)) ? (max_above) :
(child_baseline + ipad_y))
;
662 max_below = MAX (max_below , child_requisition.height + ipad_h - (child_baseline + ipad_y))(((max_below) > (child_requisition.height + ipad_h - (child_baseline
+ ipad_y))) ? (max_below) : (child_requisition.height + ipad_h
- (child_baseline + ipad_y)))
;
663 }
664 avg_w += child_requisition.width + ipad_w;
665 avg_h += child_requisition.height + ipad_h;
666 }
667 }
668 avg_w /= MAX (nchildren, 1)(((nchildren) > (1)) ? (nchildren) : (1));
15
'?' condition is false
669 avg_h /= MAX (nchildren, 1)(((nchildren) > (1)) ? (nchildren) : (1));
16
'?' condition is false
670
671 if (baseline
16.1
'baseline' is non-null
)
672 *baseline = have_baseline
17.1
'have_baseline' is 0
? max_above : -1;
17
Taking true branch
18
'?' condition is false
673 if (baseline_height
18.1
'baseline_height' is non-null
)
19
Taking true branch
674 *baseline_height = max_above + max_below;
675
676 *widths = g_new (gint, nchildren)((gint *) g_malloc_n ((nchildren), sizeof (gint)));
20
Storing uninitialized value
677 *heights = g_new (gint, nchildren)((gint *) g_malloc_n ((nchildren), sizeof (gint)));
678 *baselines = g_new (gint, nchildren)((gint *) g_malloc_n ((nchildren), sizeof (gint)));
679
680 i = 0;
681 children = list;
682 while (children)
21
Loop condition is true. Entering loop body
24
Loop condition is false. Execution continues on line 752
683 {
684 CtkWidget *child;
685 gboolean is_secondary;
686 gboolean non_homogeneous;
687
688 child = children->data;
689 children = children->next;
690
691 if (ctk_widget_get_visible (child))
22
Assuming the condition is false
23
Taking false branch
692 {
693 is_secondary = ctk_button_box_get_child_secondary (bbox, child);
694 non_homogeneous = ctk_button_box_get_child_non_homogeneous (bbox, child);
695
696 if (is_secondary)
697 nsecondaries++;
698
699 _ctk_widget_get_preferred_size_and_baseline (child,
700 &child_requisition, NULL((void*)0), &child_baseline, NULL((void*)0));
701
702 if (homogeneous ||
703 (!non_homogeneous && (child_requisition.width + ipad_w < avg_w * 1.5)))
704 {
705 (*widths)[i] = -1;
706 if (child_requisition.width + ipad_w > needed_width)
707 needed_width = child_requisition.width + ipad_w;
708 }
709 else
710 {
711 (*widths)[i] = child_requisition.width + ipad_w;
712 }
713
714 (*baselines)[i] = -1;
715
716 if (homogeneous ||
717 (!non_homogeneous && (child_requisition.height + ipad_h < avg_h * 1.5)))
718 {
719 (*heights)[i] = -1;
720
721 if (orientation == CTK_ORIENTATION_HORIZONTAL &&
722 ctk_widget_get_valign_with_baseline (child) == CTK_ALIGN_BASELINE &&
723 child_baseline != -1)
724 {
725 (*baselines)[i] = child_baseline + ipad_y;
726
727 if (child_baseline + ipad_y > needed_above)
728 needed_above = child_baseline + ipad_y;
729 if (child_requisition.height - child_baseline + ipad_y > needed_below)
730 needed_below = child_requisition.height - child_baseline + ipad_y;
731 }
732 else
733 {
734 if (child_requisition.height + ipad_h > needed_height)
735 needed_height = child_requisition.height + ipad_h;
736 }
737 }
738 else
739 {
740 (*heights)[i] = child_requisition.height + ipad_h;
741
742 if (orientation == CTK_ORIENTATION_HORIZONTAL &&
743 ctk_widget_get_valign_with_baseline (child) == CTK_ALIGN_BASELINE &&
744 child_baseline != -1)
745 (*baselines)[i] = child_baseline + ipad_y;
746 }
747
748 i++;
749 }
750 }
751
752 g_list_free (list);
753
754 needed_height = MAX (needed_height, needed_above + needed_below)(((needed_height) > (needed_above + needed_below)) ? (needed_height
) : (needed_above + needed_below))
;
25
Assuming the condition is true
26
'?' condition is true
755
756 for (i = 0; i < nchildren; i++)
27
The value 0 is assigned to 'i'
28
Loop condition is true. Entering loop body
757 {
758 if ((*widths)[i] == -1)
29
The left operand of '==' is a garbage value
759 (*widths)[i] = needed_width;
760 if ((*heights)[i] == -1)
761 {
762 (*heights)[i] = needed_height;
763 if ((*baselines)[i] != -1)
764 (*baselines)[i] = needed_above;
765 }
766 }
767
768 if (nvis_children)
769 *nvis_children = nchildren;
770
771 if (nvis_secondaries)
772 *nvis_secondaries = nsecondaries;
773}
774
775static void
776ctk_button_box_size_request (CtkWidget *widget,
777 CtkRequisition *requisition,
778 gint *baseline)
779{
780 CtkButtonBoxPrivate *priv;
781 CtkButtonBox *bbox;
782 gint nvis_children;
783 gint max_size, max_above, max_below;
784 gint total_size;
785 gint spacing;
786 CtkOrientation orientation;
787 gint *widths;
788 gint *heights;
789 gint *baselines;
790 gint i;
791
792 if (baseline)
793 *baseline = -1;
794
795 bbox = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
;
796 priv = bbox->priv;
797
798 orientation = ctk_orientable_get_orientation (CTK_ORIENTABLE (widget)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_orientable_get_type ()))))))
);
799 spacing = ctk_box_get_spacing (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
800
801 ctk_button_box_child_requisition (widget,
802 &nvis_children,
803 NULL((void*)0),
804 &widths, &heights, &baselines, baseline, NULL((void*)0));
805
806 max_size = max_above = max_below = 0;
807 total_size = 0;
808 for (i = 0; i < nvis_children; i++)
809 {
810 if (orientation == CTK_ORIENTATION_HORIZONTAL)
811 {
812 total_size += widths[i];
813 if (baselines[i] == -1)
814 max_size = MAX (max_size, heights[i])(((max_size) > (heights[i])) ? (max_size) : (heights[i]));
815 else
816 {
817 max_above = MAX (max_above, baselines[i])(((max_above) > (baselines[i])) ? (max_above) : (baselines
[i]))
;
818 max_below = MAX (max_below, heights[i] - baselines[i])(((max_below) > (heights[i] - baselines[i])) ? (max_below)
: (heights[i] - baselines[i]))
;
819 }
820 }
821 else
822 {
823 total_size += heights[i];
824 max_size = MAX (max_size, widths[i])(((max_size) > (widths[i])) ? (max_size) : (widths[i]));
825 }
826 }
827 g_free (widths);
828 g_free (heights);
829 g_free (baselines);
830
831 max_size = MAX (max_size, max_above + max_below)(((max_size) > (max_above + max_below)) ? (max_size) : (max_above
+ max_below))
;
832
833 switch (ctk_box_get_baseline_position (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
))
834 {
835 case CTK_BASELINE_POSITION_TOP:
836 break;
837 case CTK_BASELINE_POSITION_CENTER:
838 if (baseline != NULL((void*)0) && *baseline != -1)
839 *baseline += (max_size - (max_above + max_below)) / 2;
840 break;
841 case CTK_BASELINE_POSITION_BOTTOM:
842 if (baseline != NULL((void*)0) && *baseline != -1)
843 *baseline += max_size - (max_above + max_below);
844 break;
845 }
846
847 if (nvis_children == 0)
848 {
849 requisition->width = 0;
850 requisition->height = 0;
851 }
852 else
853 {
854 switch (priv->layout_style)
855 {
856 case CTK_BUTTONBOX_SPREAD:
857 if (orientation == CTK_ORIENTATION_HORIZONTAL)
858 requisition->width = total_size + ((nvis_children + 1)*spacing);
859 else
860 requisition->height = total_size + ((nvis_children + 1)*spacing);
861
862 break;
863 case CTK_BUTTONBOX_EDGE:
864 case CTK_BUTTONBOX_START:
865 case CTK_BUTTONBOX_END:
866 case CTK_BUTTONBOX_CENTER:
867 case CTK_BUTTONBOX_EXPAND:
868 if (orientation == CTK_ORIENTATION_HORIZONTAL)
869 requisition->width = total_size + ((nvis_children - 1)*spacing);
870 else
871 requisition->height = total_size + ((nvis_children - 1)*spacing);
872
873 break;
874 default:
875 g_assert_not_reached ()do { g_assertion_message_expr ("Ctk", "ctkbbox.c", 875, ((const
char*) (__func__)), ((void*)0)); } while (0)
;
876 break;
877 }
878
879 if (orientation == CTK_ORIENTATION_HORIZONTAL)
880 requisition->height = max_size;
881 else
882 requisition->width = max_size;
883 }
884}
885
886static void
887ctk_button_box_measure (CtkCssGadget *gadget,
888 CtkOrientation orientation,
889 int for_size G_GNUC_UNUSED__attribute__ ((__unused__)),
890 int *minimum,
891 int *natural,
892 int *minimum_baseline,
893 int *natural_baseline,
894 gpointer unused G_GNUC_UNUSED__attribute__ ((__unused__)))
895{
896 CtkWidget *widget;
897 CtkRequisition requisition;
898 int baseline;
899 int *pb;
900
901 if (minimum_baseline || natural_baseline)
902 pb = &baseline;
903 else
904 pb = NULL((void*)0);
905
906 widget = ctk_css_gadget_get_owner (gadget);
907 ctk_button_box_size_request (widget, &requisition, pb);
908
909 if (orientation == CTK_ORIENTATION_HORIZONTAL)
910 *minimum = *natural = requisition.width;
911 else
912 *minimum = *natural = requisition.height;
913
914 if (minimum_baseline)
915 *minimum_baseline = baseline;
916 if (natural_baseline)
917 *natural_baseline = baseline;
918}
919
920static void
921ctk_button_box_get_preferred_width (CtkWidget *widget,
922 gint *minimum,
923 gint *natural)
924{
925 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
->priv;
926 CtkCssGadget *gadget;
927
928 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
929 gadget = ctk_box_get_gadget (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
930 else
931 gadget = priv->gadget;
932
933 ctk_css_gadget_get_preferred_size (gadget,
934 CTK_ORIENTATION_HORIZONTAL,
935 -1,
936 minimum, natural,
937 NULL((void*)0), NULL((void*)0));
938}
939
940static void
941ctk_button_box_get_preferred_height (CtkWidget *widget,
942 gint *minimum,
943 gint *natural)
944{
945 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
->priv;
946 CtkCssGadget *gadget;
947
948 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
949 gadget = ctk_box_get_gadget (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
950 else
951 gadget = priv->gadget;
952
953 ctk_css_gadget_get_preferred_size (gadget,
954 CTK_ORIENTATION_VERTICAL,
955 -1,
956 minimum, natural,
957 NULL((void*)0), NULL((void*)0));
958}
959
960static void
961ctk_button_box_get_preferred_width_for_height (CtkWidget *widget,
962 gint height,
963 gint *minimum,
964 gint *natural)
965{
966 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
->priv;
967 CtkCssGadget *gadget;
968
969 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
970 gadget = ctk_box_get_gadget (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
971 else
972 gadget = priv->gadget;
973
974 ctk_css_gadget_get_preferred_size (gadget,
975 CTK_ORIENTATION_HORIZONTAL,
976 height,
977 minimum, natural,
978 NULL((void*)0), NULL((void*)0));
979}
980
981static void
982ctk_button_box_get_preferred_height_for_width (CtkWidget *widget,
983 gint width,
984 gint *minimum,
985 gint *natural)
986{
987 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
->priv;
988 CtkCssGadget *gadget;
989
990 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
991 gadget = ctk_box_get_gadget (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
992 else
993 gadget = priv->gadget;
994
995 ctk_css_gadget_get_preferred_size (gadget,
996 CTK_ORIENTATION_VERTICAL,
997 width,
998 minimum, natural,
999 NULL((void*)0), NULL((void*)0));
1000}
1001
1002static void
1003ctk_button_box_get_preferred_height_and_baseline_for_width (CtkWidget *widget,
1004 gint width,
1005 gint *minimum,
1006 gint *natural,
1007 gint *minimum_baseline,
1008 gint *natural_baseline)
1009{
1010 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
->priv;
1011 CtkCssGadget *gadget;
1012
1013 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
1014 gadget = ctk_box_get_gadget (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
1015 else
1016 gadget = priv->gadget;
1017
1018 ctk_css_gadget_get_preferred_size (gadget,
1019 CTK_ORIENTATION_VERTICAL,
1020 width,
1021 minimum, natural,
1022 minimum_baseline, natural_baseline);
1023}
1024
1025static void
1026ctk_button_box_size_allocate (CtkWidget *widget,
1027 CtkAllocation *allocation)
1028{
1029 CtkButtonBoxPrivate *priv = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
->priv;
1030 CtkCssGadget *gadget;
1031 CdkRectangle clip;
1032
1033 if (priv->layout_style == CTK_BUTTONBOX_EXPAND)
1034 gadget = ctk_box_get_gadget (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
1035 else
1036 gadget = priv->gadget;
1037
1038 ctk_widget_set_allocation (widget, allocation);
1039
1040 ctk_css_gadget_allocate (gadget,
1041 allocation,
1042 ctk_widget_get_allocated_baseline (widget),
1043 &clip);
1044
1045 ctk_widget_set_clip (widget, &clip);
1046}
1047
1048static void
1049ctk_button_box_allocate (CtkCssGadget *gadget,
1050 const CtkAllocation *allocation,
1051 int baseline,
1052 CtkAllocation *out_clip,
1053 gpointer unused G_GNUC_UNUSED__attribute__ ((__unused__)))
1054{
1055 CtkWidget *widget;
1056 CtkButtonBoxPrivate *priv;
1057 CtkButtonBox *bbox;
1058 GList *children, *list;
1059 CtkAllocation child_allocation;
1060 gint nvis_children;
1061 gint n_primaries;
1062 gint n_secondaries;
1063 gint x = 0;
1064 gint y = 0;
1065 gint secondary_x = 0;
1066 gint secondary_y = 0;
1067 gint width = 0;
1068 gint height = 0;
1069 gint childspacing = 0;
1070 gint spacing;
1071 CtkOrientation orientation;
1072 gint ipad_x, ipad_y;
1073 gint *widths;
1074 gint *heights;
1075 gint *baselines;
1076 gint *sizes;
1077 gint primary_size;
1078 gint secondary_size;
1079 gint total_size;
1080 gint baseline_height;
1081 gint child_baseline;
1082 gint i;
1083
1084 widget = ctk_css_gadget_get_owner (gadget);
1085 bbox = CTK_BUTTON_BOX (widget)((((CtkButtonBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_button_box_get_type ()))))))
;
1086 priv = bbox->priv;
1087
1088 orientation = ctk_orientable_get_orientation (CTK_ORIENTABLE (widget)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_orientable_get_type ()))))))
);
1089 spacing = ctk_box_get_spacing (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
1090
1091 ctk_widget_style_get (widget,
1092 "child-internal-pad-x", &ipad_x,
1093 "child-internal-pad-y", &ipad_y,
1094 NULL((void*)0));
1095 ctk_button_box_child_requisition (widget,
1
Calling 'ctk_button_box_child_requisition'
1096 &nvis_children,
1097 &n_secondaries,
1098 &widths, &heights, &baselines, &baseline, &baseline_height);
1099
1100 if (baseline != -1)
1101 {
1102 /* TODO: modify baseline based on baseline_pos && allocated_baseline*/
1103 switch (ctk_box_get_baseline_position (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
))
1104 {
1105 case CTK_BASELINE_POSITION_TOP:
1106 /* keep baseline as is */
1107 break;
1108 case CTK_BASELINE_POSITION_CENTER:
1109 baseline = baseline + (allocation->height - baseline_height) / 2;
1110 break;
1111 case CTK_BASELINE_POSITION_BOTTOM:
1112 baseline = allocation->height - (baseline_height - baseline);
1113 break;
1114 }
1115 }
1116
1117 n_primaries = nvis_children - n_secondaries;
1118 primary_size = 0;
1119 secondary_size = 0;
1120 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1121 sizes = widths;
1122 else
1123 sizes = heights;
1124
1125 i = 0;
1126 list = children = _ctk_box_get_children (CTK_BOX (widget)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_box_get_type ()))))))
);
1127 while (children)
1128 {
1129 CtkWidget *child;
1130
1131 child = children->data;
1132 children = children->next;
1133
1134 if (ctk_widget_get_visible (child))
1135 {
1136 if (ctk_button_box_get_child_secondary (bbox, child))
1137 secondary_size += sizes[i];
1138 else
1139 primary_size += sizes[i];
1140 i++;
1141 }
1142 }
1143 total_size = primary_size + secondary_size;
1144
1145 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1146 width = allocation->width;
1147 else
1148 height = allocation->height;
1149
1150 switch (priv->layout_style)
1151 {
1152 case CTK_BUTTONBOX_SPREAD:
1153
1154 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1155 {
1156 childspacing = (width - total_size) / (nvis_children + 1);
1157 x = allocation->x + childspacing;
1158 secondary_x = x + primary_size + n_primaries * childspacing;
1159 }
1160 else
1161 {
1162 childspacing = (height - total_size) / (nvis_children + 1);
1163 y = allocation->y + childspacing;
1164 secondary_y = y + primary_size + n_primaries * childspacing;
1165 }
1166
1167 break;
1168
1169 case CTK_BUTTONBOX_EDGE:
1170
1171 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1172 {
1173 if (nvis_children >= 2)
1174 {
1175 childspacing = (width - total_size) / (nvis_children - 1);
1176 x = allocation->x;
1177 secondary_x = x + primary_size + n_primaries * childspacing;
1178 }
1179 else if (nvis_children == 1)
1180 {
1181 /* one child, just center */
1182 childspacing = width;
1183 x = secondary_x = allocation->x
1184 + (allocation->width - widths[0]) / 2;
1185 }
1186 else
1187 {
1188 /* zero children, meh */
1189 childspacing = width;
1190 x = secondary_x = allocation->x + allocation->width / 2;
1191 }
1192 }
1193 else
1194 {
1195 if (nvis_children >= 2)
1196 {
1197 childspacing = (height - total_size) / (nvis_children - 1);
1198 y = allocation->y;
1199 secondary_y = y + primary_size + n_primaries * childspacing;
1200 }
1201 else if (nvis_children == 1)
1202 {
1203 /* one child, just center */
1204 childspacing = height;
1205 y = secondary_y = allocation->y
1206 + (allocation->height - heights[0]) / 2;
1207 }
1208 else
1209 {
1210 /* zero children, meh */
1211 childspacing = height;
1212 y = secondary_y = allocation->y + allocation->height / 2;
1213 }
1214 }
1215
1216 break;
1217
1218 case CTK_BUTTONBOX_START:
1219
1220 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1221 {
1222 childspacing = spacing;
1223 x = allocation->x;
1224 secondary_x = allocation->x + allocation->width
1225 - secondary_size - spacing * (n_secondaries - 1);
1226 }
1227 else
1228 {
1229 childspacing = spacing;
1230 y = allocation->y;
1231 secondary_y = allocation->y + allocation->height
1232 - secondary_size - spacing * (n_secondaries - 1);
1233 }
1234
1235 break;
1236
1237 case CTK_BUTTONBOX_END:
1238
1239 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1240 {
1241 childspacing = spacing;
1242 x = allocation->x + allocation->width
1243 - primary_size - spacing * (n_primaries - 1);
1244 secondary_x = allocation->x;
1245 }
1246 else
1247 {
1248 childspacing = spacing;
1249 y = allocation->y + allocation->height
1250 - primary_size - spacing * (n_primaries - 1);
1251 secondary_y = allocation->y;
1252 }
1253
1254 break;
1255
1256 case CTK_BUTTONBOX_CENTER:
1257
1258 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1259 {
1260 childspacing = spacing;
1261 x = allocation->x +
1262 (allocation->width
1263 - (primary_size + spacing * (n_primaries - 1))) / 2
1264 + (secondary_size + n_secondaries * spacing) / 2;
1265 secondary_x = allocation->x;
1266 }
1267 else
1268 {
1269 childspacing = spacing;
1270 y = allocation->y +
1271 (allocation->height
1272 - (primary_size + spacing * (n_primaries - 1))) / 2
1273 + (secondary_size + n_secondaries * spacing) / 2;
1274 secondary_y = allocation->y;
1275 }
1276
1277 break;
1278
1279 default:
1280 g_assert_not_reached ()do { g_assertion_message_expr ("Ctk", "ctkbbox.c", 1280, ((const
char*) (__func__)), ((void*)0)); } while (0)
;
1281 break;
1282 }
1283
1284 children = list;
1285 i = 0;
1286 while (children)
1287 {
1288 CtkWidget *child;
1289
1290 child = children->data;
1291 children = children->next;
1292
1293 if (ctk_widget_get_visible (child))
1294 {
1295 child_allocation.width = widths[i];
1296 child_allocation.height = heights[i];
1297 child_baseline = -1;
1298
1299 if (orientation == CTK_ORIENTATION_HORIZONTAL)
1300 {
1301 if (baselines[i] != -1)
1302 {
1303 child_allocation.y = allocation->y + baseline - baselines[i];
1304 child_baseline = baselines[i];
1305 }
1306 else
1307 child_allocation.y = allocation->y + (allocation->height - child_allocation.height) / 2;
1308
1309 if (ctk_button_box_get_child_secondary (bbox, child))
1310 {
1311 child_allocation.x = secondary_x;
1312 secondary_x += child_allocation.width + childspacing;
1313 }
1314 else
1315 {
1316 child_allocation.x = x;
1317 x += child_allocation.width + childspacing;
1318 }
1319
1320 if (ctk_widget_get_direction (widget) == CTK_TEXT_DIR_RTL)
1321 child_allocation.x = (allocation->x + allocation->width)
1322 - (child_allocation.x + child_allocation.width - allocation->x);
1323 }
1324 else
1325 {
1326 child_allocation.x = allocation->x + (allocation->width - child_allocation.width) / 2;
1327
1328 if (ctk_button_box_get_child_secondary (bbox, child))
1329 {
1330 child_allocation.y = secondary_y;
1331 secondary_y += child_allocation.height + childspacing;
1332 }
1333 else
1334 {
1335 child_allocation.y = y;
1336 y += child_allocation.height + childspacing;
1337 }
1338 }
1339
1340 ctk_widget_size_allocate_with_baseline (child, &child_allocation, child_baseline);
1341 i++;
1342 }
1343 }
1344
1345 g_list_free (list);
1346 g_free (widths);
1347 g_free (heights);
1348 g_free (baselines);
1349
1350 ctk_container_get_children_clip (CTK_CONTAINER (widget)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_container_get_type ()))))))
, out_clip);
1351}
1352
1353/**
1354 * ctk_button_box_new:
1355 * @orientation: the box's orientation.
1356 *
1357 * Creates a new #CtkButtonBox.
1358 *
1359 * Returns: a new #CtkButtonBox.
1360 *
1361 * Since: 3.0
1362 */
1363CtkWidget *
1364ctk_button_box_new (CtkOrientation orientation)
1365{
1366 return g_object_new (CTK_TYPE_BUTTON_BOX(ctk_button_box_get_type ()),
1367 "orientation", orientation,
1368 NULL((void*)0));
1369}
1370
1371/**
1372 * ctk_button_box_get_child_non_homogeneous:
1373 * @widget: a #CtkButtonBox
1374 * @child: a child of @widget
1375 *
1376 * Returns whether the child is exempted from homogenous
1377 * sizing.
1378 *
1379 * Returns: %TRUE if the child is not subject to homogenous sizing
1380 *
1381 * Since: 3.2
1382 */
1383gboolean
1384ctk_button_box_get_child_non_homogeneous (CtkButtonBox *widget,
1385 CtkWidget *child)
1386{
1387 g_return_val_if_fail (CTK_IS_BUTTON_BOX (widget), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((ctk_button_box_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_BUTTON_BOX (widget)"); return ((0)); } } while (0
)
;
1388 g_return_val_if_fail (CTK_IS_WIDGET (child), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((child)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_WIDGET (child)"); return ((0)); } } while (0)
;
1389
1390 return (g_object_get_data (G_OBJECT (child)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), (((GType) ((20) << (2))))))))
, CTK_BOX_NON_HOMOGENEOUS"ctk-box-non-homogeneous") != NULL((void*)0));
1391}
1392
1393/**
1394 * ctk_button_box_set_child_non_homogeneous:
1395 * @widget: a #CtkButtonBox
1396 * @child: a child of @widget
1397 * @non_homogeneous: the new value
1398 *
1399 * Sets whether the child is exempted from homogeous sizing.
1400 *
1401 * Since: 3.2
1402 */
1403void
1404ctk_button_box_set_child_non_homogeneous (CtkButtonBox *widget,
1405 CtkWidget *child,
1406 gboolean non_homogeneous)
1407{
1408 g_return_if_fail (CTK_IS_BUTTON_BOX (widget))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((widget)); GType __t = ((ctk_button_box_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_BUTTON_BOX (widget)"); return; } } while (0)
;
1409 g_return_if_fail (CTK_IS_WIDGET (child))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((child)); GType __t = ((ctk_widget_get_type ())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning ("Ctk", ((const char*) (__func__
)), "CTK_IS_WIDGET (child)"); return; } } while (0)
;
1410 g_return_if_fail (ctk_widget_get_parent (child) == CTK_WIDGET (widget))do { if ((ctk_widget_get_parent (child) == ((((CtkWidget*) (void
*) g_type_check_instance_cast ((GTypeInstance*) ((widget)), (
(ctk_widget_get_type ())))))))) { } else { g_return_if_fail_warning
("Ctk", ((const char*) (__func__)), "ctk_widget_get_parent (child) == CTK_WIDGET (widget)"
); return; } } while (0)
;
1411
1412 g_object_set_data (G_OBJECT (child)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((child)), (((GType) ((20) << (2))))))))
,
1413 CTK_BOX_NON_HOMOGENEOUS"ctk-box-non-homogeneous",
1414 non_homogeneous ? GINT_TO_POINTER (1)((gpointer) (glong) (1)) : NULL((void*)0));
1415 ctk_widget_child_notify (child, "non-homogeneous");
1416
1417 if (ctk_widget_get_visible (CTK_WIDGET (widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_widget_get_type ()))))))
) &&
1418 ctk_widget_get_visible (child))
1419 ctk_widget_queue_resize (child);
1420}