Commit fa3c8f18 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Revert "Removed tons of api that we dont absolutely need in GtkCellAreaContext:"

This reverts commit 5f7787ab.
parent 7fc7bd61
......@@ -1284,7 +1284,8 @@ compute_size (GtkCellAreaBox *box,
for (i = 0; i < priv->groups->len; i++)
{
CellGroup *group = &g_array_index (priv->groups, CellGroup, i);
gint group_min = 0, group_nat = 0;
gint group_min_size = 0;
gint group_nat_size = 0;
for (list = group->cells; list; list = list->next)
{
......@@ -1304,33 +1305,42 @@ compute_size (GtkCellAreaBox *box,
min_size += priv->spacing;
nat_size += priv->spacing;
}
if (group_min > 0)
if (group_min_size > 0)
{
group_min += priv->spacing;
group_nat += priv->spacing;
group_min_size += priv->spacing;
group_nat_size += priv->spacing;
}
min_size += renderer_min_size;
nat_size += renderer_nat_size;
group_min += renderer_min_size;
group_nat += renderer_nat_size;
min_size += renderer_min_size;
nat_size += renderer_nat_size;
group_min_size += renderer_min_size;
group_nat_size += renderer_nat_size;
}
else
{
min_size = MAX (min_size, renderer_min_size);
nat_size = MAX (nat_size, renderer_nat_size);
group_min = MAX (group_min, renderer_min_size);
group_nat = MAX (group_nat, renderer_nat_size);
min_size = MAX (min_size, renderer_min_size);
nat_size = MAX (nat_size, renderer_nat_size);
group_min_size = MAX (group_min_size, renderer_min_size);
group_nat_size = MAX (group_nat_size, renderer_nat_size);
}
}
if (for_size < 0)
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (for_size < 0)
gtk_cell_area_box_context_push_group_width (context, group->id, group_min_size, group_nat_size);
else
gtk_cell_area_box_context_push_group_width_for_height (context, group->id, for_size,
group_min_size, group_nat_size);
}
else
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_cell_area_box_context_push_group_width (context, group->id, group_min, group_nat);
if (for_size < 0)
gtk_cell_area_box_context_push_group_height (context, group->id, group_min_size, group_nat_size);
else
gtk_cell_area_box_context_push_group_height (context, group->id, group_min, group_nat);
gtk_cell_area_box_context_push_group_height_for_width (context, group->id, for_size,
group_min_size, group_nat_size);
}
}
......@@ -1519,6 +1529,17 @@ compute_size_for_opposing_orientation (GtkCellAreaBox *box,
min_size = MAX (min_size, group_min);
nat_size = MAX (nat_size, group_nat);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_cell_area_box_context_push_group_height_for_width (context, group_idx, for_size,
group_min, group_nat);
}
else
{
gtk_cell_area_box_context_push_group_width_for_height (context, group_idx, for_size,
group_min, group_nat);
}
}
*minimum_size = min_size;
......
This diff is collapsed.
......@@ -72,20 +72,47 @@ void gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxCo
gint group_idx,
gint minimum_width,
gint natural_width);
void gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_width,
gint minimum_height,
gint natural_height);
void gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint minimum_height,
gint natural_height);
void gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_height,
gint minimum_width,
gint natural_width);
/* Fetch cell-group sizes */
void gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint *minimum_width,
gint *natural_width);
void gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_width,
gint *minimum_height,
gint *natural_height);
void gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint *minimum_height,
gint *natural_height);
void gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_height,
gint *minimum_width,
gint *natural_width);
GtkRequestedSize *gtk_cell_area_box_context_get_widths (GtkCellAreaBoxContext *box_context,
gint *n_widths);
GtkRequestedSize *gtk_cell_area_box_context_get_heights (GtkCellAreaBoxContext *box_context,
......
This diff is collapsed.
......@@ -55,14 +55,22 @@ struct _GtkCellAreaContextClass
/* Subclasses can use this to flush their alignments/allocations */
void (* flush_preferred_width) (GtkCellAreaContext *context);
void (* flush_preferred_height_for_width) (GtkCellAreaContext *context,
gint width);
void (* flush_preferred_height) (GtkCellAreaContext *context);
void (* flush_preferred_width_for_height) (GtkCellAreaContext *context,
gint height);
void (* flush_allocation) (GtkCellAreaContext *context);
/* These must be invoked after a series of requests before consulting
* the context values, implementors use this to push the overall
* requests while acconting for any internal alignments */
void (* sum_preferred_width) (GtkCellAreaContext *context);
void (* sum_preferred_height_for_width) (GtkCellAreaContext *context,
gint width);
void (* sum_preferred_height) (GtkCellAreaContext *context);
void (* sum_preferred_width_for_height) (GtkCellAreaContext *context,
gint height);
/* Store an allocation value for a GtkCellArea contextual to a range of
* treemodel rows */
......@@ -85,13 +93,21 @@ GtkCellArea *gtk_cell_area_context_get_area (GtkCellArea
/* Apis for GtkCellArea clients to flush the cache */
void gtk_cell_area_context_flush (GtkCellAreaContext *context);
void gtk_cell_area_context_flush_preferred_width (GtkCellAreaContext *context);
void gtk_cell_area_context_flush_preferred_height_for_width (GtkCellAreaContext *context,
gint for_width);
void gtk_cell_area_context_flush_preferred_height (GtkCellAreaContext *context);
void gtk_cell_area_context_flush_preferred_width_for_height (GtkCellAreaContext *context,
gint for_height);
void gtk_cell_area_context_flush_allocation (GtkCellAreaContext *context);
/* 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_context_sum_preferred_width (GtkCellAreaContext *context);
void gtk_cell_area_context_sum_preferred_height_for_width (GtkCellAreaContext *context,
gint for_width);
void gtk_cell_area_context_sum_preferred_height (GtkCellAreaContext *context);
void gtk_cell_area_context_sum_preferred_width_for_height (GtkCellAreaContext *context,
gint for_height);
/* Apis to set an allocation size in one dimension or another, the subclass specific context
* will store allocated positions/sizes for individual cells or groups of cells */
......@@ -104,9 +120,17 @@ void gtk_cell_area_context_allocate_height (GtkCellArea
void gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context,
gint *minimum_width,
gint *natural_width);
void gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context,
gint for_width,
gint *minimum_height,
gint *natural_height);
void gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context,
gint *minimum_height,
gint *natural_height);
void gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context,
gint for_height,
gint *minimum_width,
gint *natural_width);
void gtk_cell_area_context_get_allocation (GtkCellAreaContext *context,
gint *width,
gint *height);
......@@ -115,9 +139,17 @@ void gtk_cell_area_context_get_allocation (GtkCellArea
void gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context,
gint minimum_width,
gint natural_width);
void gtk_cell_area_context_push_preferred_height_for_width (GtkCellAreaContext *context,
gint for_width,
gint minimum_height,
gint natural_height);
void gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context,
gint minimum_height,
gint natural_height);
void gtk_cell_area_context_push_preferred_width_for_height (GtkCellAreaContext *context,
gint for_height,
gint minimum_width,
gint natural_width);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment