forked from AuroraMiddleware/gtk
Formatting and typo fixes
This commit is contained in:
parent
909ca43c1a
commit
148ea63dba
@ -36,7 +36,7 @@
|
|||||||
* Some important things to keep in mind when implementing
|
* Some important things to keep in mind when implementing
|
||||||
* or using the extended layout.
|
* or using the extended layout.
|
||||||
*
|
*
|
||||||
* The Extended Layout system will query a logical heirarchy in
|
* The Extended Layout system will query a logical hierarchy in
|
||||||
* only one orientation at a time. When widgets are initially queried
|
* only one orientation at a time. When widgets are initially queried
|
||||||
* for their minimum sizes it is generally done in a dual pass
|
* for their minimum sizes it is generally done in a dual pass
|
||||||
* in the direction chosen by the toplevel.
|
* in the direction chosen by the toplevel.
|
||||||
@ -46,22 +46,22 @@
|
|||||||
* in the interface will computed and collectively returned to
|
* in the interface will computed and collectively returned to
|
||||||
* the toplevel by way of gtk_extended_layout_get_desired_width().
|
* the toplevel by way of gtk_extended_layout_get_desired_width().
|
||||||
* Next; the toplevel will use the minimum width to query for the
|
* Next; the toplevel will use the minimum width to query for the
|
||||||
* minimum height contextual to that width using gtk_extended_layout_get_height_for_width()
|
* minimum height contextual to that width using
|
||||||
* which will also be a highly recursive operation. This minimum
|
* gtk_extended_layout_get_height_for_width() which will also be a
|
||||||
* for minimum size can be used to set the minimum size constraint
|
* highly recursive operation. This minimum for minimum size can be
|
||||||
* on the toplevel.
|
* used to set the minimum size constraint on the toplevel.
|
||||||
*
|
*
|
||||||
* When allocating; each container can use the minimum and natural
|
* When allocating; each container can use the minimum and natural
|
||||||
* sizes reported by thier children to allocate natural sizes and
|
* sizes reported by their children to allocate natural sizes and
|
||||||
* expose as much content as possible with the given allocation.
|
* expose as much content as possible with the given allocation.
|
||||||
*
|
*
|
||||||
* That means that the request operation at allocation time will
|
* That means that the request operation at allocation time will
|
||||||
* usually fire again in contexts of different allocated sizes than
|
* usually fire again in contexts of different allocated sizes than
|
||||||
* the ones originally queried for.
|
* the ones originally queried for.
|
||||||
*
|
*
|
||||||
* A Widget that does not actually do height-for-width
|
* A widget that does not actually do height-for-width
|
||||||
* or width-for-height size negotiations only has to implement
|
* or width-for-height size negotiations only has to implement
|
||||||
* get_desired_width() and get_desired_height()
|
* get_desired_width() and get_desired_height().
|
||||||
*
|
*
|
||||||
* If a widget does move content around to smartly use up the
|
* If a widget does move content around to smartly use up the
|
||||||
* allocated size, then it must support the request properly in
|
* allocated size, then it must support the request properly in
|
||||||
@ -151,8 +151,7 @@ get_cached_desired_size (gint for_size,
|
|||||||
|
|
||||||
cs = &cached_sizes[i];
|
cs = &cached_sizes[i];
|
||||||
|
|
||||||
if (cs->age > 0 &&
|
if (cs->age > 0 && cs->for_size == for_size)
|
||||||
cs->for_size == for_size)
|
|
||||||
{
|
{
|
||||||
*result = cs;
|
*result = cs;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -172,8 +171,9 @@ destroy_cache (ExtendedLayoutCache *cache)
|
|||||||
g_slice_free (ExtendedLayoutCache, cache);
|
g_slice_free (ExtendedLayoutCache, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLayoutCache *
|
static ExtendedLayoutCache *
|
||||||
get_cache (GtkExtendedLayout *layout, gboolean create)
|
get_cache (GtkExtendedLayout *layout,
|
||||||
|
gboolean create)
|
||||||
{
|
{
|
||||||
ExtendedLayoutCache *cache;
|
ExtendedLayoutCache *cache;
|
||||||
|
|
||||||
@ -228,11 +228,11 @@ compute_size_for_orientation (GtkExtendedLayout *layout,
|
|||||||
{
|
{
|
||||||
cached_size = &cache->desired_widths[0];
|
cached_size = &cache->desired_widths[0];
|
||||||
|
|
||||||
if (GTK_WIDGET_WIDTH_REQUEST_NEEDED (layout) == FALSE)
|
if (!GTK_WIDGET_WIDTH_REQUEST_NEEDED (layout))
|
||||||
found_in_cache = get_cached_desired_size (for_size, cache->desired_widths, &cached_size);
|
found_in_cache = get_cached_desired_size (for_size, cache->desired_widths, &cached_size);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset (cache->desired_widths, 0x0, N_CACHED_SIZES * sizeof (DesiredSize));
|
memset (cache->desired_widths, 0, N_CACHED_SIZES * sizeof (DesiredSize));
|
||||||
cache->cached_width_age = 1;
|
cache->cached_width_age = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,11 +240,11 @@ compute_size_for_orientation (GtkExtendedLayout *layout,
|
|||||||
{
|
{
|
||||||
cached_size = &cache->desired_heights[0];
|
cached_size = &cache->desired_heights[0];
|
||||||
|
|
||||||
if (GTK_WIDGET_HEIGHT_REQUEST_NEEDED (layout) == FALSE)
|
if (!GTK_WIDGET_HEIGHT_REQUEST_NEEDED (layout))
|
||||||
found_in_cache = get_cached_desired_size (for_size, cache->desired_heights, &cached_size);
|
found_in_cache = get_cached_desired_size (for_size, cache->desired_heights, &cached_size);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset (cache->desired_heights, 0x0, N_CACHED_SIZES * sizeof (DesiredSize));
|
memset (cache->desired_heights, 0, N_CACHED_SIZES * sizeof (DesiredSize));
|
||||||
cache->cached_height_age = 1;
|
cache->cached_height_age = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,10 +302,12 @@ compute_size_for_orientation (GtkExtendedLayout *layout,
|
|||||||
GTK_PRIVATE_UNSET_FLAG (layout, GTK_HEIGHT_REQUEST_NEEDED);
|
GTK_PRIVATE_UNSET_FLAG (layout, GTK_HEIGHT_REQUEST_NEEDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get size groups to compute the base requisition once one of the values have been cached,
|
/* Get size groups to compute the base requisition once one
|
||||||
* then go ahead and update the cache with the sizegroup computed value.
|
* of the values have been cached, then go ahead and update
|
||||||
|
* the cache with the sizegroup computed value.
|
||||||
*
|
*
|
||||||
* Note this is also where values from gtk_widget_set_size_request() are considered.
|
* Note this is also where values from gtk_widget_set_size_request()
|
||||||
|
* are considered.
|
||||||
*/
|
*/
|
||||||
group_size =
|
group_size =
|
||||||
_gtk_size_group_bump_requisition (GTK_WIDGET (layout),
|
_gtk_size_group_bump_requisition (GTK_WIDGET (layout),
|
||||||
@ -340,15 +342,16 @@ compute_size_for_orientation (GtkExtendedLayout *layout,
|
|||||||
* @layout: a #GtkExtendedLayout instance
|
* @layout: a #GtkExtendedLayout instance
|
||||||
*
|
*
|
||||||
* Gets whether the widget prefers a height-for-width layout
|
* Gets whether the widget prefers a height-for-width layout
|
||||||
* or a width-for-height layout
|
* or a width-for-height layout.
|
||||||
|
*
|
||||||
|
* <note><para>#GtkBin widgets generally propagate the preference of
|
||||||
|
* their child, container widgets need to request something either in
|
||||||
|
* context of their children or in context of their allocation
|
||||||
|
* capabilities.</para></note>
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the widget prefers height-for-width, %FALSE if
|
* Returns: %TRUE if the widget prefers height-for-width, %FALSE if
|
||||||
* the widget should be treated with a width-for-height preference.
|
* the widget should be treated with a width-for-height preference.
|
||||||
*
|
*
|
||||||
* <note><para>#GtkBin widgets generally propagate the preference of thier child,
|
|
||||||
* container widgets need to request something either in context of their
|
|
||||||
* children or in context of their allocation capabilities.</para></note>
|
|
||||||
*
|
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
@ -369,12 +372,13 @@ gtk_extended_layout_is_height_for_width (GtkExtendedLayout *layout)
|
|||||||
/**
|
/**
|
||||||
* gtk_extended_layout_get_desired_width:
|
* gtk_extended_layout_get_desired_width:
|
||||||
* @layout: a #GtkExtendedLayout instance
|
* @layout: a #GtkExtendedLayout instance
|
||||||
* @minimum_width: location to store the minimum size, or %NULL
|
* @minimum_width: location to store the minimum width, or %NULL
|
||||||
* @natural_width: location to store the natural size, or %NULL
|
* @natural_width: location to store the natural width, or %NULL
|
||||||
*
|
*
|
||||||
* Retreives a widget's initial minimum and natural width.
|
* Retrieves a widget's initial minimum and natural width.
|
||||||
*
|
*
|
||||||
* <note><para>This call is specific to height for width requests.</para></note>
|
* <note><para>This call is specific to height-for-width
|
||||||
|
* requests.</para></note>
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
*/
|
*/
|
||||||
@ -383,19 +387,21 @@ gtk_extended_layout_get_desired_width (GtkExtendedLayout *layout,
|
|||||||
gint *minimum_width,
|
gint *minimum_width,
|
||||||
gint *natural_width)
|
gint *natural_width)
|
||||||
{
|
{
|
||||||
compute_size_for_orientation (layout, GTK_SIZE_GROUP_HORIZONTAL, -1, minimum_width, natural_width);
|
compute_size_for_orientation (layout, GTK_SIZE_GROUP_HORIZONTAL,
|
||||||
|
-1, minimum_width, natural_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_extended_layout_get_desired_height:
|
* gtk_extended_layout_get_desired_height:
|
||||||
* @layout: a #GtkExtendedLayout instance
|
* @layout: a #GtkExtendedLayout instance
|
||||||
* @minimum_width: location to store the minimum size, or %NULL
|
* @minimum_width: location to store the minimum height, or %NULL
|
||||||
* @natural_width: location to store the natural size, or %NULL
|
* @natural_width: location to store the natural height, or %NULL
|
||||||
*
|
*
|
||||||
* Retreives a widget's minimum and natural size in a single dimension.
|
* Retrieves a widget's initial minimum and natural height.
|
||||||
*
|
*
|
||||||
* <note><para>This call is specific to width for height requests.</para></note>
|
* <note><para>This call is specific to width-for-height
|
||||||
|
* requests.</para></note>
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
*/
|
*/
|
||||||
@ -404,7 +410,8 @@ gtk_extended_layout_get_desired_height (GtkExtendedLayout *layout,
|
|||||||
gint *minimum_height,
|
gint *minimum_height,
|
||||||
gint *natural_height)
|
gint *natural_height)
|
||||||
{
|
{
|
||||||
compute_size_for_orientation (layout, GTK_SIZE_GROUP_VERTICAL, -1, minimum_height, natural_height);
|
compute_size_for_orientation (layout, GTK_SIZE_GROUP_VERTICAL,
|
||||||
|
-1, minimum_height, natural_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -416,7 +423,7 @@ gtk_extended_layout_get_desired_height (GtkExtendedLayout *layout,
|
|||||||
* @minimum_size: location for storing the minimum size, or %NULL
|
* @minimum_size: location for storing the minimum size, or %NULL
|
||||||
* @natural_size: location for storing the natural size, or %NULL
|
* @natural_size: location for storing the natural size, or %NULL
|
||||||
*
|
*
|
||||||
* Retreives a widget's desired width if it would be given
|
* Retrieves a widget's desired width if it would be given
|
||||||
* the specified @height.
|
* the specified @height.
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
@ -427,7 +434,8 @@ gtk_extended_layout_get_width_for_height (GtkExtendedLayout *layout,
|
|||||||
gint *minimum_width,
|
gint *minimum_width,
|
||||||
gint *natural_width)
|
gint *natural_width)
|
||||||
{
|
{
|
||||||
compute_size_for_orientation (layout, GTK_SIZE_GROUP_HORIZONTAL, height, minimum_width, natural_width);
|
compute_size_for_orientation (layout, GTK_SIZE_GROUP_HORIZONTAL,
|
||||||
|
height, minimum_width, natural_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -437,7 +445,7 @@ gtk_extended_layout_get_width_for_height (GtkExtendedLayout *layout,
|
|||||||
* @minimum_size: location for storing the minimum size, or %NULL
|
* @minimum_size: location for storing the minimum size, or %NULL
|
||||||
* @natural_size: location for storing the natural size, or %NULL
|
* @natural_size: location for storing the natural size, or %NULL
|
||||||
*
|
*
|
||||||
* Retreives a widget's desired height if it would be given
|
* Retrieves a widget's desired height if it would be given
|
||||||
* the specified @width.
|
* the specified @width.
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
@ -448,7 +456,8 @@ gtk_extended_layout_get_height_for_width (GtkExtendedLayout *layout,
|
|||||||
gint *minimum_height,
|
gint *minimum_height,
|
||||||
gint *natural_height)
|
gint *natural_height)
|
||||||
{
|
{
|
||||||
compute_size_for_orientation (layout, GTK_SIZE_GROUP_VERTICAL, width, minimum_height, natural_height);
|
compute_size_for_orientation (layout, GTK_SIZE_GROUP_VERTICAL,
|
||||||
|
width, minimum_height, natural_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -460,14 +469,14 @@ gtk_extended_layout_get_height_for_width (GtkExtendedLayout *layout,
|
|||||||
* @minimum_size: location for storing the minimum size, or %NULL
|
* @minimum_size: location for storing the minimum size, or %NULL
|
||||||
* @natural_size: location for storing the natural size, or %NULL
|
* @natural_size: location for storing the natural size, or %NULL
|
||||||
*
|
*
|
||||||
* Retreives the minimum and natural size of a widget taking
|
* Retrieves the minimum and natural size of a widget taking
|
||||||
* into account the widget's preference for height-for-width management.
|
* into account the widget's preference for height-for-width management.
|
||||||
*
|
*
|
||||||
* If request_natural is specified, the non-contextual natural value will
|
* If request_natural is specified, the non-contextual natural value will
|
||||||
* be used to make the contextual request; otherwise the minimum will be used.
|
* be used to make the contextual request; otherwise the minimum will be used.
|
||||||
*
|
*
|
||||||
* This is used to retreive a suitable size by container widgets whom dont
|
* This is used to retrieve a suitable size by container widgets which do
|
||||||
* impose any restrictions on the child placement
|
* not impose any restrictions on the child placement.
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user