summaryrefslogtreecommitdiff
path: root/gtk/gtkcolumnviewcell.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-06-05 09:37:59 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-06-05 10:42:20 -0400
commit11a18bd61a8434b0bb0029a6eee7a798b10a137c (patch)
tree429f72e49dcdb5b7102e20d00bdef9e209389898 /gtk/gtkcolumnviewcell.c
parent9e55cd68e4b47196a6334c9feea86870bb603e54 (diff)
downloadgtk+-11a18bd61a8434b0bb0029a6eee7a798b10a137c.tar.gz
columnview: Take column width into account for measuring
When measuring the height of a cell, we need to give it it the width of its column, if we expect realistic results.
Diffstat (limited to 'gtk/gtkcolumnviewcell.c')
-rw-r--r--gtk/gtkcolumnviewcell.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gtk/gtkcolumnviewcell.c b/gtk/gtkcolumnviewcell.c
index 0f14795476..e0f0885803 100644
--- a/gtk/gtkcolumnviewcell.c
+++ b/gtk/gtkcolumnviewcell.c
@@ -55,13 +55,24 @@ gtk_column_view_cell_measure (GtkWidget *widget,
{
GtkColumnViewCell *cell = GTK_COLUMN_VIEW_CELL (widget);
GtkWidget *child = gtk_widget_get_first_child (widget);
+ int fixed_width = gtk_column_view_column_get_fixed_width (cell->column);
+
+ if (orientation == GTK_ORIENTATION_VERTICAL)
+ {
+ if (fixed_width > -1)
+ {
+ if (for_size == -1)
+ for_size = fixed_width;
+ else
+ for_size = MIN (for_size, fixed_width);
+ }
+ }
if (child)
gtk_widget_measure (child, orientation, for_size, minimum, natural, minimum_baseline, natural_baseline);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- int fixed_width = gtk_column_view_column_get_fixed_width (cell->column);
if (fixed_width > -1)
*minimum = *natural = fixed_width;
}