API: widget: Add gtk_widget_queue_allocate()

This is so widgets can queue a rerun of their allocation logic, but
without triggering resizes everywhere.

For now, it just calls gtk_widget_queue_resize().
This commit is contained in:
Benjamin Otte 2015-09-14 17:56:05 +02:00
parent 798a288405
commit 195397e87a
2 changed files with 27 additions and 3 deletions

View File

@ -5576,6 +5576,28 @@ gtk_widget_queue_draw (GtkWidget *widget)
0, 0, rect.width, rect.height);
}
/**
* gtk_widget_queue_allocate:
* @widget: a #GtkWidget
*
* This function is only for use in widget implementations.
*
* Flags the widget for a rerun of the GtkWidgetClass::size_allocate
* function. Use this function instead of gtk_widget_queue_resize()
* when the @widget's size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is gtk_widget_set_halign().
*/
void
gtk_widget_queue_allocate (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
/* for now... */
gtk_widget_queue_resize (widget);
}
/**
* gtk_widget_queue_resize:
* @widget: a #GtkWidget
@ -10979,7 +11001,7 @@ gtk_widget_error_bell (GtkWidget *widget)
settings = gtk_widget_get_settings (widget);
if (!settings)
return;
return;
g_object_get (settings,
"gtk-error-bell", &beep,
@ -14544,7 +14566,7 @@ gtk_widget_set_halign (GtkWidget *widget,
return;
widget->priv->halign = align;
gtk_widget_queue_resize (widget);
gtk_widget_queue_allocate (widget);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HALIGN]);
}
@ -14610,7 +14632,7 @@ gtk_widget_set_valign (GtkWidget *widget,
return;
widget->priv->valign = align;
gtk_widget_queue_resize (widget);
gtk_widget_queue_allocate (widget);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_VALIGN]);
}

View File

@ -663,6 +663,8 @@ GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_resize (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
GDK_AVAILABLE_IN_3_20
void gtk_widget_queue_allocate (GtkWidget *widget);
GDK_AVAILABLE_IN_3_8
GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget);