Currently get_desired_size() is more of an emulation of
gtk_widget_size_request() for the minimum size as it bases the
contextual request on the minimum preferred size; this argument
lets you do the request with the natural preferred size as well.
After fixing height requests this works much smoother, although in
some places pango seems to ellipsize a rotated label when given
the width it requested.
This is the correct support for the opposing orientation for widgets
that support height-for-width, in an interface that was realized as
width-for-height, a height-for-width supporting widget should return
the minimum height for the minimum width when the initial
get_desired_height() is run.
Fixed the cache to be cleared when flagged with WIDTH/HEIGHT_REQUEST_NEEDED.
This error was causing some widgets to not be sized correctly (the stock and
icon browser in the demo for instance).
My previous commit to GtkSizeGroup made sure that when
gtk_widget_set_size_request() is set on a widget, it will be
taken into account when computing the widget's own request,
this commit fixes the case where there is no explicit size
request.
This test is a collection of builder files which demonstrate the
added features of natural sizes and height-for-width geometry; so
far it only contains 3 cases, more to come...
This should not change the space taken by the spinner when hidden,
and it should only set the minimum size not the actual size (i.e. code
in place was conditionally setting it if not allocated 12x12, which
doesnt really make sense)... This fixes spinners showing at the correct size
in gtk-demo.
This was causing a 0 height action-area because a GtkBox does not
generally update ->requisition with anything useful
(call gtk_widget_get_child_requisition() here instead).
Now (when wrapping), if no "width-chars" was specified for a minimum
width, default to the width guessed by gtk_label_ensure_layout(), small
specified widths will otherwise result in very large height requests.
gtk_extended_get_desired_size() was mixing up orientations based
on the preference, considering ditching the preference anyway.
Also slightly enhanced debug prints.
Introduce an algorithm to allocate children some virtual widths based on
their base widths returned by ->get_desired_width(), then return the
collective desired heights for each or thier virtually allocated width.
This will only work in the horizontal orientation.
This commit makes GtkLabel use "max-width-chars" to determine the
desired natural width for wrapping labels as well as all around refactoring
the initially reported values in get_desired_width/height. this also
addresses some issues with rotating ellipsizing text.
Fixed GtkExtendedLayout to interact with sizegroups, "size-requsts"
and caching the values all in the same code segment.
Migrated the cache code to be internal to gtkextendedlayout.c
Since GtkLabel is returning invalid natural sizes for now,
in order to test regressions well with the new width-for-height
api, I've temporarily disabled the natural values.
Removed _gtk_size_group_compute_requisition and
_gtk_size_group_get_child_requisition in favor of
_gtk_size_group_bump_requisition() which does an orientation
contextual computation of the size group and returns the
collective value in one pass.
Added a function to update sizegroups in multiple passes, this
way the width and height can be updated in the sizegroups after
querying the extended layout implementor for these.
Implemented this in GtkExtendedLayout, sizegroups should be working reasonably now.
This commit changes gtk_extended_layout_get_desired_size() for
per dimension variants. Furthermore this commit reverts the actions
done in size-groups for now as it needs a different approach.
The natural width/height parameters added to aux_info have been changed
for a per width cache for heights and a per height cache for widths.
gtk-demo is still working, currently sizegroups are not taken
into account as mentioned above - size groups need to be alerted both
when the widths and heights are updated independantly and then that
information needs to repropagate also to other extended layout implementors.
GtkWindow now requests the minimum width for the natural height
of its child, or the opposite; depending on ->get_height_for_width.
Currently its not done for GTK_WINDOW_POPUP windows as the menushells
aren't working right yet.
This patch adds another commented algorythm to find the collective
minimum and natural height for a said width of a horizontally oriented
box (or the opposite). The algorithm works quite well and can be optimized
a bit more - currently its commented because GtkLabel cannot effectively
do width-for-height calculations (doh).
Further, this patch returns an is_height_for_width() preference depending
on the boxes orientation (vertical boxes are width-for-height).
Added an indicator telling whether a widget prefers to be allocated
as height-for-width or width-for-height. Usually this depends on the
orientation of a container or the nature of a content widget like GtkLabel.
This indicator is only used in the seldom case where a parent is allocating
free space to the child and the child can flow in either direction, GtkWindow
and GtkScrolledWindow are users of this api.
In order for natural size information to cascade correctly up through
the ancestry GtkBox needs to report height-for-width and width-for-height,
this patch includes an implementation for both in both orientations, one
of them is commented for now as its much too cpu intensive to actually use.
Merged in fixes from the old branch in a patch prepared by Matthias Clasen,
added some fixes of my own to make sure that label wrapping follows allocation
and not requisition at show time (allocate time).
Instead of implementing ->get_desired_size() on GtkBin, which
cant really be done because border widths are in the domain of
the concrete subclasses; here we implement only the get_height_for_width
and get_width_for_height apis - GtkBin subclasses whom might have a
variable border width depending on allocations need to write their
own height-for-width implementations.
Fixed gtksizegroup.c:do_size_request() to never force an initial requisition
as some widgets expect it to remain unchanged across resizes (GtkImage
with pixbufs/filenames assigned is one of these cases).
gtk_box_size_allocate() was forgetting to fetch the minimum
size for children when allocating in homogeneous mode and then
accessing the uninitialized allocated values in that case, fixed.
With this commit it is possible to use ellipsizing text
in the combobox's cell renderers and have them desire to
expand to natural size when placed in a GtkBox.
Ever since size groups gtk_widget_size_request() can be used in place
of gtk_widget_get_child_requisition(), deprecating both now in favor
of gtk_extended_layout_get_desired_size().
collapse get_fast_child_requisition && get_fast_natural_size into
a single get_fast_size() function which uses the possibly hard coded
minimum request as a minimum value for the returned desired size
(this fixes cases where widgets unwarily return height-for-width
with minimum size > natural size).
Added gtk_cell_view_get_desired_size_of_row() to report full
extended layout information for a said row, this obsoletes
gtk_cell_view_get_size_of_row(). Also make GtkCellView queue
a resize on itself when cell renderers are added/removed.