[gnome-mines/arnaudb/wip/gtk4: 58/85] Adapt to measure().




commit 1f2e57386caeee65d298d25b153aae1626357f37
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Apr 13 22:59:05 2020 +0200

    Adapt to measure().
    
    TODO test.

 src/minefield-view.vala | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/minefield-view.vala b/src/minefield-view.vala
index 0c23c68..4fc22b3 100644
--- a/src/minefield-view.vala
+++ b/src/minefield-view.vala
@@ -309,14 +309,12 @@ public class MinefieldView : Gtk.Grid
         get_style_context  ().add_class ("completedField");
     }
 
-    public override void get_preferred_width (out int minimum, out int natural)
+    public override void measure (Gtk.Orientation orientation, int for_size, out int minimum, out int 
natural, out int minimum_baseline, out int natural_baseline)
     {
-        minimum = natural = minefield != null ? (int) (minefield.width * minimum_size) : 0;
-    }
-
-    public override void get_preferred_height (out int minimum, out int natural)
-    {
-        minimum = natural = minefield != null ? (int) (minefield.height * minimum_size) : 0;
+        if (orientation == Gtk.Orientation.HORIZONTAL)
+            minimum = natural = minefield != null ? (int) (minefield.width * minimum_size) : 0;
+        else
+            minimum = natural = minefield != null ? (int) (minefield.height * minimum_size) : 0;
     }
 
     public new void add (Gtk.Widget child, int i, int j)


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