[gtk/columnview-layout] columnview: Take column width into account for measuring
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/columnview-layout] columnview: Take column width into account for measuring
- Date: Fri, 5 Jun 2020 14:43:28 +0000 (UTC)
commit 11a18bd61a8434b0bb0029a6eee7a798b10a137c
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 5 09:37:59 2020 -0400
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.
gtk/gtkcolumnviewcell.c | 13 ++++++++++++-
gtk/gtkcolumnviewtitle.c | 13 ++++++++++++-
2 files changed, 24 insertions(+), 2 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;
}
diff --git a/gtk/gtkcolumnviewtitle.c b/gtk/gtkcolumnviewtitle.c
index 53dc56df8f..12c39d9ba3 100644
--- a/gtk/gtkcolumnviewtitle.c
+++ b/gtk/gtkcolumnviewtitle.c
@@ -63,13 +63,24 @@ gtk_column_view_title_measure (GtkWidget *widget,
{
GtkColumnViewTitle *self = GTK_COLUMN_VIEW_TITLE (widget);
GtkWidget *child = gtk_widget_get_first_child (widget);
+ int fixed_width = gtk_column_view_column_get_fixed_width (self->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 (self->column);
if (fixed_width > -1)
*minimum = *natural = fixed_width;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]