Added apis to GtkCellArea for GtkIconView purposes.

Added a few apis,

  - GtkCellAreaContext get_preferred_height_for_width &
    width for height apis and vfuncs, this lets the icon view
    request the collective (and aligned) height for width for
    a said row.

  - gtk_cell_area_copy_context() this creates a duplicate of
    an already created and requested context, this way the icon
    view uses a global context to request the widths of all rows
    and then makes a copy with all the stored alignments and
    uses a separate copy to calculate the height and alignments
    of each row separately.
This commit is contained in:
Tristan Van Berkom
2010-12-13 00:18:00 +09:00
parent ff39c76bfd
commit 0431dd67f8
7 changed files with 277 additions and 30 deletions

View File

@ -1924,6 +1924,46 @@ gtk_cell_area_create_context (GtkCellArea *area)
return NULL;
}
/**
* gtk_cell_area_copy_context:
* @area: a #GtkCellArea
* @context: the #GtkCellAreaContext to copy
*
* This is sometimes needed for cases where rows need to share
* alignments in one orientation but may be separately grouped
* in the opposing orientation.
*
* For instance, #GtkIconView creates all icons (rows) to have
* the same width and the cells theirin to have the same
* horizontal alignments. However each row of icons may have
* a separate collective height. #GtkIconView uses this to
* request the heights of each row based on a context which
* was already used to request all the row widths that are
* to be displayed.
*
* Return value: (transfer full): a newly created #GtkCellAreaContext copy of @context.
*
* Since: 3.0
*/
GtkCellAreaContext *
gtk_cell_area_copy_context (GtkCellArea *area,
GtkCellAreaContext *context)
{
GtkCellAreaClass *class;
g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL);
g_return_val_if_fail (GTK_IS_CELL_AREA_CONTEXT (context), NULL);
class = GTK_CELL_AREA_GET_CLASS (area);
if (class->copy_context)
return class->copy_context (area, context);
g_warning ("GtkCellAreaClass::copy_context not implemented for `%s'",
g_type_name (G_TYPE_FROM_INSTANCE (area)));
return NULL;
}
/**
* gtk_cell_area_get_request_mode: