diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-12-13 00:18:00 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-12-13 00:29:21 +0900 |
commit | 0431dd67f82def7af57119b27bcc4dea0b7a2167 (patch) | |
tree | 94dceaea7c9f8b34b5674aacc98dd0e663ba838c /gtk/gtkcellareacontext.c | |
parent | ff39c76bfd9ea882c80c60313b594cf73035fa6e (diff) | |
download | gtk+-0431dd67f82def7af57119b27bcc4dea0b7a2167.tar.gz |
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.
Diffstat (limited to 'gtk/gtkcellareacontext.c')
-rw-r--r-- | gtk/gtkcellareacontext.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gtk/gtkcellareacontext.c b/gtk/gtkcellareacontext.c index 087b590401..f3c14b00dd 100644 --- a/gtk/gtkcellareacontext.c +++ b/gtk/gtkcellareacontext.c @@ -490,6 +490,66 @@ gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context, } /** + * gtk_cell_area_context_get_preferred_height_for_width: + * @context: a #GtkCellAreaContext + * @width: a proposed width for allocation + * @minimum_height: (out) (allow-none): location to store the minimum height, or %NULL + * @natural_height: (out) (allow-none): location to store the natural height, or %NULL + * + * Gets the accumulative preferred height for @width for all rows which have been + * requested for the same said @width with this context. + * + * After gtk_cell_area_context_reset() is called and/or before ever requesting + * the size of a #GtkCellArea, the returned values are -1. + * + * Since: 3.0 + */ +void +gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context, + gint width, + gint *minimum_height, + gint *natural_height) +{ + g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context)); + + if (GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_height_for_width) + GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_height_for_width (context, + width, + minimum_height, + natural_height); +} + +/** + * gtk_cell_area_context_get_preferred_width_for_height: + * @context: a #GtkCellAreaContext + * @height: a proposed height for allocation + * @minimum_width: (out) (allow-none): location to store the minimum width, or %NULL + * @natural_width: (out) (allow-none): location to store the natural width, or %NULL + * + * Gets the accumulative preferred width for @height for all rows which have + * been requested for the same said @height with this context. + * + * After gtk_cell_area_context_reset() is called and/or before ever requesting + * the size of a #GtkCellArea, the returned values are -1. + * + * Since: 3.0 + */ +void +gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context, + gint height, + gint *minimum_width, + gint *natural_width) +{ + g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context)); + + if (GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_width_for_height) + GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_width_for_height (context, + height, + minimum_width, + natural_width); +} + +/** * gtk_cell_area_context_get_allocation: * @context: a #GtkCellAreaContext * @width: (out) (allow-none): location to store the allocated width, or %NULL. |