summaryrefslogtreecommitdiff
path: root/gtk/gtkicon.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/gtkicon.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/gtkicon.c')
-rw-r--r--gtk/gtkicon.c46
1 files changed, 10 insertions, 36 deletions
diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c
index 3e5e80f39f..65068b53d4 100644
--- a/gtk/gtkicon.c
+++ b/gtk/gtkicon.c
@@ -94,49 +94,25 @@ gtk_icon_set_property (GObject *object,
}
static void
-gtk_icon_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
- gint for_width,
- gint *minimum,
- gint *natural,
- gint *minimum_baseline,
- gint *natural_baseline)
+gtk_icon_measure (GtkWidget *widget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline)
{
GtkIcon *self = GTK_ICON (widget);
GtkIconPrivate *priv = gtk_icon_get_instance_private (self);
gtk_css_gadget_get_preferred_size (priv->gadget,
- GTK_ORIENTATION_VERTICAL,
- for_width,
+ orientation,
+ for_size,
minimum, natural,
minimum_baseline, natural_baseline);
}
static void
-gtk_icon_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- gtk_icon_get_preferred_height_and_baseline_for_width (widget, -1,
- minimum, natural,
- NULL, NULL);
-}
-
-static void
-gtk_icon_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkIcon *self = GTK_ICON (widget);
- GtkIconPrivate *priv = gtk_icon_get_instance_private (self);
-
- gtk_css_gadget_get_preferred_size (priv->gadget,
- GTK_ORIENTATION_HORIZONTAL,
- -1,
- minimum, natural,
- NULL, NULL);
-}
-
-static void
gtk_icon_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
@@ -175,9 +151,7 @@ gtk_icon_class_init (GtkIconClass *klass)
oclass->finalize = gtk_icon_finalize;
wclass->size_allocate = gtk_icon_size_allocate;
- wclass->get_preferred_width = gtk_icon_get_preferred_width;
- wclass->get_preferred_height = gtk_icon_get_preferred_height;
- wclass->get_preferred_height_and_baseline_for_width = gtk_icon_get_preferred_height_and_baseline_for_width;
+ wclass->measure = gtk_icon_measure;
wclass->draw = gtk_icon_draw;
icon_props[PROP_CSS_NAME] =