[glom/gtkmm4v3: 8/21] gtk4: eggplaceholder: Replace get_preferred_*() with measure().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/gtkmm4v3: 8/21] gtk4: eggplaceholder: Replace get_preferred_*() with measure().
- Date: Tue, 14 Mar 2017 09:44:14 +0000 (UTC)
commit 5b917d854325ed29956c6274b112ee31fa9a0839
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Dec 18 12:07:15 2016 +0100
gtk4: eggplaceholder: Replace get_preferred_*() with measure().
.../eggspreadtable/eggplaceholder.c | 64 ++++++++++----------
1 files changed, 31 insertions(+), 33 deletions(-)
---
diff --git a/glom/utility_widgets/eggspreadtable/eggplaceholder.c
b/glom/utility_widgets/eggspreadtable/eggplaceholder.c
index d0913e8..5d66842 100644
--- a/glom/utility_widgets/eggspreadtable/eggplaceholder.c
+++ b/glom/utility_widgets/eggspreadtable/eggplaceholder.c
@@ -5,12 +5,13 @@
static void egg_placeholder_finalize (GObject *object);
/* GtkWidgetClass */
-static void egg_placeholder_get_preferred_width (GtkWidget *widget,
- gint *min_width,
- gint *nat_width);
-static void egg_placeholder_get_preferred_height (GtkWidget *widget,
- gint *min_height,
- gint *nat_height);
+static void egg_placeholder_measure (GtkWidget *widget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline);
#define ANIMATION_STEP 0.12F /* How much percentage of the size to animate per iteration */
#define ANIMATION_FREQ 20 /* At what frequency in millisecs to animate */
@@ -42,8 +43,7 @@ static void egg_placeholder_class_init (EggPlaceholderClass * klass)
object_class->finalize = egg_placeholder_finalize;
- widget_class->get_preferred_width = egg_placeholder_get_preferred_width;
- widget_class->get_preferred_height = egg_placeholder_get_preferred_height;
+ widget_class->measure = egg_placeholder_measure;
placeholder_signals[SIGNAL_ANIMATION_DONE] =
g_signal_new ("animation-done",
@@ -85,38 +85,36 @@ egg_placeholder_finalize (GObject * object)
}
static void
-egg_placeholder_get_preferred_width (GtkWidget *widget,
- gint *min_width,
- gint *nat_width)
-{
+egg_placeholder_measure (GtkWidget *widget,
+ GtkOrientation orientation,
+ G_GNUC_UNUSED int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline) {
EggPlaceholder *placeholder = EGG_PLACEHOLDER (widget);
- gint width;
-
- if (placeholder->priv->animation_orientation == GTK_ORIENTATION_HORIZONTAL)
- width = placeholder->priv->width * placeholder->priv->animation_percent;
- else
- width = placeholder->priv->width;
- *min_width = *nat_width = width;
-}
+ /* TODO: Use for_size? */
-static void
-egg_placeholder_get_preferred_height (GtkWidget *widget,
- gint *min_height,
- gint *nat_height)
-{
- EggPlaceholder *placeholder = EGG_PLACEHOLDER (widget);
- gint height;
+ if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+ if (placeholder->priv->animation_orientation == GTK_ORIENTATION_HORIZONTAL)
+ *natural = placeholder->priv->width * placeholder->priv->animation_percent;
+ else
+ *natural = placeholder->priv->width;
+ } else {
+ if (placeholder->priv->animation_orientation == GTK_ORIENTATION_VERTICAL)
+ *natural = placeholder->priv->height * placeholder->priv->animation_percent;
+ else
+ *natural = placeholder->priv->height;
- if (placeholder->priv->animation_orientation == GTK_ORIENTATION_VERTICAL)
- height = placeholder->priv->height * placeholder->priv->animation_percent;
- else
- height = placeholder->priv->height;
+ }
- *min_height = *nat_height = height;
+ *minimum = *natural;
+ *minimum_baseline = 0;
+ *natural_baseline = 0;
}
-static gboolean
+static gboolean
placeholder_animate (EggPlaceholder *placeholder)
{
if (placeholder->priv->animation_direction == EGG_PLACEHOLDER_ANIM_IN)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]