forked from AuroraMiddleware/gtk
Remove size_request from GtkPaned
This is not the final word; GtkPaned should really implement height-for-width, but I didn't have time to complete that now.
This commit is contained in:
parent
80ac6c9701
commit
9b60d27b83
@ -119,8 +119,13 @@ static void gtk_paned_get_child_property (GtkContainer *container,
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_paned_finalize (GObject *object);
|
static void gtk_paned_finalize (GObject *object);
|
||||||
|
|
||||||
static void gtk_paned_size_request (GtkWidget *widget,
|
static void gtk_paned_get_preferred_width (GtkWidget *widget,
|
||||||
GtkRequisition *requisition);
|
gint *minimum,
|
||||||
|
gint *natural);
|
||||||
|
static void gtk_paned_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural);
|
||||||
|
|
||||||
static void gtk_paned_size_allocate (GtkWidget *widget,
|
static void gtk_paned_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static void gtk_paned_realize (GtkWidget *widget);
|
static void gtk_paned_realize (GtkWidget *widget);
|
||||||
@ -228,7 +233,8 @@ gtk_paned_class_init (GtkPanedClass *class)
|
|||||||
object_class->get_property = gtk_paned_get_property;
|
object_class->get_property = gtk_paned_get_property;
|
||||||
object_class->finalize = gtk_paned_finalize;
|
object_class->finalize = gtk_paned_finalize;
|
||||||
|
|
||||||
widget_class->size_request = gtk_paned_size_request;
|
widget_class->get_preferred_width = gtk_paned_get_preferred_width;
|
||||||
|
widget_class->get_preferred_height = gtk_paned_get_preferred_height;
|
||||||
widget_class->size_allocate = gtk_paned_size_allocate;
|
widget_class->size_allocate = gtk_paned_size_allocate;
|
||||||
widget_class->realize = gtk_paned_realize;
|
widget_class->realize = gtk_paned_realize;
|
||||||
widget_class->unrealize = gtk_paned_unrealize;
|
widget_class->unrealize = gtk_paned_unrealize;
|
||||||
@ -792,41 +798,44 @@ gtk_paned_finalize (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_paned_size_request (GtkWidget *widget,
|
gtk_paned_get_preferred_size (GtkWidget *widget,
|
||||||
GtkRequisition *requisition)
|
GtkOrientation orientation,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
{
|
{
|
||||||
GtkPaned *paned = GTK_PANED (widget);
|
GtkPaned *paned = GTK_PANED (widget);
|
||||||
GtkPanedPrivate *priv = paned->priv;
|
GtkPanedPrivate *priv = paned->priv;
|
||||||
GtkRequisition child_requisition;
|
gint child_min, child_nat;
|
||||||
|
|
||||||
requisition->width = 0;
|
*minimum = *natural = 0;
|
||||||
requisition->height = 0;
|
|
||||||
|
|
||||||
if (priv->child1 && gtk_widget_get_visible (priv->child1))
|
if (priv->child1 && gtk_widget_get_visible (priv->child1))
|
||||||
{
|
{
|
||||||
gtk_widget_get_preferred_size (priv->child1,
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
&child_requisition, NULL);
|
gtk_widget_get_preferred_width (priv->child1, &child_min, &child_nat);
|
||||||
|
else
|
||||||
|
gtk_widget_get_preferred_height (priv->child1, &child_min, &child_nat);
|
||||||
|
|
||||||
requisition->height = child_requisition.height;
|
*minimum = child_min;
|
||||||
requisition->width = child_requisition.width;
|
*natural = child_nat;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->child2 && gtk_widget_get_visible (priv->child2))
|
if (priv->child2 && gtk_widget_get_visible (priv->child2))
|
||||||
{
|
{
|
||||||
gtk_widget_get_preferred_size (priv->child2,
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
&child_requisition, NULL);
|
gtk_widget_get_preferred_width (priv->child2, &child_min, &child_nat);
|
||||||
|
else
|
||||||
|
gtk_widget_get_preferred_height (priv->child2, &child_min, &child_nat);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == orientation)
|
||||||
{
|
{
|
||||||
requisition->height = MAX (requisition->height,
|
*minimum += child_min;
|
||||||
child_requisition.height);
|
*natural += child_nat;
|
||||||
requisition->width += child_requisition.width;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requisition->width = MAX (requisition->width,
|
*minimum = MAX (*minimum, child_min);
|
||||||
child_requisition.width);
|
*natural = MAX (*natural, child_nat);
|
||||||
requisition->height += child_requisition.height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,13 +846,30 @@ gtk_paned_size_request (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
|
gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == orientation)
|
||||||
requisition->width += handle_size;
|
{
|
||||||
else
|
*minimum += handle_size;
|
||||||
requisition->height += handle_size;
|
*natural += handle_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_paned_get_preferred_width (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
gtk_paned_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum, natural);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_paned_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
gtk_paned_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum, natural);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flip_child (GtkWidget *widget,
|
flip_child (GtkWidget *widget,
|
||||||
GtkAllocation *child_pos)
|
GtkAllocation *child_pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user