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:
@ -25,7 +25,6 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksizegroup.h"
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtksizerequest.h"
|
||||
|
||||
|
||||
|
||||
@ -717,9 +716,9 @@ compute_dimension (GtkWidget *widget,
|
||||
else
|
||||
{
|
||||
if (mode == GTK_SIZE_GROUP_HORIZONTAL)
|
||||
gtk_size_request_get_width (GTK_SIZE_REQUEST (tmp_widget), &min_dimension, &nat_dimension);
|
||||
gtk_widget_get_preferred_width (tmp_widget, &min_dimension, &nat_dimension);
|
||||
else
|
||||
gtk_size_request_get_height (GTK_SIZE_REQUEST (tmp_widget), &min_dimension, &nat_dimension);
|
||||
gtk_widget_get_preferred_height (tmp_widget, &min_dimension, &nat_dimension);
|
||||
}
|
||||
|
||||
if (gtk_widget_get_mapped (tmp_widget) || !priv->ignore_hidden)
|
||||
@ -778,7 +777,7 @@ compute_dimension (GtkWidget *widget,
|
||||
*
|
||||
* This function is used both to update sizegroup minimum and natural size
|
||||
* information and widget minimum and natural sizes in multiple passes from
|
||||
* the #GtkSizeRequest apis.
|
||||
* the size request apis.
|
||||
*/
|
||||
void
|
||||
_gtk_size_group_bump_requisition (GtkWidget *widget,
|
||||
|
||||
Reference in New Issue
Block a user