summaryrefslogtreecommitdiff
path: root/gtk/gtkswitch.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2016-10-22 16:06:14 +0200
committerTimm Bäder <mail@baedert.org>2016-10-22 19:05:47 +0200
commit9992a616efa47205ac16ed8be255eda5e7aadf6c (patch)
tree3879538642de33a77472bafe3e6e8afea3b3e343 /gtk/gtkswitch.c
parent6525b95e2502080c08b65317c910204c2b6125da (diff)
downloadgtk+-9992a616efa47205ac16ed8be255eda5e7aadf6c.tar.gz
widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget implementations have to override instead of the old get_preferred_width, get_preferred_height, get_preferred_width_for_height, get_preferred_height_for_width and get_preferred_height_and_baseline_for_width.
Diffstat (limited to 'gtk/gtkswitch.c')
-rw-r--r--gtk/gtkswitch.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 4e31fbf3f4..8fa964346f 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -404,27 +404,19 @@ gtk_switch_get_content_size (GtkCssGadget *gadget,
}
static void
-gtk_switch_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
+gtk_switch_measure (GtkWidget *widget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline)
{
gtk_css_gadget_get_preferred_size (GTK_SWITCH (widget)->priv->gadget,
- GTK_ORIENTATION_HORIZONTAL,
- -1,
- minimum, natural,
- NULL, NULL);
-}
-
-static void
-gtk_switch_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- gtk_css_gadget_get_preferred_size (GTK_SWITCH (widget)->priv->gadget,
- GTK_ORIENTATION_VERTICAL,
- -1,
+ orientation,
+ for_size,
minimum, natural,
- NULL, NULL);
+ minimum_baseline, natural_baseline);
}
static void
@@ -782,8 +774,7 @@ gtk_switch_class_init (GtkSwitchClass *klass)
g_object_class_install_properties (gobject_class, LAST_PROP, switch_props);
- widget_class->get_preferred_width = gtk_switch_get_preferred_width;
- widget_class->get_preferred_height = gtk_switch_get_preferred_height;
+ widget_class->measure = gtk_switch_measure;
widget_class->size_allocate = gtk_switch_size_allocate;
widget_class->realize = gtk_switch_realize;
widget_class->unrealize = gtk_switch_unrealize;