[gtk+/rendering-cleanup-next: 194/203] Move GtkSizeRequest into GtkWidget
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 194/203] Move GtkSizeRequest into GtkWidget
- Date: Thu, 23 Sep 2010 10:47:24 +0000 (UTC)
commit 4fd7524faed1650562b349e4508c1b6d805914e5
Author: Benjamin Otte <otte redhat com>
Date: Wed Sep 22 00:27:45 2010 +0200
Move GtkSizeRequest into GtkWidget
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.
demos/gtk-demo/offscreen_window.c | 4 +-
demos/gtk-demo/offscreen_window2.c | 4 +-
docs/reference/gtk/gtk3-sections.txt | 16 ++--
gtk/gtk.symbols | 13 ++--
gtk/gtkaccellabel.c | 21 +----
gtk/gtkalignment.c | 51 +++++-------
gtk/gtkarrow.c | 30 +++-----
gtk/gtkaspectframe.c | 3 +-
gtk/gtkassistant.c | 12 ++--
gtk/gtkbbox.c | 3 +-
gtk/gtkbin.c | 82 ++++++++-----------
gtk/gtkbox.c | 130 ++++++++++++++----------------
gtk/gtkbutton.c | 38 +++------
gtk/gtkcellview.c | 68 +++++++---------
gtk/gtkcheckbutton.c | 4 +-
gtk/gtkcombobox.c | 109 ++++++++++++--------------
gtk/gtkentry.c | 7 +-
gtk/gtkexpander.c | 91 ++++++++++------------
gtk/gtkfixed.c | 6 +-
gtk/gtkfontsel.c | 6 +-
gtk/gtkframe.c | 93 ++++++++++------------
gtk/gtkhandlebox.c | 9 +--
gtk/gtkimagemenuitem.c | 7 +-
gtk/gtklabel.c | 69 +++++++---------
gtk/gtklayout.c | 5 +-
gtk/gtkmenu.c | 58 ++++++--------
gtk/gtkmenubar.c | 6 +-
gtk/gtkmenuitem.c | 60 ++++++--------
gtk/gtknotebook.c | 8 +-
gtk/gtkpaned.c | 7 +-
gtk/gtkpathbar.c | 17 ++---
gtk/gtkprivate.h | 2 +-
gtk/gtkscrolledwindow.c | 83 +++++++++-----------
gtk/gtksizegroup.c | 7 +-
gtk/gtksizerequest.c | 146 ++++++++++++++++------------------
gtk/gtksizerequest.h | 53 ------------
gtk/gtkspinbutton.c | 16 ++--
gtk/gtkspinner.c | 35 ++++-----
gtk/gtktable.c | 16 ++--
gtk/gtktextlayout.c | 3 +-
gtk/gtktextview.c | 15 +---
gtk/gtktoolbar.c | 5 +-
gtk/gtktreeview.c | 7 +-
gtk/gtkviewport.c | 60 ++++++--------
gtk/gtkwidget.c | 78 ++++++++----------
gtk/gtkwidget.h | 38 +++++++++
gtk/gtkwindow.c | 52 +++++--------
gtk/gtkwrapbox.c | 129 ++++++++++++++----------------
tests/gtkoffscreenbox.c | 8 +-
tests/testellipsise.c | 3 +-
50 files changed, 768 insertions(+), 1025 deletions(-)
---
diff --git a/demos/gtk-demo/offscreen_window.c b/demos/gtk-demo/offscreen_window.c
index 00fc2fa..d067f73 100644
--- a/demos/gtk-demo/offscreen_window.c
+++ b/demos/gtk-demo/offscreen_window.c
@@ -433,8 +433,8 @@ gtk_rotated_bin_size_allocate (GtkWidget *widget,
s = sin (bin->angle);
c = cos (bin->angle);
- gtk_size_request_get_preferred_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;
diff --git a/demos/gtk-demo/offscreen_window2.c b/demos/gtk-demo/offscreen_window2.c
index 09d08ec..025eb3e 100644
--- a/demos/gtk-demo/offscreen_window2.c
+++ b/demos/gtk-demo/offscreen_window2.c
@@ -348,8 +348,8 @@ gtk_mirror_bin_size_allocate (GtkWidget *widget,
GtkRequisition child_requisition;
GtkAllocation child_allocation;
- gtk_size_request_get_preferred_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;
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 2bef6be..918bcd8 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -6287,16 +6287,14 @@ gtk_orientable_get_type
<SECTION>
<FILE>gtksizerequest</FILE>
<TITLE>GtkSizeRequest</TITLE>
-GtkSizeRequest
-GtkSizeRequestIface
GtkSizeRequestMode
GtkRequestedSize
-gtk_size_request_get_preferred_height
-gtk_size_request_get_preferred_width
-gtk_size_request_get_preferred_height_for_width
-gtk_size_request_get_preferred_width_for_height
-gtk_size_request_get_request_mode
-gtk_size_request_get_preferred_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>
@@ -6307,7 +6305,7 @@ GTK_IS_SIZE_REQUEST
GTK_TYPE_SIZE_REQUEST
<SUBSECTION Private>
-gtk_size_request_get_type
+gtk_widget_get_type
</SECTION>
<SECTION>
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index f9327b1..8039e0c 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -3036,13 +3036,12 @@ gtk_size_group_set_mode
#if IN_HEADER(__GTK_SIZE_REQUEST_H__)
#if IN_FILE(__GTK_SIZE_REQUEST_C__)
-gtk_size_request_get_preferred_height
-gtk_size_request_get_preferred_height_for_width
-gtk_size_request_get_request_mode
-gtk_size_request_get_preferred_size
-gtk_size_request_get_type G_GNUC_CONST
-gtk_size_request_get_preferred_width
-gtk_size_request_get_preferred_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
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 4bfcc58..edddf66 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -125,19 +125,14 @@ static gboolean gtk_accel_label_draw (GtkWidget *widget,
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_preferred_width (GtkSizeRequest *widget,
+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)
@@ -153,6 +148,7 @@ 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 (":>");
@@ -349,14 +345,7 @@ gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label)
}
static void
-gtk_accel_label_size_request_init (GtkSizeRequestIface *iface)
-{
- parent_size_request_iface = g_type_interface_peek_parent (iface);
- iface->get_preferred_width = gtk_accel_label_get_preferred_width;
-}
-
-static void
-gtk_accel_label_get_preferred_width (GtkSizeRequest *widget,
+gtk_accel_label_get_preferred_width (GtkWidget *widget,
gint *min_width,
gint *nat_width)
{
@@ -364,7 +353,7 @@ gtk_accel_label_get_preferred_width (GtkSizeRequest *widget,
PangoLayout *layout;
gint width;
- parent_size_request_iface->get_preferred_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));
diff --git a/gtk/gtkalignment.c b/gtk/gtkalignment.c
index fb7d028..1d25d97 100644
--- a/gtk/gtkalignment.c
+++ b/gtk/gtkalignment.c
@@ -88,17 +88,14 @@ static void gtk_alignment_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gtk_alignment_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_alignment_get_preferred_width (GtkSizeRequest *widget,
+static void gtk_alignment_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_alignment_get_preferred_height (GtkSizeRequest *widget,
+static void gtk_alignment_get_preferred_height (GtkWidget *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))
+G_DEFINE_TYPE (GtkAlignment, gtk_alignment, GTK_TYPE_BIN)
static void
gtk_alignment_class_init (GtkAlignmentClass *class)
@@ -112,7 +109,9 @@ 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,
@@ -488,7 +487,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
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;
@@ -499,10 +498,9 @@ gtk_alignment_size_allocate (GtkWidget *widget,
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;
@@ -515,23 +513,23 @@ gtk_alignment_size_allocate (GtkWidget *widget,
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_preferred_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_preferred_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_preferred_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_preferred_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);
}
@@ -557,20 +555,13 @@ gtk_alignment_size_allocate (GtkWidget *widget,
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_preferred_width = gtk_alignment_get_preferred_width;
- iface->get_preferred_height = gtk_alignment_get_preferred_height;
-}
-
-static void
-gtk_alignment_get_preferred_size (GtkSizeRequest *widget,
+gtk_alignment_get_preferred_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
@@ -590,14 +581,12 @@ gtk_alignment_get_preferred_size (GtkSizeRequest *widget,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
minimum += (priv->padding_left + priv->padding_right);
- gtk_size_request_get_preferred_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_preferred_height (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
}
natural = minimum;
@@ -614,7 +603,7 @@ gtk_alignment_get_preferred_size (GtkSizeRequest *widget,
}
static void
-gtk_alignment_get_preferred_width (GtkSizeRequest *widget,
+gtk_alignment_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
@@ -622,7 +611,7 @@ gtk_alignment_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_alignment_get_preferred_height (GtkSizeRequest *widget,
+gtk_alignment_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c
index 4261420..801afaf 100644
--- a/gtk/gtkarrow.c
+++ b/gtk/gtkarrow.c
@@ -77,17 +77,14 @@ static void gtk_arrow_get_property (GObject *object,
static gboolean gtk_arrow_draw (GtkWidget *widget,
cairo_t *cr);
-static void gtk_arrow_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_arrow_get_preferred_width (GtkSizeRequest *widget,
+static void gtk_arrow_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_arrow_get_preferred_height (GtkSizeRequest *widget,
+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
@@ -103,6 +100,8 @@ gtk_arrow_class_init (GtkArrowClass *class)
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,
@@ -199,16 +198,9 @@ gtk_arrow_init (GtkArrow *arrow)
}
static void
-gtk_arrow_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_arrow_get_preferred_width;
- iface->get_preferred_height = gtk_arrow_get_preferred_height;
-}
-
-static void
-gtk_arrow_get_preferred_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_arrow_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gint xpad;
@@ -222,9 +214,9 @@ gtk_arrow_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_arrow_get_preferred_height (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size)
+gtk_arrow_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
gint ypad;
diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c
index 2cbbabb..dbeedcd 100644
--- a/gtk/gtkaspectframe.c
+++ b/gtk/gtkaspectframe.c
@@ -352,8 +352,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
{
GtkRequisition child_requisition;
- gtk_size_request_get_preferred_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 /
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 75f6aa1..8cb1029 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -1225,8 +1225,8 @@ gtk_assistant_size_allocate (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
/* Header */
- gtk_size_request_get_preferred_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;
@@ -1236,8 +1236,8 @@ gtk_assistant_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (priv->header_image, &header_allocation);
/* Action area */
- gtk_size_request_get_preferred_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;
@@ -1250,8 +1250,8 @@ gtk_assistant_size_allocate (GtkWidget *widget,
gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
/* Sidebar */
- gtk_size_request_get_preferred_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;
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index d34b2f0..a1ee727 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -478,8 +478,7 @@ gtk_button_box_child_requisition (GtkWidget *widget,
if (is_secondary)
nsecondaries++;
- gtk_size_request_get_preferred_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))
{
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 02ed7e9..2e2cde6 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -59,29 +59,27 @@ static void gtk_bin_forall (GtkContainer *container,
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_preferred_width_for_height (GtkSizeRequest *widget,
+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 (GtkSizeRequest *widget,
+static void gtk_bin_get_preferred_height_for_width (GtkWidget *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))
+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;
@@ -186,57 +184,47 @@ gtk_bin_forall (GtkContainer *container,
* 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_preferred_width_for_height = gtk_bin_get_preferred_width_for_height;
- iface->get_preferred_height_for_width = gtk_bin_get_preferred_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_preferred_width() wrapper
+ /* 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_preferred_width (GTK_SIZE_REQUEST (bin), &hmin, &hnat);
- GTK_SIZE_REQUEST_GET_IFACE (bin)->get_preferred_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_preferred_width (GTK_SIZE_REQUEST (priv->child), &child_hmin, NULL);
- gtk_size_request_get_preferred_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_preferred_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;
@@ -246,9 +234,9 @@ gtk_bin_get_preferred_width_for_height (GtkSizeRequest *widget,
{
get_child_padding_delta (bin, &hdelta, &vdelta);
- gtk_size_request_get_preferred_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;
@@ -257,14 +245,14 @@ gtk_bin_get_preferred_width_for_height (GtkSizeRequest *widget,
*natural_width = child_nat + hdelta;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
static void
-gtk_bin_get_preferred_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;
@@ -274,9 +262,9 @@ gtk_bin_get_preferred_height_for_width (GtkSizeRequest *widget,
{
get_child_padding_delta (bin, &hdelta, &vdelta);
- gtk_size_request_get_preferred_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;
@@ -285,7 +273,7 @@ gtk_bin_get_preferred_height_for_width (GtkSizeRequest *widget,
*natural_height = child_nat + vdelta;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_height (widget, minimum_height, natural_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, minimum_height, natural_height);
}
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 6a408f2..e8310c5 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -171,30 +171,25 @@ static void gtk_box_get_child_property (GtkContainer *container,
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_preferred_width (GtkSizeRequest *widget,
+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 (GtkSizeRequest *widget,
+static void gtk_box_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_box_get_preferred_width_for_height (GtkSizeRequest *widget,
+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 (GtkSizeRequest *widget,
+static void gtk_box_get_preferred_height_for_width (GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height);
-static GtkSizeRequestIface *parent_size_request_iface;
-
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)
@@ -206,7 +201,12 @@ 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;
@@ -446,15 +446,15 @@ gtk_box_size_allocate (GtkWidget *widget,
continue;
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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 */
@@ -802,20 +802,8 @@ gtk_box_pack (GtkBox *box,
}
-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_preferred_width = gtk_box_get_preferred_width;
- iface->get_preferred_height = gtk_box_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_box_get_preferred_height_for_width;
- iface->get_preferred_width_for_height = gtk_box_get_preferred_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;
@@ -824,10 +812,10 @@ gtk_box_get_request_mode (GtkSizeRequest *widget)
}
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;
@@ -851,11 +839,11 @@ gtk_box_get_size (GtkSizeRequest *widget,
gint child_minimum, child_natural;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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)
{
@@ -905,17 +893,17 @@ gtk_box_get_size (GtkSizeRequest *widget,
}
static void
-gtk_box_get_preferred_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_preferred_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);
}
@@ -954,13 +942,13 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
if (gtk_widget_get_visible (child->widget))
{
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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)
@@ -1074,11 +1062,11 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
/* Assign the child's position. */
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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);
@@ -1115,11 +1103,11 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
{
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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;
@@ -1156,13 +1144,13 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
}
static void
-gtk_box_get_preferred_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);
@@ -1171,13 +1159,13 @@ gtk_box_get_preferred_width_for_height (GtkSizeRequest *widget,
}
static void
-gtk_box_get_preferred_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);
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 394f712..5935abc 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -172,11 +172,10 @@ static void gtk_button_set_related_action (GtkButton *button,
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_preferred_width (GtkSizeRequest *widget,
+static void gtk_button_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_button_get_preferred_height (GtkSizeRequest *widget,
+static void gtk_button_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
@@ -184,9 +183,7 @@ static guint button_signals[LAST_SIGNAL] = { 0 };
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)
@@ -208,6 +205,8 @@ 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;
@@ -1891,14 +1890,7 @@ gtk_button_finish_activate (GtkButton *button,
static void
-gtk_button_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_button_get_preferred_width;
- iface->get_preferred_height = gtk_button_get_preferred_height;
-}
-
-static void
-gtk_button_get_size (GtkSizeRequest *widget,
+gtk_button_get_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
@@ -1946,11 +1938,9 @@ gtk_button_get_size (GtkSizeRequest *widget,
gint child_min, child_nat;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (child),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
else
- gtk_size_request_get_preferred_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;
@@ -1964,17 +1954,17 @@ gtk_button_get_size (GtkSizeRequest *widget,
}
static void
-gtk_button_get_preferred_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_preferred_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);
}
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 44efcac..4f6f445 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -24,8 +24,8 @@
#include "gtkintl.h"
#include "gtkcellrenderertext.h"
#include "gtkcellrendererpixbuf.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
+#include "gtksizerequest.h"
#include <gobject/gmarshal.h>
#include "gtkbuildable.h"
@@ -120,18 +120,17 @@ static void gtk_cell_view_buildable_custom_tag_end (GtkBuildable
const gchar *tagname,
gpointer *data);
-static void gtk_cell_view_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_cell_view_get_preferred_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_preferred_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_preferred_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_preferred_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);
@@ -152,9 +151,7 @@ G_DEFINE_TYPE_WITH_CODE (GtkCellView, gtk_cell_view, GTK_TYPE_WIDGET,
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
@@ -167,8 +164,12 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
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,
@@ -1047,13 +1048,13 @@ gtk_cell_view_get_desired_width_of_row (GtkCellView *cell_view,
cell_view->priv->displayed_row =
gtk_tree_row_reference_new (cell_view->priv->model, path);
- gtk_cell_view_get_preferred_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_preferred_width (GTK_SIZE_REQUEST (cell_view), NULL, NULL);
+ gtk_cell_view_get_preferred_width (GTK_WIDGET (cell_view), NULL, NULL);
}
@@ -1089,13 +1090,13 @@ gtk_cell_view_get_desired_height_for_width_of_row (GtkCellView *cell_view,
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_preferred_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_preferred_width (GTK_SIZE_REQUEST (cell_view), NULL, NULL);
+ gtk_cell_view_get_preferred_width (GTK_WIDGET (cell_view), NULL, NULL);
}
/**
@@ -1188,18 +1189,9 @@ gtk_cell_view_buildable_custom_tag_end (GtkBuildable *buildable,
}
static void
-gtk_cell_view_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_cell_view_get_preferred_width;
- iface->get_preferred_height = gtk_cell_view_get_preferred_height;
- iface->get_preferred_width_for_height = gtk_cell_view_get_preferred_width_for_height;
- iface->get_preferred_height_for_width = gtk_cell_view_get_preferred_height_for_width;
-}
-
-static void
-gtk_cell_view_get_preferred_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;
@@ -1246,9 +1238,9 @@ gtk_cell_view_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_cell_view_get_preferred_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;
@@ -1259,10 +1251,10 @@ gtk_cell_view_get_preferred_height (GtkSizeRequest *widget,
}
static void
-gtk_cell_view_get_preferred_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) */
@@ -1270,10 +1262,10 @@ gtk_cell_view_get_preferred_width_for_height (GtkSizeRequest *widget,
}
static void
-gtk_cell_view_get_preferred_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;
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 6e7e2ee..6821c95 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -29,7 +29,6 @@
#include "gtkcheckbutton.h"
#include "gtklabel.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -285,8 +284,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
GtkRequisition child_requisition;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gtk_size_request_get_preferred_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 -
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index bc4e8e1..ae5b451 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -38,7 +38,6 @@
#include "gtktreeselection.h"
#include "gtkvseparator.h"
#include "gtkwindow.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include <gdk/gdkkeysyms.h>
@@ -467,18 +466,17 @@ static void gtk_combo_box_buildable_custom_tag_end (GtkBuildable *bui
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_preferred_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_preferred_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_preferred_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_preferred_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);
@@ -490,9 +488,7 @@ G_DEFINE_TYPE_WITH_CODE (GtkComboBox, gtk_combo_box, GTK_TYPE_BIN,
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 */
@@ -520,6 +516,10 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
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;
@@ -1588,7 +1588,7 @@ gtk_combo_box_menu_position_over (GtkMenu *menu,
menu_xpos = allocation.x;
menu_ypos = allocation.y + allocation.height / 2 - 2;
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (menu), &menu_width, NULL);
+ gtk_widget_get_preferred_width (GTK_WIDGET (menu), &menu_width, NULL);
if (active != NULL)
{
@@ -1888,7 +1888,7 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box,
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_preferred_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);
@@ -2297,7 +2297,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
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_preferred_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);
}
@@ -5945,15 +5945,6 @@ gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable,
static void
-gtk_combo_box_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_combo_box_get_preferred_width;
- iface->get_preferred_height = gtk_combo_box_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_combo_box_get_preferred_height_for_width;
- iface->get_preferred_width_for_height = gtk_combo_box_get_preferred_width_for_height;
-}
-
-static void
gtk_combo_box_remeasure (GtkComboBox *combo_box)
{
GtkComboBoxPrivate *priv = combo_box->priv;
@@ -6001,8 +5992,8 @@ gtk_combo_box_measure_height_for_width (GtkComboBox *combo_box,
child = gtk_bin_get_child (GTK_BIN (combo_box));
- gtk_size_request_get_preferred_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))
@@ -6038,9 +6029,9 @@ gtk_combo_box_measure_height_for_width (GtkComboBox *combo_box,
static void
-gtk_combo_box_get_preferred_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;
@@ -6057,7 +6048,7 @@ gtk_combo_box_get_preferred_width (GtkSizeRequest *widget,
child = gtk_bin_get_child (GTK_BIN (widget));
/* common */
- gtk_size_request_get_preferred_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);
@@ -6093,8 +6084,8 @@ gtk_combo_box_get_preferred_width (GtkSizeRequest *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box));
xthickness = gtk_widget_get_style (priv->button)->xthickness;
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (priv->separator), &sep_width, NULL);
- gtk_size_request_get_preferred_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);
@@ -6105,8 +6096,8 @@ gtk_combo_box_get_preferred_width (GtkSizeRequest *widget,
{
gint but_width, but_nat_width;
- gtk_size_request_get_preferred_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;
@@ -6137,8 +6128,8 @@ gtk_combo_box_get_preferred_width (GtkSizeRequest *widget,
}
/* the button */
- gtk_size_request_get_preferred_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;
@@ -6160,35 +6151,35 @@ gtk_combo_box_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_combo_box_get_preferred_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_preferred_width (widget, &min_width, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_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_preferred_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_preferred_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_preferred_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;
@@ -6223,12 +6214,12 @@ gtk_combo_box_get_preferred_height_for_width (GtkSizeRequest *widget,
xthickness = button_style->xthickness;
ythickness = button_style->ythickness;
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (priv->separator), &sep_width, NULL);
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (priv->arrow), &arrow_width, NULL);
- gtk_size_request_get_preferred_height_for_width (GTK_SIZE_REQUEST (priv->separator),
- sep_width, &sep_height, NULL);
- gtk_size_request_get_preferred_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);
@@ -6249,9 +6240,9 @@ gtk_combo_box_get_preferred_height_for_width (GtkSizeRequest *widget,
/* there is a custom child widget inside (no priv->cell_view) */
gint but_width, but_height;
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (priv->button), &but_width, NULL);
- gtk_size_request_get_preferred_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;
@@ -6267,9 +6258,9 @@ gtk_combo_box_get_preferred_height_for_width (GtkSizeRequest *widget,
gint but_width, but_height;
gint xpad = 0, ypad = 0;
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (priv->button), &but_width, NULL);
- gtk_size_request_get_preferred_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)
{
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 16c4ae2..e69dc56 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -53,7 +53,6 @@
#include "gtkseparatormenuitem.h"
#include "gtkselection.h"
#include "gtksettings.h"
-#include "gtksizerequest.h"
#include "gtkspinbutton.h"
#include "gtkstock.h"
#include "gtktextutil.h"
@@ -2992,8 +2991,7 @@ gtk_entry_get_text_area_size (GtkEntry *entry,
gint frame_height;
gint xborder, yborder;
- gtk_size_request_get_preferred_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);
@@ -3047,8 +3045,7 @@ get_widget_window_size (GtkEntry *entry,
GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET (entry);
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
if (x)
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index f89daa7..af40376 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -27,7 +27,6 @@
#include "gtklabel.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
#include "gtkcontainer.h"
#include "gtkmarshalers.h"
#include "gtkmain.h"
@@ -134,28 +133,25 @@ static void gtk_expander_buildable_add_child (GtkBuildable *buildable,
const gchar *type);
-/* GtkSizeRequest */
-static void gtk_expander_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_expander_get_preferred_width (GtkSizeRequest *widget,
+/* GtkWidget */
+static void gtk_expander_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_expander_get_preferred_height (GtkSizeRequest *widget,
+static void gtk_expander_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_expander_get_preferred_height_for_width (GtkSizeRequest *layout,
+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 (GtkSizeRequest *layout,
+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)
@@ -190,6 +186,10 @@ 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;
@@ -451,8 +451,8 @@ gtk_expander_realize (GtkWidget *widget)
{
GtkRequisition label_requisition;
- gtk_size_request_get_preferred_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
@@ -620,7 +620,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
gint natural_label_width;
gboolean ltr;
- gtk_size_request_get_preferred_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;
@@ -630,8 +630,8 @@ gtk_expander_size_allocate (GtkWidget *widget,
/* We distribute the minimum height to the label widget and prioritize
* the child widget giving it the remaining height */
- gtk_size_request_get_preferred_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;
@@ -1272,19 +1272,10 @@ gtk_expander_activate (GtkExpander *expander)
}
-static void
-gtk_expander_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_expander_get_preferred_width;
- iface->get_preferred_height = gtk_expander_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_expander_get_preferred_height_for_width;
- iface->get_preferred_width_for_height = gtk_expander_get_preferred_width_for_height;
-}
-
static void
-gtk_expander_get_preferred_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;
@@ -1318,8 +1309,8 @@ gtk_expander_get_preferred_width (GtkSizeRequest *widget,
{
gint label_min, label_nat;
- gtk_size_request_get_preferred_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;
@@ -1329,8 +1320,8 @@ gtk_expander_get_preferred_width (GtkSizeRequest *widget,
{
gint child_min, child_nat;
- gtk_size_request_get_preferred_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);
@@ -1342,9 +1333,9 @@ gtk_expander_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_expander_get_preferred_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;
@@ -1378,8 +1369,8 @@ gtk_expander_get_preferred_height (GtkSizeRequest *widget,
{
gint label_min, label_nat;
- gtk_size_request_get_preferred_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;
@@ -1399,8 +1390,8 @@ gtk_expander_get_preferred_height (GtkSizeRequest *widget,
{
gint child_min, child_nat;
- gtk_size_request_get_preferred_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;
@@ -1412,10 +1403,10 @@ gtk_expander_get_preferred_height (GtkSizeRequest *widget,
}
static void
-gtk_expander_get_preferred_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;
@@ -1452,9 +1443,9 @@ gtk_expander_get_preferred_height_for_width (GtkSizeRequest *widget,
{
gint label_min, label_nat;
- gtk_size_request_get_preferred_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;
@@ -1474,9 +1465,9 @@ gtk_expander_get_preferred_height_for_width (GtkSizeRequest *widget,
{
gint child_min, child_nat;
- gtk_size_request_get_preferred_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;
@@ -1487,12 +1478,12 @@ gtk_expander_get_preferred_height_for_width (GtkSizeRequest *widget,
}
static void
-gtk_expander_get_preferred_width_for_height (GtkSizeRequest *widget,
+gtk_expander_get_preferred_width_for_height (GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width)
{
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 5db680f..58fd7bb 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -28,8 +28,6 @@
#include "gtkfixed.h"
-#include "gtksizerequest.h"
-
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -401,8 +399,8 @@ gtk_fixed_size_allocate (GtkWidget *widget,
if (gtk_widget_get_visible (child->widget))
{
- gtk_size_request_get_preferred_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;
diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c
index 7da275a..39dc317 100644
--- a/gtk/gtkfontsel.c
+++ b/gtk/gtkfontsel.c
@@ -59,7 +59,6 @@
#include "gtkintl.h"
#include "gtkaccessible.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
struct _GtkFontSelectionPrivate
@@ -1173,8 +1172,7 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel)
GtkWidget *preview_entry = priv->preview_entry;
const gchar *text;
- gtk_size_request_get_preferred_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);
@@ -1182,7 +1180,7 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel)
gtk_widget_modify_style (preview_entry, rc_style);
g_object_unref (rc_style);
- gtk_size_request_get_preferred_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);
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index bd86356..45d112c 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -31,7 +31,7 @@
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
+
#define LABEL_PAD 1
#define LABEL_SIDE_PAD 2
@@ -90,18 +90,17 @@ static void gtk_frame_buildable_add_child (GtkBuildable *buildable,
GObject *child,
const gchar *type);
-static void gtk_frame_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_frame_get_preferred_width (GtkSizeRequest *widget,
+static void gtk_frame_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_frame_get_preferred_height (GtkSizeRequest *widget,
+static void gtk_frame_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_frame_get_preferred_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_preferred_width_for_height(GtkSizeRequest *layout,
+static void gtk_frame_get_preferred_width_for_height(GtkWidget *layout,
gint width,
gint *minimum_height,
gint *natural_height);
@@ -109,9 +108,7 @@ static void gtk_frame_get_preferred_width_for_height(GtkSizeRequest *layout
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)
@@ -170,8 +167,12 @@ 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;
@@ -681,12 +682,12 @@ gtk_frame_size_allocate (GtkWidget *widget,
else
xalign = 1 - priv->label_xalign;
- gtk_size_request_get_preferred_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_preferred_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 +
@@ -732,7 +733,7 @@ gtk_frame_real_compute_child_allocation (GtkFrame *frame,
{
gint nat_width, width, height;
- gtk_size_request_get_preferred_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;
@@ -740,8 +741,8 @@ gtk_frame_real_compute_child_allocation (GtkFrame *frame,
width = MIN (width, nat_width);
- gtk_size_request_get_preferred_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);
}
@@ -759,7 +760,7 @@ gtk_frame_real_compute_child_allocation (GtkFrame *frame,
}
static void
-gtk_frame_get_preferred_size (GtkSizeRequest *request,
+gtk_frame_get_preferred_size (GtkWidget *request,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
@@ -780,15 +781,15 @@ gtk_frame_get_preferred_size (GtkSizeRequest *request,
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_size_request_get_preferred_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_preferred_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);
}
@@ -804,15 +805,15 @@ gtk_frame_get_preferred_size (GtkSizeRequest *request,
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_size_request_get_preferred_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_preferred_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;
}
@@ -839,27 +840,27 @@ gtk_frame_get_preferred_size (GtkSizeRequest *request,
}
static void
-gtk_frame_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_frame_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
static void
-gtk_frame_get_preferred_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;
@@ -882,8 +883,8 @@ gtk_frame_get_preferred_height_for_width (GtkSizeRequest *request,
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
{
- gtk_size_request_get_preferred_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;
}
@@ -891,8 +892,8 @@ gtk_frame_get_preferred_height_for_width (GtkSizeRequest *request,
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
- gtk_size_request_get_preferred_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;
}
@@ -905,19 +906,11 @@ gtk_frame_get_preferred_height_for_width (GtkSizeRequest *request,
}
static void
-gtk_frame_get_preferred_width_for_height (GtkSizeRequest *widget,
+gtk_frame_get_preferred_width_for_height (GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width)
{
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_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_preferred_width = gtk_frame_get_preferred_width;
- iface->get_preferred_height = gtk_frame_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_frame_get_preferred_height_for_width;
- iface->get_preferred_width_for_height = gtk_frame_get_preferred_width_for_height;
-}
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index d9f2d8b..ba14f22 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -32,7 +32,6 @@
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkwindow.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -448,7 +447,7 @@ gtk_handle_box_realize (GtkWidget *widget)
if (child)
gtk_widget_set_parent_window (child, priv->bin_window);
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
attributes.x = 0;
attributes.y = 0;
@@ -639,8 +638,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
if (child)
{
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
}
else
{
@@ -1345,8 +1343,7 @@ gtk_handle_box_motion (GtkWidget *widget,
if (child)
{
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
}
else
{
diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c
index d561917..9732b6e 100644
--- a/gtk/gtkimagemenuitem.c
+++ b/gtk/gtkimagemenuitem.c
@@ -36,7 +36,6 @@
#include "gtkcontainer.h"
#include "gtkwindow.h"
#include "gtkactivatable.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
#include "gtkprivate.h"
@@ -346,8 +345,7 @@ gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
GtkRequisition image_requisition;
guint toggle_spacing;
- gtk_size_request_get_preferred_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,
@@ -501,8 +499,7 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
* come up with a solution that's really better.
*/
- gtk_size_request_get_preferred_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);
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 9f40686..5a50c1f 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -49,7 +49,6 @@
#include "gtkimage.h"
#include "gtkshow.h"
#include "gtktooltip.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
@@ -331,19 +330,18 @@ static void gtk_label_get_link_colors (GtkWidget *widget,
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_preferred_width (GtkSizeRequest *widget,
+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 (GtkSizeRequest *widget,
+static void gtk_label_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_label_get_preferred_width_for_height (GtkSizeRequest *widget,
+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 (GtkSizeRequest *widget,
+static void gtk_label_get_preferred_height_for_width (GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height);
@@ -352,9 +350,7 @@ 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,
@@ -414,6 +410,11 @@ gtk_label_class_init (GtkLabelClass *class)
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;
@@ -3353,20 +3354,10 @@ get_single_line_height (GtkWidget *widget,
return ascent + descent;
}
-static void
-gtk_label_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_request_mode = gtk_label_get_request_mode;
- iface->get_preferred_width = gtk_label_get_preferred_width;
- iface->get_preferred_height = gtk_label_get_preferred_height;
- iface->get_preferred_width_for_height = gtk_label_get_preferred_width_for_height;
- iface->get_preferred_height_for_width = gtk_label_get_preferred_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)
@@ -3419,7 +3410,7 @@ get_size_for_allocation (GtkLabel *label,
}
static void
-gtk_label_get_preferred_size (GtkSizeRequest *widget,
+gtk_label_get_preferred_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
@@ -3567,26 +3558,26 @@ gtk_label_get_preferred_size (GtkSizeRequest *widget,
static void
-gtk_label_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_label_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
static void
-gtk_label_get_preferred_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;
@@ -3611,14 +3602,14 @@ gtk_label_get_preferred_width_for_height (GtkSizeRequest *widget,
*natural_width += xpad * 2;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
static void
-gtk_label_get_preferred_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;
@@ -3643,7 +3634,7 @@ gtk_label_get_preferred_height_for_width (GtkSizeRequest *widget,
*natural_height += ypad * 2;
}
else
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_height (widget, minimum_height, natural_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, minimum_height, natural_height);
}
static void
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index f53f504..e9907af 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -34,8 +34,6 @@
#include "gdkconfig.h"
-#include "gtksizerequest.h"
-
#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
@@ -1125,8 +1123,7 @@ gtk_layout_allocate_child (GtkLayout *layout,
allocation.x = child->x;
allocation.y = child->y;
- gtk_size_request_get_preferred_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;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 8da4f58..2db6913 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -41,7 +41,6 @@
#include "gtkhbox.h"
#include "gtkvscrollbar.h"
#include "gtksettings.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -258,14 +257,13 @@ static gboolean gtk_menu_real_can_activate_accel (GtkWidget *widget,
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_preferred_width (GtkSizeRequest *widget,
+static void gtk_menu_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_menu_get_preferred_height (GtkSizeRequest *widget,
+static void gtk_menu_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_menu_get_preferred_height_for_width (GtkSizeRequest *widget,
+static void gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
gint for_size,
gint *minimum_size,
gint *natural_size);
@@ -281,9 +279,7 @@ gtk_menu_get_private (GtkMenu *menu)
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)
@@ -490,6 +486,9 @@ gtk_menu_class_init (GtkMenuClass *class)
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;
@@ -1625,7 +1624,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
/* 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_preferred_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;
@@ -2599,8 +2598,8 @@ calculate_line_heights (GtkMenu *menu,
part = avail_width / (r - l);
- gtk_size_request_get_preferred_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);
@@ -3011,19 +3010,10 @@ gtk_menu_show (GtkWidget *widget)
}
-
-static void
-gtk_menu_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_menu_get_preferred_width;
- iface->get_preferred_height = gtk_menu_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_menu_get_preferred_height_for_width;
-}
-
static void
-gtk_menu_get_preferred_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;
@@ -3071,7 +3061,7 @@ gtk_menu_get_preferred_width (GtkSizeRequest *widget,
*/
GTK_MENU_ITEM (child)->show_submenu_indicator = TRUE;
- gtk_size_request_get_preferred_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);
@@ -3136,22 +3126,22 @@ gtk_menu_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_menu_get_preferred_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_preferred_width (widget, &min_width, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_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_preferred_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);
@@ -4522,7 +4512,7 @@ gtk_menu_position (GtkMenu *menu)
/* Get the minimum height for minimum width to figure out
* the right place to popup the menu.
*/
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (pointer_screen != screen)
{
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 09d0d67..981edaa 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -426,8 +426,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
- gtk_size_request_get_preferred_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)
@@ -477,8 +476,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
- gtk_size_request_get_preferred_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)
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index ea52c60..0eaf19b 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -37,7 +37,6 @@
#include "gtkprivate.h"
#include "gtkbuildable.h"
#include "gtkactivatable.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
@@ -127,14 +126,13 @@ static void gtk_real_menu_item_set_label (GtkMenuItem *menu_item,
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_preferred_width (GtkSizeRequest *widget,
+static void gtk_menu_item_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_menu_item_get_preferred_height (GtkSizeRequest *widget,
+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 (GtkSizeRequest *widget,
+static void gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
gint for_size,
gint *minimum_size,
gint *natural_size);
@@ -170,9 +168,7 @@ G_DEFINE_TYPE_WITH_CODE (GtkMenuItem, gtk_menu_item, GTK_TYPE_BIN,
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))
@@ -204,6 +200,9 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
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;
@@ -660,17 +659,9 @@ get_minimum_width (GtkWidget *widget)
}
static void
-gtk_menu_item_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_menu_item_get_preferred_width;
- iface->get_preferred_height = gtk_menu_item_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_menu_item_get_preferred_height_for_width;
-}
-
-static void
-gtk_menu_item_get_preferred_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;
@@ -720,7 +711,7 @@ gtk_menu_item_get_preferred_width (GtkSizeRequest *request,
{
gint child_min, child_nat;
- gtk_size_request_get_preferred_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)
{
@@ -762,9 +753,9 @@ gtk_menu_item_get_preferred_width (GtkSizeRequest *request,
}
static void
-gtk_menu_item_get_preferred_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;
@@ -816,7 +807,7 @@ gtk_menu_item_get_preferred_height (GtkSizeRequest *request,
{
gint child_min, child_nat;
- gtk_size_request_get_preferred_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;
@@ -863,10 +854,10 @@ gtk_menu_item_get_preferred_height (GtkSizeRequest *request,
}
static void
-gtk_menu_item_get_preferred_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;
@@ -941,10 +932,10 @@ gtk_menu_item_get_preferred_height_for_width (GtkSizeRequest *request,
avail_size -= arrow_spacing;
}
- gtk_size_request_get_preferred_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;
@@ -1395,8 +1386,7 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
child_allocation.x += allocation->x;
child_allocation.y += allocation->y;
- gtk_size_request_get_preferred_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)
@@ -2002,7 +1992,7 @@ gtk_menu_item_position_menu (GtkMenu *menu,
direction = gtk_widget_get_direction (widget);
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (menu), &requisition, NULL);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);
twidth = requisition.width;
theight = requisition.height;
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 8026145..1e92745 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -38,7 +38,6 @@
#include "gtkmenu.h"
#include "gtkmenuitem.h"
#include "gtklabel.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkbindings.h"
@@ -2199,8 +2198,8 @@ gtk_notebook_size_allocate (GtkWidget *widget,
widget_allocation.y = allocation->y + border_width;
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (priv->action_widget[i]),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (priv->action_widget[i],
+ &requisition, NULL);
switch (tab_pos)
{
@@ -5880,8 +5879,7 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
xthickness = style->xthickness;
ythickness = style->ythickness;
- gtk_size_request_get_preferred_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,
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 0fd1606..ecc977c 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -33,7 +33,6 @@
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkorientable.h"
-#include "gtksizerequest.h"
#include "gtkwindow.h"
#include "gtkprivate.h"
@@ -887,10 +886,8 @@ gtk_paned_size_allocate (GtkWidget *widget,
gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (priv->child1),
- &child1_requisition, NULL);
- gtk_size_request_get_preferred_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;
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 28b6112..3257aed 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -36,7 +36,6 @@
#include "gtkhbox.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
-#include "gtksizerequest.h"
enum {
@@ -497,8 +496,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
{
child = BUTTON_DATA (list->data)->button;
- gtk_size_request_get_preferred_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)
@@ -528,8 +526,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
* button, then count backwards.
*/
/* Count down the path chain towards the end. */
- gtk_size_request_get_preferred_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;
@@ -537,8 +535,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
{
child = BUTTON_DATA (list->data)->button;
- gtk_size_request_get_preferred_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)
@@ -557,8 +554,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
{
child = BUTTON_DATA (first_button->next->data)->button;
- gtk_size_request_get_preferred_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)
{
@@ -605,8 +601,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
button_data = BUTTON_DATA (list->data);
child = button_data->button;
- gtk_size_request_get_preferred_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);
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 9e5b4cf..b1ba9a4 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -115,7 +115,7 @@ gboolean _gtk_fnmatch (const char *pattern,
#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
*/
#define GTK_SIZE_REQUEST_CACHED_SIZES 3
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index b5c2742..be04fe4 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -28,7 +28,6 @@
#include <math.h>
#include <gdk/gdkkeysyms.h>
#include "gtkbindings.h"
-#include "gtksizerequest.h"
#include "gtkmarshalers.h"
#include "gtkscrolledwindow.h"
#include "gtkwindow.h"
@@ -151,27 +150,24 @@ static void gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjus
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_preferred_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_preferred_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_preferred_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_preferred_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
@@ -229,6 +225,10 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
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;
@@ -1333,8 +1333,8 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget,
GtkRequisition vscrollbar_requisition;
gboolean is_rtl;
- gtk_size_request_get_preferred_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 &&
@@ -1351,8 +1351,8 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget,
{
GtkRequisition hscrollbar_requisition;
- gtk_size_request_get_preferred_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)
@@ -1455,8 +1455,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
{
GtkRequisition hscrollbar_requisition;
- gtk_size_request_get_preferred_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);
@@ -1506,8 +1506,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
if (!gtk_widget_get_visible (priv->vscrollbar))
gtk_widget_show (priv->vscrollbar);
- gtk_size_request_get_preferred_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 ||
@@ -1801,16 +1801,7 @@ _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window)
static void
-gtk_scrolled_window_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_scrolled_window_get_preferred_width;
- iface->get_preferred_height = gtk_scrolled_window_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_scrolled_window_get_preferred_height_for_width;
- iface->get_preferred_width_for_height = gtk_scrolled_window_get_preferred_width_for_height;
-}
-
-static void
-gtk_scrolled_window_get_preferred_size (GtkSizeRequest *widget,
+gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
@@ -1848,9 +1839,9 @@ gtk_scrolled_window_get_preferred_size (GtkSizeRequest *widget,
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_size_request_get_preferred_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)
{
@@ -1876,9 +1867,9 @@ gtk_scrolled_window_get_preferred_size (GtkSizeRequest *widget,
}
else /* GTK_ORIENTATION_VERTICAL */
{
- gtk_size_request_get_preferred_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)
{
@@ -1954,39 +1945,39 @@ gtk_scrolled_window_get_preferred_size (GtkSizeRequest *widget,
}
static void
-gtk_scrolled_window_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_scrolled_window_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
static void
-gtk_scrolled_window_get_preferred_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_preferred_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_preferred_width_for_height (GtkSizeRequest *widget,
+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_preferred_width (widget, minimum_width, natural_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index a91fcaa..422a7d9 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -25,7 +25,6 @@
#include "gtkprivate.h"
#include "gtksizegroup.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
@@ -671,7 +670,7 @@ get_base_dimension (GtkWidget *widget,
/* XXX Possibly we should be using natural values and not minimums here. */
gint width;
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (widget), &width, NULL);
+ gtk_widget_get_preferred_width (widget, &width, NULL);
return width;
}
@@ -680,7 +679,7 @@ get_base_dimension (GtkWidget *widget,
/* XXX Possibly we should be using natural values and not minimums here. */
gint height;
- gtk_size_request_get_preferred_height (GTK_SIZE_REQUEST (widget), &height, NULL);
+ gtk_widget_get_preferred_height (widget, &height, NULL);
return height;
}
@@ -778,7 +777,7 @@ compute_dimension (GtkWidget *widget,
* value in the dimension @mode.
*
* This function is used to update sizegroup minimum size information
- * in multiple passes from the new #GtkSizeRequest manager.
+ * in multiple passes from the new #GtkWidget manager.
*/
gint
_gtk_size_group_bump_requisition (GtkWidget *widget,
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 87d32ba..b49b87d 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -25,9 +25,9 @@
/**
* 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).
@@ -36,14 +36,14 @@
*
* 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
@@ -54,10 +54,10 @@
* 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_preferred_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_preferred_height_for_width(), which will also
+ * 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.
*
@@ -67,7 +67,7 @@
*
* 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.
*
@@ -98,18 +98,6 @@
#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
*
@@ -160,7 +148,7 @@ static GQuark recursion_check_quark = 0;
#endif /* G_DISABLE_CHECKS */
static void
-push_recursion_check (GtkSizeRequest *request,
+push_recursion_check (GtkWidget *request,
GtkSizeGroupMode orientation,
gint for_size)
{
@@ -184,10 +172,10 @@ push_recursion_check (GtkSizeRequest *request,
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);
@@ -198,7 +186,7 @@ push_recursion_check (GtkSizeRequest *request,
}
static void
-pop_recursion_check (GtkSizeRequest *request,
+pop_recursion_check (GtkWidget *request,
GtkSizeGroupMode orientation)
{
#ifndef G_DISABLE_CHECKS
@@ -207,7 +195,7 @@ pop_recursion_check (GtkSizeRequest *request,
}
static void
-compute_size_for_orientation (GtkSizeRequest *request,
+compute_size_for_orientation (GtkWidget *request,
GtkSizeGroupMode orientation,
gint for_size,
gint *minimum_size,
@@ -219,7 +207,7 @@ compute_size_for_orientation (GtkSizeRequest *request,
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);
@@ -265,9 +253,9 @@ compute_size_for_orientation (GtkSizeRequest *request,
requisition_size = requisition.width;
if (for_size < 0)
- GTK_SIZE_REQUEST_GET_IFACE (request)->get_preferred_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_preferred_width_for_height (request, for_size,
+ GTK_WIDGET_GET_CLASS (request)->get_preferred_width_for_height (request, for_size,
&min_size, &nat_size);
}
else
@@ -275,9 +263,9 @@ compute_size_for_orientation (GtkSizeRequest *request,
requisition_size = requisition.height;
if (for_size < 0)
- GTK_SIZE_REQUEST_GET_IFACE (request)->get_preferred_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_preferred_height_for_width (request, for_size,
+ GTK_WIDGET_GET_CLASS (request)->get_preferred_height_for_width (request, for_size,
&min_size, &nat_size);
}
pop_recursion_check (request, orientation);
@@ -382,8 +370,8 @@ compute_size_for_orientation (GtkSizeRequest *request,
}
/**
- * 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.
@@ -398,23 +386,23 @@ compute_size_for_orientation (GtkSizeRequest *request,
* 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_preferred_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
*
@@ -426,9 +414,9 @@ gtk_size_request_get_request_mode (GtkSizeRequest *widget)
* Since: 3.0
*/
void
-gtk_size_request_get_preferred_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);
@@ -436,8 +424,8 @@ gtk_size_request_get_preferred_width (GtkSizeRequest *widget,
/**
- * gtk_size_request_get_preferred_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
*
@@ -448,9 +436,9 @@ gtk_size_request_get_preferred_width (GtkSizeRequest *widget,
* Since: 3.0
*/
void
-gtk_size_request_get_preferred_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);
@@ -459,8 +447,8 @@ gtk_size_request_get_preferred_height (GtkSizeRequest *widget,
/**
- * gtk_size_request_get_preferred_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
@@ -471,18 +459,18 @@ gtk_size_request_get_preferred_height (GtkSizeRequest *widget,
* Since: 3.0
*/
void
-gtk_size_request_get_preferred_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_preferred_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
@@ -493,18 +481,18 @@ gtk_size_request_get_preferred_width_for_height (GtkSizeRequest *widget,
* Since: 3.0
*/
void
-gtk_size_request_get_preferred_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_preferred_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
*
@@ -517,49 +505,49 @@ gtk_size_request_get_preferred_height_for_width (GtkSizeRequest *widget,
* Since: 3.0
*/
void
-gtk_size_request_get_preferred_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_preferred_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_preferred_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_preferred_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_preferred_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_preferred_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_preferred_width_for_height (widget, nat_height,
- NULL, &natural_size->width);
+ gtk_widget_get_preferred_width_for_height (widget, nat_height,
+ NULL, &natural_size->width);
}
}
}
diff --git a/gtk/gtksizerequest.h b/gtk/gtksizerequest.h
index 096533f..22922c2 100644
--- a/gtk/gtksizerequest.h
+++ b/gtk/gtksizerequest.h
@@ -28,14 +28,6 @@
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;
/**
@@ -56,51 +48,6 @@ struct _GtkRequestedSize
};
-struct _GtkSizeRequestIface
-{
- GTypeInterface g_iface;
-
- /* virtual table */
- GtkSizeRequestMode (* get_request_mode) (GtkSizeRequest *widget);
-
- void (* get_preferred_height) (GtkSizeRequest *widget,
- gint *minimum_height,
- gint *natural_height);
- void (* get_preferred_width_for_height) (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width);
- void (* get_preferred_width) (GtkSizeRequest *widget,
- gint *minimum_width,
- gint *natural_width);
- void (* get_preferred_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_preferred_width (GtkSizeRequest *widget,
- gint *minimum_width,
- gint *natural_width);
-void gtk_size_request_get_preferred_height_for_width (GtkSizeRequest *widget,
- gint width,
- gint *minimum_height,
- gint *natural_height);
-void gtk_size_request_get_preferred_height (GtkSizeRequest *widget,
- gint *minimum_height,
- gint *natural_height);
-void gtk_size_request_get_preferred_width_for_height (GtkSizeRequest *widget,
- gint height,
- gint *minimum_width,
- gint *natural_width);
-void gtk_size_request_get_preferred_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,
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 2d36e75..3c3f2bb 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -40,7 +40,6 @@
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtksettings.h"
-#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -594,8 +593,7 @@ gtk_spin_button_realize (GtkWidget *widget)
arrow_size = spin_button_get_arrow_size (spin_button);
- gtk_size_request_get_preferred_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) |
@@ -755,7 +753,7 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
arrow_size = spin_button_get_arrow_size (spin);
panel_width = arrow_size + 2 * gtk_widget_get_style (widget)->xthickness;
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_set_allocation (widget, allocation);
@@ -873,7 +871,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
widget = GTK_WIDGET (spin_button);
style = gtk_widget_get_style (widget);
- gtk_size_request_get_preferred_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;
@@ -980,7 +978,7 @@ gtk_spin_button_enter_notify (GtkWidget *widget,
device = gdk_event_get_device ((GdkEvent *) event);
gdk_window_get_device_position (priv->panel, device, &x, &y, NULL);
- gtk_size_request_get_preferred_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;
@@ -1161,7 +1159,7 @@ gtk_spin_button_button_press (GtkWidget *widget,
if (GTK_ENTRY (widget)->editable)
gtk_spin_button_update (spin);
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget), &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
if (event->y <= requisition.height / 2)
{
@@ -1209,7 +1207,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
{
GtkRequisition requisition;
- gtk_size_request_get_preferred_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 &&
@@ -1260,7 +1258,7 @@ gtk_spin_button_motion_notify (GtkWidget *widget,
gdk_event_request_motions (event);
- gtk_size_request_get_preferred_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)
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index ebea4e1..b43f6ef 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -34,7 +34,6 @@
#include "gtkintl.h"
#include "gtkaccessible.h"
#include "gtkimage.h"
-#include "gtksizerequest.h"
#include "gtkspinner.h"
#include "gtkstyle.h"
@@ -87,13 +86,17 @@ static void gtk_spinner_set_property (GObject *object,
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)
@@ -113,6 +116,8 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
widget_class->unrealize = gtk_spinner_unrealize;
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:
*
@@ -215,9 +220,9 @@ gtk_spinner_init (GtkSpinner *spinner)
}
static void
-gtk_spinner_get_preferred_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;
@@ -227,9 +232,9 @@ gtk_spinner_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_spinner_get_preferred_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;
@@ -238,14 +243,6 @@ gtk_spinner_get_preferred_height (GtkSizeRequest *widget,
*natural_size = SPINNER_SIZE;
}
-static void
-gtk_spinner_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_spinner_get_preferred_width;
- iface->get_preferred_height = gtk_spinner_get_preferred_height;
-}
-
-
static gboolean
gtk_spinner_draw (GtkWidget *widget,
cairo_t *cr)
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index 4bea349..52c78ec 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -29,7 +29,6 @@
#include "gtktable.h"
#include "gtkprivate.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
@@ -1068,8 +1067,7 @@ gtk_table_size_request_pass1 (GtkTable *table)
{
GtkRequisition child_requisition;
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (child->widget),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
/* Child spans a single column.
*/
@@ -1139,8 +1137,8 @@ gtk_table_size_request_pass3 (GtkTable *table)
{
GtkRequisition child_requisition;
- gtk_size_request_get_preferred_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.
@@ -1191,8 +1189,8 @@ gtk_table_size_request_pass3 (GtkTable *table)
{
GtkRequisition child_requisition;
- gtk_size_request_get_preferred_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.
@@ -1669,8 +1667,8 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
GtkRequisition child_requisition;
guint border_width;
- gtk_size_request_get_preferred_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));
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 4ff16d6..c8e0730 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1614,8 +1614,7 @@ add_child_attrs (GtkTextLayout *layout,
/* Found it */
GtkRequisition req;
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (child),
- &req, NULL);
+ gtk_widget_get_preferred_size (child, &req, NULL);
width = req.width;
height = req.height;
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 96bf404..69011a7 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -40,7 +40,6 @@
#include "gtkseparatormenuitem.h"
#include "gtksettings.h"
#include "gtkstock.h"
-#include "gtksizerequest.h"
#include "gtktextbufferrichtext.h"
#include "gtktextdisplay.h"
#include "gtktextview.h"
@@ -141,7 +140,7 @@ struct _GtkTextViewPrivate
* 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;
@@ -3310,13 +3309,11 @@ gtk_text_view_size_request (GtkWidget *widget,
GtkRequisition child_req;
GtkRequisition old_req;
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (child->widget),
- &old_req, NULL);
+ gtk_widget_get_preferred_size (child->widget, &old_req, NULL);
gtk_widget_size_request (child->widget, &child_req);
- gtk_size_request_get_preferred_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 &&
@@ -3361,8 +3358,7 @@ gtk_text_view_compute_child_allocation (GtkTextView *text_view,
allocation->x = vc->from_left_of_buffer - text_view->priv->xoffset;
allocation->y = buffer_y - text_view->priv->yoffset;
- gtk_size_request_get_preferred_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;
}
@@ -3463,8 +3459,7 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
allocation.x = child->x;
allocation.y = child->y;
- gtk_size_request_get_preferred_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;
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 3d9be3c..a12820b 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -53,7 +53,6 @@
#include "gtkseparatormenuitem.h"
#include "gtkseparatortoolitem.h"
#include "gtkstock.h"
-#include "gtksizerequest.h"
#include "gtktoolshell.h"
#include "gtkvbox.h"
#include "gtkprivate.h"
@@ -1452,8 +1451,8 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
border_width += get_internal_padding (toolbar);
- gtk_size_request_get_preferred_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);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 351430c..5dae924 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -44,7 +44,6 @@
#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)
@@ -5347,8 +5346,7 @@ gtk_tree_view_key_press (GtkWidget *widget,
GtkRequisition button_req;
gint old_width = column->resized_width;
- gtk_size_request_get_preferred_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);
@@ -10530,8 +10528,7 @@ gtk_tree_view_new_column_width (GtkTreeView *tree_view,
/* Clamp down the value */
if (column->min_width == -1)
{
- gtk_size_request_get_preferred_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
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 332dee8..21b10ae 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -26,7 +26,6 @@
#include "config.h"
#include "gtkviewport.h"
-#include "gtksizerequest.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
@@ -92,21 +91,18 @@ static void gtk_viewport_size_allocate (GtkWidget *widget,
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_preferred_width (GtkSizeRequest *widget,
- gint *minimum_size,
- gint *natural_size);
-static void gtk_viewport_get_preferred_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)
@@ -131,6 +127,8 @@ 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;
@@ -442,8 +440,7 @@ viewport_set_hadjustment_values (GtkViewport *viewport,
{
GtkRequisition child_requisition;
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
hadjustment->upper = MAX (child_requisition.width, view_allocation.width);
}
else
@@ -482,10 +479,10 @@ viewport_set_vadjustment_values (GtkViewport *viewport,
{
gint natural_height;
- gtk_size_request_get_preferred_height_for_width (GTK_SIZE_REQUEST (child),
- view_allocation.width,
- NULL,
- &natural_height);
+ gtk_widget_get_preferred_height_for_width (child,
+ view_allocation.width,
+ NULL,
+ &natural_height);
vadjustment->upper = MAX (natural_height, view_allocation.height);
}
else
@@ -935,14 +932,7 @@ gtk_viewport_style_set (GtkWidget *widget,
static void
-gtk_viewport_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_viewport_get_preferred_width;
- iface->get_preferred_height = gtk_viewport_get_preferred_height;
-}
-
-static void
-gtk_viewport_get_preferred_size (GtkSizeRequest *widget,
+gtk_viewport_get_preferred_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size)
@@ -975,9 +965,9 @@ gtk_viewport_get_preferred_size (GtkSizeRequest *widget,
if (child && gtk_widget_get_visible (child))
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
else
- gtk_size_request_get_preferred_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;
@@ -991,17 +981,17 @@ gtk_viewport_get_preferred_size (GtkSizeRequest *widget,
}
static void
-gtk_viewport_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
}
static void
-gtk_viewport_get_preferred_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_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 68e5231..5afd974 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -368,6 +368,20 @@ static gint gtk_widget_event_internal (GtkWidget *widget,
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);
@@ -408,11 +422,10 @@ static void gtk_widget_buildable_custom_finished (GtkBuildable
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);
@@ -500,13 +513,6 @@ gtk_widget_get_type (void)
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);
@@ -514,8 +520,6 @@ gtk_widget_get_type (void)
&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;
@@ -610,6 +614,10 @@ gtk_widget_class_init (GtkWidgetClass *klass)
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;
@@ -4090,7 +4098,7 @@ gtk_widget_queue_resize_no_redraw (GtkWidget *widget)
* 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_preferred_size() instead.
+ * Deprecated: 3.0: Use gtk_widget_get_preferred_size() instead.
**/
void
gtk_widget_size_request (GtkWidget *widget,
@@ -4098,8 +4106,7 @@ gtk_widget_size_request (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget),
- requisition, NULL);
+ gtk_widget_get_preferred_size (widget, requisition, NULL);
}
/**
@@ -4127,14 +4134,13 @@ gtk_widget_size_request (GtkWidget *widget,
* gtk_widget_size_request().
*
*
- * Deprecated: 3.0: Use gtk_size_request_get_preferred_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_preferred_size (GTK_SIZE_REQUEST (widget),
- requisition, NULL);
+ gtk_widget_get_preferred_size (widget, requisition, NULL);
}
static gboolean
@@ -4627,7 +4633,7 @@ gtk_widget_real_adjust_size_allocation (GtkWidget *widget,
aux_info = _gtk_widget_get_aux_info_or_defaults (widget);
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget), &min, &natural);
+ gtk_widget_get_preferred_size (widget, &min, &natural);
get_span_inside_border_horizontal (widget,
aux_info,
@@ -11211,13 +11217,10 @@ gtk_widget_buildable_custom_finished (GtkBuildable *buildable,
}
}
-/*
- * 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;
@@ -11227,9 +11230,9 @@ gtk_widget_real_get_width (GtkSizeRequest *widget,
}
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;
@@ -11239,30 +11242,21 @@ gtk_widget_real_get_height (GtkSizeRequest *widget,
}
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_preferred_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_preferred_width(layout, minimum_width, natural_width);
-}
-
-static void
-gtk_widget_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_widget_real_get_width;
- iface->get_preferred_height = gtk_widget_real_get_height;
- iface->get_preferred_width_for_height = gtk_widget_real_get_width_for_height;
- iface->get_preferred_height_for_width = gtk_widget_real_get_height_for_width;
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
}
GtkAlign
@@ -11991,7 +11985,7 @@ gtk_widget_get_requisition (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (requisition != NULL);
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget), requisition, NULL);
+ gtk_widget_get_preferred_size (widget, requisition, NULL);
}
/**
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index e0c900d..d154985 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -334,6 +334,24 @@ struct _GtkWidgetClass
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);
@@ -544,6 +562,26 @@ void gtk_widget_size_request (GtkWidget *widget,
GtkRequisition *requisition);
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);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 7ab1326..4410769 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -48,7 +48,6 @@
#include "gtkmarshalers.h"
#include "gtkplug.h"
#include "gtkbuildable.h"
-#include "gtksizerequest.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
@@ -432,19 +431,16 @@ static void gtk_window_buildable_custom_finished (GtkBuildable *buildable,
gpointer user_data);
-static void gtk_window_size_request_init (GtkSizeRequestIface *iface);
-static void gtk_window_get_preferred_width (GtkSizeRequest *widget,
+static void gtk_window_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size);
-static void gtk_window_get_preferred_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,
@@ -553,6 +549,8 @@ gtk_window_class_init (GtkWindowClass *klass)
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;
@@ -5502,18 +5500,10 @@ gtk_window_real_set_focus (GtkWindow *window,
}
-static void
-gtk_window_size_request_init (GtkSizeRequestIface *iface)
-{
- iface->get_preferred_width = gtk_window_get_preferred_width;
- iface->get_preferred_height = gtk_window_get_preferred_height;
-}
-
-
static void
-gtk_window_get_preferred_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;
@@ -5529,8 +5519,7 @@ gtk_window_get_preferred_width (GtkSizeRequest *widget,
if (child && gtk_widget_get_visible (child))
{
gint child_min, child_nat;
- gtk_size_request_get_preferred_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;
@@ -5538,9 +5527,9 @@ gtk_window_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_window_get_preferred_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;
@@ -5556,8 +5545,7 @@ gtk_window_get_preferred_height (GtkSizeRequest *widget,
if (child && gtk_widget_get_visible (child))
{
gint child_min, child_nat;
- gtk_size_request_get_preferred_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;
@@ -5634,8 +5622,7 @@ gtk_window_compute_configure_request_size (GtkWindow *window,
if (priv->need_default_size)
{
- gtk_size_request_get_preferred_size (GTK_SIZE_REQUEST (widget),
- &requisition, NULL);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
/* Default to requisition */
*width = requisition.width;
@@ -6557,8 +6544,7 @@ gtk_window_compute_hints (GtkWindow *window,
widget = GTK_WIDGET (window);
- gtk_size_request_get_preferred_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)
@@ -6588,11 +6574,11 @@ gtk_window_compute_hints (GtkWindow *window,
*
* Finding these answers would be a bit of a mess here. (Bug #68668)
*/
- gtk_size_request_get_preferred_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_preferred_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;
}
diff --git a/gtk/gtkwrapbox.c b/gtk/gtkwrapbox.c
index e360115..0adc83b 100644
--- a/gtk/gtkwrapbox.c
+++ b/gtk/gtkwrapbox.c
@@ -116,28 +116,25 @@ static void gtk_wrap_box_get_child_property (GtkContainer *container,
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_preferred_width (GtkSizeRequest *widget,
+/* 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 (GtkSizeRequest *widget,
+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 (GtkSizeRequest *box,
+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 (GtkSizeRequest *box,
+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))
@@ -152,6 +149,11 @@ gtk_wrap_box_class_init (GtkWrapBoxClass *class)
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;
@@ -456,11 +458,9 @@ get_average_item_size (GtkWrapBox *box,
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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);
@@ -497,13 +497,13 @@ get_largest_size_for_opposing_orientation (GtkWrapBox *box,
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_height_for_width (GTK_SIZE_REQUEST (child->widget),
+ gtk_widget_get_preferred_height_for_width (child->widget,
item_size,
&child_min, &child_nat);
else
- gtk_size_request_get_preferred_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);
@@ -555,13 +555,13 @@ get_largest_size_for_line_in_opposing_orientation (GtkWrapBox *box,
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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);
@@ -621,11 +621,9 @@ get_largest_size_for_free_line_in_opposing_orientation (GtkWrapBox *box,
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_width (GTK_SIZE_REQUEST (child->widget),
- NULL, &child_size);
+ gtk_widget_get_preferred_width (child->widget, NULL, &child_size);
else
- gtk_size_request_get_preferred_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;
@@ -654,13 +652,13 @@ get_largest_size_for_free_line_in_opposing_orientation (GtkWrapBox *box,
requested.data = child;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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;
@@ -723,13 +721,13 @@ get_largest_size_for_free_line_in_opposing_orientation (GtkWrapBox *box,
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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);
@@ -810,11 +808,11 @@ gather_aligned_item_requests (GtkWrapBox *box,
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_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;
@@ -1391,21 +1389,12 @@ gtk_wrap_box_get_child_property (GtkContainer *container,
}
/*****************************************************
- * 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_preferred_width = gtk_wrap_box_get_preferred_width;
- iface->get_preferred_height = gtk_wrap_box_get_preferred_height;
- iface->get_preferred_height_for_width = gtk_wrap_box_get_preferred_height_for_width;
- iface->get_preferred_width_for_height = gtk_wrap_box_get_preferred_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;
@@ -1452,11 +1441,11 @@ get_largest_line_length (GtkWrapBox *box,
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_size_request_get_preferred_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_preferred_height (GTK_SIZE_REQUEST (child->widget),
- &child_min, &child_nat);
+ gtk_widget_get_preferred_height (child->widget,
+ &child_min, &child_nat);
if (i > 0)
{
@@ -1483,7 +1472,7 @@ get_largest_line_length (GtkWrapBox *box,
static void
-gtk_wrap_box_get_preferred_width (GtkSizeRequest *widget,
+gtk_wrap_box_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
@@ -1543,8 +1532,8 @@ gtk_wrap_box_get_preferred_width (GtkSizeRequest *widget,
/* Return the width for the minimum height */
gint min_height;
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_height (widget, &min_height, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_width_for_height (widget, min_height,
+ 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);
}
@@ -1557,7 +1546,7 @@ gtk_wrap_box_get_preferred_width (GtkSizeRequest *widget,
}
static void
-gtk_wrap_box_get_preferred_height (GtkSizeRequest *widget,
+gtk_wrap_box_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
@@ -1575,8 +1564,8 @@ gtk_wrap_box_get_preferred_height (GtkSizeRequest *widget,
/* Return the height for the minimum width */
gint min_width;
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_width (widget, &min_width, NULL);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_height_for_width (widget, min_width,
+ 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 */
@@ -1630,7 +1619,7 @@ gtk_wrap_box_get_preferred_height (GtkSizeRequest *widget,
}
static void
-gtk_wrap_box_get_preferred_height_for_width (GtkSizeRequest *widget,
+gtk_wrap_box_get_preferred_height_for_width (GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height)
@@ -1654,7 +1643,7 @@ gtk_wrap_box_get_preferred_height_for_width (GtkSizeRequest *widget,
n_children = get_visible_children (box);
/* Make sure its no smaller than the minimum */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_width (widget, &min_width, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL);
avail_size = MAX (width, min_width);
@@ -1795,7 +1784,7 @@ gtk_wrap_box_get_preferred_height_for_width (GtkSizeRequest *widget,
else /* GTK_ORIENTATION_VERTICAL */
{
/* Return the minimum height */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_height (widget, &min_height, &nat_height);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_height, &nat_height);
}
if (minimum_height)
@@ -1806,7 +1795,7 @@ gtk_wrap_box_get_preferred_height_for_width (GtkSizeRequest *widget,
}
static void
-gtk_wrap_box_get_preferred_width_for_height (GtkSizeRequest *widget,
+gtk_wrap_box_get_preferred_width_for_height (GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width)
@@ -1826,7 +1815,7 @@ gtk_wrap_box_get_preferred_width_for_height (GtkSizeRequest *widget,
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
/* Return the minimum width */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_width (widget, &min_width, &nat_width);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, &nat_width);
}
else /* GTK_ORIENTATION_VERTICAL */
{
@@ -1835,7 +1824,7 @@ gtk_wrap_box_get_preferred_width_for_height (GtkSizeRequest *widget,
n_children = get_visible_children (box);
/* Make sure its no smaller than the minimum */
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_preferred_height (widget, &min_height, NULL);
+ GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_height, NULL);
avail_size = MAX (height, min_height);
diff --git a/tests/gtkoffscreenbox.c b/tests/gtkoffscreenbox.c
index 80f4535..3a79f7f 100644
--- a/tests/gtkoffscreenbox.c
+++ b/tests/gtkoffscreenbox.c
@@ -527,8 +527,8 @@ gtk_offscreen_box_size_allocate (GtkWidget *widget,
GtkRequisition child_requisition;
GtkAllocation child_allocation;
- gtk_size_request_get_preferred_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);
@@ -552,8 +552,8 @@ gtk_offscreen_box_size_allocate (GtkWidget *widget,
GtkRequisition child_requisition;
GtkAllocation child_allocation;
- gtk_size_request_get_preferred_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);
diff --git a/tests/testellipsise.c b/tests/testellipsise.c
index ef22b5e..6124033 100644
--- a/tests/testellipsise.c
+++ b/tests/testellipsise.c
@@ -84,8 +84,7 @@ ebox_draw_cb (GtkWidget *widget,
gtk_widget_translate_coordinates (label, widget, 0, 0, &x, &y);
layout = gtk_widget_create_pango_layout (widget, "");
- gtk_size_request_get_preferred_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"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]