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);
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;
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));
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;
gtk_widget_show_all (vbox);
/* Compute the size without the drawing area, so we know how big to make the default size */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (vbox),
+ gtk_widget_get_preferred_size ( (vbox),
&scratch_requisition, NULL);
darea = gtk_drawing_area_new ();
<SECTION>
<FILE>gtksizerequest</FILE>
<TITLE>GtkSizeRequest</TITLE>
-GtkSizeRequest
-GtkSizeRequestIface
GtkSizeRequestMode
GtkRequestedSize
-gtk_size_request_get_height
-gtk_size_request_get_width
-gtk_size_request_get_height_for_width
-gtk_size_request_get_width_for_height
-gtk_size_request_get_request_mode
-gtk_size_request_get_size
+gtk_widget_get_preferred_height
+gtk_widget_get_preferred_width
+gtk_widget_get_preferred_height_for_width
+gtk_widget_get_preferred_width_for_height
+gtk_widget_get_request_mode
+gtk_widget_get_preferred_size
gtk_distribute_natural_allocation
<SUBSECTION Standard>
GTK_TYPE_SIZE_REQUEST
<SUBSECTION Private>
-gtk_size_request_get_type
+gtk_widget_get_type
</SECTION>
<SECTION>
gtk_separator_tool_item_get_type
gtk_settings_get_type
gtk_size_group_get_type
-gtk_size_request_get_type
gtk_socket_get_type
gtk_spin_button_get_type
gtk_spinner_get_type
<para>
The size requisition phase of the widget layout process operates top-down.
It starts at a top-level widget, typically a #GtkWindow. The top-level widget
-asks its child for its size requisition by calling gtk_size_request_get_size().
+asks its child for its size requisition by calling gtk_size_request_get_preferred_size().
To determine its requisition, the child asks its own children for their
requisitions and so on. Finally, the top-level widget will get a requisition
back from its child.
<para>
The #GtkFileChooserButton will ellipsize the label,
and thus will thus request little horizontal space. To give the button
-more space, you should call gtk_size_request_get_size(),
+more space, you should call gtk_size_request_get_preferred_size(),
gtk_file_chooser_button_set_width_chars(), or pack the button in
such a way that other interface elements give space to the widget.
</para>
#if IN_HEADER(__GTK_SIZE_REQUEST_H__)
#if IN_FILE(__GTK_SIZE_REQUEST_C__)
-gtk_size_request_get_height
-gtk_size_request_get_height_for_width
-gtk_size_request_get_request_mode
-gtk_size_request_get_size
-gtk_size_request_get_type G_GNUC_CONST
-gtk_size_request_get_width
-gtk_size_request_get_width_for_height
+gtk_widget_get_preferred_height
+gtk_widget_get_preferred_height_for_width
+gtk_widget_get_preferred
+gtk_widget_get_preferred_size
+gtk_widget_get_preferred_width
+gtk_widget_get_preferred_width_for_height
#endif
#endif
static const gchar *gtk_accel_label_get_string (GtkAccelLabel *accel_label);
-static void gtk_accel_label_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_accel_label_get_width (GtkSizeRequest *widget,
- gint *min_width,
- gint *nat_width);
+static void gtk_accel_label_get_preferred_width (GtkWidget *widget,
+ gint *min_width,
+ gint *nat_width);
#define GTK_ACCEL_LABEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ACCEL_LABEL, GtkAccelLabelPrivate))
-static GtkSizeRequestIface *parent_size_request_iface;
-
-G_DEFINE_TYPE_WITH_CODE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_LABEL,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_accel_label_size_request_init))
+G_DEFINE_TYPE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_LABEL)
static void
gtk_accel_label_class_init (GtkAccelLabelClass *class)
object_class->destroy = gtk_accel_label_destroy;
widget_class->draw = gtk_accel_label_draw;
+ widget_class->get_preferred_width = gtk_accel_label_get_preferred_width;
class->signal_quote1 = g_strdup ("<:");
class->signal_quote2 = g_strdup (":>");
}
static void
-gtk_accel_label_size_request_init (GtkSizeRequestIface *iface)
-{
- parent_size_request_iface = g_type_interface_peek_parent (iface);
- iface->get_width = gtk_accel_label_get_width;
-}
-
-static void
-gtk_accel_label_get_width (GtkSizeRequest *widget,
- gint *min_width,
- gint *nat_width)
+gtk_accel_label_get_preferred_width (GtkWidget *widget,
+ gint *min_width,
+ gint *nat_width)
{
GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (widget);
PangoLayout *layout;
gint width;
- parent_size_request_iface->get_width (widget, min_width, nat_width);
+ GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->get_preferred_width (widget, min_width, nat_width);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (widget),
gtk_accel_label_get_string (accel_label));
ac_width = gtk_accel_label_get_accel_width (accel_label);
gtk_widget_get_allocation (widget, &allocation);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (allocation.width >= requisition.width + ac_width)
{
GValue *value,
GParamSpec *pspec);
-static void gtk_alignment_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_alignment_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_alignment_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-
-G_DEFINE_TYPE_WITH_CODE (GtkAlignment, gtk_alignment, GTK_TYPE_BIN,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_alignment_size_request_init))
+static void gtk_alignment_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_alignment_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+
+G_DEFINE_TYPE (GtkAlignment, gtk_alignment, GTK_TYPE_BIN)
static void
gtk_alignment_class_init (GtkAlignmentClass *class)
gobject_class->set_property = gtk_alignment_set_property;
gobject_class->get_property = gtk_alignment_get_property;
- widget_class->size_allocate = gtk_alignment_size_allocate;
+ widget_class->size_allocate = gtk_alignment_size_allocate;
+ widget_class->get_preferred_width = gtk_alignment_get_preferred_width;
+ widget_class->get_preferred_height = gtk_alignment_get_preferred_height;
g_object_class_install_property (gobject_class,
PROP_XALIGN,
GtkAlignmentPrivate *priv = alignment->priv;
GtkBin *bin;
GtkAllocation child_allocation;
- GtkWidget *bin_child;
+ GtkWidget *child;
gint width, height;
guint border_width;
gint padding_horizontal, padding_vertical;
gtk_widget_set_allocation (widget, allocation);
bin = GTK_BIN (widget);
- bin_child = gtk_bin_get_child (bin);
- if (bin_child && gtk_widget_get_visible (bin_child))
+ child = gtk_bin_get_child (bin);
+ if (child && gtk_widget_get_visible (child))
{
- GtkSizeRequest *child = GTK_SIZE_REQUEST (bin_child);
gint child_nat_width;
gint child_nat_height;
gint child_width, child_height;
width = MAX (1, allocation->width - padding_horizontal - 2 * border_width);
height = MAX (1, allocation->height - padding_vertical - 2 * border_width);
- if (gtk_size_request_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
+ if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
{
- gtk_size_request_get_width (child, NULL, &child_nat_width);
+ gtk_widget_get_preferred_width (child, NULL, &child_nat_width);
child_width = MIN (width, child_nat_width);
- gtk_size_request_get_height_for_width (child, child_width, NULL, &child_nat_height);
+ gtk_widget_get_preferred_height_for_width (child, child_width, NULL, &child_nat_height);
child_height = MIN (height, child_nat_height);
}
else
{
- gtk_size_request_get_height (child, NULL, &child_nat_height);
+ gtk_widget_get_preferred_height (child, NULL, &child_nat_height);
child_height = MIN (height, child_nat_height);
- gtk_size_request_get_width_for_height (child, child_height, NULL, &child_nat_width);
+ gtk_widget_get_preferred_width_for_height (child, child_height, NULL, &child_nat_width);
child_width = MIN (width, child_nat_width);
}
child_allocation.y = priv->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
- gtk_widget_size_allocate (bin_child, &child_allocation);
+ gtk_widget_size_allocate (child, &child_allocation);
}
}
static void
-gtk_alignment_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_alignment_get_width;
- iface->get_height = gtk_alignment_get_height;
-}
-
-static void
-gtk_alignment_get_size (GtkSizeRequest *widget,
- GtkOrientation orientation,
- gint *minimum_size,
- gint *natural_size)
+gtk_alignment_get_preferred_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
GtkAlignmentPrivate *priv = alignment->priv;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
minimum += (priv->padding_left + priv->padding_right);
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
}
else
{
minimum += (priv->padding_top + priv->padding_bottom);
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
}
natural = minimum;
}
static void
-gtk_alignment_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_alignment_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_alignment_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+ gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_alignment_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_alignment_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_alignment_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
+ gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
/**
static gboolean gtk_arrow_draw (GtkWidget *widget,
cairo_t *cr);
-static void gtk_arrow_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_arrow_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_arrow_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
+static void gtk_arrow_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_arrow_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
-G_DEFINE_TYPE_WITH_CODE (GtkArrow, gtk_arrow, GTK_TYPE_MISC,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_arrow_size_request_init))
+G_DEFINE_TYPE (GtkArrow, gtk_arrow, GTK_TYPE_MISC)
static void
gobject_class->get_property = gtk_arrow_get_property;
widget_class->draw = gtk_arrow_draw;
+ widget_class->get_preferred_width = gtk_arrow_get_preferred_width;
+ widget_class->get_preferred_height = gtk_arrow_get_preferred_height;
g_object_class_install_property (gobject_class,
PROP_ARROW_TYPE,
}
static void
-gtk_arrow_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_arrow_get_width;
- iface->get_height = gtk_arrow_get_height;
-}
-
-static void
-gtk_arrow_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_arrow_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gint xpad;
}
static void
-gtk_arrow_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_arrow_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gint ypad;
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (child_requisition.height != 0)
{
ratio = ((gdouble) child_requisition.width /
GtkAssistantPage *page = list->data;
gint w, h;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->page),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (page->page,
+ &child_requisition, NULL);
width = MAX (width, child_requisition.width);
height = MAX (height, child_requisition.height);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->title),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (page->title,
+ &child_requisition, NULL);
w = child_requisition.width;
h = child_requisition.height;
list = list->next;
}
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sidebar_image),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->sidebar_image,
+ &child_requisition, NULL);
width += child_requisition.width;
height = MAX (height, child_requisition.height);
gtk_widget_set_size_request (priv->header_image, header_width, header_height);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header_image),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->header_image,
+ &child_requisition, NULL);
width = MAX (width, header_width) + 2 * header_padding;
height += header_height + 2 * header_padding;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_area),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->action_area,
+ &child_requisition, NULL);
width = MAX (width, child_requisition.width);
height += child_requisition.height + ACTION_AREA_SPACING;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
/* Header */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header_image),
- &header_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->header_image,
+ &header_requisition, NULL);
header_allocation.x = border_width + header_padding;
header_allocation.y = border_width + header_padding;
gtk_widget_size_allocate (priv->header_image, &header_allocation);
/* Action area */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_area),
- &action_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->action_area,
+ &action_requisition, NULL);
child_allocation.x = border_width;
child_allocation.y = allocation->height - border_width - action_requisition.height;
gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
/* Sidebar */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sidebar_image),
- &sidebar_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->sidebar_image,
+ &sidebar_requisition, NULL);
if (rtl)
child_allocation.x = allocation->width - border_width - sidebar_requisition.width;
if (gtk_widget_get_visible (child))
{
nchildren += 1;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child,
+ &child_requisition, NULL);
avg_w += child_requisition.width + ipad_w;
avg_h += child_requisition.height + ipad_h;
}
if (is_secondary)
nsecondaries++;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (homogeneous || (child_requisition.width + ipad_w < avg_w * 1.5))
{
static GType gtk_bin_child_type (GtkContainer *container);
-static void gtk_bin_size_request_init (GtkSizeRequestIface *iface);
-static GtkSizeRequestMode gtk_bin_get_request_mode (GtkSizeRequest *widget);
-static void gtk_bin_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width);
-static void gtk_bin_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height);
-
-static GtkSizeRequestIface *parent_size_request_iface;
-
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_bin_size_request_init))
+static GtkSizeRequestMode gtk_bin_get_request_mode (GtkWidget *widget);
+static void gtk_bin_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width);
+static void gtk_bin_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
+
+G_DEFINE_ABSTRACT_TYPE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
static void
gtk_bin_class_init (GtkBinClass *class)
{
- GtkContainerClass *container_class;
+ GtkWidgetClass *widget_class = (GtkWidgetClass*) class;
+ GtkContainerClass *container_class = (GtkContainerClass*) class;
- container_class = (GtkContainerClass*) class;
+ widget_class->get_request_mode = gtk_bin_get_request_mode;
+ widget_class->get_preferred_width_for_height = gtk_bin_get_preferred_width_for_height;
+ widget_class->get_preferred_height_for_width = gtk_bin_get_preferred_height_for_width;
container_class->add = gtk_bin_add;
container_class->remove = gtk_bin_remove;
* deduce a common code path for the get_width_for_height()/get_height_for_width()
* cases by using the delta of the base size requsts.
*/
-static void
-gtk_bin_size_request_init (GtkSizeRequestIface *iface)
-{
- parent_size_request_iface = g_type_interface_peek_parent (iface);
-
- iface->get_request_mode = gtk_bin_get_request_mode;
- iface->get_width_for_height = gtk_bin_get_width_for_height;
- iface->get_height_for_width = gtk_bin_get_height_for_width;
-}
-
static GtkSizeRequestMode
-gtk_bin_get_request_mode (GtkSizeRequest *widget)
+gtk_bin_get_request_mode (GtkWidget *widget)
{
GtkBin *bin = GTK_BIN (widget);
GtkBinPrivate *priv = bin->priv;
if (priv->child)
- return gtk_size_request_get_request_mode (GTK_SIZE_REQUEST (priv->child));
+ return gtk_widget_get_request_mode (priv->child);
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
}
static void
-get_child_padding_delta (GtkBin *bin,
- gint *delta_h,
- gint *delta_v)
+get_child_padding_delta (GtkBin *bin,
+ gint *delta_h,
+ gint *delta_v)
{
GtkBinPrivate *priv = bin->priv;
gint hmin, vmin, hnat, vnat, child_hmin, child_vmin;
- /* we can't use gtk_size_request_get_width() wrapper because we want
- * our "original" request, not any external adjustments from
- * set_size_request() or whatever. we have to ask for natural also
- * because NULL isn't allowed for the direct vfuncs
+ /* we can't use gtk_widget_get_preferred_width() wrapper
+ * because we want our "original" request, not any external
+ * adjustments from set_size_request() or whatever. we have
+ * to ask for natural also because NULL isn't allowed for the
+ * direct vfuncs
*/
- GTK_SIZE_REQUEST_GET_IFACE (bin)->get_width(GTK_SIZE_REQUEST (bin), &hmin, &hnat);
- GTK_SIZE_REQUEST_GET_IFACE (bin)->get_height (GTK_SIZE_REQUEST (bin), &vmin, &vnat);
+ GTK_WIDGET_GET_CLASS (bin)->get_preferred_width (GTK_WIDGET (bin), &hmin, &hnat);
+ GTK_WIDGET_GET_CLASS (bin)->get_preferred_height (GTK_WIDGET (bin), &vmin, &vnat);
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->child), &child_hmin, NULL);
- gtk_size_request_get_height (GTK_SIZE_REQUEST (priv->child), &child_vmin, NULL);
+ gtk_widget_get_preferred_width (priv->child, &child_hmin, NULL);
+ gtk_widget_get_preferred_height (priv->child, &child_vmin, NULL);
*delta_h = hmin - child_hmin;
*delta_v = vmin - child_vmin;
}
static void
-gtk_bin_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_bin_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
GtkBin *bin = GTK_BIN (widget);
GtkBinPrivate *priv = bin->priv;
{
get_child_padding_delta (bin, &hdelta, &vdelta);
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (priv->child),
- height - vdelta,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width_for_height (priv->child,
+ height - vdelta,
+ &child_min, &child_nat);
if (minimum_width)
*minimum_width = child_min + hdelta;
*natural_width = child_nat + hdelta;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
static void
-gtk_bin_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_bin_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
GtkBin *bin = GTK_BIN (widget);
GtkBinPrivate *priv = bin->priv;
{
get_child_padding_delta (bin, &hdelta, &vdelta);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->child),
- width - hdelta,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (priv->child,
+ width - hdelta,
+ &child_min, &child_nat);
if (minimum_height)
*minimum_height = child_min + vdelta;
*natural_height = child_nat + vdelta;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height (widget, minimum_height, natural_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, minimum_height, natural_height);
}
static GType gtk_box_child_type (GtkContainer *container);
-static void gtk_box_size_request_init (GtkSizeRequestIface *iface);
-static GtkSizeRequestMode gtk_box_get_request_mode (GtkSizeRequest *widget);
-static void gtk_box_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_box_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_box_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width);
-static void gtk_box_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height);
-
-static GtkSizeRequestIface *parent_size_request_iface;
+static GtkSizeRequestMode gtk_box_get_request_mode (GtkWidget *widget);
+static void gtk_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_box_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width);
+static void gtk_box_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
G_DEFINE_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
- NULL)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_box_size_request_init));
+ NULL))
static void
gtk_box_class_init (GtkBoxClass *class)
object_class->set_property = gtk_box_set_property;
object_class->get_property = gtk_box_get_property;
- widget_class->size_allocate = gtk_box_size_allocate;
+ widget_class->size_allocate = gtk_box_size_allocate;
+ widget_class->get_request_mode = gtk_box_get_request_mode;
+ widget_class->get_preferred_width = gtk_box_get_preferred_width;
+ widget_class->get_preferred_height = gtk_box_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_box_get_preferred_height_for_width;
+ widget_class->get_preferred_width_for_height = gtk_box_get_preferred_width_for_height;
container_class->add = gtk_box_add;
container_class->remove = gtk_box_remove;
continue;
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
- allocation->height,
- &sizes[i].minimum_size,
- &sizes[i].natural_size);
+ gtk_widget_get_preferred_width_for_height (child->widget,
+ allocation->height,
+ &sizes[i].minimum_size,
+ &sizes[i].natural_size);
else
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
- allocation->width,
- &sizes[i].minimum_size,
- &sizes[i].natural_size);
+ gtk_widget_get_preferred_height_for_width (child->widget,
+ allocation->width,
+ &sizes[i].minimum_size,
+ &sizes[i].natural_size);
/* Assert the api is working properly */
}
-static void
-gtk_box_size_request_init (GtkSizeRequestIface *iface)
-{
- parent_size_request_iface = g_type_interface_peek_parent (iface);
-
- iface->get_request_mode = gtk_box_get_request_mode;
- iface->get_width = gtk_box_get_width;
- iface->get_height = gtk_box_get_height;
- iface->get_height_for_width = gtk_box_get_height_for_width;
- iface->get_width_for_height = gtk_box_get_width_for_height;
-}
-
static GtkSizeRequestMode
-gtk_box_get_request_mode (GtkSizeRequest *widget)
+gtk_box_get_request_mode (GtkWidget *widget)
{
GtkBoxPrivate *private = GTK_BOX (widget)->priv;
}
static void
-gtk_box_get_size (GtkSizeRequest *widget,
- GtkOrientation orientation,
- gint *minimum_size,
- gint *natural_size)
+gtk_box_get_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkBox *box;
GtkBoxPrivate *private;
gint child_minimum, child_natural;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- &child_minimum, &child_natural);
+ gtk_widget_get_preferred_width (child->widget,
+ &child_minimum, &child_natural);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- &child_minimum, &child_natural);
+ gtk_widget_get_preferred_height (child->widget,
+ &child_minimum, &child_natural);
if (private->orientation == orientation)
{
}
static void
-gtk_box_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gtk_box_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_box_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
if (gtk_widget_get_visible (child->widget))
{
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- &sizes[i].minimum_size,
- &sizes[i].natural_size);
+ gtk_widget_get_preferred_width (child->widget,
+ &sizes[i].minimum_size,
+ &sizes[i].natural_size);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- &sizes[i].minimum_size,
- &sizes[i].natural_size);
+ gtk_widget_get_preferred_height (child->widget,
+ &sizes[i].minimum_size,
+ &sizes[i].natural_size);
/* Assert the api is working properly */
if (sizes[i].minimum_size < 0)
/* Assign the child's position. */
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
- child_size, &child_minimum, &child_natural);
+ gtk_widget_get_preferred_height_for_width (child->widget,
+ child_size, &child_minimum, &child_natural);
else /* (private->orientation == GTK_ORIENTATION_VERTICAL) */
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
- child_size, &child_minimum, &child_natural);
+ gtk_widget_get_preferred_width_for_height (child->widget,
+ child_size, &child_minimum, &child_natural);
computed_minimum = MAX (computed_minimum, child_minimum);
{
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
- avail_size, &child_size, &child_natural);
+ gtk_widget_get_preferred_width_for_height (child->widget,
+ avail_size, &child_size, &child_natural);
else
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
- avail_size, &child_size, &child_natural);
+ gtk_widget_get_preferred_height_for_width (child->widget,
+ avail_size, &child_size, &child_natural);
child_size += child->padding * 2;
}
static void
-gtk_box_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_box_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
GtkBox *box = GTK_BOX (widget);
- GtkBoxPrivate *private = box->priv;
+ GtkBoxPrivate *private = box->priv;
if (private->orientation == GTK_ORIENTATION_VERTICAL)
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width);
}
static void
-gtk_box_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_box_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
GtkBox *box = GTK_BOX (widget);
- GtkBoxPrivate *private = box->priv;
+ GtkBoxPrivate *private = box->priv;
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height);
static void gtk_button_set_use_action_appearance (GtkButton *button,
gboolean use_appearance);
-static void gtk_button_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_button_get_width (GtkSizeRequest *widget,
+static void gtk_button_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_button_get_height (GtkSizeRequest *widget,
+static void gtk_button_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
G_DEFINE_TYPE_WITH_CODE (GtkButton, gtk_button, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
- gtk_button_activatable_interface_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_button_size_request_init))
+ gtk_button_activatable_interface_init))
static void
gtk_button_class_init (GtkButtonClass *klass)
object_class->destroy = gtk_button_destroy;
+ widget_class->get_preferred_width = gtk_button_get_preferred_width;
+ widget_class->get_preferred_height = gtk_button_get_preferred_height;
widget_class->screen_changed = gtk_button_screen_changed;
widget_class->realize = gtk_button_realize;
widget_class->unrealize = gtk_button_unrealize;
static void
-gtk_button_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_button_get_width;
- iface->get_height = gtk_button_get_height;
-}
-
-static void
-gtk_button_get_size (GtkSizeRequest *widget,
+gtk_button_get_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
gint child_min, child_nat;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
minimum += child_min;
natural += child_nat;
}
static void
-gtk_button_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_button_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gtk_button_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_button_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_button_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gtk_button_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
if (priv->sizing_label == NULL)
priv->sizing_label = gtk_label_new (_("New accelerator..."));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sizing_label),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (priv->sizing_label, &requisition, NULL);
GTK_CELL_RENDERER_CLASS (gtk_cell_renderer_accel_parent_class)->get_size (cell, widget, cell_area,
x_offset, y_offset, width, height);
gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->entry),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (priv->entry, &requisition, NULL);
if (requisition.height < cell_area->height)
{
GtkBorder *style_border;
#include "gtkintl.h"
#include "gtkcellrenderertext.h"
#include "gtkcellrendererpixbuf.h"
-#include "gtksizerequest.h"
#include "gtkcellsizerequest.h"
#include "gtkprivate.h"
+#include "gtksizerequest.h"
#include <gobject/gmarshal.h>
#include "gtkbuildable.h"
const gchar *tagname,
gpointer *data);
-static void gtk_cell_view_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_cell_view_get_width (GtkSizeRequest *widget,
+static void gtk_cell_view_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_cell_view_get_height (GtkSizeRequest *widget,
+static void gtk_cell_view_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_cell_view_get_width_for_height (GtkSizeRequest *widget,
+static void gtk_cell_view_get_preferred_width_for_height (GtkWidget *widget,
gint avail_size,
gint *minimum_size,
gint *natural_size);
-static void gtk_cell_view_get_height_for_width (GtkSizeRequest *widget,
+static void gtk_cell_view_get_preferred_height_for_width (GtkWidget *widget,
gint avail_size,
gint *minimum_size,
gint *natural_size);
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
gtk_cell_view_cell_layout_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_cell_view_buildable_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_cell_view_size_request_init))
+ gtk_cell_view_buildable_init))
static void
gobject_class->set_property = gtk_cell_view_set_property;
gobject_class->finalize = gtk_cell_view_finalize;
- widget_class->draw = gtk_cell_view_draw;
- widget_class->size_allocate = gtk_cell_view_size_allocate;
+ widget_class->draw = gtk_cell_view_draw;
+ widget_class->size_allocate = gtk_cell_view_size_allocate;
+ widget_class->get_preferred_width = gtk_cell_view_get_preferred_width;
+ widget_class->get_preferred_height = gtk_cell_view_get_preferred_height;
+ widget_class->get_preferred_width_for_height = gtk_cell_view_get_preferred_width_for_height;
+ widget_class->get_preferred_height_for_width = gtk_cell_view_get_preferred_height_for_width;
/* properties */
g_object_class_install_property (gobject_class,
cell_view->priv->displayed_row =
gtk_tree_row_reference_new (cell_view->priv->model, path);
- gtk_cell_view_get_width (GTK_SIZE_REQUEST (cell_view), minimum_size, natural_size);
+ gtk_cell_view_get_preferred_width (GTK_WIDGET (cell_view), minimum_size, natural_size);
gtk_tree_row_reference_free (cell_view->priv->displayed_row);
cell_view->priv->displayed_row = tmp;
/* Restore active size (this will restore the cellrenderer info->width/requested_width's) */
- gtk_cell_view_get_width (GTK_SIZE_REQUEST (cell_view), NULL, NULL);
+ gtk_cell_view_get_preferred_width (GTK_WIDGET (cell_view), NULL, NULL);
}
gtk_tree_row_reference_new (cell_view->priv->model, path);
/* Then get the collective height_for_width based on the cached values */
- gtk_cell_view_get_height_for_width (GTK_SIZE_REQUEST (cell_view), avail_size, minimum_size, natural_size);
+ gtk_cell_view_get_preferred_height_for_width (GTK_WIDGET (cell_view), avail_size, minimum_size, natural_size);
gtk_tree_row_reference_free (cell_view->priv->displayed_row);
cell_view->priv->displayed_row = tmp;
/* Restore active size (this will restore the cellrenderer info->width/requested_width's) */
- gtk_cell_view_get_width (GTK_SIZE_REQUEST (cell_view), NULL, NULL);
+ gtk_cell_view_get_preferred_width (GTK_WIDGET (cell_view), NULL, NULL);
}
/**
}
static void
-gtk_cell_view_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_cell_view_get_width;
- iface->get_height = gtk_cell_view_get_height;
- iface->get_width_for_height = gtk_cell_view_get_width_for_height;
- iface->get_height_for_width = gtk_cell_view_get_height_for_width;
-}
-
-static void
-gtk_cell_view_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_cell_view_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GList *list;
gint cell_min, cell_nat;
}
gtk_cell_size_request_get_width (GTK_CELL_SIZE_REQUEST (info->cell),
- GTK_WIDGET (cellview), &cell_min, &cell_nat);
+ GTK_WIDGET (cellview), &cell_min, &cell_nat);
info->requested_width = cell_min;
info->natural_width = cell_nat;
}
static void
-gtk_cell_view_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_cell_view_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gint minimum_width;
/* CellViews only need to respond to height-for-width mode (cellview is pretty much
* an implementation detail of GtkComboBox) */
- gtk_cell_view_get_width (widget, &minimum_width, NULL);
- gtk_cell_view_get_height_for_width (widget, minimum_width, minimum_size, natural_size);
+ gtk_cell_view_get_preferred_width (widget, &minimum_width, NULL);
+ gtk_cell_view_get_preferred_height_for_width (widget, minimum_width, minimum_size, natural_size);
}
static void
-gtk_cell_view_get_width_for_height (GtkSizeRequest *widget,
- gint for_size,
- gint *minimum_size,
- gint *natural_size)
+gtk_cell_view_get_preferred_width_for_height (GtkWidget *widget,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size)
{
/* CellViews only need to respond to height-for-width mode (cellview is pretty much
* an implementation detail of GtkComboBox) */
- gtk_cell_view_get_width (widget, minimum_size, natural_size);
+ gtk_cell_view_get_preferred_width (widget, minimum_size, natural_size);
}
static void
-gtk_cell_view_get_height_for_width (GtkSizeRequest *widget,
- gint for_size,
- gint *minimum_size,
- gint *natural_size)
+gtk_cell_view_get_preferred_height_for_width (GtkWidget *widget,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkCellView *cellview = GTK_CELL_VIEW (widget);
GList *list;
GtkRequestedSize requested;
gtk_cell_size_request_get_width (GTK_CELL_SIZE_REQUEST (info->cell),
- GTK_WIDGET (cellview),
- &requested.minimum_size,
- &requested.natural_size);
+ GTK_WIDGET (cellview),
+ &requested.minimum_size,
+ &requested.natural_size);
requested.data = info;
g_array_append_val (array, requested);
/* Get the height for the real width of this cell */
gtk_cell_size_request_get_height_for_width (GTK_CELL_SIZE_REQUEST (info->cell),
- GTK_WIDGET (widget),
- cell_width, &cell_minimum, &cell_natural);
+ GTK_WIDGET (widget),
+ cell_width, &cell_minimum, &cell_natural);
minimum = MAX (minimum, cell_minimum);
natural = MAX (natural, cell_natural);
#include "gtkcheckbutton.h"
#include "gtklabel.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
requisition->width += child_requisition.width + indicator_spacing;
requisition->height += child_requisition.height;
GtkRequisition child_requisition;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
child_allocation.width = MIN (child_requisition.width,
allocation->width -
gdk_window_get_origin (gtk_widget_get_window (widget),
&root_x, &root_y);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
/* Put corner of menu centered on color cell */
#include "gtktreeselection.h"
#include "gtkvseparator.h"
#include "gtkwindow.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include <gdk/gdkkeysyms.h>
static void gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
GdkEvent *event);
-static void gtk_combo_box_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_combo_box_get_width (GtkSizeRequest *widget,
+static void gtk_combo_box_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_combo_box_get_height (GtkSizeRequest *widget,
+static void gtk_combo_box_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_combo_box_get_width_for_height (GtkSizeRequest *widget,
+static void gtk_combo_box_get_preferred_width_for_height (GtkWidget *widget,
gint avail_size,
gint *minimum_size,
gint *natural_size);
-static void gtk_combo_box_get_height_for_width (GtkSizeRequest *widget,
+static void gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
gint avail_size,
gint *minimum_size,
gint *natural_size);
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE,
gtk_combo_box_cell_editable_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_combo_box_buildable_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_combo_box_size_request_init))
+ gtk_combo_box_buildable_init))
/* common */
widget_class->grab_focus = gtk_combo_box_grab_focus;
widget_class->style_set = gtk_combo_box_style_set;
widget_class->state_changed = gtk_combo_box_state_changed;
+ widget_class->get_preferred_width = gtk_combo_box_get_preferred_width;
+ widget_class->get_preferred_height = gtk_combo_box_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_combo_box_get_preferred_height_for_width;
+ widget_class->get_preferred_width_for_height = gtk_combo_box_get_preferred_width_for_height;
gtk_object_class = (GtkObjectClass *)klass;
gtk_object_class->destroy = gtk_combo_box_destroy;
if (GTK_SHADOW_NONE != combo_box->priv->shadow_type)
sx -= gtk_widget_get_style (GTK_WIDGET (combo_box))->xthickness;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &req, NULL);
if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_LTR)
*x = sx;
menu_xpos = allocation.x;
menu_ypos = allocation.y + allocation.height / 2 - 2;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (menu), &menu_width, NULL);
+ gtk_widget_get_preferred_width (GTK_WIDGET (menu), &menu_width, NULL);
if (active != NULL)
{
hpolicy = vpolicy = GTK_POLICY_NEVER;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
hpolicy, vpolicy);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->scrolled_window),
- &popup_req, NULL);
+ gtk_widget_get_preferred_size (priv->scrolled_window,
+ &popup_req, NULL);
if (popup_req.width > *width)
{
hpolicy = GTK_POLICY_ALWAYS;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
hpolicy, vpolicy);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->scrolled_window),
- &popup_req, NULL);
+ gtk_widget_get_preferred_size (priv->scrolled_window,
+ &popup_req, NULL);
}
*height = popup_req.height;
gtk_widget_get_allocation (GTK_WIDGET (combo_box), &allocation);
width = allocation.width;
gtk_widget_set_size_request (priv->popup_widget, -1, -1);
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->popup_widget), &min_width, NULL);
+ gtk_widget_get_preferred_width (priv->popup_widget, &min_width, NULL);
gtk_widget_set_size_request (priv->popup_widget,
MAX (width, min_width), -1);
}
#define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON \
- gtk_size_request_get_size (GTK_SIZE_REQUEST (combo_box->priv->button), \
- &req, NULL); \
+ gtk_widget_get_preferred_size (combo_box->priv->button, \
+ &req, NULL); \
\
if (is_rtl) \
child.x = allocation->x + shadow_width; \
/* handle the children */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow),
- &req, NULL);
+ gtk_widget_get_preferred_size (priv->arrow, &req, NULL);
child.width = req.width;
if (!is_rtl)
child.x += width - req.width;
gtk_widget_size_allocate (priv->arrow, &child);
if (is_rtl)
child.x += req.width;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->separator),
- &req, NULL);
+ gtk_widget_get_preferred_size (priv->separator, &req, NULL);
child.width = req.width;
if (!is_rtl)
child.x -= req.width;
gtk_widget_get_allocation (GTK_WIDGET (combo_box), &combo_box_allocation);
width = combo_box_allocation.width;
gtk_widget_set_size_request (priv->popup_widget, -1, -1);
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->popup_widget), &min_width, NULL);
+ gtk_widget_get_preferred_width (priv->popup_widget, &min_width, NULL);
gtk_widget_set_size_request (priv->popup_widget,
MAX (width, min_width), -1);
}
gtk_tree_path_free (path);
gtk_combo_box_sync_cells (combo_box, GTK_CELL_LAYOUT (cell_view));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (cell_view),
- &req, NULL);
+ gtk_widget_get_preferred_size (cell_view, &req, NULL);
gtk_widget_show (cell_view);
return item;
}
-static void
-gtk_combo_box_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_combo_box_get_width;
- iface->get_height = gtk_combo_box_get_height;
- iface->get_height_for_width = gtk_combo_box_get_height_for_width;
- iface->get_width_for_height = gtk_combo_box_get_width_for_height;
-}
-
static void
gtk_combo_box_remeasure (GtkComboBox *combo_box)
{
child = gtk_bin_get_child (GTK_BIN (combo_box));
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child), avail_width,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child, avail_width,
+ &child_min, &child_nat);
if (!priv->model ||
!gtk_tree_model_get_iter_first (priv->model, &iter))
static void
-gtk_combo_box_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_combo_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv;
child = gtk_bin_get_child (GTK_BIN (widget));
/* common */
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
gtk_combo_box_remeasure (combo_box);
child_min = MAX (child_min, priv->minimum_width);
border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box));
xthickness = gtk_widget_get_style (priv->button)->xthickness;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->separator), &sep_width, NULL);
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->arrow), &arrow_width, NULL);
+ gtk_widget_get_preferred_width (priv->separator, &sep_width, NULL);
+ gtk_widget_get_preferred_width (priv->arrow, &arrow_width, NULL);
xpad = 2*(border_width + xthickness + focus_width + focus_pad);
{
gint but_width, but_nat_width;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button),
- &but_width, &but_nat_width);
+ gtk_widget_get_preferred_width (priv->button,
+ &but_width, &but_nat_width);
minimum_width = child_min + but_width;
natural_width = child_nat + but_nat_width;
}
/* the button */
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button),
- &button_width, &button_nat_width);
+ gtk_widget_get_preferred_width (priv->button,
+ &button_width, &button_nat_width);
minimum_width += button_width;
natural_width += button_nat_width;
}
static void
-gtk_combo_box_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_combo_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gint min_width;
/* Combo box is height-for-width only
* (so we always just reserve enough height for the minimum width) */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height_for_width (widget, min_width, minimum_size, natural_size);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, minimum_size, natural_size);
}
static void
-gtk_combo_box_get_width_for_height (GtkSizeRequest *widget,
- gint avail_size,
- gint *minimum_size,
- gint *natural_size)
+gtk_combo_box_get_preferred_width_for_height (GtkWidget *widget,
+ gint avail_size,
+ gint *minimum_size,
+ gint *natural_size)
{
/* Combo box is height-for-width only
* (so we assume we always reserved enough height for the minimum width) */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_size, natural_size);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_size, natural_size);
}
static void
-gtk_combo_box_get_height_for_width (GtkSizeRequest *widget,
- gint avail_size,
- gint *minimum_size,
- gint *natural_size)
+gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
+ gint avail_size,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv;
xthickness = button_style->xthickness;
ythickness = button_style->ythickness;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->separator), &sep_width, NULL);
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->arrow), &arrow_width, NULL);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->separator),
- sep_width, &sep_height, NULL);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->arrow),
- arrow_width, &arrow_height, NULL);
+ gtk_widget_get_preferred_width (priv->separator, &sep_width, NULL);
+ gtk_widget_get_preferred_width (priv->arrow, &arrow_width, NULL);
+ gtk_widget_get_preferred_height_for_width (priv->separator,
+ sep_width, &sep_height, NULL);
+ gtk_widget_get_preferred_height_for_width (priv->arrow,
+ arrow_width, &arrow_height, NULL);
xpad = 2*(border_width + xthickness + focus_width + focus_pad);
ypad = 2*(border_width + ythickness + focus_width + focus_pad);
/* there is a custom child widget inside (no priv->cell_view) */
gint but_width, but_height;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button), &but_width, NULL);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->button),
- but_width, &but_height, NULL);
+ gtk_widget_get_preferred_width (priv->button, &but_width, NULL);
+ gtk_widget_get_preferred_height_for_width (priv->button,
+ but_width, &but_height, NULL);
size -= but_width;
gint but_width, but_height;
gint xpad = 0, ypad = 0;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button), &but_width, NULL);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->button),
- but_width, &but_height, NULL);
+ gtk_widget_get_preferred_width (priv->button, &but_width, NULL);
+ gtk_widget_get_preferred_height_for_width (priv->button,
+ but_width, &but_height, NULL);
if (priv->cell_view_frame && priv->has_frame)
{
GtkAllocation allocation;
GtkRequisition requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget,
+ &requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
if (requisition.width > allocation.width ||
#include "gtkseparatormenuitem.h"
#include "gtkselection.h"
#include "gtksettings.h"
-#include "gtksizerequest.h"
#include "gtkspinbutton.h"
#include "gtkstock.h"
#include "gtktextutil.h"
gint frame_height;
gint xborder, yborder;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
_gtk_entry_get_borders (entry, &xborder, &yborder);
GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET (entry);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
if (x)
gtk_menu_set_monitor (menu, monitor_num);
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (entry->popup_menu),
- &menu_req, NULL);
+ gtk_widget_get_preferred_size (entry->popup_menu,
+ &menu_req, NULL);
height = gdk_window_get_height (entry->text_area);
gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL);
_gtk_entry_effective_inner_border (entry, &inner_border);
else
gtk_widget_hide (completion->priv->action_view);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (completion->priv->popup_window),
- &popup_req, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (completion->priv->entry),
- &entry_req, NULL);
+ gtk_widget_get_preferred_size (completion->priv->popup_window,
+ &popup_req, NULL);
+ gtk_widget_get_preferred_size (completion->priv->entry,
+ &entry_req, NULL);
if (x < monitor.x)
x = monitor.x;
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
#include "gtklabel.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
#include "gtkcontainer.h"
#include "gtkmarshalers.h"
#include "gtkmain.h"
const gchar *type);
-/* GtkSizeRequest */
-static void gtk_expander_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_expander_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_expander_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_expander_get_height_for_width (GtkSizeRequest *layout,
- gint width,
- gint *minimum_height,
- gint *natural_height);
-static void gtk_expander_get_width_for_height (GtkSizeRequest *layout,
- gint width,
- gint *minimum_height,
- gint *natural_height);
+/* GtkWidget */
+static void gtk_expander_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_expander_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_expander_get_preferred_height_for_width (GtkWidget *layout,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
+static void gtk_expander_get_preferred_width_for_height (GtkWidget *layout,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
G_DEFINE_TYPE_WITH_CODE (GtkExpander, gtk_expander, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_expander_buildable_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_expander_size_request_init))
+ gtk_expander_buildable_init))
static void
gtk_expander_class_init (GtkExpanderClass *klass)
widget_class->state_changed = gtk_expander_state_changed;
widget_class->drag_motion = gtk_expander_drag_motion;
widget_class->drag_leave = gtk_expander_drag_leave;
+ widget_class->get_preferred_width = gtk_expander_get_preferred_width;
+ widget_class->get_preferred_height = gtk_expander_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_expander_get_preferred_height_for_width;
+ widget_class->get_preferred_width_for_height = gtk_expander_get_preferred_width_for_height;
container_class->add = gtk_expander_add;
container_class->remove = gtk_expander_remove;
{
GtkRequisition label_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->label_widget),
- &label_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->label_widget,
+ &label_requisition, NULL);
label_height = label_requisition.height;
}
else
gint natural_label_width;
gboolean ltr;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget), NULL, &natural_label_width);
+ gtk_widget_get_preferred_width (priv->label_widget, NULL, &natural_label_width);
if (priv->label_fill)
label_allocation.width = allocation->width - label_xpad;
/* We distribute the minimum height to the label widget and prioritize
* the child widget giving it the remaining height */
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget),
- label_allocation.width, &label_height, NULL);
+ gtk_widget_get_preferred_height_for_width (priv->label_widget,
+ label_allocation.width, &label_height, NULL);
ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;
}
-static void
-gtk_expander_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_expander_get_width;
- iface->get_height = gtk_expander_get_height;
- iface->get_height_for_width = gtk_expander_get_height_for_width;
- iface->get_width_for_height = gtk_expander_get_width_for_height;
-}
-
static void
-gtk_expander_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_expander_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkExpander *expander;
GtkWidget *child;
{
gint label_min, label_nat;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget),
- &label_min, &label_nat);
+ gtk_widget_get_preferred_width (priv->label_widget,
+ &label_min, &label_nat);
*minimum_size += label_min;
*natural_size += label_nat;
{
gint child_min, child_nat;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child,
+ &child_min, &child_nat);
*minimum_size = MAX (*minimum_size, child_min);
*natural_size = MAX (*natural_size, child_nat);
}
static void
-gtk_expander_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_expander_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkExpander *expander;
GtkWidget *child;
{
gint label_min, label_nat;
- gtk_size_request_get_height (GTK_SIZE_REQUEST (priv->label_widget),
- &label_min, &label_nat);
+ gtk_widget_get_preferred_height (priv->label_widget,
+ &label_min, &label_nat);
*minimum_size += label_min;
*natural_size += label_nat;
{
gint child_min, child_nat;
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child,
+ &child_min, &child_nat);
*minimum_size += child_min + priv->spacing;
*natural_size += child_nat + priv->spacing;
}
static void
-gtk_expander_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_expander_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
GtkExpander *expander;
GtkWidget *child;
{
gint label_min, label_nat;
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget),
- MAX (width - label_xpad, 1),
- &label_min, &label_nat);
+ gtk_widget_get_preferred_height_for_width (priv->label_widget,
+ MAX (width - label_xpad, 1),
+ &label_min, &label_nat);
*minimum_height += label_min;
*natural_height += label_nat;
{
gint child_min, child_nat;
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
- MAX (width - 2 * border_width, 1),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child,
+ MAX (width - 2 * border_width, 1),
+ &child_min, &child_nat);
*minimum_height += child_min + priv->spacing;
*natural_height += child_nat + priv->spacing;
}
static void
-gtk_expander_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_expander_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
*x += (allocation.width - req.width) / 2;
impl->preview_widget &&
gtk_widget_get_visible (impl->preview_widget))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (impl->preview_box),
- &req, NULL);
+ gtk_widget_get_preferred_size (impl->preview_box,
+ &req, NULL);
*default_width += PREVIEW_HBOX_SPACING + req.width;
}
if (impl->extra_widget &&
gtk_widget_get_visible (impl->extra_widget))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (impl->extra_align),
- &req, NULL);
+ gtk_widget_get_preferred_size (impl->extra_align,
+ &req, NULL);
*default_height += gtk_box_get_spacing (GTK_BOX (chooser_embed)) + req.height;
}
}
else
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (impl),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (impl),
+ &req, NULL);
*default_width = req.width;
*default_height = req.height;
}
{
/* Force a size request of everything before we start. This will make sure
* that widget->requisition is meaningful. */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (dialog),
- &req, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &widget_req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (dialog),
+ &req, NULL);
+ gtk_widget_get_preferred_size (widget,
+ &widget_req, NULL);
}
_gtk_file_chooser_embed_get_default_size (GTK_FILE_CHOOSER_EMBED (priv->widget),
GtkAllocation entry_allocation;
int feedback_x, feedback_y;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (chooser_entry->completion_feedback_window),
- &feedback_req, NULL);
+ gtk_widget_get_preferred_size (chooser_entry->completion_feedback_window,
+ &feedback_req, NULL);
gdk_window_get_origin (gtk_widget_get_window (widget), &entry_x, &entry_y);
gtk_widget_get_allocation (widget, &entry_allocation);
#include "gtkfixed.h"
-#include "gtksizerequest.h"
-
#include "gtkprivate.h"
#include "gtkintl.h"
if (gtk_widget_get_visible (child->widget))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition,
+ NULL);
requisition->height = MAX (requisition->height,
child->y +
if (gtk_widget_get_visible (child->widget))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
child_allocation.x = child->x + border_width;
child_allocation.y = child->y + border_width;
#include "gtkintl.h"
#include "gtkaccessible.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
struct _GtkFontSelectionPrivate
GtkWidget *preview_entry = priv->preview_entry;
const gchar *text;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (preview_entry),
- &old_requisition, NULL);
+ gtk_widget_get_preferred_size (preview_entry, &old_requisition, NULL);
rc_style = gtk_rc_style_new ();
rc_style->font_desc = gtk_font_selection_get_font_description (fontsel);
gtk_widget_modify_style (preview_entry, rc_style);
g_object_unref (rc_style);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (preview_entry), &new_requisition, NULL);
+ gtk_widget_get_preferred_size (preview_entry, &new_requisition, NULL);
/* We don't ever want to be over MAX_PREVIEW_HEIGHT pixels high. */
new_height = CLAMP (new_requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
+
#define LABEL_PAD 1
#define LABEL_SIDE_PAD 2
GObject *child,
const gchar *type);
-static void gtk_frame_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_frame_get_width (GtkSizeRequest *widget,
+static void gtk_frame_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_frame_get_height (GtkSizeRequest *widget,
+static void gtk_frame_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_frame_get_height_for_width (GtkSizeRequest *layout,
+static void gtk_frame_get_preferred_height_for_width(GtkWidget *layout,
gint width,
gint *minimum_height,
gint *natural_height);
-static void gtk_frame_get_width_for_height (GtkSizeRequest *layout,
+static void gtk_frame_get_preferred_width_for_height(GtkWidget *layout,
gint width,
gint *minimum_height,
gint *natural_height);
G_DEFINE_TYPE_WITH_CODE (GtkFrame, gtk_frame, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_frame_buildable_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_frame_size_request_init))
+ gtk_frame_buildable_init))
static void
gtk_frame_class_init (GtkFrameClass *class)
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE));
- widget_class->draw = gtk_frame_draw;
- widget_class->size_allocate = gtk_frame_size_allocate;
+ widget_class->draw = gtk_frame_draw;
+ widget_class->size_allocate = gtk_frame_size_allocate;
+ widget_class->get_preferred_width = gtk_frame_get_preferred_width;
+ widget_class->get_preferred_height = gtk_frame_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_frame_get_preferred_height_for_width;
+ widget_class->get_preferred_width_for_height = gtk_frame_get_preferred_width_for_height;
container_class->remove = gtk_frame_remove;
container_class->forall = gtk_frame_forall;
else
xalign = 1 - priv->label_xalign;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget), NULL, &nat_width);
+ gtk_widget_get_preferred_width (priv->label_widget, NULL, &nat_width);
width = new_allocation.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD;
width = MIN (width, nat_width);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget), width,
- &height, NULL);
+ gtk_widget_get_preferred_height_for_width (priv->label_widget, width,
+ &height, NULL);
priv->label_allocation.x = priv->child_allocation.x + LABEL_SIDE_PAD +
{
gint nat_width, width, height;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget), NULL, &nat_width);
+ gtk_widget_get_preferred_width (priv->label_widget, NULL, &nat_width);
width = allocation.width;
width -= 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
width = MIN (width, nat_width);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget), width,
- &height, NULL);
+ gtk_widget_get_preferred_height_for_width (priv->label_widget, width,
+ &height, NULL);
top_margin = MAX (height, style->ythickness);
}
}
static void
-gtk_frame_get_size (GtkSizeRequest *request,
- GtkOrientation orientation,
- gint *minimum_size,
- gint *natural_size)
+gtk_frame_get_preferred_size (GtkWidget *request,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkFrame *frame = GTK_FRAME (request);
GtkFramePrivate *priv = frame->priv;
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (priv->label_widget,
+ &child_min, &child_nat);
minimum = child_min + 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
natural = child_nat + 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
}
else
{
- gtk_size_request_get_height (GTK_SIZE_REQUEST (priv->label_widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (priv->label_widget,
+ &child_min, &child_nat);
minimum = MAX (0, child_min - style->ythickness);
natural = MAX (0, child_nat - style->ythickness);
}
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child,
+ &child_min, &child_nat);
minimum = MAX (minimum, child_min);
natural = MAX (natural, child_nat);
}
else
{
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child,
+ &child_min, &child_nat);
minimum += child_min;
natural += child_nat;
}
}
static void
-gtk_frame_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_frame_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_frame_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+ gtk_frame_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_frame_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_frame_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_frame_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
+ gtk_frame_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
static void
-gtk_frame_get_height_for_width (GtkSizeRequest *request,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_frame_get_preferred_height_for_width (GtkWidget *request,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
GtkWidget *widget = GTK_WIDGET (request);
GtkWidget *child;
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
{
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget),
- label_width, &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (priv->label_widget,
+ label_width, &child_min, &child_nat);
minimum += child_min;
natural += child_nat;
}
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
- width, &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child,
+ width, &child_min, &child_nat);
minimum += child_min;
natural += child_nat;
}
}
static void
-gtk_frame_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_frame_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
-static void
-gtk_frame_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_frame_get_width;
- iface->get_height = gtk_frame_get_height;
- iface->get_height_for_width = gtk_frame_get_height_for_width;
- iface->get_width_for_height = gtk_frame_get_width_for_height;
-}
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkwindow.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
if (child)
gtk_widget_set_parent_window (child, priv->bin_window);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
attributes.x = 0;
attributes.y = 0;
*/
if (child)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
}
else
{
if (child)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
}
else
{
if (child)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
}
else
{
tmp_list = tmp_list->next;
if (gtk_widget_get_visible (child->widget))
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
}
}
#include "gtkcontainer.h"
#include "gtkwindow.h"
#include "gtkactivatable.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
#include "gtkprivate.h"
GtkRequisition image_requisition;
guint toggle_spacing;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image),
- &image_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->image, &image_requisition, NULL);
gtk_widget_style_get (GTK_WIDGET (menu_item),
"toggle-spacing", &toggle_spacing,
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->image, &child_requisition, NULL);
child_width = child_requisition.width;
child_height = child_requisition.height;
* come up with a solution that's really better.
*/
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->image),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->image, &child_requisition, NULL);
gtk_widget_get_allocation (widget, &widget_allocation);
#include "gtkimage.h"
#include "gtkshow.h"
#include "gtktooltip.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
static void emit_activate_link (GtkLabel *label,
GtkLabelLink *link);
-static void gtk_label_size_request_init (GtkSizeRequestIface *iface);
-static GtkSizeRequestMode gtk_label_get_request_mode (GtkSizeRequest *widget);
-static void gtk_label_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_label_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_label_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width);
-static void gtk_label_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height);
+static GtkSizeRequestMode gtk_label_get_request_mode (GtkWidget *widget);
+static void gtk_label_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_label_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_label_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width);
+static void gtk_label_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
static GtkBuildableIface *buildable_parent_iface = NULL;
G_DEFINE_TYPE_WITH_CODE (GtkLabel, gtk_label, GTK_TYPE_MISC,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_label_buildable_interface_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_label_size_request_init));
+ gtk_label_buildable_interface_init))
static void
add_move_binding (GtkBindingSet *binding_set,
widget_class->grab_focus = gtk_label_grab_focus;
widget_class->popup_menu = gtk_label_popup_menu;
widget_class->focus = gtk_label_focus;
+ widget_class->get_request_mode = gtk_label_get_request_mode;
+ widget_class->get_preferred_width = gtk_label_get_preferred_width;
+ widget_class->get_preferred_height = gtk_label_get_preferred_height;
+ widget_class->get_preferred_width_for_height = gtk_label_get_preferred_width_for_height;
+ widget_class->get_preferred_height_for_width = gtk_label_get_preferred_height_for_width;
class->move_cursor = gtk_label_move_cursor;
class->copy_clipboard = gtk_label_copy_clipboard;
return ascent + descent;
}
-static void
-gtk_label_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_request_mode = gtk_label_get_request_mode;
- iface->get_width = gtk_label_get_width;
- iface->get_height = gtk_label_get_height;
- iface->get_width_for_height = gtk_label_get_width_for_height;
- iface->get_height_for_width = gtk_label_get_height_for_width;
-}
-
static GtkSizeRequestMode
-gtk_label_get_request_mode (GtkSizeRequest *layout)
+gtk_label_get_request_mode (GtkWidget *widget)
{
- GtkLabel *label = GTK_LABEL (layout);
+ GtkLabel *label = GTK_LABEL (widget);
gdouble angle = gtk_label_get_angle (label);
if (angle == 90 || angle == 270)
}
static void
-gtk_label_get_size (GtkSizeRequest *widget,
- GtkOrientation orientation,
- gint *minimum_size,
- gint *natural_size)
+gtk_label_get_preferred_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = label->priv;
static void
-gtk_label_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_label_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_label_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+ gtk_label_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_label_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_label_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_label_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
+ gtk_label_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
static void
-gtk_label_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_label_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = label->priv;
*natural_width += xpad * 2;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
static void
-gtk_label_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_label_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = label->priv;
*natural_height += ypad * 2;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height (widget, minimum_height, natural_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, minimum_height, natural_height);
}
static void
*x += allocation.x;
*y += allocation.y;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
#include "gdkconfig.h"
-#include "gtksizerequest.h"
-
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
tmp_list = tmp_list->next;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
}
}
allocation.x = child->x;
allocation.y = child->y;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget, &requisition, NULL);
allocation.width = requisition.width;
allocation.height = requisition.height;
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->popup_menu),
- &req, NULL);
+ gtk_widget_get_preferred_size (priv->popup_menu, &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
*x += allocation.width / 2;
#include "gtkhbox.h"
#include "gtkvscrollbar.h"
#include "gtksettings.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
static void _gtk_menu_refresh_accel_paths (GtkMenu *menu,
gboolean group_changed);
-static void gtk_menu_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_menu_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_menu_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_menu_get_height_for_width (GtkSizeRequest *widget,
- gint for_size,
- gint *minimum_size,
- gint *natural_size);
+static void gtk_menu_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_menu_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size);
static const gchar attach_data_key[] = "gtk-menu-attach-data";
return G_TYPE_INSTANCE_GET_PRIVATE (menu, GTK_TYPE_MENU, GtkMenuPrivate);
}
-G_DEFINE_TYPE_WITH_CODE (GtkMenu, gtk_menu, GTK_TYPE_MENU_SHELL,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_menu_size_request_init))
+G_DEFINE_TYPE (GtkMenu, gtk_menu, GTK_TYPE_MENU_SHELL)
static void
menu_queue_resize (GtkMenu *menu)
widget_class->focus = gtk_menu_focus;
widget_class->can_activate_accel = gtk_menu_real_can_activate_accel;
widget_class->grab_notify = gtk_menu_grab_notify;
+ widget_class->get_preferred_width = gtk_menu_get_preferred_width;
+ widget_class->get_preferred_height = gtk_menu_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_menu_get_preferred_height_for_width;
container_class->remove = gtk_menu_remove;
container_class->get_child_property = gtk_menu_get_child_property;
/* Instead of trusting the menu position function to queue a resize when the
* menu goes out of bounds, invalidate the cached size here. */
gtk_widget_queue_resize (GTK_WIDGET (menu));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu->toplevel), &tmp_request, NULL);
+ gtk_widget_get_preferred_size (menu->toplevel, &tmp_request, NULL);
tmp_allocation.width = tmp_request.width;
tmp_allocation.height = tmp_request.height;
{
GtkRequisition requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu->tearoff_scrollbar),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (menu->tearoff_scrollbar,
+ &requisition, NULL);
width += requisition.width;
}
/* Update menu->requisition
*/
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- NULL, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ NULL, NULL);
gtk_menu_set_tearoff_hints (menu, gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (menu))));
part = avail_width / (r - l);
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child), part,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child, part,
+ &child_min, &child_nat);
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
}
-
-static void
-gtk_menu_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_menu_get_width;
- iface->get_height = gtk_menu_get_height;
- iface->get_height_for_width = gtk_menu_get_height_for_width;
-}
-
static void
-gtk_menu_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_menu_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkMenu *menu;
GtkMenuShell *menu_shell;
*/
GTK_MENU_ITEM (child)->show_submenu_indicator = TRUE;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
max_toggle_size = MAX (max_toggle_size, toggle_size);
}
static void
-gtk_menu_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_menu_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gint min_width;
/* Menus are height-for-width only, just return the height for the minimum width */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height_for_width (widget, min_width, minimum_size, natural_size);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, minimum_size, natural_size);
}
static void
-gtk_menu_get_height_for_width (GtkSizeRequest *widget,
- gint for_size,
- gint *minimum_size,
- gint *natural_size)
+gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkMenu *menu = GTK_MENU (widget);
GtkMenuPrivate *private = gtk_menu_get_private (menu);
/* Get the minimum height for minimum width to figure out
* the right place to popup the menu.
*/
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (pointer_screen != screen)
{
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (children->data),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (children->data,
+ &child_requisition, NULL);
if (_gtk_menu_item_is_selectable (children->data) &&
child_offset >= lower &&
gint toggle_size;
GTK_MENU_ITEM (child)->show_submenu_indicator = FALSE;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
#include "gtkprivate.h"
#include "gtkbuildable.h"
#include "gtkactivatable.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
const gchar *label);
static G_CONST_RETURN gchar * gtk_real_menu_item_get_label (GtkMenuItem *menu_item);
-static void gtk_menu_item_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_menu_item_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_menu_item_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_menu_item_get_height_for_width (GtkSizeRequest *widget,
- gint for_size,
- gint *minimum_size,
- gint *natural_size);
+static void gtk_menu_item_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_menu_item_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size);
static void gtk_menu_item_buildable_interface_init (GtkBuildableIface *iface);
static void gtk_menu_item_buildable_add_child (GtkBuildable *buildable,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_menu_item_buildable_interface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
- gtk_menu_item_activatable_interface_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_menu_item_size_request_init))
+ gtk_menu_item_activatable_interface_init))
#define GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), GTK_TYPE_MENU_ITEM, GtkMenuItemPrivate))
widget_class->mnemonic_activate = gtk_menu_item_mnemonic_activate;
widget_class->parent_set = gtk_menu_item_parent_set;
widget_class->can_activate_accel = gtk_menu_item_can_activate_accel;
+ widget_class->get_preferred_width = gtk_menu_item_get_preferred_width;
+ widget_class->get_preferred_height = gtk_menu_item_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_menu_item_get_preferred_height_for_width;
container_class->forall = gtk_menu_item_forall;
}
static void
-gtk_menu_item_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_menu_item_get_width;
- iface->get_height = gtk_menu_item_get_height;
- iface->get_height_for_width = gtk_menu_item_get_height_for_width;
-}
-
-static void
-gtk_menu_item_get_width (GtkSizeRequest *request,
- gint *minimum_size,
- gint *natural_size)
+gtk_menu_item_get_preferred_width (GtkWidget *request,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkMenuItem *menu_item;
GtkBin *bin;
{
gint child_min, child_nat;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
if (menu_item->submenu && menu_item->show_submenu_indicator)
{
}
static void
-gtk_menu_item_get_height (GtkSizeRequest *request,
- gint *minimum_size,
- gint *natural_size)
+gtk_menu_item_get_preferred_height (GtkWidget *request,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkMenuItem *menu_item;
GtkBin *bin;
{
gint child_min, child_nat;
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
min_height += child_min;
nat_height += child_nat;
}
static void
-gtk_menu_item_get_height_for_width (GtkSizeRequest *request,
- gint for_size,
- gint *minimum_size,
- gint *natural_size)
+gtk_menu_item_get_preferred_height_for_width (GtkWidget *request,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkMenuItem *menu_item;
GtkBin *bin;
avail_size -= arrow_spacing;
}
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child), avail_size, &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child,
+ avail_size,
+ &child_min,
+ &child_nat);
min_height += child_min;
nat_height += child_nat;
child_allocation.x += allocation->x;
child_allocation.y += allocation->y;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (menu_item->submenu && menu_item->show_submenu_indicator)
{
if (direction == GTK_TEXT_DIR_RTL)
direction = gtk_widget_get_direction (widget);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu), &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);
twidth = requisition.width;
theight = requisition.height;
GdkScreen *screen;
GdkWindow *window;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->menu),
- &menu_req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (priv->menu),
+ &menu_req, NULL);
orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button));
direction = gtk_widget_get_direction (widget);
else
{
gdk_window_get_origin (GTK_BUTTON (priv->arrow_button)->event_window, x, y);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button),
- &req, NULL);
+ gtk_widget_get_preferred_size (priv->arrow_button,
+ &req, NULL);
gtk_widget_get_allocation (priv->arrow_button, &arrow_allocation);
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtklabel.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkbindings.h"
if (gtk_widget_get_visible (page->child))
{
vis_pages++;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (page->child,
+ &child_requisition, NULL);
requisition->width = MAX (requisition->width,
child_requisition.width);
if (!gtk_widget_get_visible (page->tab_label))
gtk_widget_show (page->tab_label);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (page->tab_label,
+ &child_requisition, NULL);
page->requisition.width = child_requisition.width + 2 * style->xthickness;
page->requisition.height = child_requisition.height + 2 * style->ythickness;
{
if (priv->action_widget[i])
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]),
- &action_widget_requisition[i], NULL);
+ gtk_widget_get_preferred_size (priv->action_widget[i],
+ &action_widget_requisition[i], NULL);
action_widget_requisition[i].width += style->xthickness;
action_widget_requisition[i].height += style->ythickness;
}
widget_allocation.y = allocation->y + border_width;
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (priv->action_widget[i],
+ &requisition, NULL);
switch (tab_pos)
{
gdk_window_get_origin (gtk_widget_get_window (w), x, y);
gtk_widget_get_allocation (w, &allocation);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &requisition, NULL);
if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
*x += allocation.x + allocation.width - requisition.width;
notebook = GTK_WIDGET (data);
child = gtk_bin_get_child (GTK_BIN (widget));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget,
+ &requisition, NULL);
gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook));
gtk_paint_extension (gtk_widget_get_style (notebook),
xthickness = style->xthickness;
ythickness = style->ythickness;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label),
- &tab_requisition, NULL);
+ gtk_widget_get_preferred_size (page->tab_label, &tab_requisition, NULL);
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"tab-curvature", &tab_curvature,
{
GtkRequisition child_req;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_req, NULL);
+ gtk_widget_get_preferred_size (child, &child_req, NULL);
requisition->width += child_req.width;
requisition->height += child_req.height;
GtkAllocation allocation = { 0, 0 };
GtkRequisition requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
allocation.width = requisition.width;
allocation.height = requisition.height;
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkorientable.h"
-#include "gtksizerequest.h"
#include "gtkwindow.h"
#include "gtkprivate.h"
if (priv->child1 && gtk_widget_get_visible (priv->child1))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child1),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->child1,
+ &child_requisition, NULL);
requisition->height = child_requisition.height;
requisition->width = child_requisition.width;
if (priv->child2 && gtk_widget_get_visible (priv->child2))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child2),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->child2,
+ &child_requisition, NULL);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child1),
- &child1_requisition, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->child2),
- &child2_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->child1, &child1_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->child2, &child2_requisition, NULL);
old_handle_pos = priv->handle_pos;
#include "gtkhbox.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
-#include "gtksizerequest.h"
enum {
for (list = path_bar->button_list; list; list = list->next)
{
button_data = BUTTON_DATA (list->data);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (button_data->button),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (button_data->button,
+ &child_requisition, NULL);
if (button_data->type == NORMAL_BUTTON)
/* Use 2*Height as button width because of ellipsized label. */
if (path_bar->button_list && path_bar->button_list->next != NULL)
requisition->width += (path_bar->spacing + path_bar->slider_width) * 2;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (path_bar->up_slider_button),
- &child_requisition, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (path_bar->down_slider_button),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (path_bar->up_slider_button,
+ &child_requisition, NULL);
+ gtk_widget_get_preferred_size (path_bar->down_slider_button,
+ &child_requisition, NULL);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
requisition->width += border_width * 2;
{
child = BUTTON_DATA (list->data)->button;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
width += child_requisition.width + path_bar->spacing;
if (list == path_bar->fake_root)
* button, then count backwards.
*/
/* Count down the path chain towards the end. */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (BUTTON_DATA (first_button->data)->button),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (BUTTON_DATA (first_button->data)->button,
+ &child_requisition, NULL);
width = child_requisition.width;
list = first_button->prev;
{
child = BUTTON_DATA (list->data)->button;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (width + child_requisition.width +
path_bar->spacing + slider_space > allocation_width)
{
child = BUTTON_DATA (first_button->next->data)->button;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (width + child_requisition.width + path_bar->spacing + slider_space > allocation_width)
{
button_data = BUTTON_DATA (list->data);
child = button_data->button;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
child_allocation.width = MIN (child_requisition.width,
allocation_width - (path_bar->spacing + path_bar->slider_width) * 2);
const char *tab_label;
/* Make the template the size of the custom widget size request */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (op->priv->custom_widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (op->priv->custom_widget,
+ &requisition, NULL);
base_units = GetDialogBaseUnits ();
baseunitX = LOWORD (base_units);
#endif
-/* With GtkSizeRequest, a widget may be requested
+/* With GtkWidget , a widget may be requested
* its width for 2 or maximum 3 heights in one resize
* (Note this define is limited by the bitfield sizes
* defined on the SizeRequestCache structure).
height = (impl->icon_size + font_size) * NUM_LINES;
/* Use at least the requisition size... */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &req, NULL);
+ gtk_widget_get_preferred_size (widget, &req, NULL);
width = MAX (width, req.width);
height = MAX (height, req.height);
gdk_window_get_origin (gtk_widget_get_window (widget),
x, y);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
*x += (allocation.width - req.width) / 2;
#include <math.h>
#include <gdk/gdkkeysyms.h>
#include "gtkbindings.h"
-#include "gtksizerequest.h"
#include "gtkmarshalers.h"
#include "gtkscrolledwindow.h"
#include "gtkwindow.h"
static void gtk_scrolled_window_update_real_placement (GtkScrolledWindow *scrolled_window);
-static void gtk_scrolled_window_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_scrolled_window_get_width (GtkSizeRequest *widget,
+static void gtk_scrolled_window_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_scrolled_window_get_height (GtkSizeRequest *widget,
+static void gtk_scrolled_window_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_scrolled_window_get_height_for_width (GtkSizeRequest *layout,
+static void gtk_scrolled_window_get_preferred_height_for_width (GtkWidget *layout,
gint width,
gint *minimum_height,
gint *natural_height);
-static void gtk_scrolled_window_get_width_for_height (GtkSizeRequest *layout,
+static void gtk_scrolled_window_get_preferred_width_for_height (GtkWidget *layout,
gint width,
gint *minimum_height,
gint *natural_height);
static guint signals[LAST_SIGNAL] = {0};
-G_DEFINE_TYPE_WITH_CODE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_scrolled_window_size_request_init))
+G_DEFINE_TYPE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN)
static void
widget_class->size_allocate = gtk_scrolled_window_size_allocate;
widget_class->scroll_event = gtk_scrolled_window_scroll_event;
widget_class->focus = gtk_scrolled_window_focus;
+ widget_class->get_preferred_width = gtk_scrolled_window_get_preferred_width;
+ widget_class->get_preferred_height = gtk_scrolled_window_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_scrolled_window_get_preferred_height_for_width;
+ widget_class->get_preferred_width_for_height = gtk_scrolled_window_get_preferred_width_for_height;
container_class->add = gtk_scrolled_window_add;
container_class->remove = gtk_scrolled_window_remove;
GtkRequisition vscrollbar_requisition;
gboolean is_rtl;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->vscrollbar),
- &vscrollbar_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->vscrollbar,
+ &vscrollbar_requisition, NULL);
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
if ((!is_rtl &&
{
GtkRequisition hscrollbar_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->hscrollbar),
- &hscrollbar_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->hscrollbar,
+ &hscrollbar_requisition, NULL);
if (priv->real_window_placement == GTK_CORNER_BOTTOM_LEFT ||
priv->real_window_placement == GTK_CORNER_BOTTOM_RIGHT)
{
GtkRequisition hscrollbar_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->hscrollbar),
- &hscrollbar_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->hscrollbar,
+ &hscrollbar_requisition, NULL);
if (!gtk_widget_get_visible (priv->hscrollbar))
gtk_widget_show (priv->hscrollbar);
if (!gtk_widget_get_visible (priv->vscrollbar))
gtk_widget_show (priv->vscrollbar);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->vscrollbar),
- &vscrollbar_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->vscrollbar,
+ &vscrollbar_requisition, NULL);
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL &&
(priv->real_window_placement == GTK_CORNER_TOP_RIGHT ||
static void
-gtk_scrolled_window_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_scrolled_window_get_width;
- iface->get_height = gtk_scrolled_window_get_height;
- iface->get_height_for_width = gtk_scrolled_window_get_height_for_width;
- iface->get_width_for_height = gtk_scrolled_window_get_width_for_height;
-}
-
-static void
-gtk_scrolled_window_get_size (GtkSizeRequest *widget,
- GtkOrientation orientation,
- gint *minimum_size,
- gint *natural_size)
+gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
natural_req.width = 0;
natural_req.height = 0;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->hscrollbar),
- &hscrollbar_requisition, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->vscrollbar),
- &vscrollbar_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->hscrollbar,
+ &hscrollbar_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->vscrollbar,
+ &vscrollbar_requisition, NULL);
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
- &min_child_size,
- &nat_child_size);
+ gtk_widget_get_preferred_width (child,
+ &min_child_size,
+ &nat_child_size);
if (priv->hscrollbar_policy == GTK_POLICY_NEVER)
{
}
else /* GTK_ORIENTATION_VERTICAL */
{
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
- &min_child_size,
- &nat_child_size);
+ gtk_widget_get_preferred_height (child,
+ &min_child_size,
+ &nat_child_size);
if (priv->vscrollbar_policy == GTK_POLICY_NEVER)
{
}
static void
-gtk_scrolled_window_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_scrolled_window_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_scrolled_window_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+ gtk_scrolled_window_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_scrolled_window_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_scrolled_window_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_scrolled_window_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
+ gtk_scrolled_window_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
static void
-gtk_scrolled_window_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_scrolled_window_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height (widget, minimum_height, natural_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, minimum_height, natural_height);
}
static void
-gtk_scrolled_window_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_scrolled_window_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
#include "gtkprivate.h"
#include "gtksizegroup.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
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)
*
* 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,
/**
* SECTION:gtksizerequest
* @Short_Description: Height-for-width geometry management
- * @Title: GtkSizeRequest
+ * @Title: GtkWidget
*
- * The GtkSizeRequest interface is GTK+'s height-for-width (and width-for-height)
+ * The GtkWidget interface is GTK+'s height-for-width (and width-for-height)
* geometry management system. Height-for-width means that a widget can
* change how much vertical space it needs, depending on the amount
* of horizontal space that it is given (and similar for width-for-height).
*
* GTK+'s traditional two-pass <link linkend="size-allocation">size-allocation</link>
* algorithm does not allow this flexibility. #GtkWidget provides a default
- * implementation of the #GtkSizeRequest interface for existing widgets,
+ * implementation of the #GtkWidget interface for existing widgets,
* which always requests the same height, regardless of the available width.
*
* <refsect2>
- * <title>Implementing GtkSizeRequest</title>
+ * <title>Implementing GtkWidget </title>
* <para>
* Some important things to keep in mind when implementing
- * the GtkSizeRequest interface and when using it in container
+ * the GtkWidget interface and when using it in container
* implementations.
*
* The geometry management system will query a logical hierarchy in
* For instance when queried in the normal height-for-width mode:
* First the default minimum and natural width for each widget
* in the interface will computed and collectively returned to
- * the toplevel by way of gtk_size_request_get_width().
+ * the toplevel by way of gtk_widget_get_preferred_width().
* Next, the toplevel will use the minimum width to query for the
* minimum height contextual to that width using
- * gtk_size_request_get_height_for_width(), which will also be a
- * highly recursive operation. This minimum-for-minimum size can be
- * used to set the minimum size constraint on the toplevel.
+ * gtk_widget_get_preferred_height_for_width(), which will also
+ * be a highly recursive operation. This minimum-for-minimum size can
+ * be used to set the minimum size constraint on the toplevel.
*
* When allocating, each container can use the minimum and natural
* sizes reported by their children to allocate natural sizes and
*
* That means that the request operation at allocation time will
* usually fire again in contexts of different allocated sizes than
- * the ones originally queried for. #GtkSizeRequest caches a
+ * the ones originally queried for. #GtkWidget caches a
* small number of results to avoid re-querying for the same
* allocated size in one allocation cycle.
*
#include "gtkprivate.h"
#include "gtkintl.h"
-typedef GtkSizeRequestIface GtkSizeRequestInterface;
-G_DEFINE_INTERFACE (GtkSizeRequest,
- gtk_size_request,
- GTK_TYPE_WIDGET);
-
-
-static void
-gtk_size_request_default_init (GtkSizeRequestInterface *iface)
-{
-}
-
-
/* looks for a cached size request for this for_size. If not
* found, returns the oldest entry so it can be overwritten
*
#endif /* G_DISABLE_CHECKS */
static void
-push_recursion_check (GtkSizeRequest *request,
+push_recursion_check (GtkWidget *request,
GtkSizeGroupMode orientation,
gint for_size)
{
if (previous_method != NULL)
{
- g_warning ("%s %p: widget tried to gtk_size_request_%s inside "
- " GtkSizeRequest::%s implementation. "
- "Should just invoke GTK_SIZE_REQUEST_GET_IFACE(widget)->%s "
- "directly rather than using gtk_size_request_%s",
+ g_warning ("%s %p: widget tried to gtk_widget_%s inside "
+ " GtkWidget ::%s implementation. "
+ "Should just invoke GTK_WIDGET_GET_CLASS(widget)->%s "
+ "directly rather than using gtk_widget_%s",
G_OBJECT_TYPE_NAME (request), request,
method, previous_method,
method, method);
}
static void
-pop_recursion_check (GtkSizeRequest *request,
+pop_recursion_check (GtkWidget *request,
GtkSizeGroupMode orientation)
{
#ifndef G_DISABLE_CHECKS
}
static void
-compute_size_for_orientation (GtkSizeRequest *request,
+compute_size_for_orientation (GtkWidget *request,
GtkSizeGroupMode orientation,
gint for_size,
gint *minimum_size,
gboolean found_in_cache = FALSE;
int adjusted_min, adjusted_natural;
- g_return_if_fail (GTK_IS_SIZE_REQUEST (request));
+ g_return_if_fail (GTK_IS_WIDGET (request));
g_return_if_fail (minimum_size != NULL || natural_size != NULL);
widget = GTK_WIDGET (request);
requisition_size = requisition.width;
if (for_size < 0)
- GTK_SIZE_REQUEST_GET_IFACE (request)->get_width (request, &min_size, &nat_size);
+ GTK_WIDGET_GET_CLASS (request)->get_preferred_width (request, &min_size, &nat_size);
else
- GTK_SIZE_REQUEST_GET_IFACE (request)->get_width_for_height (request, for_size,
- &min_size, &nat_size);
+ GTK_WIDGET_GET_CLASS (request)->get_preferred_width_for_height (request, for_size,
+ &min_size, &nat_size);
}
else
{
requisition_size = requisition.height;
if (for_size < 0)
- GTK_SIZE_REQUEST_GET_IFACE (request)->get_height (request, &min_size, &nat_size);
+ GTK_WIDGET_GET_CLASS (request)->get_preferred_height (request, &min_size, &nat_size);
else
- GTK_SIZE_REQUEST_GET_IFACE (request)->get_height_for_width (request, for_size,
- &min_size, &nat_size);
+ GTK_WIDGET_GET_CLASS (request)->get_preferred_height_for_width (request, for_size,
+ &min_size, &nat_size);
}
pop_recursion_check (request, orientation);
}
/**
- * gtk_size_request_get_request_mode:
- * @widget: a #GtkSizeRequest instance
+ * gtk_widget_get_preferred:
+ * @widget: a #GtkWidget instance
*
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
* Since: 3.0
*/
GtkSizeRequestMode
-gtk_size_request_get_request_mode (GtkSizeRequest *widget)
+gtk_widget_get_request_mode (GtkWidget *widget)
{
- GtkSizeRequestIface *iface;
+ GtkWidgetClass *klass;
- g_return_val_if_fail (GTK_IS_SIZE_REQUEST (widget), GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH);
- iface = GTK_SIZE_REQUEST_GET_IFACE (widget);
- if (iface->get_request_mode)
- return iface->get_request_mode (widget);
+ klass = GTK_WIDGET_GET_CLASS (widget);
+ if (klass->get_request_mode)
+ return klass->get_request_mode (widget);
/* By default widgets are height-for-width. */
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
}
/**
- * gtk_size_request_get_width:
- * @widget: a #GtkSizeRequest instance
+ * gtk_widget_get_preferred_width:
+ * @widget: a #GtkWidget instance
* @minimum_width: (out) (allow-none): location to store the minimum width, or %NULL
* @natural_width: (out) (allow-none): location to store the natural width, or %NULL
*
* Since: 3.0
*/
void
-gtk_size_request_get_width (GtkSizeRequest *widget,
- gint *minimum_width,
- gint *natural_width)
+gtk_widget_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width)
{
compute_size_for_orientation (widget, GTK_SIZE_GROUP_HORIZONTAL,
-1, minimum_width, natural_width);
/**
- * gtk_size_request_get_height:
- * @widget: a #GtkSizeRequest instance
+ * gtk_widget_get_preferred_height:
+ * @widget: a #GtkWidget instance
* @minimum_height: (out) (allow-none): location to store the minimum height, or %NULL
* @natural_height: (out) (allow-none): location to store the natural height, or %NULL
*
* Since: 3.0
*/
void
-gtk_size_request_get_height (GtkSizeRequest *widget,
- gint *minimum_height,
- gint *natural_height)
+gtk_widget_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height)
{
compute_size_for_orientation (widget, GTK_SIZE_GROUP_VERTICAL,
-1, minimum_height, natural_height);
/**
- * gtk_size_request_get_width_for_height:
- * @widget: a #GtkSizeRequest instance
+ * gtk_widget_get_preferred_width_for_height:
+ * @widget: a #GtkWidget instance
* @height: the height which is available for allocation
* @minimum_width: (out) (allow-none): location for storing the minimum width, or %NULL
* @natural_width: (out) (allow-none): location for storing the natural width, or %NULL
* Since: 3.0
*/
void
-gtk_size_request_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
compute_size_for_orientation (widget, GTK_SIZE_GROUP_HORIZONTAL,
height, minimum_width, natural_width);
}
/**
- * gtk_size_request_get_height_for_width:
- * @widget: a #GtkSizeRequest instance
+ * gtk_widget_get_preferred_height_for_width:
+ * @widget: a #GtkWidget instance
* @width: the width which is available for allocation
* @minimum_height: (out) (allow-none): location for storing the minimum height, or %NULL
* @natural_height: (out) (allow-none): location for storing the natural height, or %NULL
* Since: 3.0
*/
void
-gtk_size_request_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
compute_size_for_orientation (widget, GTK_SIZE_GROUP_VERTICAL,
width, minimum_height, natural_height);
}
/**
- * gtk_size_request_get_size:
- * @widget: a #GtkSizeRequest instance
+ * gtk_widget_get_preferred_size:
+ * @widget: a #GtkWidget instance
* @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
* @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
*
* Since: 3.0
*/
void
-gtk_size_request_get_size (GtkSizeRequest *widget,
- GtkRequisition *minimum_size,
- GtkRequisition *natural_size)
+gtk_widget_get_preferred_size (GtkWidget *widget,
+ GtkRequisition *minimum_size,
+ GtkRequisition *natural_size)
{
gint min_width, nat_width;
gint min_height, nat_height;
- g_return_if_fail (GTK_IS_SIZE_REQUEST (widget));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
- if (gtk_size_request_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
+ if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
{
- gtk_size_request_get_width (widget, &min_width, &nat_width);
+ gtk_widget_get_preferred_width (widget, &min_width, &nat_width);
if (minimum_size)
{
minimum_size->width = min_width;
- gtk_size_request_get_height_for_width (widget, min_width,
- &minimum_size->height, NULL);
+ gtk_widget_get_preferred_height_for_width (widget, min_width,
+ &minimum_size->height, NULL);
}
if (natural_size)
{
natural_size->width = nat_width;
- gtk_size_request_get_height_for_width (widget, nat_width,
- NULL, &natural_size->height);
+ gtk_widget_get_preferred_height_for_width (widget, nat_width,
+ NULL, &natural_size->height);
}
}
else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
{
- gtk_size_request_get_height (widget, &min_height, &nat_height);
+ gtk_widget_get_preferred_height (widget, &min_height, &nat_height);
if (minimum_size)
{
minimum_size->height = min_height;
- gtk_size_request_get_width_for_height (widget, min_height,
- &minimum_size->width, NULL);
+ gtk_widget_get_preferred_width_for_height (widget, min_height,
+ &minimum_size->width, NULL);
}
if (natural_size)
{
natural_size->height = nat_height;
- gtk_size_request_get_width_for_height (widget, nat_height,
- NULL, &natural_size->width);
+ gtk_widget_get_preferred_width_for_height (widget, nat_height,
+ NULL, &natural_size->width);
}
}
}
G_BEGIN_DECLS
-#define GTK_TYPE_SIZE_REQUEST (gtk_size_request_get_type ())
-#define GTK_SIZE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SIZE_REQUEST, GtkSizeRequest))
-#define GTK_SIZE_REQUEST_CLASS(klass) ((GtkSizeRequestIface*)g_type_interface_peek ((klass), GTK_TYPE_SIZE_REQUEST))
-#define GTK_IS_SIZE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SIZE_REQUEST))
-#define GTK_SIZE_REQUEST_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_SIZE_REQUEST, GtkSizeRequestIface))
-
-typedef struct _GtkSizeRequest GtkSizeRequest;
-typedef struct _GtkSizeRequestIface GtkSizeRequestIface;
typedef struct _GtkRequestedSize GtkRequestedSize;
/**
};
-struct _GtkSizeRequestIface
-{
- GTypeInterface g_iface;
-
- /* virtual table */
- GtkSizeRequestMode (* get_request_mode) (GtkSizeRequest *widget);
-
- void (* get_height) (GtkSizeRequest *widget,
- gint *minimum_height,
- gint *natural_height);
- void (* get_width_for_height) (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width);
- void (* get_width) (GtkSizeRequest *widget,
- gint *minimum_width,
- gint *natural_width);
- void (* get_height_for_width) (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height);
-};
-
-GType gtk_size_request_get_type (void) G_GNUC_CONST;
-
-GtkSizeRequestMode gtk_size_request_get_request_mode (GtkSizeRequest *widget);
-void gtk_size_request_get_width (GtkSizeRequest *widget,
- gint *minimum_width,
- gint *natural_width);
-void gtk_size_request_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height);
-void gtk_size_request_get_height (GtkSizeRequest *widget,
- gint *minimum_height,
- gint *natural_height);
-void gtk_size_request_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width);
-void gtk_size_request_get_size (GtkSizeRequest *widget,
- GtkRequisition *minimum_size,
- GtkRequisition *natural_size);
-
-
/* General convenience function to aid in allocating natural sizes */
-gint gtk_distribute_natural_allocation (gint extra_space,
- guint n_requested_sizes,
- GtkRequestedSize *sizes);
+gint gtk_distribute_natural_allocation (gint extra_space,
+ guint n_requested_sizes,
+ GtkRequestedSize *sizes);
G_END_DECLS
if (socket->plug_widget)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (socket->plug_widget),
- requisition, NULL);
+ gtk_widget_get_preferred_size (socket->plug_widget, requisition, NULL);
}
else
{
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtksettings.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
arrow_size = spin_button_get_arrow_size (spin_button);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (spin_button), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_events (widget, gtk_widget_get_events (widget) |
arrow_size = spin_button_get_arrow_size (spin);
panel_width = arrow_size + 2 * gtk_widget_get_style (widget)->xthickness;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_set_allocation (widget, allocation);
widget = GTK_WIDGET (spin_button);
style = gtk_widget_get_style (widget);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
width = spin_button_get_arrow_size (spin_button) + 2 * style->xthickness;
device = gdk_event_get_device ((GdkEvent *) event);
gdk_window_get_device_position (priv->panel, device, &x, &y, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (y <= requisition.height / 2)
priv->in_child = GTK_ARROW_UP;
if (GTK_ENTRY (widget)->editable)
gtk_spin_button_update (spin);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (event->y <= requisition.height / 2)
{
{
GtkRequisition requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (event->y >= 0 && event->x >= 0 &&
event->y <= requisition.height &&
gdk_event_request_motions (event);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (y <= requisition.height / 2 &&
priv->in_child == GTK_ARROW_DOWN)
#include "gtkintl.h"
#include "gtkaccessible.h"
#include "gtkimage.h"
-#include "gtksizerequest.h"
#include "gtkspinner.h"
#include "gtkstyle.h"
GParamSpec *pspec);
static void gtk_spinner_set_active (GtkSpinner *spinner,
gboolean active);
+static void gtk_spinner_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_spinner_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+
static AtkObject *gtk_spinner_get_accessible (GtkWidget *widget);
static GType gtk_spinner_accessible_get_type (void);
-static void gtk_spinner_size_request_init (GtkSizeRequestIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_spinner_size_request_init))
+G_DEFINE_TYPE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET)
static void
gtk_spinner_class_init (GtkSpinnerClass *klass)
widget_class->draw = gtk_spinner_draw;
widget_class->style_set = gtk_spinner_style_set;
widget_class->get_accessible = gtk_spinner_get_accessible;
+ widget_class->get_preferred_width = gtk_spinner_get_preferred_width;
+ widget_class->get_preferred_height = gtk_spinner_get_preferred_height;
/* GtkSpinner:active:
*
}
static void
-gtk_spinner_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_spinner_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
if (minimum_size)
*minimum_size = SPINNER_SIZE;
}
static void
-gtk_spinner_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_spinner_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
if (minimum_size)
*minimum_size = SPINNER_SIZE;
*natural_size = SPINNER_SIZE;
}
-static void
-gtk_spinner_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_spinner_get_width;
- iface->get_height = gtk_spinner_get_height;
-}
-
-
static gboolean
gtk_spinner_draw (GtkWidget *widget,
cairo_t *cr)
gdk_window_get_origin (window, x, y);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &menu_req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &menu_req, NULL);
gtk_widget_get_allocation (widget, &allocation);
if (_gtk_tray_icon_get_orientation (tray_icon) == GTK_ORIENTATION_VERTICAL)
#include "gtktable.h"
#include "gtkprivate.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
children = children->next;
if (gtk_widget_get_visible (child->widget))
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- NULL, NULL);
+ gtk_widget_get_preferred_size (child->widget, NULL, NULL);
if (child->left_attach == (child->right_attach - 1) && child->xexpand)
priv->cols[child->left_attach].expand = TRUE;
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
/* Child spans a single column.
*/
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
/* Check and see if there is already enough space
* for the child.
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
/* Check and see if there is already enough space
* for the child.
GtkRequisition child_requisition;
guint border_width;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget,
+ &child_requisition, NULL);
gtk_widget_get_allocation (GTK_WIDGET (table), &table_allocation);
border_width = gtk_container_get_border_width (GTK_CONTAINER (table));
/* Found it */
GtkRequisition req;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &req, NULL);
+ gtk_widget_get_preferred_size (child, &req, NULL);
width = req.width;
height = req.height;
#include "gtkseparatormenuitem.h"
#include "gtksettings.h"
#include "gtkstock.h"
-#include "gtksizerequest.h"
#include "gtktextbufferrichtext.h"
#include "gtktextdisplay.h"
#include "gtktextview.h"
* FIXME: This could be done in a simpler way by
* consulting the above width/height of the buffer + some
* padding values, however all of this request code needs
- * to be changed to use GtkSizeRequestIface and deserves
+ * to be changed to use GtkWidget Iface and deserves
* more attention.
*/
GtkRequisition cached_size_request;
GtkRequisition child_req;
GtkRequisition old_req;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &old_req, NULL);
+ gtk_widget_get_preferred_size (child->widget, &old_req, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_req, NULL);
+ gtk_widget_get_preferred_size (child->widget, &child_req, NULL);
/* Invalidate layout lines if required */
if (priv->layout &&
{
GtkRequisition child_req;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_req, NULL);
+ gtk_widget_get_preferred_size (child->widget,
+ &child_req, NULL);
}
tmp_list = g_slist_next (tmp_list);
allocation->x = vc->from_left_of_buffer - text_view->priv->xoffset;
allocation->y = buffer_y - text_view->priv->yoffset;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (vc->widget),
- &req, NULL);
+ gtk_widget_get_preferred_size (vc->widget, &req, NULL);
allocation->width = req.width;
allocation->height = req.height;
}
allocation.x = child->x;
allocation.y = child->y;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_req, NULL);
+ gtk_widget_get_preferred_size (child->widget, &child_req, NULL);
allocation.width = child_req.width;
allocation.height = child_req.height;
gtk_text_view_get_visible_rect (text_view, &onscreen_rect);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (text_view->priv->popup_menu),
- &req, NULL);
+ gtk_widget_get_preferred_size (text_view->priv->popup_menu,
+ &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
#include "gtkseparatormenuitem.h"
#include "gtkseparatortoolitem.h"
#include "gtkstock.h"
-#include "gtksizerequest.h"
#include "gtktoolshell.h"
#include "gtkvbox.h"
#include "gtkprivate.h"
if (priv->show_arrow)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button),
- &arrow_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->arrow_button,
+ &arrow_requisition, NULL);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
long_req = arrow_requisition.width;
border_width += get_internal_padding (toolbar);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button),
- &arrow_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->arrow_button,
+ &arrow_requisition, NULL);
shadow_type = get_shadow_type (toolbar);
g_assert (content);
g_assert (toolbar_content_is_placeholder (content));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->highlight_tool_item),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (priv->highlight_tool_item),
+ &requisition, NULL);
toolbar_content_set_expand (content, gtk_tool_item_get_expand (tool_item));
gint monitor_num;
GdkScreen *screen;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow_button),
- &req, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
- &menu_req, NULL);
+ gtk_widget_get_preferred_size (priv->arrow_button,
+ &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+ &menu_req, NULL);
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
monitor_num = gdk_screen_get_monitor_at_window (screen,
GtkToolbar *toolbar,
GtkRequisition *requisition)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (content->item),
- requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (content->item),
+ requisition, NULL);
if (content->is_placeholder &&
content->disappearing)
{
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- requisition, NULL);
+ gtk_widget_get_preferred_size (child, requisition, NULL);
}
else
{
if (priv->children && gtk_tool_item_group_get_label_widget (group))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header),
- requisition, NULL);
+ gtk_widget_get_preferred_size (priv->header,
+ requisition, NULL);
gtk_widget_show (priv->header);
}
else
GtkRequisition req = {0, 0};
guint width;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (child->item),
+ &req, NULL);
width = udiv (req.width, item_size.width);
col += width;
GtkRequisition req = {0, 0};
guint width;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (child->item),
+ &req, NULL);
width = udiv (req.width, item_size.width);
GtkRequisition req = {0, 0};
guint width;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item),
- &req, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (child->item),
+ &req, NULL);
width = udiv (req.width, item_size.width);
col += width;
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->header,
+ &child_requisition, NULL);
if (GTK_ORIENTATION_VERTICAL == orientation)
inquery->height += child_requisition.height;
/* place the header widget */
if (gtk_widget_get_visible (priv->header))
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (priv->header,
+ &child_requisition, NULL);
if (GTK_ORIENTATION_VERTICAL == orientation)
{
if (!child->homogeneous)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (child->item),
+ &child_requisition, NULL);
child_requisition.width = MIN (child_requisition.width, item_area.width);
}
if (!child->homogeneous && child->expand)
new_row = TRUE;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->item),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (child->item),
+ &child_requisition, NULL);
if (!homogeneous_only || child->homogeneous)
item_size->width = MAX (item_size->width, child_requisition.width);
GtkRequisition requisition;
GtkToolItemGroupPrivate* priv = group->priv;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (group),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (group),
+ &requisition, NULL);
if (!priv->collapsed || priv->animation_timeout)
{
if (!group->widget)
continue;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (group->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (group->widget),
+ &child_requisition, NULL);
if (GTK_ORIENTATION_VERTICAL == palette->priv->orientation)
{
screen = gtk_widget_get_screen (new_tooltip_widget);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (tooltip->current_window),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (tooltip->current_window),
+ &requisition, NULL);
monitor_num = gdk_screen_get_monitor_at_point (screen,
tooltip->last_x,
#include "gtkframe.h"
#include "gtktreemodelsort.h"
#include "gtktooltip.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#define GTK_TREE_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
column = list->data;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (column->button),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (column->button, &requisition, NULL);
column->button_request = requisition.width;
tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height);
}
tmp_list = tmp_list->next;
if (gtk_widget_get_visible (child->widget))
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
}
}
GtkRequisition button_req;
gint old_width = column->resized_width;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (column->button), &button_req, NULL);
+ gtk_widget_get_preferred_size (column->button, &button_req, NULL);
column->resized_width = MAX (column->resized_width,
column->width);
* same when we get our next size_allocate. If we don't do this, we'll be
* in an inconsistent state if we call top_row_to_dy. */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (tree_view),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (tree_view),
+ &requisition, NULL);
tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width);
tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height);
gtk_adjustment_changed (tree_view->priv->hadjustment);
* same when we get our next size_allocate. If we don't do this, we'll be
* in an inconsistent state when we call top_row_to_dy. */
- gtk_size_request_get_size (GTK_SIZE_REQUEST (tree_view),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (tree_view),
+ &requisition, NULL);
tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width);
tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height);
gtk_adjustment_changed (tree_view->priv->hadjustment);
{
GtkRequisition requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (tree_view),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (tree_view),
+ &requisition, NULL);
tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width);
tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height);
/* Clamp down the value */
if (column->min_width == -1)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (column->button), &button_req, NULL);
+ gtk_widget_get_preferred_size (column->button, &button_req, NULL);
width = MAX (button_req.width, width);
}
else
gdk_window_get_origin (tree_window, &tree_x, &tree_y);
tree_width = gdk_window_get_width (tree_window);
tree_height = gdk_window_get_height (tree_window);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (search_dialog),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (search_dialog, &requisition, NULL);
if (tree_x + tree_width > gdk_screen_get_width (screen))
x = gdk_screen_get_width (screen) - requisition.width;
gtk_tree_view_real_set_cursor (tree_view, path, FALSE, TRUE);
cell_area->y += pre_val - (int)tree_view->priv->vadjustment->value;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (cell_editable),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (cell_editable),
+ &requisition, NULL);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
#include "config.h"
#include "gtkviewport.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
GtkAllocation *allocation);
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
-static void gtk_viewport_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
+static void gtk_viewport_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
-static void gtk_viewport_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_viewport_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_viewport_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
+static void gtk_viewport_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_viewport_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
-G_DEFINE_TYPE_WITH_CODE (GtkViewport, gtk_viewport, GTK_TYPE_BIN,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_viewport_size_request_init))
+G_DEFINE_TYPE (GtkViewport, gtk_viewport, GTK_TYPE_BIN)
static void
gtk_viewport_class_init (GtkViewportClass *class)
widget_class->draw = gtk_viewport_draw;
widget_class->size_allocate = gtk_viewport_size_allocate;
widget_class->style_set = gtk_viewport_style_set;
+ widget_class->get_preferred_width = gtk_viewport_get_preferred_width;
+ widget_class->get_preferred_height = gtk_viewport_get_preferred_height;
container_class->add = gtk_viewport_add;
{
gint minimum_width;
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child),
- view_allocation.height,
- &minimum_width,
- NULL);
+ gtk_widget_get_preferred_width_for_height (child,
+ view_allocation.height,
+ &minimum_width,
+ NULL);
hadjustment->upper = MAX (minimum_width, view_allocation.width);
}
else
{
gint minimum_height;
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
- view_allocation.width,
- &minimum_height,
- NULL);
+ gtk_widget_get_preferred_height_for_width (child,
+ view_allocation.width,
+ &minimum_height,
+ NULL);
vadjustment->upper = MAX (minimum_height, view_allocation.height);
}
static void
-gtk_viewport_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_viewport_get_width;
- iface->get_height = gtk_viewport_get_height;
-}
-
-static void
-gtk_viewport_get_size (GtkSizeRequest *widget,
- GtkOrientation orientation,
- gint *minimum_size,
- gint *natural_size)
+gtk_viewport_get_preferred_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkViewport *viewport = GTK_VIEWPORT (widget);
GtkViewportPrivate *priv = viewport->priv;
if (child && gtk_widget_get_visible (child))
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
minimum += child_min;
natural += child_nat;
}
static void
-gtk_viewport_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_viewport_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_viewport_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+ gtk_viewport_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_viewport_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_viewport_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
- gtk_viewport_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
+ gtk_viewport_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
GdkEvent *event);
static gboolean gtk_widget_real_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
+static void gtk_widget_real_get_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_widget_real_get_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_widget_real_get_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
+static void gtk_widget_real_get_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width);
static const GtkWidgetAuxInfo* _gtk_widget_get_aux_info_or_defaults (GtkWidget *widget);
static void gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info);
static AtkObject* gtk_widget_real_get_accessible (GtkWidget *widget);
static void gtk_widget_buildable_parser_finished (GtkBuildable *buildable,
GtkBuilder *builder);
-static void gtk_widget_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_widget_real_get_width (GtkSizeRequest *widget,
+static void gtk_widget_real_get_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_widget_real_get_height (GtkSizeRequest *widget,
+static void gtk_widget_real_get_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
NULL /* interface data */
};
- const GInterfaceInfo layout_info =
- {
- (GInterfaceInitFunc) gtk_widget_size_request_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface data */
- };
-
widget_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkWidget",
&widget_info, G_TYPE_FLAG_ABSTRACT);
&accessibility_info) ;
g_type_add_interface_static (widget_type, GTK_TYPE_BUILDABLE,
&buildable_info) ;
- g_type_add_interface_static (widget_type, GTK_TYPE_SIZE_REQUEST,
- &layout_info) ;
}
return widget_type;
klass->unrealize = gtk_widget_real_unrealize;
klass->size_request = gtk_widget_real_size_request;
klass->size_allocate = gtk_widget_real_size_allocate;
+ klass->get_preferred_width = gtk_widget_real_get_width;
+ klass->get_preferred_height = gtk_widget_real_get_height;
+ klass->get_preferred_width_for_height = gtk_widget_real_get_width_for_height;
+ klass->get_preferred_height_for_width = gtk_widget_real_get_height_for_width;
klass->state_changed = NULL;
klass->parent_set = NULL;
klass->hierarchy_changed = NULL;
* Also remember that the size request is not necessarily the size
* a widget will actually be allocated.
*
- * Deprecated: 3.0: Use gtk_size_request_get_size() instead.
+ * Deprecated: 3.0: Use gtk_widget_get_preferred_size() instead.
**/
void
gtk_widget_size_request (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), requisition, NULL);
+ gtk_widget_get_preferred_size (widget, requisition, NULL);
}
/**
* gtk_widget_size_request().
*
*
- * Deprecated: 3.0: Use gtk_size_request_get_size() instead.
+ * Deprecated: 3.0: Use gtk_widget_get_preferred_size() instead.
**/
void
gtk_widget_get_child_requisition (GtkWidget *widget,
GtkRequisition *requisition)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), requisition, NULL);
+ gtk_widget_get_preferred_size (widget, requisition, NULL);
}
static gboolean
aux_info = _gtk_widget_get_aux_info_or_defaults (widget);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &min, &natural);
+ gtk_widget_get_preferred_size (widget, &min, &natural);
get_span_inside_border_horizontal (widget,
aux_info,
* @height indicates that that dimension has not been set explicitly
* and the natural requisition of the widget will be used intead. See
* gtk_widget_set_size_request(). To get the size a widget will
- * actually request, call gtk_size_request_get_size() instead of
+ * actually request, call gtk_size_request_get_preferred_size() instead of
* this function.
**/
void
}
}
-/*
- * GtkSizeRequest implementation
- */
static void
-gtk_widget_real_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_widget_real_get_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
if (minimum_size)
*minimum_size = 0;
}
static void
-gtk_widget_real_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_widget_real_get_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
if (minimum_size)
*minimum_size = 0;
}
static void
-gtk_widget_real_get_height_for_width (GtkSizeRequest *layout,
+gtk_widget_real_get_height_for_width (GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height)
{
- GTK_SIZE_REQUEST_GET_IFACE (layout)->get_height(layout, minimum_height, natural_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, minimum_height, natural_height);
}
static void
-gtk_widget_real_get_width_for_height (GtkSizeRequest *layout,
+gtk_widget_real_get_width_for_height (GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width)
{
- GTK_SIZE_REQUEST_GET_IFACE (layout)->get_width(layout, minimum_width, natural_width);
-}
-
-static void
-gtk_widget_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_widget_real_get_width;
- iface->get_height = gtk_widget_real_get_height;
- iface->get_width_for_height = gtk_widget_real_get_width_for_height;
- iface->get_height_for_width = gtk_widget_real_get_height_for_width;
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
/**
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (requisition != NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), requisition, NULL);
+ gtk_widget_get_preferred_size (widget, requisition, NULL);
}
/**
gboolean (* draw) (GtkWidget *widget,
cairo_t *cr);
+ /* size requests */
+ GtkSizeRequestMode (* get_request_mode) (GtkWidget *widget);
+
+ void (* get_preferred_height) (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height);
+ void (* get_preferred_width_for_height) (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width);
+ void (* get_preferred_width) (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width);
+ void (* get_preferred_height_for_width) (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
+
/* Mnemonics */
gboolean (* mnemonic_activate) (GtkWidget *widget,
gboolean group_cycling);
#endif
void gtk_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
+
+GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
+void gtk_widget_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width);
+void gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
+void gtk_widget_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height);
+void gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width);
+void gtk_widget_get_preferred_size (GtkWidget *widget,
+ GtkRequisition *minimum_size,
+ GtkRequisition *natural_size);
+
#ifndef GTK_DISABLE_DEPRECATED
void gtk_widget_get_child_requisition (GtkWidget *widget,
GtkRequisition *requisition);
GtkRequisition requisition;
GtkAllocation allocation = { 0, 0, 200, 200 };
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (requisition.width || requisition.height)
{
/* non-empty window */
#include "gtkmarshalers.h"
#include "gtkplug.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
gpointer user_data);
-static void gtk_window_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_window_get_width (GtkSizeRequest *widget,
+static void gtk_window_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_window_get_height (GtkSizeRequest *widget,
+static void gtk_window_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_window_buildable_interface_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_window_size_request_init))
+ gtk_window_buildable_interface_init))
static void
add_tab_bindings (GtkBindingSet *binding_set,
widget_class->client_event = gtk_window_client_event;
widget_class->focus = gtk_window_focus;
widget_class->draw = gtk_window_draw;
+ widget_class->get_preferred_width = gtk_window_get_preferred_width;
+ widget_class->get_preferred_height = gtk_window_get_preferred_height;
container_class->check_resize = gtk_window_check_resize;
GtkRequisition requisition;
GtkAllocation allocation = { 0, 0, 200, 200 };
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (requisition.width || requisition.height)
{
/* non-empty window */
}
-static void
-gtk_window_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_width = gtk_window_get_width;
- iface->get_height = gtk_window_get_height;
-}
-
-
static void
-gtk_window_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_window_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkWindow *window;
GtkWidget *child;
if (child && gtk_widget_get_visible (child))
{
gint child_min, child_nat;
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
*minimum_size += child_min;
*natural_size += child_nat;
}
static void
-gtk_window_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_window_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkWindow *window;
GtkWidget *child;
if (child && gtk_widget_get_visible (child))
{
gint child_min, child_nat;
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
*minimum_size += child_min;
*natural_size += child_nat;
if (priv->need_default_size)
{
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
/* Default to requisition */
*width = requisition.width;
screen = gtk_window_check_screen (window);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- NULL, NULL);
+ gtk_widget_get_preferred_size (widget, NULL, NULL);
gtk_window_compute_configure_request_size (window, (guint *)&w, (guint *)&h);
gtk_window_compute_hints (window, &new_geometry, &new_flags);
/* Compute the set of geometry hints and flags for a window
* based on the application set geometry, and requisition
- * of the window. gtk_size_request_get_size() must have been
+ * of the window. gtk_size_request_get_preferred_size() must have been
* called first.
*/
static void
widget = GTK_WIDGET (window);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
geometry_info = gtk_window_get_geometry_info (GTK_WINDOW (widget), FALSE);
if (geometry_info)
*
* Finding these answers would be a bit of a mess here. (Bug #68668)
*/
- gtk_size_request_get_size (GTK_SIZE_REQUEST (geometry_info->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (geometry_info->widget,
+ &child_requisition, NULL);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget,
+ &requisition, NULL);
extra_width = requisition.width - child_requisition.width;
extra_height = requisition.height - child_requisition.height;
}
static GType gtk_wrap_box_child_type (GtkContainer *container);
-/* GtkSizeRequest */
-static void gtk_wrap_box_size_request_init (GtkSizeRequestIface *iface);
-static GtkSizeRequestMode gtk_wrap_box_get_request_mode (GtkSizeRequest *widget);
-static void gtk_wrap_box_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_wrap_box_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_wrap_box_get_height_for_width (GtkSizeRequest *box,
- gint width,
- gint *minimum_height,
- gint *natural_height);
-static void gtk_wrap_box_get_width_for_height (GtkSizeRequest *box,
- gint width,
- gint *minimum_height,
- gint *natural_height);
+/* GtkWidget */
+static GtkSizeRequestMode gtk_wrap_box_get_request_mode (GtkWidget *widget);
+static void gtk_wrap_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_wrap_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_wrap_box_get_preferred_height_for_width (GtkWidget *box,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
+static void gtk_wrap_box_get_preferred_width_for_height (GtkWidget *box,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
G_DEFINE_TYPE_WITH_CODE (GtkWrapBox, gtk_wrap_box, GTK_TYPE_CONTAINER,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
- gtk_wrap_box_size_request_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
gobject_class->set_property = gtk_wrap_box_set_property;
widget_class->size_allocate = gtk_wrap_box_size_allocate;
+ widget_class->get_request_mode = gtk_wrap_box_get_request_mode;
+ widget_class->get_preferred_width = gtk_wrap_box_get_preferred_width;
+ widget_class->get_preferred_height = gtk_wrap_box_get_preferred_height;
+ widget_class->get_preferred_height_for_width = gtk_wrap_box_get_preferred_height_for_width;
+ widget_class->get_preferred_width_for_height = gtk_wrap_box_get_preferred_width_for_height;
container_class->add = gtk_wrap_box_add;
container_class->remove = gtk_wrap_box_remove;
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child->widget, &child_min, &child_nat);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child->widget, &child_min, &child_nat);
max_min_size = MAX (max_min_size, child_min);
max_nat_size = MAX (max_nat_size, child_nat);
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
- item_size,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child->widget,
+ item_size,
+ &child_min, &child_nat);
else
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
- item_size,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width_for_height (child->widget,
+ item_size,
+ &child_min, &child_nat);
max_min_size = MAX (max_min_size, child_min);
max_nat_size = MAX (max_nat_size, child_nat);
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
- this_item_size,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child->widget,
+ this_item_size,
+ &child_min, &child_nat);
else
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
- this_item_size,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width_for_height (child->widget,
+ this_item_size,
+ &child_min, &child_nat);
max_min_size = MAX (max_min_size, child_min);
max_nat_size = MAX (max_nat_size, child_nat);
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- NULL, &child_size);
+ gtk_widget_get_preferred_width (child->widget, NULL, &child_size);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- NULL, &child_size);
+ gtk_widget_get_preferred_height (child->widget, NULL, &child_size);
if (i > 0)
child_size += spacing;
requested.data = child;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- &requested.minimum_size,
- &requested.natural_size);
+ gtk_widget_get_preferred_width (child->widget,
+ &requested.minimum_size,
+ &requested.natural_size);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- &requested.minimum_size,
- &requested.natural_size);
+ gtk_widget_get_preferred_height (child->widget,
+ &requested.minimum_size,
+ &requested.natural_size);
if (i > 0)
size -= spacing;
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child->widget),
- sizes[i].minimum_size,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height_for_width (child->widget,
+ sizes[i].minimum_size,
+ &child_min, &child_nat);
else
- gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child->widget),
- sizes[i].minimum_size,
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width_for_height (child->widget,
+ sizes[i].minimum_size,
+ &child_min, &child_nat);
max_min_size = MAX (max_min_size, child_min);
max_nat_size = MAX (max_nat_size, child_nat);
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child->widget,
+ &child_min, &child_nat);
else
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child->widget,
+ &child_min, &child_nat);
/* Get the index and push it over for the last line when spreading to the end */
position = i % line_length;
}
/*****************************************************
- * GtkSizeRequestIface *
+ * size requests *
*****************************************************/
-static void
-gtk_wrap_box_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_request_mode = gtk_wrap_box_get_request_mode;
- iface->get_width = gtk_wrap_box_get_width;
- iface->get_height = gtk_wrap_box_get_height;
- iface->get_height_for_width = gtk_wrap_box_get_height_for_width;
- iface->get_width_for_height = gtk_wrap_box_get_width_for_height;
-}
static GtkSizeRequestMode
-gtk_wrap_box_get_request_mode (GtkSizeRequest *widget)
+gtk_wrap_box_get_request_mode (GtkWidget *widget)
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child->widget,
+ &child_min, &child_nat);
else /* GTK_ORIENTATION_VERTICAL */
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child->widget,
+ &child_min, &child_nat);
line_min += child_min;
line_nat += child_nat;
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child->widget,
+ &child_min, &child_nat);
else /* GTK_ORIENTATION_VERTICAL */
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child->widget,
+ &child_min, &child_nat);
aligned_item_sizes[i % line_length].minimum_size =
MAX (aligned_item_sizes[i % line_length].minimum_size, child_min);
static void
-gtk_wrap_box_get_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_wrap_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
/* Return the width for the minimum height */
gint min_height;
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height (widget, &min_height, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width_for_height (widget, min_height, &min_width, &nat_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_height, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width_for_height (widget, min_height,
+ &min_width, &nat_width);
}
}
static void
-gtk_wrap_box_get_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_wrap_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
/* Return the height for the minimum width */
gint min_width;
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height_for_width (widget, min_width, &min_height, &nat_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width,
+ &min_height, &nat_height);
}
else /* GTK_ORIENTATION_VERTICAL */
{
}
static void
-gtk_wrap_box_get_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height)
+gtk_wrap_box_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
n_children = get_visible_children (box);
/* Make sure its no smaller than the minimum */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL);
avail_size = MAX (width, min_width);
else /* GTK_ORIENTATION_VERTICAL */
{
/* Return the minimum height */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height (widget, &min_height, &nat_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_height, &nat_height);
}
if (minimum_height)
}
static void
-gtk_wrap_box_get_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width)
+gtk_wrap_box_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
{
GtkWrapBox *box = GTK_WRAP_BOX (widget);
GtkWrapBoxPrivate *priv = box->priv;
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
/* Return the minimum width */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, &nat_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, &nat_width);
}
else /* GTK_ORIENTATION_VERTICAL */
{
n_children = get_visible_children (box);
/* Make sure its no smaller than the minimum */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height (widget, &min_height, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_height, NULL);
avail_size = MAX (height, min_height);
gdk_window_get_frame_extents (gtk_widget_get_window (toplevel),
&rect);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (status_window->window),
+ gtk_widget_get_preferred_size ( (status_window->window),
&requisition, NULL);
if (rect.y + rect.height + requisition.height < height)
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child1),
+ gtk_widget_get_preferred_size ( (offscreen_box->child1),
&child_requisition, NULL);
w = MAX (w, CHILD1_SIZE_SCALE * child_requisition.width);
{
GtkRequisition child_requisition;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child2),
+ gtk_widget_get_preferred_size ( (offscreen_box->child2),
&child_requisition, NULL);
w = MAX (w, CHILD2_SIZE_SCALE * child_requisition.width);
GtkRequisition child_requisition;
GtkAllocation child_allocation;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child1),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (offscreen_box->child1,
+ &child_requisition, NULL);
child_allocation.x = child_requisition.width * (CHILD1_SIZE_SCALE - 1.0) / 2;
child_allocation.y = start_y + child_requisition.height * (CHILD1_SIZE_SCALE - 1.0) / 2;
child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width);
GtkRequisition child_requisition;
GtkAllocation child_allocation;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (offscreen_box->child2),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (offscreen_box->child2,
+ &child_requisition, NULL);
child_allocation.x = child_requisition.width * (CHILD2_SIZE_SCALE - 1.0) / 2;
child_allocation.y = start_y + child_requisition.height * (CHILD2_SIZE_SCALE - 1.0) / 2;
child_allocation.width = MAX (1, (gint) allocation->width - 2 * border_width);
gtk_widget_translate_coordinates (label, widget, 0, 0, &x, &y);
layout = gtk_widget_create_pango_layout (widget, "");
- gtk_size_request_get_size (GTK_SIZE_REQUEST (label),
- &minimum_size, &natural_size);
+ gtk_widget_get_preferred_size (label, &minimum_size, &natural_size);
pango_layout_set_markup (layout,
"<span color='#c33'>\342\227\217 requisition</span>\n"
gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (window)));
gtk_widget_set_size_request (drawing_area, DEFAULT_TEXT_RADIUS * 2, DEFAULT_TEXT_RADIUS * 2);
- gtk_size_request_get_size (GTK_SIZE_REQUEST (window),
+ gtk_widget_get_preferred_size ( (window),
&requisition, NULL);
gtk_widget_set_size_request (drawing_area, -1, -1);
gtk_window_resize (GTK_WINDOW (window), requisition.width, requisition.height);