Move GtkSizeRequest into GtkWidget

It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.

Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.

So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
  gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
  gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.

The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
This commit is contained in:
Benjamin Otte
2010-09-21 16:35:17 +02:00
parent f52a1fcfbd
commit d9c9259861
78 changed files with 1090 additions and 1357 deletions

View File

@ -391,7 +391,7 @@ gtk_rotated_bin_size_request (GtkWidget *widget,
child_requisition.height = 0;
if (bin->child && gtk_widget_get_visible (bin->child))
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
gtk_widget_get_preferred_size ( (bin->child),
&child_requisition, NULL);
s = sin (bin->angle);
@ -434,8 +434,8 @@ gtk_rotated_bin_size_allocate (GtkWidget *widget,
s = sin (bin->angle);
c = cos (bin->angle);
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
&child_requisition, NULL);
gtk_widget_get_preferred_size (bin->child,
&child_requisition, NULL);
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.height = child_requisition.height;

View File

@ -315,7 +315,7 @@ gtk_mirror_bin_size_request (GtkWidget *widget,
child_requisition.height = 0;
if (bin->child && gtk_widget_get_visible (bin->child))
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
gtk_widget_get_preferred_size ( (bin->child),
&child_requisition, NULL);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@ -349,8 +349,8 @@ gtk_mirror_bin_size_allocate (GtkWidget *widget,
GtkRequisition child_requisition;
GtkAllocation child_allocation;
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
&child_requisition, NULL);
gtk_widget_get_preferred_size (bin->child,
&child_requisition, NULL);
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.height = child_requisition.height;