| 1 | /* GTK - The GIMP Toolkit |
| 2 | * gtksizegroup.c: |
| 3 | * Copyright (C) 2001 Red Hat Software |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 20 | #include <string.h> |
| 21 | |
| 22 | #include "gtkbuildable.h"cxx . . $ `<file>/gtk/gtkbuildable.h`/ |
| 23 | #include "gtkbuilderprivate.h"cxx . . $ `<file>/gtk/gtkbuilderprivate.h`/ |
| 24 | #include "gtkwidget.h"cxx . . $ `<file>/gtk/gtkwidget.h`/ |
| 25 | #include "gtktypebuiltins.h"cxx . . $ `<file>/build/gtk/gtktypebuiltins.h`/ |
| 26 | #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/ |
| 27 | #include "gtksizegroup-private.h"cxx . . $ `<file>/gtk/gtksizegroup-private.h`/ |
| 28 | #include "gtkwidgetprivate.h"cxx . . $ `<file>/gtk/gtkwidgetprivate.h`/ |
| 29 | |
| 30 | |
| 31 | /** |
| 32 | * GtkSizeGroup |
| 33 | * |
| 34 | * Groups widgets together so they all request the same size. |
| 35 | * |
| 36 | * This is typically useful when you want a column of widgets to have |
| 37 | * the same size, but you can’t use a [[email protected]] or [[email protected]]. |
| 38 | * |
| 39 | * In detail, the size requested for each widget in a `GtkSizeGroup` is |
| 40 | * the maximum of the sizes that would have been requested for each |
| 41 | * widget in the size group if they were not in the size group. The |
| 42 | * [mode][[email protected]_mode] of the size group determines |
| 43 | * whether this applies to the horizontal size, the vertical size, or |
| 44 | * both sizes. |
| 45 | * |
| 46 | * Note that size groups only affect the amount of space requested, not |
| 47 | * the size that the widgets finally receive. If you want the widgets in |
| 48 | * a `GtkSizeGroup` to actually be the same size, you need to pack them in |
| 49 | * such a way that they get the size they request and not more. In |
| 50 | * particular it doesn't make a lot of sense to set |
| 51 | * [the expand flags][[email protected]_hexpand] on the widgets that |
| 52 | * are members of a size group. |
| 53 | * |
| 54 | * `GtkSizeGroup` objects are referenced by each widget in the size group, |
| 55 | * so once you have added all widgets to a `GtkSizeGroup`, you can drop |
| 56 | * the initial reference to the size group with |
| 57 | * [[email protected]]. If the widgets in the size group are |
| 58 | * subsequently destroyed, then they will be removed from the size group |
| 59 | * and drop their references on the size group; when all widgets have been |
| 60 | * removed, the size group will be freed. |
| 61 | * |
| 62 | * Widgets can be part of multiple size groups; GTK will compute the |
| 63 | * horizontal size of a widget from the horizontal requisition of all widgets |
| 64 | * that can be reached from the widget by a chain of size groups with mode |
| 65 | * [[email protected]] or [[email protected]], and |
| 66 | * the vertical size from the vertical requisition of all widgets that can be |
| 67 | * reached from the widget by a chain of size groups with mode |
| 68 | * [[email protected]] or [[email protected]]. |
| 69 | * |
| 70 | * # Size groups and trading height-for-width |
| 71 | * |
| 72 | * ::: warning |
| 73 | * Generally, size groups don't interact well with widgets that |
| 74 | * trade height for width (or width for height), such as wrappable |
| 75 | * labels. Avoid using size groups with such widgets. |
| 76 | * |
| 77 | * A size group with mode [[email protected]] or |
| 78 | * [[email protected]] only consults non-contextual sizes |
| 79 | * of widgets other than the one being measured, since it has no |
| 80 | * knowledge of what size a widget will get allocated in the other |
| 81 | * orientation. This can lead to widgets in a group actually requesting |
| 82 | * different contextual sizes, contrary to the purpose of |
| 83 | * `GtkSizeGroup`. |
| 84 | * |
| 85 | * In contrast, a size group with mode [[email protected]] can |
| 86 | * properly propagate the available size in the opposite orientation |
| 87 | * when measuring widgets in the group, which results in consistent and |
| 88 | * accurate measurements. |
| 89 | * |
| 90 | * In case some mechanism other than a size group is already used to |
| 91 | * ensure that widgets in a group all get the same size in one |
| 92 | * orientation (for example, some common ancestor is known to allocate |
| 93 | * the same width to all its children), and the size group is only |
| 94 | * really needed to also make the widgets request the same size in the |
| 95 | * other orientation, it is beneficial to still set the group's mode to |
| 96 | * [[email protected]]. This lets the group assume and count |
| 97 | * on sizes of the widgets in the former orientation being the same, |
| 98 | * which enables it to propagate the available size as described above. |
| 99 | * |
| 100 | * # Alternatives to size groups |
| 101 | * |
| 102 | * Size groups have many limitations, such as only influencing size |
| 103 | * requests but not allocations, and poor height-for-width support. When |
| 104 | * possible, prefer using dedicated mechanisms that can properly ensure |
| 105 | * that the widgets get the same size. |
| 106 | * |
| 107 | * Various container widgets and layout managers support a homogeneous |
| 108 | * layout mode, where they will explicitly give the same size to their |
| 109 | * children (see [[email protected]:homogeneous]). Using homogeneous mode |
| 110 | * can also have large performance benefits compared to either the same |
| 111 | * container in non-homogeneous mode, or to size groups. |
| 112 | * |
| 113 | * [[email protected]] can be used to position widgets into rows and |
| 114 | * columns. Members of each column will have the same width among them; |
| 115 | * likewise, members of each row will have the same height. On top of |
| 116 | * that, the heights can be made equal between all rows with |
| 117 | * [[email protected]:row-homogeneous], and the widths can be made equal |
| 118 | * between all columns with [[email protected]:column-homogeneous]. |
| 119 | * |
| 120 | * # GtkSizeGroup as GtkBuildable |
| 121 | * |
| 122 | * Size groups can be specified in a UI definition by placing an `<object>` |
| 123 | * element with `class="GtkSizeGroup"` somewhere in the UI definition. The |
| 124 | * widgets that belong to the size group are specified by a `<widgets>` element |
| 125 | * that may contain multiple `<widget>` elements, one for each member of the |
| 126 | * size group. The ”name” attribute gives the id of the widget. |
| 127 | * |
| 128 | * An example of a UI definition fragment with `GtkSizeGroup`: |
| 129 | * ```xml |
| 130 | * <object class="GtkSizeGroup"> |
| 131 | * <property name="mode">horizontal</property> |
| 132 | * <widgets> |
| 133 | * <widget name="radio1"/> |
| 134 | * <widget name="radio2"/> |
| 135 | * </widgets> |
| 136 | * </object> |
| 137 | * ``` |
| 138 | */ |
| 139 | |
| 140 | typedef struct _GtkSizeGroupClasscxx . . $ _GtkSizeGroupClass# GtkSizeGroupClasscxx . . $ GtkSizeGroupClass#; |
| 141 | typedef struct _GtkSizeGroupPrivatecxx . . $ _GtkSizeGroupPrivate# GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate#; |
| 142 | |
| 143 | struct _GtkSizeGroupClasscxx . . $ _GtkSizeGroupClass# |
| 144 | { |
| 145 | GObjectClasscxx . . $ GObjectClass# parent_classcxx . . $ _GtkSizeGroupClass#parent_class.; |
| 146 | }; |
| 147 | |
| 148 | struct _GtkSizeGroupPrivatecxx . . $ _GtkSizeGroupPrivate# |
| 149 | { |
| 150 | GSListcxx . . $ GSList# *widgetscxx . . $ _GtkSizeGroupPrivate#widgets.; |
| 151 | |
| 152 | guint8cxx . . $ guint8# modecxx . . $ _GtkSizeGroupPrivate#mode.; |
| 153 | }; |
| 154 | |
| 155 | enumcxx . . $ $anonymous_type_d9ab2bfe69464401_0# { |
| 156 | PROP_0cxx . . $ PROP_0., |
| 157 | PROP_MODEcxx . . $ PROP_MODE. |
| 158 | }; |
| 159 | |
| 160 | static void gtk_size_group_set_propertycxx . . $ gtk_size_group_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object, |
| 161 | guintcxx . . $ guint# prop_id, |
| 162 | const GValuecxx . . $ GValue# *value, |
| 163 | GParamSpeccxx . . $ GParamSpec# *pspec); |
| 164 | static void gtk_size_group_get_propertycxx . . $ gtk_size_group_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object, |
| 165 | guintcxx . . $ guint# prop_id, |
| 166 | GValuecxx . . $ GValue# *value, |
| 167 | GParamSpeccxx . . $ GParamSpec# *pspec); |
| 168 | |
| 169 | /* GtkBuildable */ |
| 170 | static void gtk_size_group_buildable_initcxx . . $ gtk_size_group_buildable_init(c5db55232772c4cd). (GtkBuildableIfacecxx . . $ GtkBuildableIface# *iface); |
| 171 | static gbooleancxx . . $ gboolean# gtk_size_group_buildable_custom_tag_startcxx . . $ gtk_size_group_buildable_custom_tag_start(b259140ba88dbccf). (GtkBuildablecxx . . $ GtkBuildable# *buildable, |
| 172 | GtkBuildercxx . . $ GtkBuilder# *builder, |
| 173 | GObjectcxx . . $ GObject# *child, |
| 174 | const char *tagname, |
| 175 | GtkBuildableParsercxx . . $ GtkBuildableParser# *parser, |
| 176 | gpointercxx . . $ gpointer# *data); |
| 177 | static void gtk_size_group_buildable_custom_finishedcxx . . $ gtk_size_group_buildable_custom_finished(9c109889ce297a82). (GtkBuildablecxx . . $ GtkBuildable# *buildable, |
| 178 | GtkBuildercxx . . $ GtkBuilder# *builder, |
| 179 | GObjectcxx . . $ GObject# *child, |
| 180 | const char *tagname, |
| 181 | gpointercxx . . $ gpointer# user_data); |
| 182 | |
| 183 | G_STATIC_ASSERTcxx . . $ `<external>/12741050725406041920/gmacros.h:910:9`! (GTK_SIZE_GROUP_HORIZONTAL == (1 << GTK_ORIENTATION_HORIZONTAL)); |
| 184 | G_STATIC_ASSERTcxx . . $ `<external>/12741050725406041920/gmacros.h:910:9`! (GTK_SIZE_GROUP_VERTICAL == (1 << GTK_ORIENTATION_VERTICAL)); |
| 185 | G_STATIC_ASSERTcxx . . $ `<external>/12741050725406041920/gmacros.h:910:9`! (GTK_SIZE_GROUP_BOTH == (GTK_SIZE_GROUP_HORIZONTAL | GTK_SIZE_GROUP_VERTICAL)); |
| 186 | |
| 187 | G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (GtkSizeGroup, gtk_size_group, G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!, |
| 188 | G_ADD_PRIVATEcxx . . $ `<external>/9567554376676449156/gtype.h:2194:9`! (GtkSizeGroup) |
| 189 | G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (GTK_TYPE_BUILDABLEcxx . . $ `gtk/gtkbuildable.h:29:9`!, |
| 190 | gtk_size_group_buildable_init)) |
| 191 | |
| 192 | static void |
| 193 | add_widget_to_closurecxx . . $ add_widget_to_closure(3eae5d5c4d389d7a). (GHashTablecxx . . $ GHashTable# *peers, |
| 194 | GHashTablecxx . . $ GHashTable# *peers_for_both, |
| 195 | GHashTablecxx . . $ GHashTable# *groups, |
| 196 | GtkWidgetcxx . . $ GtkWidget# *widget, |
| 197 | int orientation) |
| 198 | { |
| 199 | GSListcxx . . $ GSList# *tmp_groups, *tmp_widgets; |
| 200 | |
| 201 | if (g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (peers, widget)) |
| 202 | return; |
| 203 | |
| 204 | g_hash_table_addcxx . . $ g_hash_table_add(69c5b3b3568d4848). (peers, widget); |
| 205 | if (peers_for_both) |
| 206 | g_hash_table_addcxx . . $ g_hash_table_add(69c5b3b3568d4848). (peers_for_both, widget); |
| 207 | |
| 208 | for (tmp_groups = _gtk_widget_get_sizegroupscxx . . $ _gtk_widget_get_sizegroups(b0efd5ab7f37e1a0). (widget); tmp_groups; tmp_groups = tmp_groups->nextcxx . . $ _GSList#next.) |
| 209 | { |
| 210 | GtkSizeGroupcxx . . $ GtkSizeGroup# *tmp_group = tmp_groups->datacxx . . $ _GSList#data.; |
| 211 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *tmp_priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (tmp_group); |
| 212 | |
| 213 | if (g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (groups, tmp_group)) |
| 214 | continue; |
| 215 | |
| 216 | if (orientation >= 0 && !(tmp_priv->modecxx . . $ _GtkSizeGroupPrivate#mode. & (1 << orientation))) |
| 217 | continue; |
| 218 | |
| 219 | g_hash_table_addcxx . . $ g_hash_table_add(69c5b3b3568d4848). (groups, tmp_group); |
| 220 | |
| 221 | for (tmp_widgets = tmp_priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets.; tmp_widgets; tmp_widgets = tmp_widgets->nextcxx . . $ _GSList#next.) |
| 222 | add_widget_to_closurecxx . . $ add_widget_to_closure(3eae5d5c4d389d7a). (peers, tmp_priv->modecxx . . $ _GtkSizeGroupPrivate#mode. == GTK_SIZE_GROUP_BOTHcxx . . $ GTK_SIZE_GROUP_BOTH. ? peers_for_both : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 223 | groups, tmp_widgets->datacxx . . $ _GSList#data., orientation); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | void |
| 228 | _gtk_size_group_get_widget_peerscxx . . $ _gtk_size_group_get_widget_peers(2455759e14bb5dad). (GtkWidgetcxx . . $ GtkWidget# *for_widget, |
| 229 | GtkOrientationcxx . . $ GtkOrientation# orientation, |
| 230 | GHashTablecxx . . $ GHashTable# **peers, |
| 231 | GHashTablecxx . . $ GHashTable# **peers_for_both) |
| 232 | { |
| 233 | GHashTablecxx . . $ GHashTable# *groups; |
| 234 | |
| 235 | *peers = g_hash_table_newcxx . . $ g_hash_table_new(444186de27d60923). (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`!); |
| 236 | *peers_for_both = g_hash_table_newcxx . . $ g_hash_table_new(444186de27d60923). (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`!); |
| 237 | groups = g_hash_table_newcxx . . $ g_hash_table_new(444186de27d60923). (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`!); |
| 238 | |
| 239 | add_widget_to_closurecxx . . $ add_widget_to_closure(3eae5d5c4d389d7a). (*peers, *peers_for_both, groups, for_widget, orientation); |
| 240 | |
| 241 | g_hash_table_unrefcxx . . $ g_hash_table_unref(ce4eddf544b9218). (groups); |
| 242 | } |
| 243 | |
| 244 | static void |
| 245 | queue_resize_on_groupcxx . . $ queue_resize_on_group(c252d46fe1a97ee8). (GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group) |
| 246 | { |
| 247 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 248 | GSListcxx . . $ GSList# *list; |
| 249 | |
| 250 | for (list = priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets.; list; list = list->nextcxx . . $ _GSList#next.) |
| 251 | { |
| 252 | gtk_widget_queue_resizecxx . . $ gtk_widget_queue_resize(d7cf858254b37903). (list->datacxx . . $ _GSList#data.); |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | static void |
| 257 | gtk_size_group_class_initcxx . . $ gtk_size_group_class_init(a016319bf4fcf4b5). (GtkSizeGroupClasscxx . . $ GtkSizeGroupClass# *klass) |
| 258 | { |
| 259 | GObjectClasscxx . . $ GObjectClass# *gobject_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass); |
| 260 | |
| 261 | gobject_class->set_propertycxx . . $ _GObjectClass#set_property. = gtk_size_group_set_propertycxx . . $ gtk_size_group_set_property(d7c4bb29f36c0dc4).; |
| 262 | gobject_class->get_propertycxx . . $ _GObjectClass#get_property. = gtk_size_group_get_propertycxx . . $ gtk_size_group_get_property(cee2c52f22407c66).; |
| 263 | |
| 264 | /** |
| 265 | * GtkSizeGroup:mode: |
| 266 | * |
| 267 | * The direction in which the size group affects requested sizes. |
| 268 | */ |
| 269 | g_object_class_install_propertycxx . . $ g_object_class_install_property(9c80cb614dbe5a26). (gobject_class, |
| 270 | PROP_MODEcxx . . $ PROP_MODE., |
| 271 | g_param_spec_enumcxx . . $ g_param_spec_enum(bfeb217b5dc6c0ac). ("mode", 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 | GTK_TYPE_SIZE_GROUP_MODEcxx . . $ `build/gtk/gtktypebuiltins.h:184:9`!, |
| 273 | GTK_SIZE_GROUP_HORIZONTALcxx . . $ GTK_SIZE_GROUP_HORIZONTAL., |
| 274 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.)); |
| 275 | } |
| 276 | |
| 277 | static void |
| 278 | gtk_size_group_initcxx . . $ gtk_size_group_init(c252d46fe1a97ee8). (GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group) |
| 279 | { |
| 280 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv; |
| 281 | |
| 282 | priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 283 | |
| 284 | priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 285 | priv->modecxx . . $ _GtkSizeGroupPrivate#mode. = GTK_SIZE_GROUP_HORIZONTALcxx . . $ GTK_SIZE_GROUP_HORIZONTAL.; |
| 286 | } |
| 287 | |
| 288 | static void |
| 289 | gtk_size_group_buildable_initcxx . . $ gtk_size_group_buildable_init(c5db55232772c4cd). (GtkBuildableIfacecxx . . $ GtkBuildableIface# *iface) |
| 290 | { |
| 291 | iface->custom_tag_startcxx . . $ _GtkBuildableIface#custom_tag_start. = gtk_size_group_buildable_custom_tag_startcxx . . $ gtk_size_group_buildable_custom_tag_start(b259140ba88dbccf).; |
| 292 | iface->custom_finishedcxx . . $ _GtkBuildableIface#custom_finished. = gtk_size_group_buildable_custom_finishedcxx . . $ gtk_size_group_buildable_custom_finished(9c109889ce297a82).; |
| 293 | } |
| 294 | |
| 295 | static void |
| 296 | gtk_size_group_set_propertycxx . . $ gtk_size_group_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object, |
| 297 | guintcxx . . $ guint# prop_id, |
| 298 | const GValuecxx . . $ GValue# *value, |
| 299 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 300 | { |
| 301 | GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group = GTK_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:30:9`! (object); |
| 302 | |
| 303 | switch (prop_id) |
| 304 | { |
| 305 | case PROP_MODEcxx . . $ PROP_MODE.: |
| 306 | gtk_size_group_set_modecxx . . $ gtk_size_group_set_mode(6f04b09bd24f86b2). (size_group, g_value_get_enumcxx . . $ g_value_get_enum(f890c5c75ead5b21). (value)); |
| 307 | break; |
| 308 | default: |
| 309 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 310 | break; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | static void |
| 315 | gtk_size_group_get_propertycxx . . $ gtk_size_group_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object, |
| 316 | guintcxx . . $ guint# prop_id, |
| 317 | GValuecxx . . $ GValue# *value, |
| 318 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 319 | { |
| 320 | GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group = GTK_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:30:9`! (object); |
| 321 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 322 | |
| 323 | switch (prop_id) |
| 324 | { |
| 325 | case PROP_MODEcxx . . $ PROP_MODE.: |
| 326 | g_value_set_enumcxx . . $ g_value_set_enum(b698c61e8e30c4ea). (value, priv->modecxx . . $ _GtkSizeGroupPrivate#mode.); |
| 327 | break; |
| 328 | default: |
| 329 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 330 | break; |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * gtk_size_group_new: |
| 336 | * @mode: the mode for the new size group. |
| 337 | * |
| 338 | * Create a new `GtkSizeGroup`. |
| 339 | * |
| 340 | * Returns: a newly created `GtkSizeGroup` |
| 341 | */ |
| 342 | GtkSizeGroupcxx . . $ GtkSizeGroup# * |
| 343 | gtk_size_group_newcxx . . $ gtk_size_group_new(178ffe5e7fb365b9). (GtkSizeGroupModecxx . . $ GtkSizeGroupMode# mode) |
| 344 | { |
| 345 | GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:29:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 346 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 347 | |
| 348 | priv->modecxx . . $ _GtkSizeGroupPrivate#mode. = mode; |
| 349 | |
| 350 | return size_group; |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * gtk_size_group_set_mode: |
| 355 | * @size_group: a `GtkSizeGroup` |
| 356 | * @mode: the mode to set for the size group. |
| 357 | * |
| 358 | * Sets the `GtkSizeGroupMode` of the size group. |
| 359 | * |
| 360 | * The mode of the size group determines whether the widgets in the |
| 361 | * size group should all have the same horizontal requisition |
| 362 | * (%GTK_SIZE_GROUP_HORIZONTAL) all have the same vertical requisition |
| 363 | * (%GTK_SIZE_GROUP_VERTICAL), or should all have the same requisition |
| 364 | * in both directions (%GTK_SIZE_GROUP_BOTH). |
| 365 | */ |
| 366 | void |
| 367 | gtk_size_group_set_modecxx . . $ gtk_size_group_set_mode(6f04b09bd24f86b2). (GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group, |
| 368 | GtkSizeGroupModecxx . . $ GtkSizeGroupMode# mode) |
| 369 | { |
| 370 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 371 | |
| 372 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:31:9`! (size_group)); |
| 373 | |
| 374 | if (priv->modecxx . . $ _GtkSizeGroupPrivate#mode. != mode) |
| 375 | { |
| 376 | if (priv->modecxx . . $ _GtkSizeGroupPrivate#mode. != GTK_SIZE_GROUP_NONEcxx . . $ GTK_SIZE_GROUP_NONE.) |
| 377 | queue_resize_on_groupcxx . . $ queue_resize_on_group(c252d46fe1a97ee8). (size_group); |
| 378 | priv->modecxx . . $ _GtkSizeGroupPrivate#mode. = mode; |
| 379 | if (priv->modecxx . . $ _GtkSizeGroupPrivate#mode. != GTK_SIZE_GROUP_NONEcxx . . $ GTK_SIZE_GROUP_NONE.) |
| 380 | queue_resize_on_groupcxx . . $ queue_resize_on_group(c252d46fe1a97ee8). (size_group); |
| 381 | |
| 382 | g_object_notifycxx . . $ g_object_notify(174c9e6df5777c4e). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (size_group), "mode"); |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * gtk_size_group_get_mode: |
| 388 | * @size_group: a `GtkSizeGroup` |
| 389 | * |
| 390 | * Gets the current mode of the size group. |
| 391 | * |
| 392 | * Returns: the current mode of the size group. |
| 393 | */ |
| 394 | GtkSizeGroupModecxx . . $ GtkSizeGroupMode# |
| 395 | gtk_size_group_get_modecxx . . $ gtk_size_group_get_mode(387a808a64ba78af). (GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group) |
| 396 | { |
| 397 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 398 | |
| 399 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:31:9`! (size_group), GTK_SIZE_GROUP_BOTH); |
| 400 | |
| 401 | return priv->modecxx . . $ _GtkSizeGroupPrivate#mode.; |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * gtk_size_group_add_widget: |
| 406 | * @size_group: a `GtkSizeGroup` |
| 407 | * @widget: the `GtkWidget` to add |
| 408 | * |
| 409 | * Adds a widget to a `GtkSizeGroup`. |
| 410 | * |
| 411 | * In the future, the requisition |
| 412 | * of the widget will be determined as the maximum of its requisition |
| 413 | * and the requisition of the other widgets in the size group. |
| 414 | * Whether this applies horizontally, vertically, or in both directions |
| 415 | * depends on the mode of the size group. |
| 416 | * See [[email protected]_mode]. |
| 417 | * |
| 418 | * When the widget is destroyed or no longer referenced elsewhere, it |
| 419 | * will be removed from the size group. |
| 420 | */ |
| 421 | void |
| 422 | gtk_size_group_add_widgetcxx . . $ gtk_size_group_add_widget(1c29cbce5c69a315). (GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group, |
| 423 | GtkWidgetcxx . . $ GtkWidget# *widget) |
| 424 | { |
| 425 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 426 | GSListcxx . . $ GSList# *groups; |
| 427 | |
| 428 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:31:9`! (size_group)); |
| 429 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (widget)); |
| 430 | |
| 431 | groups = _gtk_widget_get_sizegroupscxx . . $ _gtk_widget_get_sizegroups(b0efd5ab7f37e1a0). (widget); |
| 432 | |
| 433 | if (!g_slist_findcxx . . $ g_slist_find(f729b2814f82a8b5). (groups, size_group)) |
| 434 | { |
| 435 | _gtk_widget_add_sizegroupcxx . . $ _gtk_widget_add_sizegroup(c2a8b32df5332c4b). (widget, size_group); |
| 436 | |
| 437 | priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets. = g_slist_prependcxx . . $ g_slist_prepend(6eb923d8c45a5456). (priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets., widget); |
| 438 | |
| 439 | g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (size_group); |
| 440 | } |
| 441 | |
| 442 | queue_resize_on_groupcxx . . $ queue_resize_on_group(c252d46fe1a97ee8). (size_group); |
| 443 | } |
| 444 | |
| 445 | /** |
| 446 | * gtk_size_group_remove_widget: |
| 447 | * @size_group: a `GtkSizeGroup` |
| 448 | * @widget: the `GtkWidget` to remove |
| 449 | * |
| 450 | * Removes a widget from a `GtkSizeGroup`. |
| 451 | */ |
| 452 | void |
| 453 | gtk_size_group_remove_widgetcxx . . $ gtk_size_group_remove_widget(1c29cbce5c69a315). (GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group, |
| 454 | GtkWidgetcxx . . $ GtkWidget# *widget) |
| 455 | { |
| 456 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 457 | |
| 458 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:31:9`! (size_group)); |
| 459 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (widget)); |
| 460 | |
| 461 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (g_slist_find (priv->widgets, widget)); |
| 462 | |
| 463 | _gtk_widget_remove_sizegroupcxx . . $ _gtk_widget_remove_sizegroup(c2a8b32df5332c4b). (widget, size_group); |
| 464 | |
| 465 | priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets. = g_slist_removecxx . . $ g_slist_remove(f729b2814f82a8b5). (priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets., widget); |
| 466 | queue_resize_on_groupcxx . . $ queue_resize_on_group(c252d46fe1a97ee8). (size_group); |
| 467 | gtk_widget_queue_resizecxx . . $ gtk_widget_queue_resize(d7cf858254b37903). (widget); |
| 468 | |
| 469 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (size_group); |
| 470 | } |
| 471 | |
| 472 | /** |
| 473 | * gtk_size_group_get_widgets: |
| 474 | * @size_group: a `GtkSizeGroup` |
| 475 | * |
| 476 | * Returns the list of widgets associated with @size_group. |
| 477 | * |
| 478 | * Returns: (element-type GtkWidget) (transfer none): a `GSList` of |
| 479 | * widgets. The list is owned by GTK and should not be modified. |
| 480 | */ |
| 481 | GSListcxx . . $ GSList# * |
| 482 | gtk_size_group_get_widgetscxx . . $ gtk_size_group_get_widgets(34ba309d4b89a554). (GtkSizeGroupcxx . . $ GtkSizeGroup# *size_group) |
| 483 | { |
| 484 | GtkSizeGroupPrivatecxx . . $ GtkSizeGroupPrivate# *priv = gtk_size_group_get_instance_privatecxx . . $ gtk_size_group_get_instance_private(f0b60c559c61bc64). (size_group); |
| 485 | |
| 486 | return priv->widgetscxx . . $ _GtkSizeGroupPrivate#widgets.; |
| 487 | } |
| 488 | |
| 489 | typedef structcxx . . $ $anonymous_type_d9ab2bfe69464401_1# { |
| 490 | char *namecxx . . $ $anonymous_type_d9ab2bfe69464401_1#name.; |
| 491 | int linecxx . . $ $anonymous_type_d9ab2bfe69464401_1#line.; |
| 492 | int colcxx . . $ $anonymous_type_d9ab2bfe69464401_1#col.; |
| 493 | } ItemDatacxx . . $ ItemData#; |
| 494 | |
| 495 | static void |
| 496 | item_data_freecxx . . $ item_data_free(5d22bdacc48458e8). (gpointercxx . . $ gpointer# data) |
| 497 | { |
| 498 | ItemDatacxx . . $ ItemData# *item_data = data; |
| 499 | |
| 500 | g_freecxx . . $ g_free(5d22bdacc48458e8). (item_data->namecxx . . $ $anonymous_type_d9ab2bfe69464401_1#name.); |
| 501 | g_freecxx . . $ g_free(5d22bdacc48458e8). (item_data); |
| 502 | } |
| 503 | |
| 504 | typedef structcxx . . $ $anonymous_type_d9ab2bfe69464401_2# { |
| 505 | GObjectcxx . . $ GObject# *objectcxx . . $ $anonymous_type_d9ab2bfe69464401_2#object.; |
| 506 | GtkBuildercxx . . $ GtkBuilder# *buildercxx . . $ $anonymous_type_d9ab2bfe69464401_2#builder.; |
| 507 | GSListcxx . . $ GSList# *itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items.; |
| 508 | } GSListSubParserDatacxx . . $ GSListSubParserData#; |
| 509 | |
| 510 | static void |
| 511 | size_group_start_elementcxx . . $ size_group_start_element(1a4a7e835e3f8d1e). (GtkBuildableParseContextcxx . . $ GtkBuildableParseContext# *context, |
| 512 | const char *element_name, |
| 513 | const char **names, |
| 514 | const char **values, |
| 515 | gpointercxx . . $ gpointer# user_data, |
| 516 | GErrorcxx . . $ GError# **error) |
| 517 | { |
| 518 | GSListSubParserDatacxx . . $ GSListSubParserData# *data = (GSListSubParserDatacxx . . $ GSListSubParserData#*)user_data; |
| 519 | |
| 520 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (element_name, "widget") == 0) |
| 521 | { |
| 522 | const char *name; |
| 523 | ItemDatacxx . . $ ItemData# *item_data; |
| 524 | |
| 525 | if (!_gtk_builder_check_parentcxx . . $ _gtk_builder_check_parent(3836c9ef2587c51a). (data->buildercxx . . $ $anonymous_type_d9ab2bfe69464401_2#builder., context, "widgets", error)) |
| 526 | return; |
| 527 | |
| 528 | if (!g_markup_collect_attributescxx . . $ g_markup_collect_attributes(3d48c7fc65feeee5). (element_name, names, values, error, |
| 529 | G_MARKUP_COLLECT_STRINGcxx . . $ G_MARKUP_COLLECT_STRING., "name", &name, |
| 530 | G_MARKUP_COLLECT_INVALIDcxx . . $ G_MARKUP_COLLECT_INVALID.)) |
| 531 | { |
| 532 | _gtk_builder_prefix_errorcxx . . $ _gtk_builder_prefix_error(59d235fd9a2d9107). (data->buildercxx . . $ $anonymous_type_d9ab2bfe69464401_2#builder., context, error); |
| 533 | return; |
| 534 | } |
| 535 | |
| 536 | item_data = g_newcxx . . $ `<external>/1123956534522462559/gmem.h:318:9`! (ItemData, 1); |
| 537 | item_data->namecxx . . $ $anonymous_type_d9ab2bfe69464401_1#name. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (name); |
| 538 | gtk_buildable_parse_context_get_positioncxx . . $ gtk_buildable_parse_context_get_position(cfc09d4d1c1f94ab). (context, &item_data->linecxx . . $ $anonymous_type_d9ab2bfe69464401_1#line., &item_data->colcxx . . $ $anonymous_type_d9ab2bfe69464401_1#col.); |
| 539 | data->itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items. = g_slist_prependcxx . . $ g_slist_prepend(6eb923d8c45a5456). (data->itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items., item_data); |
| 540 | } |
| 541 | else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (element_name, "widgets") == 0) |
| 542 | { |
| 543 | if (!_gtk_builder_check_parentcxx . . $ _gtk_builder_check_parent(3836c9ef2587c51a). (data->buildercxx . . $ $anonymous_type_d9ab2bfe69464401_2#builder., context, "object", error)) |
| 544 | return; |
| 545 | |
| 546 | if (!g_markup_collect_attributescxx . . $ g_markup_collect_attributes(3d48c7fc65feeee5). (element_name, names, values, error, |
| 547 | G_MARKUP_COLLECT_INVALIDcxx . . $ G_MARKUP_COLLECT_INVALID., 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`!, |
| 548 | G_MARKUP_COLLECT_INVALIDcxx . . $ G_MARKUP_COLLECT_INVALID.)) |
| 549 | _gtk_builder_prefix_errorcxx . . $ _gtk_builder_prefix_error(59d235fd9a2d9107). (data->buildercxx . . $ $anonymous_type_d9ab2bfe69464401_2#builder., context, error); |
| 550 | } |
| 551 | else |
| 552 | { |
| 553 | _gtk_builder_error_unhandled_tagcxx . . $ _gtk_builder_error_unhandled_tag(2b9c57ca67e3c118). (data->buildercxx . . $ $anonymous_type_d9ab2bfe69464401_2#builder., context, |
| 554 | "GtkSizeGroup", element_name, |
| 555 | error); |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | static const GtkBuildableParsercxx . . $ GtkBuildableParser# size_group_parsercxx . . $ size_group_parser. = |
| 560 | { |
| 561 | size_group_start_elementcxx . . $ size_group_start_element(1a4a7e835e3f8d1e). |
| 562 | }; |
| 563 | |
| 564 | static gbooleancxx . . $ gboolean# |
| 565 | gtk_size_group_buildable_custom_tag_startcxx . . $ gtk_size_group_buildable_custom_tag_start(b259140ba88dbccf). (GtkBuildablecxx . . $ GtkBuildable# *buildable, |
| 566 | GtkBuildercxx . . $ GtkBuilder# *builder, |
| 567 | GObjectcxx . . $ GObject# *child, |
| 568 | const char *tagname, |
| 569 | GtkBuildableParsercxx . . $ GtkBuildableParser# *parser, |
| 570 | gpointercxx . . $ gpointer# *parser_data) |
| 571 | { |
| 572 | GSListSubParserDatacxx . . $ GSListSubParserData# *data; |
| 573 | |
| 574 | if (child) |
| 575 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 576 | |
| 577 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (tagname, "widgets") == 0) |
| 578 | { |
| 579 | data = g_new0cxx . . $ `<external>/1123956534522462559/gmem.h:335:9`! (GSListSubParserData, 1); |
| 580 | data->itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 581 | data->objectcxx . . $ $anonymous_type_d9ab2bfe69464401_2#object. = G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (buildable); |
| 582 | data->buildercxx . . $ $anonymous_type_d9ab2bfe69464401_2#builder. = builder; |
| 583 | |
| 584 | *parser = size_group_parsercxx . . $ size_group_parser.; |
| 585 | *parser_data = data; |
| 586 | |
| 587 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 588 | } |
| 589 | |
| 590 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 591 | } |
| 592 | |
| 593 | static void |
| 594 | gtk_size_group_buildable_custom_finishedcxx . . $ gtk_size_group_buildable_custom_finished(9c109889ce297a82). (GtkBuildablecxx . . $ GtkBuildable# *buildable, |
| 595 | GtkBuildercxx . . $ GtkBuilder# *builder, |
| 596 | GObjectcxx . . $ GObject# *child, |
| 597 | const char *tagname, |
| 598 | gpointercxx . . $ gpointer# user_data) |
| 599 | { |
| 600 | GSListcxx . . $ GSList# *l; |
| 601 | GSListSubParserDatacxx . . $ GSListSubParserData# *data; |
| 602 | GObjectcxx . . $ GObject# *object; |
| 603 | |
| 604 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (tagname, "widgets") != 0) |
| 605 | return; |
| 606 | |
| 607 | data = (GSListSubParserDatacxx . . $ GSListSubParserData#*)user_data; |
| 608 | data->itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items. = g_slist_reversecxx . . $ g_slist_reverse(e6171a83469a530). (data->itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items.); |
| 609 | |
| 610 | for (l = data->itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items.; l; l = l->nextcxx . . $ _GSList#next.) |
| 611 | { |
| 612 | ItemDatacxx . . $ ItemData# *item_data = l->datacxx . . $ _GSList#data.; |
| 613 | object = _gtk_builder_lookup_objectcxx . . $ _gtk_builder_lookup_object(7fcc22cd455b9e45). (builder, item_data->namecxx . . $ $anonymous_type_d9ab2bfe69464401_1#name., item_data->linecxx . . $ $anonymous_type_d9ab2bfe69464401_1#line., item_data->colcxx . . $ $anonymous_type_d9ab2bfe69464401_1#col.); |
| 614 | if (!object) |
| 615 | continue; |
| 616 | gtk_size_group_add_widgetcxx . . $ gtk_size_group_add_widget(1c29cbce5c69a315). (GTK_SIZE_GROUPcxx . . $ `gtk/gtksizegroup.h:30:9`! (data->object), GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (object)); |
| 617 | } |
| 618 | g_slist_free_fullcxx . . $ g_slist_free_full(5c74ad7c36eb6b1f). (data->itemscxx . . $ $anonymous_type_d9ab2bfe69464401_2#items., item_data_freecxx . . $ item_data_free(5d22bdacc48458e8).); |
| 619 | g_freecxx . . $ g_free(5d22bdacc48458e8). (data); |
| 620 | } |