summaryrefslogtreecommitdiff
path: root/gtk/gtkcellview.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/gtkcellview.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/gtkcellview.c')
-rw-r--r--gtk/gtkcellview.c80
1 files changed, 18 insertions, 62 deletions
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 80c7f564ad..2ae9e93981 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -97,21 +97,13 @@ static void gtk_cell_view_buildable_custom_tag_end (GtkBuildable
gpointer *data);
static GtkSizeRequestMode gtk_cell_view_get_request_mode (GtkWidget *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 (GtkWidget *widget,
- gint *minimum_size,
- gint *natural_size);
-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 (GtkWidget *widget,
- gint avail_size,
- gint *minimum_size,
- gint *natural_size);
-
+static void gtk_cell_view_measure_ (GtkWidget *widget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline);
static void context_size_changed_cb (GtkCellAreaContext *context,
GParamSpec *pspec,
GtkWidget *view);
@@ -202,10 +194,7 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
widget_class->draw = gtk_cell_view_draw;
widget_class->size_allocate = gtk_cell_view_size_allocate;
widget_class->get_request_mode = gtk_cell_view_get_request_mode;
- 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;
+ widget_class->measure = gtk_cell_view_measure_;
/* properties */
g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation");
@@ -681,54 +670,21 @@ gtk_cell_view_get_request_mode (GtkWidget *widget)
return gtk_cell_area_get_request_mode (priv->area);
}
-static void
-gtk_cell_view_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- gtk_css_gadget_get_preferred_size (GTK_CELL_VIEW (widget)->priv->gadget,
- GTK_ORIENTATION_HORIZONTAL,
- -1,
- minimum, natural,
- NULL, NULL);
-}
-
-static void
-gtk_cell_view_get_preferred_width_for_height (GtkWidget *widget,
- gint height,
- gint *minimum,
- gint *natural)
-{
- gtk_css_gadget_get_preferred_size (GTK_CELL_VIEW (widget)->priv->gadget,
- GTK_ORIENTATION_HORIZONTAL,
- height,
- minimum, natural,
- NULL, NULL);
-}
static void
-gtk_cell_view_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- gtk_css_gadget_get_preferred_size (GTK_CELL_VIEW (widget)->priv->gadget,
- GTK_ORIENTATION_VERTICAL,
- -1,
- minimum, natural,
- NULL, NULL);
-}
-
-static void
-gtk_cell_view_get_preferred_height_for_width (GtkWidget *widget,
- gint width,
- gint *minimum,
- gint *natural)
+gtk_cell_view_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_CELL_VIEW (widget)->priv->gadget,
- GTK_ORIENTATION_VERTICAL,
- width,
+ orientation,
+ for_size,
minimum, natural,
- NULL, NULL);
+ minimum_baseline, natural_baseline);
}
static void