[gtk/columnview-layout: 4/4] columnviewlayout: Take column width into account



commit 9889b796d4d547d49148a3c07a35d6dd4775accb
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 5 09:37:59 2020 -0400

    columnviewlayout: Take column width into account
    
    When measuring the height of a cell, we need to give
    it it the width of its column, if we expect realistic
    results.

 gtk/gtkcolumnviewlayout.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcolumnviewlayout.c b/gtk/gtkcolumnviewlayout.c
index 44d99df673..eecfd9907d 100644
--- a/gtk/gtkcolumnviewlayout.c
+++ b/gtk/gtkcolumnviewlayout.c
@@ -56,11 +56,24 @@ gtk_column_view_layout_measure_along (GtkColumnViewLayout *self,
       int child_nat = 0;
       int child_min_baseline = -1;
       int child_nat_baseline = -1;
+      GtkColumnViewColumn *column;
+      int col_x, col_width;
 
       if (!gtk_widget_should_layout (child))
         continue;
 
-      gtk_widget_measure (child, orientation, for_size,
+      if (GTK_IS_COLUMN_VIEW_CELL (child))
+        {
+          column = gtk_column_view_cell_get_column (GTK_COLUMN_VIEW_CELL (child));
+          gtk_column_view_column_get_allocation (column, &col_x, &col_width);
+        }
+      else
+        {
+          column = gtk_column_view_title_get_column (GTK_COLUMN_VIEW_TITLE (child));
+          gtk_column_view_column_get_header_allocation (column, &col_x, &col_width);
+        }
+
+      gtk_widget_measure (child, orientation, col_width,
                           &child_min, &child_nat,
                           &child_min_baseline, &child_nat_baseline);
 


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