1 /* gtkcellareaboxcontext.c
3 * Copyright (C) 2010 Openismus GmbH
6 * Tristan Van Berkom <tristanvb@openismus.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 #include "gtkcellareabox.h"
27 #include "gtkcellareaboxcontext.h"
28 #include "gtkorientable.h"
31 static void gtk_cell_area_box_context_finalize (GObject *object);
33 /* GtkCellAreaContextClass */
34 static void gtk_cell_area_box_context_flush_preferred_width (GtkCellAreaContext *context);
35 static void gtk_cell_area_box_context_flush_preferred_height_for_width (GtkCellAreaContext *context,
37 static void gtk_cell_area_box_context_flush_preferred_height (GtkCellAreaContext *context);
38 static void gtk_cell_area_box_context_flush_preferred_width_for_height (GtkCellAreaContext *context,
40 static void gtk_cell_area_box_context_flush_allocation (GtkCellAreaContext *context);
41 static void gtk_cell_area_box_context_sum_preferred_width (GtkCellAreaContext *context);
42 static void gtk_cell_area_box_context_sum_preferred_height_for_width (GtkCellAreaContext *context,
44 static void gtk_cell_area_box_context_sum_preferred_height (GtkCellAreaContext *context);
45 static void gtk_cell_area_box_context_sum_preferred_width_for_height (GtkCellAreaContext *context,
47 static void gtk_cell_area_box_context_allocate_width (GtkCellAreaContext *context,
49 static void gtk_cell_area_box_context_allocate_height (GtkCellAreaContext *context,
52 static void free_cache_array (GArray *array);
54 /* CachedSize management */
66 struct _GtkCellAreaBoxContextPrivate
68 /* Table of per renderer CachedSizes */
72 /* Table of per height/width hash tables of per renderer CachedSizes */
76 /* Allocation info for this context if any */
79 gint n_orientation_allocs;
80 GtkCellAreaBoxAllocation *orientation_allocs;
83 G_DEFINE_TYPE (GtkCellAreaBoxContext, gtk_cell_area_box_context, GTK_TYPE_CELL_AREA_CONTEXT);
86 free_cache_array (GArray *array)
88 g_array_free (array, TRUE);
92 gtk_cell_area_box_context_init (GtkCellAreaBoxContext *box_context)
94 GtkCellAreaBoxContextPrivate *priv;
96 box_context->priv = G_TYPE_INSTANCE_GET_PRIVATE (box_context,
97 GTK_TYPE_CELL_AREA_BOX_CONTEXT,
98 GtkCellAreaBoxContextPrivate);
99 priv = box_context->priv;
101 priv->base_widths = g_array_new (FALSE, TRUE, sizeof (BaseSize));
102 priv->base_heights = g_array_new (FALSE, TRUE, sizeof (BaseSize));
104 priv->widths = g_hash_table_new_full (g_direct_hash, g_direct_equal,
105 NULL, (GDestroyNotify)free_cache_array);
106 priv->heights = g_hash_table_new_full (g_direct_hash, g_direct_equal,
107 NULL, (GDestroyNotify)free_cache_array);
109 priv->alloc_width = 0;
110 priv->alloc_height = 0;
111 priv->orientation_allocs = NULL;
112 priv->n_orientation_allocs = 0;
116 gtk_cell_area_box_context_class_init (GtkCellAreaBoxContextClass *class)
118 GObjectClass *object_class = G_OBJECT_CLASS (class);
119 GtkCellAreaContextClass *context_class = GTK_CELL_AREA_CONTEXT_CLASS (class);
122 object_class->finalize = gtk_cell_area_box_context_finalize;
124 context_class->flush_preferred_width = gtk_cell_area_box_context_flush_preferred_width;
125 context_class->flush_preferred_height_for_width = gtk_cell_area_box_context_flush_preferred_height_for_width;
126 context_class->flush_preferred_height = gtk_cell_area_box_context_flush_preferred_height;
127 context_class->flush_preferred_width_for_height = gtk_cell_area_box_context_flush_preferred_width_for_height;
128 context_class->flush_allocation = gtk_cell_area_box_context_flush_allocation;
130 context_class->sum_preferred_width = gtk_cell_area_box_context_sum_preferred_width;
131 context_class->sum_preferred_height_for_width = gtk_cell_area_box_context_sum_preferred_height_for_width;
132 context_class->sum_preferred_height = gtk_cell_area_box_context_sum_preferred_height;
133 context_class->sum_preferred_width_for_height = gtk_cell_area_box_context_sum_preferred_width_for_height;
135 context_class->allocate_width = gtk_cell_area_box_context_allocate_width;
136 context_class->allocate_height = gtk_cell_area_box_context_allocate_height;
138 g_type_class_add_private (object_class, sizeof (GtkCellAreaBoxContextPrivate));
141 /*************************************************************
143 *************************************************************/
145 gtk_cell_area_box_context_finalize (GObject *object)
147 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (object);
148 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
150 g_array_free (priv->base_widths, TRUE);
151 g_array_free (priv->base_heights, TRUE);
152 g_hash_table_destroy (priv->widths);
153 g_hash_table_destroy (priv->heights);
155 g_free (priv->orientation_allocs);
157 G_OBJECT_CLASS (gtk_cell_area_box_context_parent_class)->finalize (object);
160 /*************************************************************
161 * GtkCellAreaContextClass *
162 *************************************************************/
164 gtk_cell_area_box_context_flush_preferred_width (GtkCellAreaContext *context)
166 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
167 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
170 for (i = 0; i < priv->base_widths->len; i++)
172 BaseSize *size = &g_array_index (priv->base_widths, BaseSize, i);
178 GTK_CELL_AREA_CONTEXT_CLASS
179 (gtk_cell_area_box_context_parent_class)->flush_preferred_width (context);
183 gtk_cell_area_box_context_flush_preferred_height_for_width (GtkCellAreaContext *context,
186 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
187 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
189 /* Flush all sizes for special -1 value */
191 g_hash_table_remove_all (priv->heights);
193 g_hash_table_remove (priv->heights, GINT_TO_POINTER (width));
195 GTK_CELL_AREA_CONTEXT_CLASS
196 (gtk_cell_area_box_context_parent_class)->flush_preferred_height_for_width (context, width);
200 gtk_cell_area_box_context_flush_preferred_height (GtkCellAreaContext *context)
202 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
203 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
206 for (i = 0; i < priv->base_heights->len; i++)
208 BaseSize *size = &g_array_index (priv->base_heights, BaseSize, i);
214 GTK_CELL_AREA_CONTEXT_CLASS
215 (gtk_cell_area_box_context_parent_class)->flush_preferred_height (context);
219 gtk_cell_area_box_context_flush_preferred_width_for_height (GtkCellAreaContext *context,
222 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
223 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
225 /* Flush all sizes for special -1 value */
227 g_hash_table_remove_all (priv->widths);
229 g_hash_table_remove (priv->widths, GINT_TO_POINTER (height));
231 GTK_CELL_AREA_CONTEXT_CLASS
232 (gtk_cell_area_box_context_parent_class)->flush_preferred_width_for_height (context, height);
236 gtk_cell_area_box_context_flush_allocation (GtkCellAreaContext *context)
238 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
239 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
241 g_free (priv->orientation_allocs);
242 priv->orientation_allocs = NULL;
243 priv->n_orientation_allocs = 0;
247 gtk_cell_area_box_context_sum_preferred_width (GtkCellAreaContext *context)
249 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
250 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
252 GtkOrientation orientation;
254 gint min_size = 0, nat_size = 0;
256 area = gtk_cell_area_context_get_area (context);
257 spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
258 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
260 for (i = 0; i < priv->base_widths->len; i++)
262 BaseSize *size = &g_array_index (priv->base_widths, BaseSize, i);
264 if (orientation == GTK_ORIENTATION_HORIZONTAL)
266 /* Dont add spacing for 0 size groups, they can be 0 size because
267 * they contain only invisible cells for this round of requests
269 if (min_size > 0 && size->nat_size > 0)
275 min_size += size->min_size;
276 nat_size += size->nat_size;
280 min_size = MAX (min_size, size->min_size);
281 nat_size = MAX (nat_size, size->nat_size);
285 gtk_cell_area_context_push_preferred_width (context, min_size, nat_size);
289 gtk_cell_area_box_context_sum_preferred_height_for_width (GtkCellAreaContext *context,
292 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
293 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
296 GtkOrientation orientation;
298 gint min_size = 0, nat_size = 0;
300 group_array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (width));
304 area = gtk_cell_area_context_get_area (context);
305 spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
306 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
308 for (i = 0; i < group_array->len; i++)
310 CachedSize *size = &g_array_index (group_array, CachedSize, i);
312 if (orientation == GTK_ORIENTATION_VERTICAL)
314 /* Dont add spacing for 0 size groups, they can be 0 size because
315 * they contain only invisible cells for this round of requests
317 if (min_size > 0 && size->nat_size > 0)
323 min_size += size->min_size;
324 nat_size += size->nat_size;
328 min_size = MAX (min_size, size->min_size);
329 nat_size = MAX (nat_size, size->nat_size);
333 gtk_cell_area_context_push_preferred_height_for_width (context, width, min_size, nat_size);
338 gtk_cell_area_box_context_sum_preferred_height (GtkCellAreaContext *context)
340 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
341 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
343 GtkOrientation orientation;
345 gint min_size = 0, nat_size = 0;
347 area = gtk_cell_area_context_get_area (context);
348 spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
349 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
351 for (i = 0; i < priv->base_heights->len; i++)
353 BaseSize *size = &g_array_index (priv->base_heights, BaseSize, i);
355 if (orientation == GTK_ORIENTATION_VERTICAL)
357 /* Dont add spacing for 0 size groups, they can be 0 size because
358 * they contain only invisible cells for this round of requests
360 if (min_size > 0 && size->nat_size > 0)
366 min_size += size->min_size;
367 nat_size += size->nat_size;
371 min_size = MAX (min_size, size->min_size);
372 nat_size = MAX (nat_size, size->nat_size);
376 gtk_cell_area_context_push_preferred_height (context, min_size, nat_size);
380 gtk_cell_area_box_context_sum_preferred_width_for_height (GtkCellAreaContext *context,
383 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
384 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
387 GtkOrientation orientation;
389 gint min_size = 0, nat_size = 0;
391 group_array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (height));
395 area = gtk_cell_area_context_get_area (context);
396 spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
397 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
399 for (i = 0; i < group_array->len; i++)
401 CachedSize *size = &g_array_index (group_array, CachedSize, i);
403 if (orientation == GTK_ORIENTATION_HORIZONTAL)
405 /* Dont add spacing for 0 size groups, they can be 0 size because
406 * they contain only invisible cells for this round of requests
408 if (min_size > 0 && size->nat_size > 0)
414 min_size += size->min_size;
415 nat_size += size->nat_size;
419 min_size = MAX (min_size, size->min_size);
420 nat_size = MAX (nat_size, size->nat_size);
424 gtk_cell_area_context_push_preferred_width_for_height (context, height, min_size, nat_size);
428 static GtkRequestedSize *
429 gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context,
430 GtkOrientation orientation,
433 GtkCellAreaBoxContextPrivate *priv;
434 GtkRequestedSize *requests;
437 gint visible_groups = 0;
440 g_return_val_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context), NULL);
442 priv = box_context->priv;
444 if (orientation == GTK_ORIENTATION_HORIZONTAL)
445 base_array = priv->base_widths;
447 base_array = priv->base_heights;
449 for (i = 0; i < base_array->len; i++)
451 size = &g_array_index (base_array, BaseSize, i);
453 if (size->nat_size > 0)
457 requests = g_new (GtkRequestedSize, visible_groups);
459 for (j = 0, i = 0; i < base_array->len; i++)
461 size = &g_array_index (base_array, BaseSize, i);
463 if (size->nat_size > 0)
465 requests[j].data = GINT_TO_POINTER (i);
466 requests[j].minimum_size = size->min_size;
467 requests[j].natural_size = size->nat_size;
473 *n_requests = visible_groups;
478 static GtkCellAreaBoxAllocation *
479 allocate_for_orientation (GtkCellAreaBoxContext *context,
480 GtkOrientation orientation,
485 GtkCellAreaBoxContextPrivate *priv = context->priv;
486 GtkRequestedSize *orientation_sizes;
487 GtkCellAreaBoxAllocation *allocs;
488 gint n_expand_groups = 0;
489 gint i, n_groups, position;
490 gint extra_size, extra_extra;
491 gint avail_size = size;
494 gtk_cell_area_box_context_get_requests (context, orientation, &n_groups);
496 /* Count groups that expand */
497 for (i = 0; i < n_groups; i++)
500 gint group_idx = GPOINTER_TO_INT (orientation_sizes[i].data);
502 if (orientation == GTK_ORIENTATION_HORIZONTAL)
503 size = &g_array_index (priv->base_widths, BaseSize, group_idx);
505 size = &g_array_index (priv->base_heights, BaseSize, group_idx);
511 /* First start by naturally allocating space among groups */
512 avail_size -= (n_groups - 1) * spacing;
513 for (i = 0; i < n_groups; i++)
514 avail_size -= orientation_sizes[i].minimum_size;
516 avail_size = gtk_distribute_natural_allocation (avail_size, n_groups, orientation_sizes);
518 /* Calculate/distribute expand for groups */
519 if (n_expand_groups > 0)
521 extra_size = avail_size / n_expand_groups;
522 extra_extra = avail_size % n_expand_groups;
525 extra_size = extra_extra = 0;
527 allocs = g_new (GtkCellAreaBoxAllocation, n_groups);
529 for (position = 0, i = 0; i < n_groups; i++)
531 BaseSize *base_size = &g_array_index (priv->base_widths, BaseSize, i);
533 allocs[i].group_idx = GPOINTER_TO_INT (orientation_sizes[i].data);
534 allocs[i].position = position;
535 allocs[i].size = orientation_sizes[i].minimum_size;
537 if (base_size->expand)
539 allocs[i].size += extra_size;
547 position += allocs[i].size;
552 *n_allocs = n_groups;
554 g_free (orientation_sizes);
560 gtk_cell_area_box_context_allocate_width (GtkCellAreaContext *context,
563 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
564 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
566 GtkOrientation orientation;
568 area = gtk_cell_area_context_get_area (context);
569 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
571 if (orientation == GTK_ORIENTATION_HORIZONTAL)
573 gint spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
575 g_free (priv->orientation_allocs);
576 priv->orientation_allocs = allocate_for_orientation (box_context, orientation, spacing, width,
577 &priv->n_orientation_allocs);
580 GTK_CELL_AREA_CONTEXT_CLASS (gtk_cell_area_box_context_parent_class)->allocate_width (context, width);
584 gtk_cell_area_box_context_allocate_height (GtkCellAreaContext *context,
587 GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
588 GtkCellAreaBoxContextPrivate *priv = box_context->priv;
590 GtkOrientation orientation;
592 area = gtk_cell_area_context_get_area (context);
593 orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
595 if (orientation == GTK_ORIENTATION_VERTICAL)
597 gint spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
599 g_free (priv->orientation_allocs);
600 priv->orientation_allocs = allocate_for_orientation (box_context, orientation, spacing, height,
601 &priv->n_orientation_allocs);
604 GTK_CELL_AREA_CONTEXT_CLASS (gtk_cell_area_box_context_parent_class)->allocate_height (context, height);
607 /*************************************************************
609 *************************************************************/
611 gtk_cell_area_box_init_groups (GtkCellAreaBoxContext *box_context,
613 gboolean *expand_groups)
615 GtkCellAreaBoxContextPrivate *priv;
618 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
619 g_return_if_fail (n_groups == 0 || expand_groups != NULL);
621 /* When the group dimensions change, all info must be flushed
622 * Note this already clears the min/nat values on the BaseSizes
624 gtk_cell_area_context_flush (GTK_CELL_AREA_CONTEXT (box_context));
626 priv = box_context->priv;
627 g_array_set_size (priv->base_widths, n_groups);
628 g_array_set_size (priv->base_heights, n_groups);
630 /* Now set the expand info */
631 for (i = 0; i < n_groups; i++)
633 BaseSize *base_width = &g_array_index (priv->base_widths, BaseSize, i);
634 BaseSize *base_height = &g_array_index (priv->base_heights, BaseSize, i);
636 base_width->expand = expand_groups[i];
637 base_height->expand = expand_groups[i];
642 gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxContext *box_context,
647 GtkCellAreaBoxContextPrivate *priv;
650 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
652 priv = box_context->priv;
653 g_return_if_fail (group_idx < priv->base_widths->len);
655 size = &g_array_index (priv->base_widths, BaseSize, group_idx);
656 size->min_size = MAX (size->min_size, minimum_width);
657 size->nat_size = MAX (size->nat_size, natural_width);
661 gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *box_context,
667 GtkCellAreaBoxContextPrivate *priv;
671 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
673 priv = box_context->priv;
674 g_return_if_fail (group_idx < priv->base_widths->len);
676 group_array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (for_width));
679 group_array = g_array_new (FALSE, TRUE, sizeof (CachedSize));
680 g_array_set_size (group_array, priv->base_heights->len);
682 g_hash_table_insert (priv->heights, GINT_TO_POINTER (for_width), group_array);
685 size = &g_array_index (group_array, CachedSize, group_idx);
686 size->min_size = MAX (size->min_size, minimum_height);
687 size->nat_size = MAX (size->nat_size, natural_height);
691 gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context,
696 GtkCellAreaBoxContextPrivate *priv;
699 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
701 priv = box_context->priv;
702 g_return_if_fail (group_idx < priv->base_heights->len);
704 size = &g_array_index (priv->base_heights, BaseSize, group_idx);
705 size->min_size = MAX (size->min_size, minimum_height);
706 size->nat_size = MAX (size->nat_size, natural_height);
710 gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *box_context,
716 GtkCellAreaBoxContextPrivate *priv;
720 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
722 priv = box_context->priv;
723 g_return_if_fail (group_idx < priv->base_widths->len);
725 group_array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (for_height));
728 group_array = g_array_new (FALSE, TRUE, sizeof (CachedSize));
729 g_array_set_size (group_array, priv->base_heights->len);
731 g_hash_table_insert (priv->widths, GINT_TO_POINTER (for_height), group_array);
734 size = &g_array_index (group_array, CachedSize, group_idx);
735 size->min_size = MAX (size->min_size, minimum_width);
736 size->nat_size = MAX (size->nat_size, natural_width);
740 gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context,
745 GtkCellAreaBoxContextPrivate *priv;
748 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
750 priv = box_context->priv;
751 g_return_if_fail (group_idx < priv->base_widths->len);
753 size = &g_array_index (priv->base_widths, BaseSize, group_idx);
756 *minimum_width = size->min_size;
759 *natural_width = size->nat_size;
763 gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box_context,
766 gint *minimum_height,
767 gint *natural_height)
769 GtkCellAreaBoxContextPrivate *priv;
772 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
774 priv = box_context->priv;
775 g_return_if_fail (group_idx < priv->base_widths->len);
777 group_array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (for_width));
781 CachedSize *size = &g_array_index (group_array, CachedSize, group_idx);
784 *minimum_height = size->min_size;
787 *natural_height = size->nat_size;
792 *minimum_height = -1;
795 *natural_height = -1;
800 gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context,
802 gint *minimum_height,
803 gint *natural_height)
805 GtkCellAreaBoxContextPrivate *priv;
808 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
810 priv = box_context->priv;
811 g_return_if_fail (group_idx < priv->base_heights->len);
813 size = &g_array_index (priv->base_heights, BaseSize, group_idx);
816 *minimum_height = size->min_size;
819 *natural_height = size->nat_size;
823 gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box_context,
829 GtkCellAreaBoxContextPrivate *priv;
832 g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
834 priv = box_context->priv;
835 g_return_if_fail (group_idx < priv->base_widths->len);
837 group_array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (for_height));
841 CachedSize *size = &g_array_index (group_array, CachedSize, group_idx);
844 *minimum_width = size->min_size;
847 *natural_width = size->nat_size;
860 gtk_cell_area_box_context_get_widths (GtkCellAreaBoxContext *box_context,
863 return gtk_cell_area_box_context_get_requests (box_context, GTK_ORIENTATION_HORIZONTAL, n_widths);
867 gtk_cell_area_box_context_get_heights (GtkCellAreaBoxContext *box_context,
870 return gtk_cell_area_box_context_get_requests (box_context, GTK_ORIENTATION_VERTICAL, n_heights);
873 G_CONST_RETURN GtkCellAreaBoxAllocation *
874 gtk_cell_area_box_context_get_orientation_allocs (GtkCellAreaBoxContext *context,
877 GtkCellAreaBoxContextPrivate *priv;
879 g_return_val_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (context), NULL);
881 priv = context->priv;
883 *n_allocs = priv->n_orientation_allocs;
885 return priv->orientation_allocs;