Commit Graph

20201 Commits

Author SHA1 Message Date
Tristan Van Berkom
c927f5e60d Split up width and height queries so that they make more sense (extended-layout) 2010-04-20 01:26:58 -04:00
Tristan Van Berkom
0330658a7f Added request_natural argument to get_desired_size()
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.
2010-04-20 01:24:51 -04:00
Tristan Van Berkom
3a9ab87489 GtkAlignment now tries to allocate natural size to the child if available and does the height-for-width calculation depending on allocation. 2010-04-20 01:22:31 -04:00
Tristan Van Berkom
0b92348077 Fixed acces of child->requisition; call gtk_widget_get_child_requisition instead.
This fixes squished pathbar issue (as access to ->requisition is really
not supported anymore).
2010-04-20 00:33:20 -04:00
Tristan Van Berkom
b0fc43e958 Reduced natural request padding for rotating ellipsizing labels
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.
2010-04-19 21:50:55 -04:00
Tristan Van Berkom
8ae5e01225 Fixed another caching bug in extended layout
Was confusing width/height REQUEST_NEEDED flags, this caused
the volumebutton test to not re-request the height properly
when changing orientations.
2010-04-19 21:37:44 -04:00
Tristan Van Berkom
de4a8f8ddc Unconditionally return the height for the minimum width when doing get_desired_height()
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.
2010-04-19 20:43:19 -04:00
Tristan Van Berkom
ee8db39393 Fixed height-for-width cache
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).
2010-04-19 20:41:23 -04:00
Tristan Van Berkom
119267d7c8 Removing old comments in gtkbin.c 2010-04-19 20:40:04 -04:00
Tristan Van Berkom
3783a0a54f Fixed computation of sizegroups when no explicit request is set.
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.
2010-04-19 14:46:28 -04:00
Tristan Van Berkom
e9e3725ee7 Fixed testellipsize 2010-04-19 14:04:20 -04:00
Tristan Van Berkom
a141c66253 Added testextendedlayout2.c to tests.
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...
2010-04-19 01:07:20 -04:00
Tristan Van Berkom
0dff033a64 Fixed GtkSpinner to request 12x12 at init time instead of at expose time.
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.
2010-04-18 20:46:30 -04:00
Tristan Van Berkom
4c1fa76520 Fixed _gtk_size_group_bump_requisition() to properly handle values specified by gtk_widget_set_size_request() 2010-04-18 20:45:42 -04:00
Tristan Van Berkom
e997ac37a7 Added GTK_DEBUG_EXTENDED_LAYOUT flag and use that for debuggin in gtkextendedlayout.c 2010-04-18 20:14:13 -04:00
Tristan Van Berkom
6dc5cdb981 Implemented GtkExtendedLayout on GtkWindow. 2010-04-18 20:13:46 -04:00
Tristan Van Berkom
fe257d23dd Fixed GtkAssistant to not access ->requisition of children directly.
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).
2010-04-18 20:11:43 -04:00
Tristan Van Berkom
3cbd9e9313 Further fixed base outputs of GtkLabel desired geometries.
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.
2010-04-18 18:13:56 -04:00
Tristan Van Berkom
da318411dc Fixed bug in gtk_extended_get_desired_size().
gtk_extended_get_desired_size() was mixing up orientations based
on the preference, considering ditching the preference anyway.
Also slightly enhanced debug prints.
2010-04-18 18:12:30 -04:00
Tristan Van Berkom
35cc52f418 Compute the collective heights for the width of a horizontal box.
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.
2010-04-18 18:09:40 -04:00
Tristan Van Berkom
33039c1452 Fixed extended layout test to compile without the gtk_label_set_fullsize() api. 2010-04-18 17:56:58 -04:00
Tristan Van Berkom
e8a365ce36 Restore functionality where ellipsizing label *minimum* size grows to "max-char-width". 2010-04-17 23:06:24 -04:00
Tristan Van Berkom
64e23c42bd Fixed GtkLabel reported minimum and natural sizes
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.
2010-04-17 22:54:29 -04:00
Tristan Van Berkom
8b57ad94c0 Now gtk_extended_layout_get_desired_size() returns a minimum for minimum in the minimum requisition and a natural for minimum in the natural. 2010-04-17 22:52:27 -04:00
Tristan Van Berkom
b30445c927 Make GtkWindow use the generic smallest size for the requisition again 2010-04-17 22:51:35 -04:00
Tristan Van Berkom
19ff8cb026 Fixed test to call the extended layout api instead of consulting ->requisition 2010-04-17 22:50:12 -04:00
Tristan Van Berkom
9247bc8d6d Fixed GtkExtendedLayout interaction with sizegroups plus cleanups
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
2010-04-17 01:51:10 -04:00
Tristan Van Berkom
46fe9c3f00 Disabling natural sizes of labels.
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.
2010-04-17 01:49:35 -04:00
Tristan Van Berkom
caba7992b8 Refactored GtkSizeGroup for GtkExtendedLayout
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.
2010-04-17 01:46:59 -04:00
Tristan Van Berkom
8432f54c51 Added _gtk_size_group_bump_requisition()
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.
2010-04-14 18:07:27 -04:00
Tristan Van Berkom
d2c35ec62a Mega commit to change ->get_desired_size() for ->get_desired_width/height().
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.
2010-04-12 22:21:46 -04:00
Tristan Van Berkom
1b2be80f10 Constrain the window to the minimum width for the natural height
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.
2010-04-10 22:48:13 -04:00
Tristan Van Berkom
6b89f05a99 Implemented gtk_extended_layout_is_height_for_width() and added another guess algorithm
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).
2010-04-10 22:39:11 -04:00
Tristan Van Berkom
639e396147 Fixed gtkbin.c:parent_extended_layout_iface to be static. 2010-04-10 22:38:47 -04:00
Tristan Van Berkom
24950ec144 Added gtk_extended_layout_is_height_for_width()
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.
2010-04-10 22:32:55 -04:00
Tristan Van Berkom
629bb5a265 Fixed warnings due to missing GTK_WIDGET (cellview) casting. 2010-04-10 22:31:52 -04:00
Tristan Van Berkom
c0e950f17b Fixed wrapping labels to show up correctly aligned inside their allocations. 2010-04-10 22:30:42 -04:00
Tristan Van Berkom
c67559ad03 Adding tests ported over from the old branch by Matthias. 2010-04-10 22:03:20 -04:00
Tristan Van Berkom
1041a186c7 Added get_height_for_width/get_width_for_height implementation to GtkBox.
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.
2010-04-09 21:50:33 -04:00
Tristan Van Berkom
35e2dfce08 Fixing height-for-width wrapping of GtkLabel
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).
2010-04-09 21:47:25 -04:00
Tristan Van Berkom
73056e92d8 Reimplemented GtkExtendedLayout on GtkBin
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.
2010-04-09 00:19:42 -04:00
Tristan Van Berkom
b3303727ad Fixed regression in GtkImage size requests
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).
2010-04-08 22:05:36 -04:00
Tristan Van Berkom
7304e4227f Fixed gtk_box_size_allocate() for homogeneous boxes
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.
2010-04-08 21:45:07 -04:00
Tristan Van Berkom
ffffa7361c Implemented GtkExtendedLayout on GtkComboBox.
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.
2010-04-08 18:54:47 -04:00
Tristan Van Berkom
531b449580 Deprecated gtk_widget_size_request and gtk_widget_get_child_requisition()
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().
2010-04-08 18:53:23 -04:00
Tristan Van Berkom
99425f15f5 Added assertions
Added assersions that gtk_extended_layout_get_height_for_width()
methods return minimum sizes lesser than the natural size.
2010-04-08 18:52:12 -04:00
Tristan Van Berkom
1706608de3 Simplified code in GtkSizeGroup, fixes minimum natural 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).
2010-04-08 18:49:34 -04:00
Tristan Van Berkom
36ef655061 Added gtk_cell_view_get_size_of_row() to gtk.symbols 2010-04-08 18:48:42 -04:00
Tristan Van Berkom
143660eff6 GtkCellView refactoring for extended layout
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.
2010-04-08 18:46:19 -04:00
Tristan Van Berkom
b10f2fc001 Some extended layout fixes for GtkCellView
Fixed GtkCellView to use the new GtkExtendedCell interface to get
natural size from cells and factored out the old size_request() method.
2010-04-07 01:27:15 -04:00