Tested all of this with some scaffolding code, test case comming soon.
{
GtkCellAreaBoxPrivate *priv = box->priv;
CellGroup group = { 0, };
+ CellGroup *group_ptr;
GList *cells, *l;
guint id = 0;
/* First group is implied */
g_array_append_val (priv->groups, group);
+ group_ptr = &g_array_index (priv->groups, CellGroup, id);
for (l = cells; l; l = l->next)
{
group.id = ++id;
g_array_append_val (priv->groups, group);
+ group_ptr = &g_array_index (priv->groups, CellGroup, id);
}
- group.cells = g_list_prepend (group.cells, info);
- group.n_cells++;
+ group_ptr->cells = g_list_prepend (group_ptr->cells, info);
+ group_ptr->n_cells++;
/* A group expands if it contains any expand cells */
if (info->expand)
- group.expand_cells++;
+ group_ptr->expand_cells++;
}
g_list_free (cells);
for (id = 0; id < priv->groups->len; id++)
{
- CellGroup *group_ptr = &g_array_index (priv->groups, CellGroup, id);
+ group_ptr = &g_array_index (priv->groups, CellGroup, id);
group_ptr->cells = g_list_reverse (group_ptr->cells);
}
return NULL;
}
+ g_print ("Allocating cells for rendering, group allocs %d\n", n_allocs);
+
for (i = 0; i < n_allocs; i++)
{
/* We dont always allocate all groups, sometimes the requested group has only invisible
* of alignments and pack order etc. */
allocated_cells = get_allocated_cells (box, box_iter, widget);
+ g_print ("Rendering an area with allocated cells %d\n",
+ g_slist_length (allocated_cells));
+
for (l = allocated_cells; l; l = l->next)
{
AllocatedCell *cell = l->data;
/* XXX We have to do some per-cell considerations for the 'flags'
* for focus handling */
+ g_print ("Rendering a cell at x: %d y: %d width %d height %d\n",
+ inner_area.x, inner_area.y, inner_area.width, inner_area.height);
+
gtk_cell_renderer_render (cell->renderer, cr, widget,
&background_area, &inner_area,
flags);
GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area);
GtkCellAreaBoxPrivate *priv = box->priv;
GtkCellAreaIter *iter =
- (GtkCellAreaIter *)g_object_new (GTK_TYPE_CELL_AREA_BOX_ITER, NULL);
+ (GtkCellAreaIter *)g_object_new (GTK_TYPE_CELL_AREA_BOX_ITER,
+ "area", area, NULL);
priv->iters = g_slist_prepend (priv->iters, iter);
gint renderer_min_size, renderer_nat_size;
if (!gtk_cell_renderer_get_visible (info->renderer))
- continue;
+ continue;
gtk_cell_area_request_renderer (area, info->renderer, orientation, widget, for_size,
&renderer_min_size, &renderer_nat_size);
size->nat_size = 0;
}
- GTK_CELL_AREA_ITER_GET_CLASS
+ GTK_CELL_AREA_ITER_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_width (iter);
}
else
g_hash_table_remove (priv->heights, GINT_TO_POINTER (width));
- GTK_CELL_AREA_ITER_GET_CLASS
+ GTK_CELL_AREA_ITER_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_height_for_width (iter, width);
}
size->nat_size = 0;
}
- GTK_CELL_AREA_ITER_GET_CLASS
+ GTK_CELL_AREA_ITER_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_height (iter);
}
else
g_hash_table_remove (priv->widths, GINT_TO_POINTER (height));
- GTK_CELL_AREA_ITER_GET_CLASS
+ GTK_CELL_AREA_ITER_CLASS
(gtk_cell_area_box_iter_parent_class)->flush_preferred_width_for_height (iter, height);
}
allocate_for_orientation (GtkCellAreaBoxIter *iter,
GtkOrientation orientation,
gint spacing,
- gint size)
+ gint size,
+ gint *n_allocs)
{
GtkCellAreaBoxIterPrivate *priv = iter->priv;
GtkRequestedSize *orientation_sizes;
position += spacing;
}
+ if (n_allocs)
+ *n_allocs = n_groups;
+
g_free (orientation_sizes);
return allocs;
gint spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
g_free (priv->orientation_allocs);
- priv->orientation_allocs = allocate_for_orientation (box_iter, orientation, spacing, width);
+ priv->orientation_allocs = allocate_for_orientation (box_iter, orientation, spacing, width,
+ &priv->n_orientation_allocs);
}
- GTK_CELL_AREA_ITER_GET_CLASS (iter)->allocate_width (iter, width);
+ GTK_CELL_AREA_ITER_CLASS (gtk_cell_area_box_iter_parent_class)->allocate_width (iter, width);
}
static void
gint spacing = gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (area));
g_free (priv->orientation_allocs);
- priv->orientation_allocs = allocate_for_orientation (box_iter, orientation, spacing, height);
+ priv->orientation_allocs = allocate_for_orientation (box_iter, orientation, spacing, height,
+ &priv->n_orientation_allocs);
}
- GTK_CELL_AREA_ITER_GET_CLASS (iter)->allocate_height (iter, height);
+ GTK_CELL_AREA_ITER_CLASS (gtk_cell_area_box_iter_parent_class)->allocate_height (iter, height);
}
/*************************************************************
gint i;
g_return_if_fail (GTK_IS_CELL_AREA_BOX_ITER (box_iter));
- g_return_if_fail (n_groups > 0 || expand_groups != NULL);
+ g_return_if_fail (n_groups == 0 || expand_groups != NULL);
/* When the group dimensions change, all info must be flushed
* Note this already clears the min/nat values on the BaseSizes
object_class->get_property = gtk_cell_area_iter_get_property;
object_class->set_property = gtk_cell_area_iter_set_property;
+ /* GtkCellAreaIterClass */
class->flush_preferred_width = gtk_cell_area_iter_real_flush_preferred_width;
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;
+ class->allocate_width = gtk_cell_area_iter_real_allocate_width;
+ class->allocate_height = gtk_cell_area_iter_real_allocate_height;
cell_area_iter_signals[SIGNAL_HEIGHT_CHANGED] =
g_signal_new (I_("height-changed"),