| 1 | /* |
| 2 | * SPDX-License-Identifier: LGPL-2.1-or-later |
| 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 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 18 | |
| 19 | #include "gtkcenterlayout.h"cxx . . $ `<file>/gtk/gtkcenterlayout.h`/ |
| 20 | |
| 21 | #include "gtkcsspositionvalueprivate.h"cxx . . $ `<file>/gtk/gtkcsspositionvalueprivate.h`/ |
| 22 | #include "gtklayoutchild.h"cxx . . $ `<file>/gtk/gtklayoutchild.h`/ |
| 23 | #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/ |
| 24 | #include "gtksizerequest.h"cxx . . $ `<file>/gtk/gtksizerequest.h`/ |
| 25 | #include "gtkwidgetprivate.h"cxx . . $ `<file>/gtk/gtkwidgetprivate.h`/ |
| 26 | #include "gtkcssnodeprivate.h"cxx . . $ `<file>/gtk/gtkcssnodeprivate.h`/ |
| 27 | |
| 28 | /** |
| 29 | * GtkCenterLayout: |
| 30 | * |
| 31 | * Manages up to three children. |
| 32 | * |
| 33 | * The start widget is allocated at the start of the layout (left in |
| 34 | * left-to-right locales and right in right-to-left ones), and the end |
| 35 | * widget at the end. |
| 36 | * |
| 37 | * The center widget is centered regarding the full width of the layout's. |
| 38 | */ |
| 39 | struct _GtkCenterLayoutcxx . . $ _GtkCenterLayout# |
| 40 | { |
| 41 | GtkLayoutManagercxx . . $ GtkLayoutManager# parent_instancecxx . . $ _GtkCenterLayout#parent_instance.; |
| 42 | |
| 43 | GtkBaselinePositioncxx . . $ GtkBaselinePosition# baseline_poscxx . . $ _GtkCenterLayout#baseline_pos.; |
| 44 | GtkOrientationcxx . . $ GtkOrientation# orientationcxx . . $ _GtkCenterLayout#orientation.; |
| 45 | gbooleancxx . . $ gboolean# shrink_center_lastcxx . . $ _GtkCenterLayout#shrink_center_last.; |
| 46 | |
| 47 | unioncxx . . $ _GtkCenterLayout#$anonymous_type_0# { |
| 48 | structcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1# { |
| 49 | GtkWidgetcxx . . $ GtkWidget# *start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.; |
| 50 | GtkWidgetcxx . . $ GtkWidget# *center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.; |
| 51 | GtkWidgetcxx . . $ GtkWidget# *end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.; |
| 52 | }; |
| 53 | GtkWidgetcxx . . $ GtkWidget# *childrencxx . . $ _GtkCenterLayout#$anonymous_type_0#children.[3]; |
| 54 | }; |
| 55 | }; |
| 56 | |
| 57 | enumcxx . . $ $anonymous_type_429435c790c2e6fd_2# { |
| 58 | PROP_0cxx . . $ PROP_0., |
| 59 | PROP_SHRINK_CENTER_LASTcxx . . $ PROP_SHRINK_CENTER_LAST., |
| 60 | LAST_PROPcxx . . $ LAST_PROP. |
| 61 | }; |
| 62 | |
| 63 | static GParamSpeccxx . . $ GParamSpec# *propscxx . . $ props.[LAST_PROPcxx . . $ LAST_PROP.] = { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, }; |
| 64 | |
| 65 | G_DEFINE_TYPEcxx . . $ `<external>/9567554376676449156/gtype.h:1834:9`! (GtkCenterLayout, gtk_center_layout, GTK_TYPE_LAYOUT_MANAGERcxx . . $ `gtk/gtklayoutmanager.h:28:9`!) |
| 66 | |
| 67 | static int |
| 68 | get_spacingcxx . . $ get_spacing(34fcdf698a98873c). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 69 | GtkCssNodecxx . . $ GtkCssNode# *node) |
| 70 | { |
| 71 | GtkCssStylecxx . . $ GtkCssStyle# *style = gtk_css_node_get_stylecxx . . $ gtk_css_node_get_style(a1a4b0668e9a2428). (node); |
| 72 | GtkCssValuecxx . . $ GtkCssValue# *border_spacing; |
| 73 | int css_spacing; |
| 74 | |
| 75 | border_spacing = style->sizecxx . . $ _GtkCssStyle#size.->border_spacingcxx . . $ _GtkCssSizeValues#border_spacing.; |
| 76 | if (self->orientationcxx . . $ _GtkCenterLayout#orientation. == GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL.) |
| 77 | css_spacing = _gtk_css_position_value_get_xcxx . . $ _gtk_css_position_value_get_x(aaf4d8e9bc9f0cb0). (border_spacing, 100); |
| 78 | else |
| 79 | css_spacing = _gtk_css_position_value_get_ycxx . . $ _gtk_css_position_value_get_y(aaf4d8e9bc9f0cb0). (border_spacing, 100); |
| 80 | |
| 81 | return css_spacing; |
| 82 | } |
| 83 | |
| 84 | static GtkSizeRequestModecxx . . $ GtkSizeRequestMode# |
| 85 | gtk_center_layout_get_request_modecxx . . $ gtk_center_layout_get_request_mode(49eed15cd1f0d10b). (GtkLayoutManagercxx . . $ GtkLayoutManager# *layout_manager, |
| 86 | GtkWidgetcxx . . $ GtkWidget# *widget) |
| 87 | { |
| 88 | GtkCenterLayoutcxx . . $ GtkCenterLayout# *self = GTK_CENTER_LAYOUTcxx . . $ GTK_CENTER_LAYOUT(c9a46933450d7649). (layout_manager); |
| 89 | int count[3] = { 0, 0, 0 }; |
| 90 | |
| 91 | if (self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.) |
| 92 | count[gtk_widget_get_request_modecxx . . $ gtk_widget_get_request_mode(2c9e09fe52fe0412). (self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.)]++; |
| 93 | |
| 94 | if (self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.) |
| 95 | count[gtk_widget_get_request_modecxx . . $ gtk_widget_get_request_mode(2c9e09fe52fe0412). (self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.)]++; |
| 96 | |
| 97 | if (self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.) |
| 98 | count[gtk_widget_get_request_modecxx . . $ gtk_widget_get_request_mode(2c9e09fe52fe0412). (self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.)]++; |
| 99 | |
| 100 | if (!count[GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTHcxx . . $ GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH.] && |
| 101 | !count[GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHTcxx . . $ GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT.]) |
| 102 | return GTK_SIZE_REQUEST_CONSTANT_SIZEcxx . . $ GTK_SIZE_REQUEST_CONSTANT_SIZE.; |
| 103 | else |
| 104 | return count[GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHTcxx . . $ GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT.] > count[GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTHcxx . . $ GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH.] |
| 105 | ? GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHTcxx . . $ GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT. |
| 106 | : GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTHcxx . . $ GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH.; |
| 107 | } |
| 108 | |
| 109 | static void |
| 110 | gtk_center_layout_distributecxx . . $ gtk_center_layout_distribute(ce6e84c135e68f46). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 111 | int for_size, |
| 112 | int size, |
| 113 | int spacing, |
| 114 | GtkRequestedSizecxx . . $ GtkRequestedSize# *sizes) |
| 115 | { |
| 116 | int center_size = 0; |
| 117 | int start_size = 0; |
| 118 | int end_size = 0; |
| 119 | gbooleancxx . . $ gboolean# center_expand = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 120 | gbooleancxx . . $ gboolean# start_expand = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 121 | gbooleancxx . . $ gboolean# end_expand = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 122 | int avail; |
| 123 | int i; |
| 124 | int needed_spacing = 0; |
| 125 | |
| 126 | /* Usable space is really less... */ |
| 127 | for (i = 0; i < 3; i++) |
| 128 | { |
| 129 | if (self->childrencxx . . $ _GtkCenterLayout#$anonymous_type_0#children.[i]) |
| 130 | needed_spacing += spacing; |
| 131 | } |
| 132 | needed_spacing -= spacing; |
| 133 | |
| 134 | sizes[0].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. = sizes[0].natural_sizecxx . . $ _GtkRequestedSize#natural_size. = 0; |
| 135 | sizes[1].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. = sizes[1].natural_sizecxx . . $ _GtkRequestedSize#natural_size. = 0; |
| 136 | sizes[2].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. = sizes[2].natural_sizecxx . . $ _GtkRequestedSize#natural_size. = 0; |
| 137 | |
| 138 | for (i = 0; i < 3; i ++) |
| 139 | { |
| 140 | if (self->childrencxx . . $ _GtkCenterLayout#$anonymous_type_0#children.[i]) |
| 141 | gtk_widget_measurecxx . . $ gtk_widget_measure(d91afbd837fc0c19). (self->childrencxx . . $ _GtkCenterLayout#$anonymous_type_0#children.[i], self->orientationcxx . . $ _GtkCenterLayout#orientation., for_size, |
| 142 | &sizes[i].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size., &sizes[i].natural_sizecxx . . $ _GtkRequestedSize#natural_size., |
| 143 | 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`!); |
| 144 | } |
| 145 | |
| 146 | if (self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.) |
| 147 | { |
| 148 | int natural_size; |
| 149 | |
| 150 | avail = size - needed_spacing - (sizes[0].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. + sizes[2].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.); |
| 151 | |
| 152 | if (self->shrink_center_lastcxx . . $ _GtkCenterLayout#shrink_center_last.) |
| 153 | natural_size = sizes[1].natural_sizecxx . . $ _GtkRequestedSize#natural_size.; |
| 154 | else |
| 155 | natural_size = CLAMPcxx . . $ `<external>/12741050725406041920/gmacros.h:984:9`! (size - needed_spacing - (sizes[0].natural_size + sizes[2].natural_size), sizes[1].minimum_size, sizes[1].natural_size); |
| 156 | |
| 157 | center_size = CLAMPcxx . . $ `<external>/12741050725406041920/gmacros.h:984:9`! (avail, sizes[1].minimum_size, natural_size); |
| 158 | center_expand = gtk_widget_compute_expandcxx . . $ gtk_widget_compute_expand(4898acbd212220bc). (self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget., self->orientationcxx . . $ _GtkCenterLayout#orientation.); |
| 159 | } |
| 160 | |
| 161 | if (self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.) |
| 162 | { |
| 163 | avail = size - needed_spacing - (center_size + sizes[2].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.); |
| 164 | start_size = CLAMPcxx . . $ `<external>/12741050725406041920/gmacros.h:984:9`! (avail, sizes[0].minimum_size, sizes[0].natural_size); |
| 165 | start_expand = gtk_widget_compute_expandcxx . . $ gtk_widget_compute_expand(4898acbd212220bc). (self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget., self->orientationcxx . . $ _GtkCenterLayout#orientation.); |
| 166 | } |
| 167 | |
| 168 | if (self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.) |
| 169 | { |
| 170 | avail = size - needed_spacing - (center_size + sizes[0].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.); |
| 171 | end_size = CLAMPcxx . . $ `<external>/12741050725406041920/gmacros.h:984:9`! (avail, sizes[2].minimum_size, sizes[2].natural_size); |
| 172 | end_expand = gtk_widget_compute_expandcxx . . $ gtk_widget_compute_expand(4898acbd212220bc). (self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget., self->orientationcxx . . $ _GtkCenterLayout#orientation.); |
| 173 | } |
| 174 | |
| 175 | if (self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.) |
| 176 | { |
| 177 | int center_pos; |
| 178 | |
| 179 | center_pos = (size / 2) - (center_size / 2); |
| 180 | |
| 181 | /* Push in from start/end */ |
| 182 | if (start_size > 0 && start_size + spacing > center_pos) |
| 183 | center_pos = start_size + spacing; |
| 184 | else if (end_size > 0 && size - end_size - spacing < center_pos + center_size) |
| 185 | center_pos = size - center_size - end_size - spacing; |
| 186 | else if (center_expand) |
| 187 | { |
| 188 | center_size = size - 2 * (MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (start_size, end_size) + spacing); |
| 189 | center_pos = (size / 2) - (center_size / 2) + spacing; |
| 190 | } |
| 191 | |
| 192 | if (start_expand) |
| 193 | start_size = center_pos - spacing; |
| 194 | |
| 195 | if (end_expand) |
| 196 | end_size = size - (center_pos + center_size) - spacing; |
| 197 | } |
| 198 | else |
| 199 | { |
| 200 | avail = size - needed_spacing - (start_size + end_size); |
| 201 | if (start_expand && end_expand) |
| 202 | { |
| 203 | start_size += avail / 2; |
| 204 | end_size += avail / 2; |
| 205 | } |
| 206 | else if (start_expand) |
| 207 | { |
| 208 | start_size += avail; |
| 209 | } |
| 210 | else if (end_expand) |
| 211 | { |
| 212 | end_size += avail; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | sizes[0].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. = start_size; |
| 217 | sizes[1].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. = center_size; |
| 218 | sizes[2].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. = end_size; |
| 219 | } |
| 220 | |
| 221 | static void |
| 222 | gtk_center_layout_measure_orientationcxx . . $ gtk_center_layout_measure_orientation(8f2d7582c23273bf). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 223 | GtkWidgetcxx . . $ GtkWidget# *widget, |
| 224 | GtkOrientationcxx . . $ GtkOrientation# orientation, |
| 225 | int for_size, |
| 226 | int *minimum, |
| 227 | int *natural, |
| 228 | int *minimum_baseline, |
| 229 | int *natural_baseline) |
| 230 | { |
| 231 | int min[3]; |
| 232 | int nat[3]; |
| 233 | int n_visible_children = 0; |
| 234 | int spacing; |
| 235 | int i; |
| 236 | |
| 237 | spacing = get_spacingcxx . . $ get_spacing(34fcdf698a98873c). (self, gtk_widget_get_css_nodecxx . . $ gtk_widget_get_css_node(e7b0819f4c134bd6). (widget)); |
| 238 | |
| 239 | for (i = 0; i < 3; i ++) |
| 240 | { |
| 241 | GtkWidgetcxx . . $ GtkWidget# *child = self->childrencxx . . $ _GtkCenterLayout#$anonymous_type_0#children.[i]; |
| 242 | |
| 243 | if (child) |
| 244 | { |
| 245 | gtk_widget_measurecxx . . $ gtk_widget_measure(d91afbd837fc0c19). (child, |
| 246 | orientation, |
| 247 | for_size, |
| 248 | &min[i], &nat[i], 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`!); |
| 249 | |
| 250 | if (_gtk_widget_get_visiblecxx . . $ _gtk_widget_get_visible(9247ef2dc26c5426). (child)) |
| 251 | n_visible_children ++; |
| 252 | } |
| 253 | else |
| 254 | { |
| 255 | min[i] = 0; |
| 256 | nat[i] = 0; |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | *minimum = min[0] + min[1] + min[2]; |
| 261 | *natural = nat[1] + 2 * MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (nat[0], nat[2]); |
| 262 | |
| 263 | if (n_visible_children > 0) |
| 264 | { |
| 265 | *minimum += (n_visible_children - 1) * spacing; |
| 266 | *natural += (n_visible_children - 1) * spacing; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | static void |
| 271 | gtk_center_layout_measure_oppositecxx . . $ gtk_center_layout_measure_opposite(ef170986fd07fe5a). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 272 | GtkOrientationcxx . . $ GtkOrientation# orientation, |
| 273 | int for_size, |
| 274 | int *minimum, |
| 275 | int *natural, |
| 276 | int *minimum_baseline, |
| 277 | int *natural_baseline) |
| 278 | { |
| 279 | int child_min, child_nat; |
| 280 | int child_min_baseline, child_nat_baseline; |
| 281 | int total_min, above_min, below_min; |
| 282 | int total_nat, above_nat, below_nat; |
| 283 | GtkWidgetcxx . . $ GtkWidget# *child[3]; |
| 284 | GtkRequestedSizecxx . . $ GtkRequestedSize# sizes[3]; |
| 285 | gbooleancxx . . $ gboolean# have_baseline = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 286 | gbooleancxx . . $ gboolean# align_baseline = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 287 | int i; |
| 288 | |
| 289 | child[0] = self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.; |
| 290 | child[1] = self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.; |
| 291 | child[2] = self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.; |
| 292 | |
| 293 | if (for_size >= 0) |
| 294 | gtk_center_layout_distributecxx . . $ gtk_center_layout_distribute(ce6e84c135e68f46). (self, -1, for_size, 0, sizes); |
| 295 | |
| 296 | above_min = below_min = above_nat = below_nat = -1; |
| 297 | total_min = total_nat = 0; |
| 298 | |
| 299 | for (i = 0; i < 3; i++) |
| 300 | { |
| 301 | if (child[i] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 302 | continue; |
| 303 | |
| 304 | gtk_widget_measurecxx . . $ gtk_widget_measure(d91afbd837fc0c19). (child[i], |
| 305 | orientation, |
| 306 | for_size >= 0 ? sizes[i].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size. : -1, |
| 307 | &child_min, &child_nat, |
| 308 | &child_min_baseline, &child_nat_baseline); |
| 309 | |
| 310 | total_min = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (total_min, child_min); |
| 311 | total_nat = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (total_nat, child_nat); |
| 312 | |
| 313 | if (orientation == GTK_ORIENTATION_VERTICALcxx . . $ GTK_ORIENTATION_VERTICAL. && child_min_baseline >= 0) |
| 314 | { |
| 315 | have_baseline = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 316 | if (gtk_widget_get_valigncxx . . $ gtk_widget_get_valign(66a538eaafe45e9). (child[i]) == GTK_ALIGN_BASELINE_FILLcxx . . $ GTK_ALIGN_BASELINE_FILL. || |
| 317 | gtk_widget_get_valigncxx . . $ gtk_widget_get_valign(66a538eaafe45e9). (child[i]) == GTK_ALIGN_BASELINE_CENTERcxx . . $ GTK_ALIGN_BASELINE_CENTER.) |
| 318 | align_baseline = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 319 | |
| 320 | below_min = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (below_min, child_min - child_min_baseline); |
| 321 | above_min = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (above_min, child_min_baseline); |
| 322 | below_nat = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (below_nat, child_nat - child_nat_baseline); |
| 323 | above_nat = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (above_nat, child_nat_baseline); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | if (have_baseline) |
| 328 | { |
| 329 | int min_baseline = -1; |
| 330 | int nat_baseline = -1; |
| 331 | |
| 332 | if (align_baseline) |
| 333 | { |
| 334 | total_min = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (total_min, above_min + below_min); |
| 335 | total_nat = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (total_nat, above_nat + below_nat); |
| 336 | } |
| 337 | |
| 338 | switch (self->baseline_poscxx . . $ _GtkCenterLayout#baseline_pos.) |
| 339 | { |
| 340 | case GTK_BASELINE_POSITION_TOPcxx . . $ GTK_BASELINE_POSITION_TOP.: |
| 341 | min_baseline = above_min; |
| 342 | nat_baseline = above_nat; |
| 343 | break; |
| 344 | case GTK_BASELINE_POSITION_CENTERcxx . . $ GTK_BASELINE_POSITION_CENTER.: |
| 345 | min_baseline = above_min + (total_min - (above_min + below_min)) / 2; |
| 346 | nat_baseline = above_nat + (total_nat - (above_nat + below_nat)) / 2; |
| 347 | break; |
| 348 | case GTK_BASELINE_POSITION_BOTTOMcxx . . $ GTK_BASELINE_POSITION_BOTTOM.: |
| 349 | min_baseline = total_min - below_min; |
| 350 | nat_baseline = total_nat - below_nat; |
| 351 | break; |
| 352 | default: |
| 353 | break; |
| 354 | } |
| 355 | |
| 356 | if (minimum_baseline) |
| 357 | *minimum_baseline = min_baseline; |
| 358 | if (natural_baseline) |
| 359 | *natural_baseline = nat_baseline; |
| 360 | } |
| 361 | |
| 362 | *minimum = total_min; |
| 363 | *natural = total_nat; |
| 364 | } |
| 365 | |
| 366 | |
| 367 | |
| 368 | static void |
| 369 | gtk_center_layout_measurecxx . . $ gtk_center_layout_measure(824d48019bf1bdbd). (GtkLayoutManagercxx . . $ GtkLayoutManager# *layout_manager, |
| 370 | GtkWidgetcxx . . $ GtkWidget# *widget, |
| 371 | GtkOrientationcxx . . $ GtkOrientation# orientation, |
| 372 | int for_size, |
| 373 | int *minimum, |
| 374 | int *natural, |
| 375 | int *minimum_baseline, |
| 376 | int *natural_baseline) |
| 377 | { |
| 378 | GtkCenterLayoutcxx . . $ GtkCenterLayout# *self = GTK_CENTER_LAYOUTcxx . . $ GTK_CENTER_LAYOUT(c9a46933450d7649). (layout_manager); |
| 379 | |
| 380 | if (self->orientationcxx . . $ _GtkCenterLayout#orientation. == orientation) |
| 381 | gtk_center_layout_measure_orientationcxx . . $ gtk_center_layout_measure_orientation(8f2d7582c23273bf). (self, widget, orientation, for_size, |
| 382 | minimum, natural, minimum_baseline, natural_baseline); |
| 383 | else |
| 384 | gtk_center_layout_measure_oppositecxx . . $ gtk_center_layout_measure_opposite(ef170986fd07fe5a). (self, orientation, for_size, |
| 385 | minimum, natural, minimum_baseline, natural_baseline); |
| 386 | } |
| 387 | |
| 388 | static void |
| 389 | gtk_center_layout_allocatecxx . . $ gtk_center_layout_allocate(e6424d224fe975e6). (GtkLayoutManagercxx . . $ GtkLayoutManager# *layout_manager, |
| 390 | GtkWidgetcxx . . $ GtkWidget# *widget, |
| 391 | int width, |
| 392 | int height, |
| 393 | int baseline) |
| 394 | { |
| 395 | GtkCenterLayoutcxx . . $ GtkCenterLayout# *self = GTK_CENTER_LAYOUTcxx . . $ GTK_CENTER_LAYOUT(c9a46933450d7649). (layout_manager); |
| 396 | GtkWidgetcxx . . $ GtkWidget# *child[3]; |
| 397 | int child_size[3]; |
| 398 | int child_pos[3]; |
| 399 | GtkRequestedSizecxx . . $ GtkRequestedSize# sizes[3]; |
| 400 | int size; |
| 401 | int for_size; |
| 402 | int i; |
| 403 | int spacing; |
| 404 | |
| 405 | spacing = get_spacingcxx . . $ get_spacing(34fcdf698a98873c). (self, gtk_widget_get_css_nodecxx . . $ gtk_widget_get_css_node(e7b0819f4c134bd6). (widget)); |
| 406 | |
| 407 | if (self->orientationcxx . . $ _GtkCenterLayout#orientation. == GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL.) |
| 408 | { |
| 409 | size = width; |
| 410 | for_size = height; |
| 411 | } |
| 412 | else |
| 413 | { |
| 414 | size = height; |
| 415 | for_size = width; |
| 416 | baseline = -1; |
| 417 | } |
| 418 | |
| 419 | /* Allocate child sizes */ |
| 420 | |
| 421 | gtk_center_layout_distributecxx . . $ gtk_center_layout_distribute(ce6e84c135e68f46). (self, for_size, size, spacing, sizes); |
| 422 | |
| 423 | child[1] = self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.; |
| 424 | child_size[1] = sizes[1].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.; |
| 425 | |
| 426 | if (self->orientationcxx . . $ _GtkCenterLayout#orientation. == GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL. && |
| 427 | gtk_widget_get_directioncxx . . $ gtk_widget_get_direction(a6537c3bfdacec30). (widget) == GTK_TEXT_DIR_RTLcxx . . $ GTK_TEXT_DIR_RTL.) |
| 428 | { |
| 429 | child[0] = self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.; |
| 430 | child[2] = self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.; |
| 431 | child_size[0] = sizes[2].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.; |
| 432 | child_size[2] = sizes[0].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.; |
| 433 | } |
| 434 | else |
| 435 | { |
| 436 | child[0] = self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.; |
| 437 | child[2] = self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.; |
| 438 | child_size[0] = sizes[0].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.; |
| 439 | child_size[2] = sizes[2].minimum_sizecxx . . $ _GtkRequestedSize#minimum_size.; |
| 440 | } |
| 441 | |
| 442 | /* Determine baseline */ |
| 443 | if (self->orientationcxx . . $ _GtkCenterLayout#orientation. == GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL. && |
| 444 | baseline == -1) |
| 445 | { |
| 446 | int min_above, nat_above; |
| 447 | int min_below, nat_below; |
| 448 | gbooleancxx . . $ gboolean# have_baseline; |
| 449 | |
| 450 | have_baseline = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 451 | min_above = nat_above = 0; |
| 452 | min_below = nat_below = 0; |
| 453 | |
| 454 | for (i = 0; i < 3; i++) |
| 455 | { |
| 456 | if (child[i] && |
| 457 | (gtk_widget_get_valigncxx . . $ gtk_widget_get_valign(66a538eaafe45e9). (child[i]) == GTK_ALIGN_BASELINE_FILLcxx . . $ GTK_ALIGN_BASELINE_FILL. || |
| 458 | gtk_widget_get_valigncxx . . $ gtk_widget_get_valign(66a538eaafe45e9). (child[i]) == GTK_ALIGN_BASELINE_CENTERcxx . . $ GTK_ALIGN_BASELINE_CENTER.)) |
| 459 | { |
| 460 | int child_min_height, child_nat_height; |
| 461 | int child_min_baseline, child_nat_baseline; |
| 462 | |
| 463 | child_min_baseline = child_nat_baseline = -1; |
| 464 | |
| 465 | gtk_widget_measurecxx . . $ gtk_widget_measure(d91afbd837fc0c19). (child[i], GTK_ORIENTATION_VERTICALcxx . . $ GTK_ORIENTATION_VERTICAL., |
| 466 | child_size[i], |
| 467 | &child_min_height, &child_nat_height, |
| 468 | &child_min_baseline, &child_nat_baseline); |
| 469 | |
| 470 | if (child_min_baseline >= 0) |
| 471 | { |
| 472 | have_baseline = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 473 | min_below = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (min_below, child_min_height - child_min_baseline); |
| 474 | nat_below = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (nat_below, child_nat_height - child_nat_baseline); |
| 475 | min_above = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (min_above, child_min_baseline); |
| 476 | nat_above = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (nat_above, child_nat_baseline); |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | if (have_baseline) |
| 482 | { |
| 483 | /* TODO: This is purely based on the minimum baseline. |
| 484 | * When things fit we should use the natural one |
| 485 | */ |
| 486 | switch (self->baseline_poscxx . . $ _GtkCenterLayout#baseline_pos.) |
| 487 | { |
| 488 | default: |
| 489 | case GTK_BASELINE_POSITION_TOPcxx . . $ GTK_BASELINE_POSITION_TOP.: |
| 490 | baseline = min_above; |
| 491 | break; |
| 492 | case GTK_BASELINE_POSITION_CENTERcxx . . $ GTK_BASELINE_POSITION_CENTER.: |
| 493 | baseline = min_above + (height - (min_above + min_below)) / 2; |
| 494 | break; |
| 495 | case GTK_BASELINE_POSITION_BOTTOMcxx . . $ GTK_BASELINE_POSITION_BOTTOM.: |
| 496 | baseline = height - min_below; |
| 497 | break; |
| 498 | } |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | /* Allocate child positions */ |
| 503 | |
| 504 | child_pos[0] = 0; |
| 505 | child_pos[1] = (size / 2) - (child_size[1] / 2); |
| 506 | child_pos[2] = size - child_size[2]; |
| 507 | |
| 508 | if (child[1]) |
| 509 | { |
| 510 | /* Push in from start/end */ |
| 511 | if (child_size[0] > 0 && child_size[0] + spacing > child_pos[1]) |
| 512 | child_pos[1] = child_size[0] + spacing; |
| 513 | else if (child_size[2] > 0 && size - child_size[2] - spacing < child_pos[1] + child_size[1]) |
| 514 | child_pos[1] = size - child_size[1] - child_size[2] - spacing; |
| 515 | } |
| 516 | |
| 517 | for (i = 0; i < 3; i++) |
| 518 | { |
| 519 | GtkAllocationcxx . . $ GtkAllocation# child_allocation; |
| 520 | |
| 521 | if (child[i] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 522 | continue; |
| 523 | |
| 524 | if (self->orientationcxx . . $ _GtkCenterLayout#orientation. == GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL.) |
| 525 | { |
| 526 | child_allocation.xcxx . . $ _cairo_rectangle_int#x. = child_pos[i]; |
| 527 | child_allocation.ycxx . . $ _cairo_rectangle_int#y. = 0; |
| 528 | child_allocation.widthcxx . . $ _cairo_rectangle_int#width. = child_size[i]; |
| 529 | child_allocation.heightcxx . . $ _cairo_rectangle_int#height. = height; |
| 530 | } |
| 531 | else |
| 532 | { |
| 533 | child_allocation.xcxx . . $ _cairo_rectangle_int#x. = 0; |
| 534 | child_allocation.ycxx . . $ _cairo_rectangle_int#y. = child_pos[i]; |
| 535 | child_allocation.widthcxx . . $ _cairo_rectangle_int#width. = width; |
| 536 | child_allocation.heightcxx . . $ _cairo_rectangle_int#height. = child_size[i]; |
| 537 | } |
| 538 | |
| 539 | gtk_widget_size_allocatecxx . . $ gtk_widget_size_allocate(6dbef67925be57e3). (child[i], &child_allocation, baseline); |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | static void |
| 544 | gtk_center_layout_set_propertycxx . . $ gtk_center_layout_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object, |
| 545 | guintcxx . . $ guint# prop_id, |
| 546 | const GValuecxx . . $ GValue# *value, |
| 547 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 548 | { |
| 549 | GtkCenterLayoutcxx . . $ GtkCenterLayout# *self = GTK_CENTER_LAYOUTcxx . . $ GTK_CENTER_LAYOUT(c9a46933450d7649). (object); |
| 550 | |
| 551 | switch (prop_id) |
| 552 | { |
| 553 | case PROP_SHRINK_CENTER_LASTcxx . . $ PROP_SHRINK_CENTER_LAST.: |
| 554 | gtk_center_layout_set_shrink_center_lastcxx . . $ gtk_center_layout_set_shrink_center_last(e40981b9b1d2f36d). (self, g_value_get_booleancxx . . $ g_value_get_boolean(f890c5c75ead5b21). (value)); |
| 555 | break; |
| 556 | |
| 557 | default: |
| 558 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 559 | break; |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | static void |
| 564 | gtk_center_layout_get_propertycxx . . $ gtk_center_layout_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object, |
| 565 | guintcxx . . $ guint# prop_id, |
| 566 | GValuecxx . . $ GValue# *value, |
| 567 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 568 | { |
| 569 | GtkCenterLayoutcxx . . $ GtkCenterLayout# *self = GTK_CENTER_LAYOUTcxx . . $ GTK_CENTER_LAYOUT(c9a46933450d7649). (object); |
| 570 | |
| 571 | switch (prop_id) |
| 572 | { |
| 573 | case PROP_SHRINK_CENTER_LASTcxx . . $ PROP_SHRINK_CENTER_LAST.: |
| 574 | g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, self->shrink_center_lastcxx . . $ _GtkCenterLayout#shrink_center_last.); |
| 575 | break; |
| 576 | |
| 577 | default: |
| 578 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 579 | break; |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | static void |
| 584 | gtk_center_layout_disposecxx . . $ gtk_center_layout_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 585 | { |
| 586 | GtkCenterLayoutcxx . . $ GtkCenterLayout# *self = GTK_CENTER_LAYOUTcxx . . $ GTK_CENTER_LAYOUT(c9a46933450d7649). (object); |
| 587 | |
| 588 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->start_widget); |
| 589 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->center_widget); |
| 590 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->end_widget); |
| 591 | |
| 592 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_center_layout_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object); |
| 593 | } |
| 594 | |
| 595 | static void |
| 596 | gtk_center_layout_class_initcxx . . $ gtk_center_layout_class_init(dd1e1f443ce6d56b). (GtkCenterLayoutClasscxx . . $ GtkCenterLayoutClass# *klass) |
| 597 | { |
| 598 | GObjectClasscxx . . $ GObjectClass# *object_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass); |
| 599 | GtkLayoutManagerClasscxx . . $ GtkLayoutManagerClass# *layout_class = GTK_LAYOUT_MANAGER_CLASScxx . . $ GTK_LAYOUT_MANAGER_CLASS(51ff573bf97a10cd). (klass); |
| 600 | |
| 601 | object_class->get_propertycxx . . $ _GObjectClass#get_property. = gtk_center_layout_get_propertycxx . . $ gtk_center_layout_get_property(cee2c52f22407c66).; |
| 602 | object_class->set_propertycxx . . $ _GObjectClass#set_property. = gtk_center_layout_set_propertycxx . . $ gtk_center_layout_set_property(d7c4bb29f36c0dc4).; |
| 603 | object_class->disposecxx . . $ _GObjectClass#dispose. = gtk_center_layout_disposecxx . . $ gtk_center_layout_dispose(6087475fa43034d3).; |
| 604 | |
| 605 | layout_class->get_request_modecxx . . $ _GtkLayoutManagerClass#get_request_mode. = gtk_center_layout_get_request_modecxx . . $ gtk_center_layout_get_request_mode(49eed15cd1f0d10b).; |
| 606 | layout_class->measurecxx . . $ _GtkLayoutManagerClass#measure. = gtk_center_layout_measurecxx . . $ gtk_center_layout_measure(824d48019bf1bdbd).; |
| 607 | layout_class->allocatecxx . . $ _GtkLayoutManagerClass#allocate. = gtk_center_layout_allocatecxx . . $ gtk_center_layout_allocate(e6424d224fe975e6).; |
| 608 | |
| 609 | /** |
| 610 | * GtkCenterLayout:shrink-center-last: |
| 611 | * |
| 612 | * Whether to shrink the center widget after other children. |
| 613 | * |
| 614 | * By default, when there's no space to give all three children their |
| 615 | * natural widths, the start and end widgets start shrinking and the |
| 616 | * center child keeps natural width until they reach minimum width. |
| 617 | * |
| 618 | * If set to `FALSE`, start and end widgets keep natural width and the |
| 619 | * center widget starts shrinking instead. |
| 620 | * |
| 621 | * Since: 4.12 |
| 622 | */ |
| 623 | propscxx . . $ props.[PROP_SHRINK_CENTER_LASTcxx . . $ PROP_SHRINK_CENTER_LAST.] = |
| 624 | g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("shrink-center-last", 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`!, |
| 625 | TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, |
| 626 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`!|G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 627 | |
| 628 | g_object_class_install_propertiescxx . . $ g_object_class_install_properties(569d03e6a4088541). (object_class, LAST_PROPcxx . . $ LAST_PROP., propscxx . . $ props.); |
| 629 | } |
| 630 | |
| 631 | static void |
| 632 | gtk_center_layout_initcxx . . $ gtk_center_layout_init(9f5dc0f2cd398de). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self) |
| 633 | { |
| 634 | self->orientationcxx . . $ _GtkCenterLayout#orientation. = GTK_ORIENTATION_HORIZONTALcxx . . $ GTK_ORIENTATION_HORIZONTAL.; |
| 635 | self->baseline_poscxx . . $ _GtkCenterLayout#baseline_pos. = GTK_BASELINE_POSITION_CENTERcxx . . $ GTK_BASELINE_POSITION_CENTER.; |
| 636 | self->shrink_center_lastcxx . . $ _GtkCenterLayout#shrink_center_last. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 637 | } |
| 638 | |
| 639 | /** |
| 640 | * gtk_center_layout_new: |
| 641 | * |
| 642 | * Creates a new `GtkCenterLayout`. |
| 643 | * |
| 644 | * Returns: the newly created `GtkCenterLayout` |
| 645 | */ |
| 646 | GtkLayoutManagercxx . . $ GtkLayoutManager# * |
| 647 | gtk_center_layout_newcxx . . $ gtk_center_layout_new(487a1448eb6d33ac). (void) |
| 648 | { |
| 649 | return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_CENTER_LAYOUTcxx . . $ `gtk/gtkcenterlayout.h:24:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 650 | } |
| 651 | |
| 652 | /** |
| 653 | * gtk_center_layout_set_orientation: |
| 654 | * @self: a `GtkCenterLayout` |
| 655 | * @orientation: the new orientation |
| 656 | * |
| 657 | * Sets the orientation of @self. |
| 658 | */ |
| 659 | void |
| 660 | gtk_center_layout_set_orientationcxx . . $ gtk_center_layout_set_orientation(ae9f141442fca2f). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 661 | GtkOrientationcxx . . $ GtkOrientation# orientation) |
| 662 | { |
| 663 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CENTER_LAYOUT (self)); |
| 664 | |
| 665 | if (orientation != self->orientationcxx . . $ _GtkCenterLayout#orientation.) |
| 666 | { |
| 667 | self->orientationcxx . . $ _GtkCenterLayout#orientation. = orientation; |
| 668 | gtk_layout_manager_layout_changedcxx . . $ gtk_layout_manager_layout_changed(c40d8ba1643043c7). (GTK_LAYOUT_MANAGERcxx . . $ GTK_LAYOUT_MANAGER(84e9acc593a3a2e). (self)); |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | /** |
| 673 | * gtk_center_layout_get_orientation: |
| 674 | * @self: a `GtkCenterLayout` |
| 675 | * |
| 676 | * Gets the current orienration of the layout manager. |
| 677 | * |
| 678 | * Returns: The current orientation of @self |
| 679 | */ |
| 680 | GtkOrientationcxx . . $ GtkOrientation# |
| 681 | gtk_center_layout_get_orientationcxx . . $ gtk_center_layout_get_orientation(a63bb605fbefe5b5). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self) |
| 682 | { |
| 683 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CENTER_LAYOUT (self), GTK_ORIENTATION_HORIZONTAL); |
| 684 | |
| 685 | return self->orientationcxx . . $ _GtkCenterLayout#orientation.; |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * gtk_center_layout_set_baseline_position: |
| 690 | * @self: a `GtkCenterLayout` |
| 691 | * @baseline_position: the new baseline position |
| 692 | * |
| 693 | * Sets the new baseline position of @self |
| 694 | */ |
| 695 | void |
| 696 | gtk_center_layout_set_baseline_positioncxx . . $ gtk_center_layout_set_baseline_position(a7598dd66afb66cb). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 697 | GtkBaselinePositioncxx . . $ GtkBaselinePosition# baseline_position) |
| 698 | { |
| 699 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CENTER_LAYOUT (self)); |
| 700 | |
| 701 | if (baseline_position != self->baseline_poscxx . . $ _GtkCenterLayout#baseline_pos.) |
| 702 | { |
| 703 | self->baseline_poscxx . . $ _GtkCenterLayout#baseline_pos. = baseline_position; |
| 704 | gtk_layout_manager_layout_changedcxx . . $ gtk_layout_manager_layout_changed(c40d8ba1643043c7). (GTK_LAYOUT_MANAGERcxx . . $ GTK_LAYOUT_MANAGER(84e9acc593a3a2e). (self)); |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | /** |
| 709 | * gtk_center_layout_get_baseline_position: |
| 710 | * @self: a `GtkCenterLayout` |
| 711 | * |
| 712 | * Returns the baseline position of the layout. |
| 713 | * |
| 714 | * Returns: The current baseline position of @self. |
| 715 | */ |
| 716 | GtkBaselinePositioncxx . . $ GtkBaselinePosition# |
| 717 | gtk_center_layout_get_baseline_positioncxx . . $ gtk_center_layout_get_baseline_position(5c7fd991aaed249c). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self) |
| 718 | { |
| 719 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CENTER_LAYOUT (self), GTK_BASELINE_POSITION_TOP); |
| 720 | |
| 721 | return self->baseline_poscxx . . $ _GtkCenterLayout#baseline_pos.; |
| 722 | } |
| 723 | |
| 724 | /** |
| 725 | * gtk_center_layout_set_start_widget: |
| 726 | * @self: a `GtkCenterLayout` |
| 727 | * @widget: (nullable): the new start widget |
| 728 | * |
| 729 | * Sets the new start widget of @self. |
| 730 | * |
| 731 | * To remove the existing start widget, pass %NULL. |
| 732 | */ |
| 733 | void |
| 734 | gtk_center_layout_set_start_widgetcxx . . $ gtk_center_layout_set_start_widget(286708e1476628f6). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 735 | GtkWidgetcxx . . $ GtkWidget# *widget) |
| 736 | { |
| 737 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CENTER_LAYOUT (self)); |
| 738 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (widget == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (widget)); |
| 739 | |
| 740 | if (g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&self->start_widget, widget)) |
| 741 | gtk_layout_manager_layout_changedcxx . . $ gtk_layout_manager_layout_changed(c40d8ba1643043c7). (GTK_LAYOUT_MANAGERcxx . . $ GTK_LAYOUT_MANAGER(84e9acc593a3a2e). (self)); |
| 742 | } |
| 743 | |
| 744 | /** |
| 745 | * gtk_center_layout_get_start_widget: |
| 746 | * @self: a `GtkCenterLayout` |
| 747 | * |
| 748 | * Returns the start widget of the layout. |
| 749 | * |
| 750 | * Returns: (nullable) (transfer none): The current start widget of @self |
| 751 | */ |
| 752 | GtkWidgetcxx . . $ GtkWidget# * |
| 753 | gtk_center_layout_get_start_widgetcxx . . $ gtk_center_layout_get_start_widget(f8dbaf810b02d56a). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self) |
| 754 | { |
| 755 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CENTER_LAYOUT (self), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 756 | |
| 757 | return self->start_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#start_widget.; |
| 758 | } |
| 759 | |
| 760 | /** |
| 761 | * gtk_center_layout_set_center_widget: |
| 762 | * @self: a `GtkCenterLayout` |
| 763 | * @widget: (nullable): the new center widget |
| 764 | * |
| 765 | * Sets the new center widget of @self. |
| 766 | * |
| 767 | * To remove the existing center widget, pass %NULL. |
| 768 | */ |
| 769 | void |
| 770 | gtk_center_layout_set_center_widgetcxx . . $ gtk_center_layout_set_center_widget(286708e1476628f6). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 771 | GtkWidgetcxx . . $ GtkWidget# *widget) |
| 772 | { |
| 773 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CENTER_LAYOUT (self)); |
| 774 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (widget == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (widget)); |
| 775 | |
| 776 | if (g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&self->center_widget, widget)) |
| 777 | gtk_layout_manager_layout_changedcxx . . $ gtk_layout_manager_layout_changed(c40d8ba1643043c7). (GTK_LAYOUT_MANAGERcxx . . $ GTK_LAYOUT_MANAGER(84e9acc593a3a2e). (self)); |
| 778 | } |
| 779 | |
| 780 | /** |
| 781 | * gtk_center_layout_get_center_widget: |
| 782 | * @self: a `GtkCenterLayout` |
| 783 | * |
| 784 | * Returns the center widget of the layout. |
| 785 | * |
| 786 | * Returns: (nullable) (transfer none): the current center widget of @self |
| 787 | */ |
| 788 | GtkWidgetcxx . . $ GtkWidget# * |
| 789 | gtk_center_layout_get_center_widgetcxx . . $ gtk_center_layout_get_center_widget(f8dbaf810b02d56a). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self) |
| 790 | { |
| 791 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CENTER_LAYOUT (self), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 792 | |
| 793 | return self->center_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#center_widget.; |
| 794 | } |
| 795 | |
| 796 | /** |
| 797 | * gtk_center_layout_set_end_widget: |
| 798 | * @self: a `GtkCenterLayout` |
| 799 | * @widget: (nullable): the new end widget |
| 800 | * |
| 801 | * Sets the new end widget of @self. |
| 802 | * |
| 803 | * To remove the existing center widget, pass %NULL. |
| 804 | */ |
| 805 | void |
| 806 | gtk_center_layout_set_end_widgetcxx . . $ gtk_center_layout_set_end_widget(286708e1476628f6). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 807 | GtkWidgetcxx . . $ GtkWidget# *widget) |
| 808 | { |
| 809 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CENTER_LAYOUT (self)); |
| 810 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (widget == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (widget)); |
| 811 | |
| 812 | if (g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&self->end_widget, widget)) |
| 813 | gtk_layout_manager_layout_changedcxx . . $ gtk_layout_manager_layout_changed(c40d8ba1643043c7). (GTK_LAYOUT_MANAGERcxx . . $ GTK_LAYOUT_MANAGER(84e9acc593a3a2e). (self)); |
| 814 | } |
| 815 | |
| 816 | /** |
| 817 | * gtk_center_layout_get_end_widget: |
| 818 | * @self: a `GtkCenterLayout` |
| 819 | * |
| 820 | * Returns the end widget of the layout. |
| 821 | * |
| 822 | * Returns: (nullable) (transfer none): the current end widget of @self |
| 823 | */ |
| 824 | GtkWidgetcxx . . $ GtkWidget# * |
| 825 | gtk_center_layout_get_end_widgetcxx . . $ gtk_center_layout_get_end_widget(f8dbaf810b02d56a). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self) |
| 826 | { |
| 827 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CENTER_LAYOUT (self), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 828 | |
| 829 | return self->end_widgetcxx . . $ _GtkCenterLayout#$anonymous_type_0#$anonymous_type_1#end_widget.; |
| 830 | } |
| 831 | |
| 832 | /** |
| 833 | * gtk_center_layout_set_shrink_center_last: |
| 834 | * @self: a `GtkCenterLayout` |
| 835 | * @shrink_center_last: whether to shrink the center widget after others |
| 836 | * |
| 837 | * Sets whether to shrink the center widget after other children. |
| 838 | * |
| 839 | * By default, when there's no space to give all three children their |
| 840 | * natural widths, the start and end widgets start shrinking and the |
| 841 | * center child keeps natural width until they reach minimum width. |
| 842 | * |
| 843 | * If set to `FALSE`, start and end widgets keep natural width and the |
| 844 | * center widget starts shrinking instead. |
| 845 | * |
| 846 | * Since: 4.12 |
| 847 | */ |
| 848 | void |
| 849 | gtk_center_layout_set_shrink_center_lastcxx . . $ gtk_center_layout_set_shrink_center_last(e40981b9b1d2f36d). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self, |
| 850 | gbooleancxx . . $ gboolean# shrink_center_last) |
| 851 | { |
| 852 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_CENTER_LAYOUT (self)); |
| 853 | |
| 854 | shrink_center_last = !!shrink_center_last; |
| 855 | |
| 856 | if (shrink_center_last == self->shrink_center_lastcxx . . $ _GtkCenterLayout#shrink_center_last.) |
| 857 | return; |
| 858 | |
| 859 | self->shrink_center_lastcxx . . $ _GtkCenterLayout#shrink_center_last. = shrink_center_last; |
| 860 | |
| 861 | gtk_layout_manager_layout_changedcxx . . $ gtk_layout_manager_layout_changed(c40d8ba1643043c7). (GTK_LAYOUT_MANAGERcxx . . $ GTK_LAYOUT_MANAGER(84e9acc593a3a2e). (self)); |
| 862 | |
| 863 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propscxx . . $ props.[PROP_SHRINK_CENTER_LASTcxx . . $ PROP_SHRINK_CENTER_LAST.]); |
| 864 | } |
| 865 | |
| 866 | /** |
| 867 | * gtk_center_layout_get_shrink_center_last: |
| 868 | * @self: a `GtkCenterLayout` |
| 869 | * |
| 870 | * Gets whether @self shrinks the center widget after other children. |
| 871 | * |
| 872 | * Returns: whether to shrink the center widget after others |
| 873 | * |
| 874 | * Since: 4.12 |
| 875 | */ |
| 876 | gbooleancxx . . $ gboolean# |
| 877 | gtk_center_layout_get_shrink_center_lastcxx . . $ gtk_center_layout_get_shrink_center_last(51bbd7e246acfecc). (GtkCenterLayoutcxx . . $ GtkCenterLayout# *self) |
| 878 | { |
| 879 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_CENTER_LAYOUT (self), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 880 | |
| 881 | return self->shrink_center_lastcxx . . $ _GtkCenterLayout#shrink_center_last.; |
| 882 | } |