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
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "gtkviewport.h"
|
||||
#include "gtkextendedlayout.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
@ -79,8 +80,6 @@ static gint gtk_viewport_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static void gtk_viewport_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_viewport_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_viewport_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
@ -88,7 +87,18 @@ static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
static void gtk_viewport_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
|
||||
G_DEFINE_TYPE (GtkViewport, gtk_viewport, GTK_TYPE_BIN)
|
||||
static void gtk_viewport_extended_layout_init (GtkExtendedLayoutIface *iface);
|
||||
static void gtk_viewport_get_desired_width (GtkExtendedLayout *layout,
|
||||
gint *minimum_size,
|
||||
gint *natural_size);
|
||||
static void gtk_viewport_get_desired_height (GtkExtendedLayout *layout,
|
||||
gint *minimum_size,
|
||||
gint *natural_size);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkViewport, gtk_viewport, GTK_TYPE_BIN,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_LAYOUT,
|
||||
gtk_viewport_extended_layout_init))
|
||||
|
||||
static void
|
||||
gtk_viewport_class_init (GtkViewportClass *class)
|
||||
@ -111,7 +121,6 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
||||
widget_class->realize = gtk_viewport_realize;
|
||||
widget_class->unrealize = gtk_viewport_unrealize;
|
||||
widget_class->expose_event = gtk_viewport_expose;
|
||||
widget_class->size_request = gtk_viewport_size_request;
|
||||
widget_class->size_allocate = gtk_viewport_size_allocate;
|
||||
widget_class->style_set = gtk_viewport_style_set;
|
||||
|
||||
@ -436,10 +445,13 @@ viewport_set_vadjustment_values (GtkViewport *viewport,
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
gint natural_height;
|
||||
|
||||
gtk_widget_get_child_requisition (bin->child, &child_requisition);
|
||||
vadjustment->upper = MAX (child_requisition.height, view_allocation.height);
|
||||
gtk_extended_layout_get_height_for_width (GTK_EXTENDED_LAYOUT (bin->child),
|
||||
view_allocation.width,
|
||||
NULL,
|
||||
&natural_height);
|
||||
vadjustment->upper = MAX (natural_height, view_allocation.height);
|
||||
}
|
||||
else
|
||||
vadjustment->upper = view_allocation.height;
|
||||
@ -740,31 +752,6 @@ gtk_viewport_add (GtkContainer *container,
|
||||
GTK_CONTAINER_CLASS (gtk_viewport_parent_class)->add (container, child);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (widget);
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
requisition->width = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
requisition->height = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
if (GTK_VIEWPORT (widget)->shadow_type != GTK_SHADOW_NONE)
|
||||
{
|
||||
requisition->width += 2 * widget->style->xthickness;
|
||||
requisition->height += 2 * widget->style->ythickness;
|
||||
}
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
requisition->width += child_requisition.width;
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
@ -868,5 +855,74 @@ gtk_viewport_style_set (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_viewport_extended_layout_init (GtkExtendedLayoutIface *iface)
|
||||
{
|
||||
iface->get_desired_width = gtk_viewport_get_desired_width;
|
||||
iface->get_desired_height = gtk_viewport_get_desired_height;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_get_desired_size (GtkExtendedLayout *layout,
|
||||
GtkOrientation orientation,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
GtkWidget *child;
|
||||
gint child_min, child_nat;
|
||||
gint minimum, natural;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (layout));
|
||||
|
||||
/* XXX This should probably be (border_width * 2); but GTK+ has
|
||||
* been doing this with a single border for a while now...
|
||||
*/
|
||||
minimum = GTK_CONTAINER (layout)->border_width;
|
||||
|
||||
if (GTK_VIEWPORT (layout)->shadow_type != GTK_SHADOW_NONE)
|
||||
{
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
minimum += 2 * GTK_WIDGET (layout)->style->xthickness;
|
||||
else
|
||||
minimum += 2 * GTK_WIDGET (layout)->style->ythickness;
|
||||
}
|
||||
|
||||
natural = minimum;
|
||||
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
gtk_extended_layout_get_desired_width (GTK_EXTENDED_LAYOUT (child), &child_min, &child_nat);
|
||||
else
|
||||
gtk_extended_layout_get_desired_height (GTK_EXTENDED_LAYOUT (child), &child_min, &child_nat);
|
||||
|
||||
minimum += child_min;
|
||||
natural += child_nat;
|
||||
}
|
||||
|
||||
if (minimum_size)
|
||||
*minimum_size = minimum;
|
||||
|
||||
if (natural_size)
|
||||
*natural_size = natural;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_get_desired_width (GtkExtendedLayout *layout,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
gtk_viewport_get_desired_size (layout, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_get_desired_height (GtkExtendedLayout *layout,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
gtk_viewport_get_desired_size (layout, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
|
||||
}
|
||||
|
||||
#define __GTK_VIEWPORT_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
Reference in New Issue
Block a user