Added the majority of the allocate machinery to GtkCellAreaIter[Box].

This commit is contained in:
Tristan Van Berkom 2010-10-30 23:06:26 +09:00
parent 86fb6ab216
commit ea6df20bbb
6 changed files with 409 additions and 164 deletions

View File

@ -410,6 +410,19 @@ flush_iters (GtkCellAreaBox *box)
}
}
/* XXX This guy makes an allocation to be stored and retrieved from the iter */
GtkCellAreaBoxAllocation *
gtk_cell_area_box_allocate (GtkCellAreaBox *box,
GtkCellAreaBoxIter *iter,
gint size,
gint *n_allocs)
{
}
/*************************************************************
* GObjectClass *
*************************************************************/

View File

@ -54,7 +54,6 @@ struct _GtkCellAreaBoxClass
{
GtkCellAreaClass parent_class;
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
@ -77,6 +76,7 @@ gint gtk_cell_area_box_get_spacing (GtkCellAreaBox *box);
void gtk_cell_area_box_set_spacing (GtkCellAreaBox *box,
gint spacing);
G_END_DECLS
#endif /* __GTK_CELL_AREA_BOX_H__ */

View File

@ -25,23 +25,31 @@
#include "gtkintl.h"
#include "gtkcellareabox.h"
#include "gtkcellareaboxiter.h"
#include "gtkorientable.h"
/* GObjectClass */
static void gtk_cell_area_box_iter_finalize (GObject *object);
/* GtkCellAreaIterClass */
static void gtk_cell_area_box_iter_sum_preferred_width (GtkCellAreaIter *iter);
static void gtk_cell_area_box_iter_sum_preferred_height_for_width (GtkCellAreaIter *iter,
gint width);
static void gtk_cell_area_box_iter_sum_preferred_height (GtkCellAreaIter *iter);
static void gtk_cell_area_box_iter_sum_preferred_width_for_height (GtkCellAreaIter *iter,
gint height);
static void gtk_cell_area_box_iter_flush_preferred_width (GtkCellAreaIter *iter);
static void gtk_cell_area_box_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
gint width);
static void gtk_cell_area_box_iter_flush_preferred_height (GtkCellAreaIter *iter);
static void gtk_cell_area_box_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint height);
static void gtk_cell_area_box_iter_flush_allocation (GtkCellAreaIter *iter);
static void gtk_cell_area_box_iter_sum_preferred_width (GtkCellAreaIter *iter);
static void gtk_cell_area_box_iter_sum_preferred_height_for_width (GtkCellAreaIter *iter,
gint width);
static void gtk_cell_area_box_iter_sum_preferred_height (GtkCellAreaIter *iter);
static void gtk_cell_area_box_iter_sum_preferred_width_for_height (GtkCellAreaIter *iter,
gint height);
static void gtk_cell_area_box_iter_allocate_width (GtkCellAreaIter *iter,
gint width);
static void gtk_cell_area_box_iter_allocate_height (GtkCellAreaIter *iter,
gint height);
/* CachedSize management */
typedef struct {
@ -61,6 +69,12 @@ struct _GtkCellAreaBoxIterPrivate
/* Table of per height/width hash tables of per renderer CachedSizes */
GHashTable *widths;
GHashTable *heights;
/* Allocation info for this iter if any */
gint alloc_width;
gint alloc_height;
gint n_orientation_allocs;
GtkCellAreaBoxAllocation *orientation_allocs;
};
G_DEFINE_TYPE (GtkCellAreaBoxIter, gtk_cell_area_box_iter, GTK_TYPE_CELL_AREA_ITER);
@ -84,6 +98,11 @@ gtk_cell_area_box_iter_init (GtkCellAreaBoxIter *box_iter)
NULL, (GDestroyNotify)g_hash_table_destroy);
priv->heights = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify)g_hash_table_destroy);
priv->alloc_width = 0;
priv->alloc_height = 0;
priv->orientation_allocs = NULL;
priv->n_orientation_allocs = 0;
}
static void
@ -95,15 +114,19 @@ gtk_cell_area_box_iter_class_init (GtkCellAreaBoxIterClass *class)
/* GObjectClass */
object_class->finalize = gtk_cell_area_box_iter_finalize;
iter_class->flush_preferred_width = gtk_cell_area_box_iter_flush_preferred_width;
iter_class->flush_preferred_height_for_width = gtk_cell_area_box_iter_flush_preferred_height_for_width;
iter_class->flush_preferred_height = gtk_cell_area_box_iter_flush_preferred_height;
iter_class->flush_preferred_width_for_height = gtk_cell_area_box_iter_flush_preferred_width_for_height;
iter_class->flush_allocation = gtk_cell_area_box_iter_flush_allocation;
iter_class->sum_preferred_width = gtk_cell_area_box_iter_sum_preferred_width;
iter_class->sum_preferred_height_for_width = gtk_cell_area_box_iter_sum_preferred_height_for_width;
iter_class->sum_preferred_height = gtk_cell_area_box_iter_sum_preferred_height;
iter_class->sum_preferred_width_for_height = gtk_cell_area_box_iter_sum_preferred_width_for_height;
iter_class->flush_preferred_width = gtk_cell_area_box_iter_flush_preferred_width;
iter_class->flush_preferred_height_for_width = gtk_cell_area_box_iter_flush_preferred_height_for_width;
iter_class->flush_preferred_height = gtk_cell_area_box_iter_flush_preferred_height;
iter_class->flush_preferred_width_for_height = gtk_cell_area_box_iter_flush_preferred_width_for_height;
iter_class->allocate_width = gtk_cell_area_box_iter_allocate_width;
iter_class->allocate_height = gtk_cell_area_box_iter_allocate_height;
g_type_class_add_private (object_class, sizeof (GtkCellAreaBoxIterPrivate));
}
@ -143,12 +166,83 @@ gtk_cell_area_box_iter_finalize (GObject *object)
g_hash_table_destroy (priv->widths);
g_hash_table_destroy (priv->heights);
g_free (priv->orientation_allocs);
G_OBJECT_CLASS (gtk_cell_area_box_iter_parent_class)->finalize (object);
}
/*************************************************************
* GtkCellAreaIterClass *
*************************************************************/
static void
gtk_cell_area_box_iter_flush_preferred_width (GtkCellAreaIter *iter)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
g_hash_table_remove_all (priv->base_widths);
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_width (iter);
}
static void
gtk_cell_area_box_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
gint width)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
/* Flush all sizes for special -1 value */
if (width < 0)
g_hash_table_remove_all (priv->heights);
else
g_hash_table_remove (priv->heights, GINT_TO_POINTER (width));
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_height_for_width (iter, width);
}
static void
gtk_cell_area_box_iter_flush_preferred_height (GtkCellAreaIter *iter)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
g_hash_table_remove_all (priv->base_heights);
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_height (iter);
}
static void
gtk_cell_area_box_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint height)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
/* Flush all sizes for special -1 value */
if (height < 0)
g_hash_table_remove_all (priv->widths);
else
g_hash_table_remove (priv->widths, GINT_TO_POINTER (height));
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_width_for_height (iter, height);
}
static void
gtk_cell_area_box_iter_flush_allocation (GtkCellAreaIter *iter)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
g_free (priv->orientation_allocs);
priv->orientation_allocs = NULL;
priv->n_orientation_allocs = 0;
}
typedef struct {
gint min_size;
gint nat_size;
@ -246,61 +340,51 @@ gtk_cell_area_box_iter_sum_preferred_width_for_height (GtkCellAreaIter *iter,
}
static void
gtk_cell_area_box_iter_flush_preferred_width (GtkCellAreaIter *iter)
gtk_cell_area_box_iter_allocate_width (GtkCellAreaIter *iter,
gint width)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
g_hash_table_remove_all (priv->base_widths);
GtkCellArea *area;
GtkOrientation orientation;
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_width (iter);
area = gtk_cell_area_iter_get_area (iter);
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
g_free (priv->orientation_allocs);
priv->orientation_allocs =
gtk_cell_area_box_allocate (GTK_CELL_AREA_BOX (area), box_iter, width,
&priv->n_orientation_allocs);
}
GTK_CELL_AREA_ITER_GET_CLASS (iter)->allocate_width (iter, width);
}
static void
gtk_cell_area_box_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
gint width)
gtk_cell_area_box_iter_allocate_height (GtkCellAreaIter *iter,
gint height)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
GtkCellArea *area;
GtkOrientation orientation;
/* Flush all sizes for special -1 value */
if (width < 0)
g_hash_table_remove_all (priv->heights);
else
g_hash_table_remove (priv->heights, GINT_TO_POINTER (width));
area = gtk_cell_area_iter_get_area (iter);
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (area));
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_height_for_width (iter, width);
}
if (orientation == GTK_ORIENTATION_VERTICAL)
{
g_free (priv->orientation_allocs);
static void
gtk_cell_area_box_iter_flush_preferred_height (GtkCellAreaIter *iter)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
g_hash_table_remove_all (priv->base_heights);
priv->orientation_allocs =
gtk_cell_area_box_allocate (GTK_CELL_AREA_BOX (area), box_iter, height,
&priv->n_orientation_allocs);
}
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_height (iter);
}
static void
gtk_cell_area_box_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint height)
{
GtkCellAreaBoxIter *box_iter = GTK_CELL_AREA_BOX_ITER (iter);
GtkCellAreaBoxIterPrivate *priv = box_iter->priv;
/* Flush all sizes for special -1 value */
if (height < 0)
g_hash_table_remove_all (priv->widths);
else
g_hash_table_remove (priv->widths, GINT_TO_POINTER (height));
GTK_CELL_AREA_ITER_GET_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_width_for_height (iter, height);
GTK_CELL_AREA_ITER_GET_CLASS (iter)->allocate_height (iter, height);
}
/*************************************************************
@ -622,3 +706,18 @@ gtk_cell_area_box_iter_get_heights (GtkCellAreaBoxIter *box_iter,
return heights;
}
G_CONST_RETURN GtkCellAreaBoxAllocation *
gtk_cell_area_box_iter_get_orientation_allocs (GtkCellAreaBoxIter *iter,
gint *n_allocs)
{
GtkCellAreaBoxIterPrivate *priv;
g_return_val_if_fail (GTK_IS_CELL_AREA_BOX_ITER (iter), NULL);
priv = iter->priv;
*n_allocs = priv->n_orientation_allocs;
return priv->orientation_allocs;
}

View File

@ -29,6 +29,7 @@
#define __GTK_CELL_AREA_BOX_ITER_H__
#include <gtk/gtkcellareaiter.h>
#include <gtk/gtkcellareabox.h>
#include <gtk/gtkcellrenderer.h>
#include <gtk/gtksizerequest.h>
@ -112,6 +113,21 @@ GtkRequestedSize *gtk_cell_area_box_iter_get_widths (GtkCellAreaBoxIter
GtkRequestedSize *gtk_cell_area_box_iter_get_heights (GtkCellAreaBoxIter *box_iter,
gint *n_heights);
/* Private iter/area interaction */
typedef struct {
gint position;
gint size;
} GtkCellAreaBoxAllocation;
GtkCellAreaBoxAllocation *gtk_cell_area_box_allocate (GtkCellAreaBox *box,
GtkCellAreaBoxIter *iter,
gint size,
gint *n_allocs);
G_CONST_RETURN GtkCellAreaBoxAllocation *
gtk_cell_area_box_iter_get_orientation_allocs (GtkCellAreaBoxIter *iter,
gint *n_allocs);
G_END_DECLS
#endif /* __GTK_CELL_AREA_BOX_ITER_H__ */

View File

@ -46,6 +46,11 @@ static void gtk_cell_area_iter_real_flush_preferred_height_for_width (GtkCe
static void gtk_cell_area_iter_real_flush_preferred_height (GtkCellAreaIter *iter);
static void gtk_cell_area_iter_real_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint height);
static void gtk_cell_area_iter_real_flush_allocation (GtkCellAreaIter *iter);
static void gtk_cell_area_iter_real_allocate_width (GtkCellAreaIter *iter,
gint width);
static void gtk_cell_area_iter_real_allocate_height (GtkCellAreaIter *iter,
gint height);
/* CachedSize management */
typedef struct {
@ -64,6 +69,8 @@ struct _GtkCellAreaIterPrivate
gint nat_width;
gint min_height;
gint nat_height;
gint alloc_width;
gint alloc_height;
GHashTable *widths;
GHashTable *heights;
@ -123,6 +130,18 @@ gtk_cell_area_iter_class_init (GtkCellAreaIterClass *class)
class->flush_preferred_height_for_width = gtk_cell_area_iter_real_flush_preferred_height_for_width;
class->flush_preferred_height = gtk_cell_area_iter_real_flush_preferred_height;
class->flush_preferred_width_for_height = gtk_cell_area_iter_real_flush_preferred_width_for_height;
class->flush_allocation = gtk_cell_area_iter_real_flush_allocation;
class->allocate_width = gtk_cell_area_iter_real_allocate_width;
class->allocate_height = gtk_cell_area_iter_real_allocate_height;
class->sum_preferred_width = NULL;
class->sum_preferred_height_for_width = NULL;
class->sum_preferred_height = NULL;
class->sum_preferred_width_for_height = NULL;
class->allocate_width = NULL;
class->allocate_height = NULL;
cell_area_iter_signals[SIGNAL_HEIGHT_CHANGED] =
g_signal_new (I_("height-changed"),
@ -400,6 +419,34 @@ gtk_cell_area_iter_real_flush_preferred_width_for_height (GtkCellAreaIter *iter,
}
}
static void
gtk_cell_area_iter_real_flush_allocation (GtkCellAreaIter *iter)
{
GtkCellAreaIterPrivate *priv = iter->priv;
priv->alloc_width = 0;
priv->alloc_height = 0;
}
static void
gtk_cell_area_iter_real_allocate_width (GtkCellAreaIter *iter,
gint width)
{
GtkCellAreaIterPrivate *priv = iter->priv;
priv->alloc_width = width;
}
static void
gtk_cell_area_iter_real_allocate_height (GtkCellAreaIter *iter,
gint height)
{
GtkCellAreaIterPrivate *priv = iter->priv;
priv->alloc_height = height;
}
/*************************************************************
* API *
*************************************************************/
@ -415,6 +462,140 @@ gtk_cell_area_iter_get_area (GtkCellAreaIter *iter)
return priv->cell_area;
}
void
gtk_cell_area_iter_flush (GtkCellAreaIter *iter)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
gtk_cell_area_iter_flush_preferred_width (iter);
gtk_cell_area_iter_flush_preferred_height_for_width (iter, -1);
gtk_cell_area_iter_flush_preferred_height (iter);
gtk_cell_area_iter_flush_preferred_width_for_height (iter, -1);
gtk_cell_area_iter_flush_allocation (iter);
}
void
gtk_cell_area_iter_flush_preferred_width (GtkCellAreaIter *iter)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_width (iter);
}
void
gtk_cell_area_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_height_for_width (iter, for_width);
}
void
gtk_cell_area_iter_flush_preferred_height (GtkCellAreaIter *iter)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_height (iter);
}
void
gtk_cell_area_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_width_for_height (iter, for_height);
}
void
gtk_cell_area_iter_flush_allocation (GtkCellAreaIter *iter)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_allocation (iter);
}
void
gtk_cell_area_iter_sum_preferred_width (GtkCellAreaIter *iter)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
if (class->sum_preferred_width)
class->sum_preferred_width (iter);
}
void
gtk_cell_area_iter_sum_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
if (class->sum_preferred_height_for_width)
class->sum_preferred_height_for_width (iter, for_width);
}
void
gtk_cell_area_iter_sum_preferred_height (GtkCellAreaIter *iter)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
if (class->sum_preferred_height)
class->sum_preferred_height (iter);
}
void
gtk_cell_area_iter_sum_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
if (class->sum_preferred_width_for_height)
class->sum_preferred_width_for_height (iter, for_height);
}
void
gtk_cell_area_iter_allocate_width (GtkCellAreaIter *iter,
gint width)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
class->allocate_width (iter, width);
}
void
gtk_cell_area_iter_allocate_height (GtkCellAreaIter *iter,
gint height)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
class->allocate_height (iter, height);
}
void
gtk_cell_area_iter_get_preferred_width (GtkCellAreaIter *iter,
gint *minimum_width,
@ -518,106 +699,23 @@ gtk_cell_area_iter_get_preferred_width_for_height (GtkCellAreaIter *iter,
}
void
gtk_cell_area_iter_sum_preferred_width (GtkCellAreaIter *iter)
gtk_cell_area_iter_get_allocation (GtkCellAreaIter *iter,
gint *width,
gint *height)
{
GtkCellAreaIterClass *class;
GtkCellAreaIterPrivate *priv;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
priv = iter->priv;
if (class->sum_preferred_width)
class->sum_preferred_width (iter);
if (width)
*width = priv->alloc_width;
if (height)
*height = priv->alloc_height;
}
void
gtk_cell_area_iter_sum_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
if (class->sum_preferred_height_for_width)
class->sum_preferred_height_for_width (iter, for_width);
}
void
gtk_cell_area_iter_sum_preferred_height (GtkCellAreaIter *iter)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
if (class->sum_preferred_height)
class->sum_preferred_height (iter);
}
void
gtk_cell_area_iter_sum_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height)
{
GtkCellAreaIterClass *class;
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
class = GTK_CELL_AREA_ITER_GET_CLASS (iter);
if (class->sum_preferred_width_for_height)
class->sum_preferred_width_for_height (iter, for_height);
}
void
gtk_cell_area_iter_flush (GtkCellAreaIter *iter)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
gtk_cell_area_iter_flush_preferred_width (iter);
gtk_cell_area_iter_flush_preferred_height_for_width (iter, -1);
gtk_cell_area_iter_flush_preferred_height (iter);
gtk_cell_area_iter_flush_preferred_width_for_height (iter, -1);
}
void
gtk_cell_area_iter_flush_preferred_width (GtkCellAreaIter *iter)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_width (iter);
}
void
gtk_cell_area_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_height_for_width (iter, for_width);
}
void
gtk_cell_area_iter_flush_preferred_height (GtkCellAreaIter *iter)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_height (iter);
}
void
gtk_cell_area_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height)
{
g_return_if_fail (GTK_IS_CELL_AREA_ITER (iter));
GTK_CELL_AREA_ITER_GET_CLASS (iter)->flush_preferred_width_for_height (iter, for_height);
}
void
gtk_cell_area_iter_push_preferred_width (GtkCellAreaIter *iter,
gint minimum_width,

View File

@ -53,13 +53,14 @@ struct _GtkCellAreaIterClass
{
GObjectClass parent_class;
/* Subclasses can use this to flush their alignments */
/* Subclasses can use this to flush their alignments/allocations */
void (* flush_preferred_width) (GtkCellAreaIter *iter);
void (* flush_preferred_height_for_width) (GtkCellAreaIter *iter,
gint width);
void (* flush_preferred_height) (GtkCellAreaIter *iter);
void (* flush_preferred_width_for_height) (GtkCellAreaIter *iter,
gint height);
void (* flush_allocation) (GtkCellAreaIter *iter);
/* These must be invoked after a series of requests before consulting
* the iter values, implementors use this to push the overall
@ -71,6 +72,13 @@ struct _GtkCellAreaIterClass
void (* sum_preferred_width_for_height) (GtkCellAreaIter *iter,
gint height);
/* Store an allocation value for a GtkCellArea contextual to a range of
* treemodel rows */
void (* allocate_width) (GtkCellAreaIter *iter,
gint width);
void (* allocate_height) (GtkCellAreaIter *iter,
gint height);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
@ -82,6 +90,32 @@ GType gtk_cell_area_iter_get_type (void) G_GNUC_C
GtkCellArea *gtk_cell_area_iter_get_area (GtkCellAreaIter *iter);
/* Apis for GtkCellArea clients to flush the cache */
void gtk_cell_area_iter_flush (GtkCellAreaIter *iter);
void gtk_cell_area_iter_flush_preferred_width (GtkCellAreaIter *iter);
void gtk_cell_area_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width);
void gtk_cell_area_iter_flush_preferred_height (GtkCellAreaIter *iter);
void gtk_cell_area_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height);
void gtk_cell_area_iter_flush_allocation (GtkCellAreaIter *iter);
/* Apis for GtkCellArea clients to sum up the results of a series of requests, this
* call is required to reduce the processing while calculating the size of each row */
void gtk_cell_area_iter_sum_preferred_width (GtkCellAreaIter *iter);
void gtk_cell_area_iter_sum_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width);
void gtk_cell_area_iter_sum_preferred_height (GtkCellAreaIter *iter);
void gtk_cell_area_iter_sum_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height);
/* Apis to set an allocation size in one dimension or another, the subclass specific iter
* will store allocated positions/sizes for individual cells or groups of cells */
void gtk_cell_area_iter_allocate_width (GtkCellAreaIter *iter,
gint width);
void gtk_cell_area_iter_allocate_height (GtkCellAreaIter *iter,
gint height);
/* Apis for GtkCellArea clients to consult cached values for multiple GtkTreeModel rows */
void gtk_cell_area_iter_get_preferred_width (GtkCellAreaIter *iter,
gint *minimum_width,
@ -97,24 +131,9 @@ void gtk_cell_area_iter_get_preferred_width_for_height (GtkCellAreaIte
gint for_height,
gint *minimum_width,
gint *natural_width);
/* Apis for GtkCellArea clients to sum up the results of a series of requests, this
* call is required to reduce the processing while calculating the size of each row */
void gtk_cell_area_iter_sum_preferred_width (GtkCellAreaIter *iter);
void gtk_cell_area_iter_sum_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width);
void gtk_cell_area_iter_sum_preferred_height (GtkCellAreaIter *iter);
void gtk_cell_area_iter_sum_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height);
/* Apis for GtkCellArea clients to flush the cache */
void gtk_cell_area_iter_flush (GtkCellAreaIter *iter);
void gtk_cell_area_iter_flush_preferred_width (GtkCellAreaIter *iter);
void gtk_cell_area_iter_flush_preferred_height_for_width (GtkCellAreaIter *iter,
gint for_width);
void gtk_cell_area_iter_flush_preferred_height (GtkCellAreaIter *iter);
void gtk_cell_area_iter_flush_preferred_width_for_height (GtkCellAreaIter *iter,
gint for_height);
void gtk_cell_area_iter_get_allocation (GtkCellAreaIter *iter,
gint *width,
gint *height);
/* Apis for GtkCellArea implementations to update cached values for multiple GtkTreeModel rows */
void gtk_cell_area_iter_push_preferred_width (GtkCellAreaIter *iter,