Initial support for baselines

This modifies the size machinery in order to allow baseline support.

We add a new widget vfunc get_preferred_height_and_baseline_for_width
which queries the normal height_for_width (or non-for-width if width
is -1) and additionally returns optional (-1 means "no baseline")
baselines for the minimal and natural heights.

We also add a new gtk_widget_size_allocate_with_baseline() which
baseline-aware containers can use to allocate children with a specific
baseline, either one inherited from the parent, or one introduced due
to requested baseline alignment in the container
itself. size_allocate_with_baseline() works just like a normal size
allocation, except the baseline gets recorded so that the child can
access it via gtk_widget_get_allocated_baseline() when it aligns
itself.

There are also adjust_baseline_request/allocation similar to the
allocation adjustment, and we extend the size request cache to also
store the baselines.
This commit is contained in:
Alexander Larsson
2013-03-05 14:54:03 +01:00
parent f15bc7818e
commit 852cbb62b8
7 changed files with 523 additions and 103 deletions

View File

@ -69,7 +69,9 @@ void _gtk_widget_compute_size_for_orientation (GtkWidget *widget,
GtkOrientation orientation,
gint for_size,
gint *minimum_size,
gint *natural_size);
gint *natural_size,
gint *minimum_baseline,
gint *natural_baseline);
void _gtk_widget_get_preferred_size_for_size (GtkWidget *widget,
GtkOrientation orientation,
gint size,