Commit Graph

20181 Commits

Author SHA1 Message Date
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
Tristan Van Berkom
51ffd59884 Implement GtkExtendedLayout on GtkButton
GtkButton as a content type of widget needs to forward natural size information
to parent containers in order to be resized naturally.
2010-04-06 20:48:41 -04:00
Tristan Van Berkom
85a55b2921 Implement GtkExtendedLayout on Alignment
GtkAlignment is already using the height for width api to align
the child in the cases where space is available, but also needed
to implement the extended layout in order to reflect natural sizes
to parent widgets.
2010-04-06 20:47:15 -04:00
Tristan Van Berkom
388ad4090c Implemented GtkExtendedLayout on GtkViewport 2010-04-06 17:15:50 -04:00
Tristan Van Berkom
a17e12c87d Implement GtkExtendedCell on GtkCellRendererText 2010-04-06 03:05:52 -04:00
Tristan Van Berkom
59dafa77dc Use new gtk_tree_view_column_get_desired_size() 2010-04-06 03:05:20 -04:00
Tristan Van Berkom
3128bd0937 Added gtk_tree_view_column_get_desired_size() as its a corner case
that does not fall under the two categories.
2010-04-06 03:03:55 -04:00
Tristan Van Berkom
bb86e61171 Added GtkExtendedCell interface (last commit) 2010-04-06 03:03:03 -04:00
Tristan Van Berkom
7beb83cea4 Add new GtkExtendedCell interface
Added a new interface to extend layout information of GtkCellRenderers,
GtkCellRenderer is a prerequisite of GtkExtendedCellIface and provides
a base implementation of ->get_desired_size() with ->get_size().

Note that the api for GtkExtendedCell differs from GtkExtendedLayout
since the cells need to be passed an additional widget to calculate
sizes contextual to the widget/screen (fonts etc).
2010-04-06 02:59:21 -04:00
Tristan Van Berkom
8263633478 Remove gtk_widget_get_desired_size() 2010-04-06 02:56:20 -04:00
Tristan Van Berkom
68c38e0ffd Fixed classes to call gtk_extended_layout_get_desired_size_again()
The previous patch removes the ambiguous gtk_widget_get_desired_size().
2010-04-06 02:55:07 -04:00
Tristan Van Berkom
ef32192329 Call the ->get_desired_size() method directly on the vtable
This commit is a mistake, it should have been included with the last
commit.
2010-04-06 02:53:51 -04:00
Tristan Van Berkom
92309019e5 Make GtkWidget a prerequisite of extended layout
As it is not allowed to called gtk_extended_layout_get_desired_size()
on a GtkWidget directly; gtk_widget_get_desired_size() was really an
ambiguous api. This patch removes the added GtkWidget api, calls
the appropriate sizegroup code which in turn envokes the interface
vtable, this patch also accordingly makes GtkWidget a prerequisite
of GtkExtendedLayout (the api doesnt work for cell renderers anyway,
patch comming...).
2010-04-06 02:47:20 -04:00
Tristan Van Berkom
52eabce3c4 Revert "Implement extended layout for GtkBin"
This reverts commit 5e8045b14d.

Conflicts:

	gtk/gtkbin.c
2010-04-05 18:10:41 -04:00
Tristan Van Berkom
24ed2f8aa1 Fixed 2 bugs in gtk_box_size_allocate()
This commit fixes the loop to take into consideration the
child->padding that will be allocated to the child while calculating
full available size. Additionally it fixes the initial positioning
of child widgets when packed at the end (a special case because the
x position used starts from the end of the box).
2010-04-05 18:01:56 -04:00
Tristan Van Berkom
eb537a6773 Fixed do_size_request() to start with a 0 base requisition instead of -1 2010-04-05 17:57:06 -04:00
Tristan Van Berkom
4b1315cedc Changed initial values for requisition from -1 to 0.
When doing size-requests and get_natural_size() calls, use 0 as
the base value instead of -1, because size_request code assumes
that widget->requesition is initialized at 0.
2010-04-04 16:38:36 -04:00
Tristan Van Berkom
75b8f7d3ae Fixed GtkBox to not call get_desired_size() on a child when no child is present. 2010-04-04 16:37:06 -04:00
Tristan Van Berkom
1212f263c3 Making function private in gtktreeviewcolumn to pass the abi test. 2010-04-03 21:37:42 -04:00
Tristan Van Berkom
ae2c0b02c3 Refixed merge conflicts for GTK_WIDGET_MAPPED/GTK_WIDGET_VISIBLE 2010-04-03 21:35:18 -04:00
Tristan Van Berkom
5d83f5eba5 Fixed internal native layout algorythm wrt size-request singals/implementations.
Because "size-request" signal can be handled by signal connections as well
as by third party derived classes it is necessary to always fire the
"size-request" signal for every recalculation of the widget requisition,
now gtksizegroup.c:do_size_request() fires the signal first and allows it
to overflow the minimum/natural sizes returned by extended layout
implementations.

GtkWidget->get_natural_size() is now left assigning default -1 values to
ensure they both get overridden by the size-request handling.
2010-04-03 20:59:28 -04:00