[gnome-tetravex/arnaudb/wip/gtk4: 46/60] Use measure().
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tetravex/arnaudb/wip/gtk4: 46/60] Use measure().
- Date: Tue, 4 Aug 2020 14:23:43 +0000 (UTC)
commit 4bfd6d81280497e67d20aac356ce94628dd7ed92
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Feb 21 04:41:00 2020 +0100
Use measure().
src/puzzle-view.vala | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/src/puzzle-view.vala b/src/puzzle-view.vala
index a9fe522..d4376f4 100644
--- a/src/puzzle-view.vala
+++ b/src/puzzle-view.vala
@@ -310,20 +310,27 @@ private class PuzzleView : Gtk.DrawingArea
return false;
}
- protected override void get_preferred_width (out int minimum, out int natural)
+ protected override void measure (Gtk.Orientation orientation,
+ int for_size,
+ out int minimum,
+ out int natural,
+ out int minimum_baseline,
+ out int natural_baseline)
{
int size = 0;
- if (puzzle_init_done)
- size = (int) ((puzzle.size * 2 + 1.0 + /* 1 × */ gap_factor) * minimum_size);
- minimum = natural = int.max (size, 500);
- }
-
- protected override void get_preferred_height (out int minimum, out int natural)
- {
- int size = 0;
- if (puzzle_init_done)
- size = (int) ((puzzle.size + 1.0) * minimum_size);
- minimum = natural = int.max (size, 300);
+ if (orientation == Gtk.Orientation.VERTICAL)
+ {
+ if (puzzle_init_done)
+ size = (int) ((puzzle.size + 1.0) * minimum_size);
+ minimum = natural = int.max (size, 300);
+ }
+ else
+ {
+ if (puzzle_init_done)
+ size = (int) ((puzzle.size * 2 + 1.0 + /* 1 × */ gap_factor) * minimum_size);
+ minimum = natural = int.max (size, 500);
+ }
+ minimum_baseline = natural_baseline = 0; // garbage
}
private void tile_moved_cb (Puzzle puzzle, Tile tile, uint8 x, uint8 y)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]