[libhandy/wip/haecker-felix/flap-widget: 73/98] Implement size_allocate itself




commit 57a1a4d3c8cc48e39fd4cbf3f8c17f9157bfbe07
Author: Felix Häcker <haeckerfelix gnome org>
Date:   Mon Jul 27 17:11:16 2020 +0200

    Implement size_allocate itself

 src/hdy-flap.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/src/hdy-flap.c b/src/hdy-flap.c
index c1fe0965..dc3d9b12 100644
--- a/src/hdy-flap.c
+++ b/src/hdy-flap.c
@@ -319,26 +319,28 @@ allocate_content (HdyFlap       *self,
 
   alloc.x = content_x;
   alloc.y = content_y;
-  alloc.width = get_flap_size (self, widget_alloc, GTK_ORIENTATION_HORIZONTAL);
-  alloc.height = get_flap_size (self, widget_alloc, GTK_ORIENTATION_VERTICAL);
+  alloc.width = get_content_size (self, widget_alloc, GTK_ORIENTATION_HORIZONTAL);
+  alloc.height = get_content_size (self, widget_alloc, GTK_ORIENTATION_VERTICAL);
 
   gtk_widget_size_allocate (content, &alloc);
 }
 
 static void
 hdy_flap_size_allocate (GtkWidget     *widget,
-                        GtkAllocation *allocation)
+                        GtkAllocation *alloc)
 {
   HdyFlap *self = HDY_FLAP (widget);
-  GtkBin *bin = GTK_BIN (widget);
-  GtkAllocation child_allocation;
-  gint baseline;
-  GtkWidget *child;
-  GtkStyleContext *context = gtk_widget_get_style_context (widget);
-  gint child_maximum = 0, lower_threshold = 0;
-  gint child_flaped_size;
+  GtkWidget *content = gtk_bin_get_child ((GtkBin*) self);
+
+  gtk_widget_set_allocation (widget, alloc);
+
+  if (hdy_flap_get_flap (self) == NULL)
+    allocate_flap (self, alloc);
+
+  if (content != NULL)
+    allocate_content (self, alloc);
 
-  gtk_widget_set_allocation (widget, allocation);
+  gtk_widget_set_clip (widget, alloc);
 }
 
 static void
@@ -385,7 +387,6 @@ hdy_flap_class_init (HdyFlapClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
 
   object_class->get_property = hdy_flap_get_property;
   object_class->set_property = hdy_flap_set_property;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]