From: Matthias Clasen Date: Fri, 30 Apr 2010 21:56:50 +0000 (-0400) Subject: Merge branch 'native-layout-incubator' X-Git-Url: http://pileus.org/git/?p=~andy%2Fgtk;a=commitdiff_plain;h=db76c77b819b1b31e19609bb1b30c85f22b5b482 Merge branch 'native-layout-incubator' Conflicts: configure.in docs/reference/gtk/tmpl/gtkaction.sgml docs/reference/gtk/tmpl/gtkbuilder.sgml gdk/directfb/gdkkeys-directfb.c gdk/gdk.symbols gdk/x11/gdkwindow-x11.c gtk/gtkalignment.c gtk/gtkbox.c gtk/gtkbutton.c gtk/gtkcelleditable.c gtk/gtkfilechooser.c gtk/gtkframe.c gtk/gtkinvisible.c gtk/gtklabel.c gtk/gtkscrolledwindow.c gtk/gtksearchenginetracker.c gtk/gtktextview.c gtk/gtktoolbutton.c gtk/gtktooltip.c gtk/gtkviewport.c gtk/gtkwidget.c gtk/gtkwindow.c po-properties/ca@valencia.po po-properties/es.po po-properties/kn.po po-properties/mr.po po/ca.po po/ca@valencia.po po/el.po po/es.po po/gl.po po/id.po po/kn.po po/lv.po po/mr.po po/th.po --- db76c77b819b1b31e19609bb1b30c85f22b5b482 diff --cc gtk/gtkalignment.c index ad741751e,73905f813..5d986e2a7 --- a/gtk/gtkalignment.c +++ b/gtk/gtkalignment.c @@@ -24,27 -24,9 +24,28 @@@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +/** + * SECTION:gtkalignment + * @Short_description: A widget which controls the alignment and size of its child + * @Title: GtkAlignment + * + * The #GtkAlignment widget controls the alignment and size of its child widget. + * It has four settings: xscale, yscale, xalign, and yalign. + * + * The scale settings are used to specify how much the child widget should + * expand to fill the space allocated to the #GtkAlignment. + * The values can range from 0 (meaning the child doesn't expand at all) to + * 1 (meaning the child expands to fill all of the available space). + * + * The align settings are used to place the child widget within the available + * area. The values range from 0 (top or left) to 1 (bottom or right). + * Of course, if the scale settings are both set to 1, the alignment settings + * have no effect. + */ + #include "config.h" #include "gtkalignment.h" + #include "gtkextendedlayout.h" #include "gtkprivate.h" #include "gtkintl.h" #include "gtkalias.h" diff --cc gtk/gtkbin.c index 3d533b2de,ed2796a89..25ccb6066 --- a/gtk/gtkbin.c +++ b/gtk/gtkbin.c @@@ -24,21 -24,9 +24,22 @@@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +/** + * SECTION:gtkbin + * @Short_description: A container with just one child + * @Title: GtkBin + * + * The #GtkBin widget is a container with just one child. + * It is not very useful itself, but it is useful for deriving subclasses, + * since it provides common code needed for handling a single child widget. + * + * Many GTK+ widgets are subclasses of #GtkBin, including #GtkWindow, + * #GtkButton, #GtkFrame, #GtkHandleBox or #GtkScrolledWindow. + */ + #include "config.h" #include "gtkbin.h" + #include "gtkextendedlayout.h" #include "gtkintl.h" #include "gtkalias.h" diff --cc gtk/gtkbox.c index d9356f53e,231a30678..35900e888 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@@ -467,94 -372,46 +426,46 @@@ gtk_box_size_allocate (GtkWidget *w { child = children->data; children = children->next; - + - if ((child->pack == GTK_PACK_START) && gtk_widget_get_visible (child->widget)) + if (gtk_widget_get_visible (child->widget)) { - if (box->homogeneous) - { - if (nvis_children == 1) - { - child_width = width; - child_height = height; - } - else - { - child_width = extra; - child_height = extra; - } - - nvis_children -= 1; - width -= extra; - height -= extra; - } - else - { - GtkRequisition child_requisition; - - gtk_widget_get_child_requisition (child->widget, &child_requisition); - - child_width = child_requisition.width + child->padding * 2; - child_height = child_requisition.height + child->padding * 2; - - if (child->expand) - { - if (nexpand_children == 1) - { - child_width += width; - child_height += height; - } - else - { - child_width += extra; - child_height += extra; - } - - nexpand_children -= 1; - width -= extra; - height -= extra; - } - } - - if (child->fill) - { - if (private->orientation == GTK_ORIENTATION_HORIZONTAL) - { - child_allocation.width = MAX (1, (gint) child_width - (gint) child->padding * 2); - child_allocation.x = x + child->padding; - } - else - { - child_allocation.height = MAX (1, child_height - (gint)child->padding * 2); - child_allocation.y = y + child->padding; - } - } + if (private->orientation == GTK_ORIENTATION_HORIZONTAL) + gtk_extended_layout_get_width_for_height (GTK_EXTENDED_LAYOUT (child->widget), + allocation->height, + &sizes[i].minimum_size, + &sizes[i].natural_size); else - { - GtkRequisition child_requisition; - - gtk_widget_get_child_requisition (child->widget, &child_requisition); - if (private->orientation == GTK_ORIENTATION_HORIZONTAL) - { - child_allocation.width = child_requisition.width; - child_allocation.x = x + (child_width - child_allocation.width) / 2; - } - else - { - child_allocation.height = child_requisition.height; - child_allocation.y = y + (child_height - child_allocation.height) / 2; - } - } - - if (direction == GTK_TEXT_DIR_RTL && - private->orientation == GTK_ORIENTATION_HORIZONTAL) - { - child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width; - } - - gtk_widget_size_allocate (child->widget, &child_allocation); - - x += child_width + box->spacing; - y += child_height + box->spacing; + gtk_extended_layout_get_height_for_width (GTK_EXTENDED_LAYOUT (child->widget), + allocation->width, + &sizes[i].minimum_size, + &sizes[i].natural_size); + + + /* Assert the api is working properly */ + if (sizes[i].minimum_size < 0) + g_error ("GtkBox child %s minimum %s: %d < 0 for %s %d", + gtk_widget_get_name (GTK_WIDGET (child->widget)), + (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height", + sizes[i].minimum_size, + (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width", + (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width); + + if (sizes[i].natural_size < sizes[i].minimum_size) + g_error ("GtkBox child %s natural %s: %d < minimum %d for %s %d", + gtk_widget_get_name (GTK_WIDGET (child->widget)), + (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height", + sizes[i].natural_size, + sizes[i].minimum_size, + (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width", + (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width); + + size -= sizes[i].minimum_size; + size -= child->padding * 2; + + spreading[i].index = i; + spreading[i].child = child; + + i += 1; } } diff --cc gtk/gtkfilechooser.c index 85f972f06,70ddfda1a..7341b6397 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@@ -504,7 -504,7 +504,11 @@@ * * * ++<<<<<<< HEAD + * bookmark_indes : ++======= + * bookmark_index : ++>>>>>>> native-layout-incubator * * * index of the bookmark to switch to; the indices start at 0. diff --cc gtk/gtkscrolledwindow.c index 5a3cd9152,936335f42..bf3cda9b1 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@@ -380,9 -397,9 +397,15 @@@ gtk_scrolled_window_init (GtkScrolledWi * gtk_scrolled_window_new: * @hadjustment: (allow-none): horizontal adjustment * @vadjustment: (allow-none): vertical adjustment ++<<<<<<< HEAD + * + * Creates a new scrolled window. + * ++======= + * + * Creates a new scrolled window. + * ++>>>>>>> native-layout-incubator * The two arguments are the scrolled window's adjustments; these will be * shared with the scrollbars and the child widget to keep the bars in sync * with the child. Usually you want to pass %NULL for the adjustments, which