Compare commits

...

1 Commits

Author SHA1 Message Date
Carlos Soriano
4c64df1245 test revealer 2018-08-03 17:28:01 +02:00

View File

@@ -307,10 +307,11 @@ gtk_revealer_get_child_allocation (GtkRevealer *revealer,
GtkAllocation *allocation,
GtkAllocation *child_allocation)
{
GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
GtkWidget *child;
GtkRevealerTransitionType transition;
GtkBorder padding;
gint vertical_padding, horizontal_padding;
gint minimum, vertical_padding, horizontal_padding;
g_return_if_fail (revealer != NULL);
g_return_if_fail (allocation != NULL);
@@ -322,24 +323,33 @@ gtk_revealer_get_child_allocation (GtkRevealer *revealer,
child_allocation->x = 0;
child_allocation->y = 0;
child_allocation->width = 0;
child_allocation->height = 0;
child_allocation->width = allocation->width - horizontal_padding;
child_allocation->height = allocation->height - vertical_padding;
child = gtk_bin_get_child (GTK_BIN (revealer));
if (child != NULL && gtk_widget_get_visible (child))
if (child != NULL && priv->current_pos != 1.0 && gtk_widget_get_visible (child))
{
transition = effective_transition (revealer);
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
gtk_widget_get_preferred_width_for_height (child, MAX (0, allocation->height - vertical_padding), NULL,
&child_allocation->width);
else
gtk_widget_get_preferred_height_for_width (child, MAX (0, allocation->width - horizontal_padding), NULL,
&child_allocation->height);
}
child_allocation->width = MAX (child_allocation->width, allocation->width - horizontal_padding);
child_allocation->height = MAX (child_allocation->height, allocation->height - vertical_padding);
switch (transition)
{
case GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT:
case GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT:
gtk_widget_get_preferred_width_for_height (child, child_allocation->height, &minimum, NULL);
child_allocation->width = MIN (minimum, child_allocation->width * (1 / priv->current_pos));
break;
case GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN:
case GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP:
gtk_widget_get_preferred_height_for_width (child, child_allocation->width, &minimum, NULL);
child_allocation->height = MIN (minimum, child_allocation->height * (1 / priv->current_pos));
break;
case GTK_REVEALER_TRANSITION_TYPE_NONE:
case GTK_REVEALER_TRANSITION_TYPE_CROSSFADE:
default:
break;
}
}
}
static void