summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2019-04-03 13:14:49 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2019-04-08 17:44:55 +0100
commitc7e03e334d02bb379353aaa315e9c1fed2b04f84 (patch)
tree05da55607341f81d49d7623c3ee7053240059bd0
parent8e06df586fc4dd8d547d630413e6c7ff2cb9e9ed (diff)
downloadgtk+-c7e03e334d02bb379353aaa315e9c1fed2b04f84.tar.gz
Port GtkExpander to GtkBinLayout
-rw-r--r--gtk/gtkexpander.c55
1 files changed, 6 insertions, 49 deletions
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index cba7916c12..c9d4995c7f 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -112,6 +112,7 @@
#include "gtkexpander.h"
+#include "gtkbinlayout.h"
#include "gtkbox.h"
#include "gtkbuildable.h"
#include "gtkcontainerprivate.h"
@@ -155,6 +156,8 @@ struct _GtkExpanderPrivate
GtkWidget *arrow_widget;
GtkWidget *child;
+ GtkLayoutManager *layout_manager;
+
guint expand_timer;
guint expanded : 1;
@@ -173,10 +176,6 @@ static void gtk_expander_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_expander_destroy (GtkWidget *widget);
-static void gtk_expander_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline);
static gboolean gtk_expander_focus (GtkWidget *widget,
GtkDirectionType direction);
static gboolean gtk_expander_drag_motion (GtkWidget *widget,
@@ -202,15 +201,6 @@ static void gtk_expander_buildable_add_child (GtkBuildable *buildable,
const gchar *type);
-/* GtkWidget */
-static void gtk_expander_measure (GtkWidget *widget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline);
-
/* Gestures */
static void gesture_multipress_released_cb (GtkGestureMultiPress *gesture,
gint n_press,
@@ -252,11 +242,9 @@ gtk_expander_class_init (GtkExpanderClass *klass)
gobject_class->get_property = gtk_expander_get_property;
widget_class->destroy = gtk_expander_destroy;
- widget_class->size_allocate = gtk_expander_size_allocate;
widget_class->focus = gtk_expander_focus;
widget_class->drag_motion = gtk_expander_drag_motion;
widget_class->drag_leave = gtk_expander_drag_leave;
- widget_class->measure = gtk_expander_measure;
container_class->add = gtk_expander_add;
container_class->remove = gtk_expander_remove;
@@ -349,6 +337,9 @@ gtk_expander_init (GtkExpander *expander)
priv->expand_timer = 0;
priv->resize_toplevel = 0;
+ priv->layout_manager = gtk_bin_layout_new ();
+ gtk_widget_set_layout_manager (GTK_WIDGET (expander), priv->layout_manager);
+
priv->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_parent (priv->box, GTK_WIDGET (expander));
@@ -494,21 +485,6 @@ gtk_expander_destroy (GtkWidget *widget)
}
static void
-gtk_expander_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline)
-{
- GtkExpanderPrivate *priv = gtk_expander_get_instance_private (GTK_EXPANDER (widget));
-
- gtk_widget_size_allocate (priv->box,
- &(GtkAllocation) {
- 0, 0,
- width, height
- }, baseline);
-}
-
-static void
gesture_multipress_released_cb (GtkGestureMultiPress *gesture,
gint n_press,
gdouble x,
@@ -829,25 +805,6 @@ gtk_expander_activate (GtkExpander *expander)
gtk_expander_set_expanded (expander, !priv->expanded);
}
-static void
-gtk_expander_measure (GtkWidget *widget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline)
-{
- GtkExpander *expander = GTK_EXPANDER (widget);
- GtkExpanderPrivate *priv = gtk_expander_get_instance_private (expander);
-
- gtk_widget_measure (priv->box,
- orientation,
- for_size,
- minimum, natural,
- minimum_baseline, natural_baseline);
-}
-
/**
* gtk_expander_new:
* @label: (nullable): the text of the label