[gtk/wip/ebassi/custom-layouts: 114/115] Port GtkViewport to GtkCustomLayout
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/custom-layouts: 114/115] Port GtkViewport to GtkCustomLayout
- Date: Mon, 8 Apr 2019 16:46:10 +0000 (UTC)
commit e12cc435afbd71e260892c491c71cef739f95f34
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Apr 8 17:40:38 2019 +0100
Port GtkViewport to GtkCustomLayout
gtk/gtkviewport.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 123227405d..14643c700e 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -27,6 +27,7 @@
#include "gtkviewport.h"
#include "gtkadjustment.h"
+#include "gtkcustomlayout.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
@@ -94,7 +95,7 @@ static void gtk_viewport_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gtk_viewport_destroy (GtkWidget *widget);
-static void gtk_viewport_size_allocate (GtkWidget *widget,
+static void gtk_viewport_allocate (GtkWidget *widget,
int width,
int height,
int baseline);
@@ -230,8 +231,6 @@ gtk_viewport_class_init (GtkViewportClass *class)
gobject_class->get_property = gtk_viewport_get_property;
widget_class->destroy = gtk_viewport_destroy;
- widget_class->size_allocate = gtk_viewport_size_allocate;
- widget_class->measure = gtk_viewport_measure;
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_VIEWPORT);
@@ -330,14 +329,20 @@ gtk_viewport_get_property (GObject *object,
static void
gtk_viewport_init (GtkViewport *viewport)
{
- GtkWidget *widget;
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
+ GtkLayoutManager *manager;
+ GtkWidget *widget;
widget = GTK_WIDGET (viewport);
gtk_widget_set_has_surface (widget, FALSE);
gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN);
+ manager = gtk_custom_layout_new (NULL,
+ gtk_viewport_measure,
+ gtk_viewport_allocate);
+ gtk_widget_set_layout_manager (widget, manager);
+
priv->shadow_type = GTK_SHADOW_IN;
priv->hadjustment = NULL;
priv->vadjustment = NULL;
@@ -485,10 +490,10 @@ gtk_viewport_get_shadow_type (GtkViewport *viewport)
}
static void
-gtk_viewport_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline)
+gtk_viewport_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkViewport *viewport = GTK_VIEWPORT (widget);
GtkViewportPrivate *priv = gtk_viewport_get_instance_private (viewport);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]