From 3128bd0937afc828ea6a1ff6293dd9491675758d Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Tue, 6 Apr 2010 03:03:55 -0400 Subject: [PATCH] Added gtk_tree_view_column_get_desired_size() as its a corner case that does not fall under the two categories. --- gtk/gtktreeviewcolumn.c | 44 ++++++++++++++++++++++------------------- gtk/gtktreeviewcolumn.h | 3 +++ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index 7dcc29af3b..8597643654 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -26,7 +26,7 @@ #include "gtkbutton.h" #include "gtkalignment.h" #include "gtklabel.h" -#include "gtkextendedlayout.h" +#include "gtkextendedcell.h" #include "gtkhbox.h" #include "gtkmarshalers.h" #include "gtkarrow.h" @@ -156,17 +156,13 @@ static void gtk_tree_view_column_clear_attributes_by_info (GtkTreeViewColum /* GtkBuildable implementation */ static void gtk_tree_view_column_buildable_init (GtkBuildableIface *iface); -static void gtk_tree_view_column_extended_layout_init (GtkExtendedLayoutIface *iface); - static guint tree_column_signals[LAST_SIGNAL] = { 0 }; G_DEFINE_TYPE_WITH_CODE (GtkTreeViewColumn, gtk_tree_view_column, GTK_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, gtk_tree_view_column_cell_layout_init) G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, - gtk_tree_view_column_buildable_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_LAYOUT, - gtk_tree_view_column_extended_layout_init)) + gtk_tree_view_column_buildable_init)) @@ -2648,8 +2644,9 @@ gtk_tree_view_column_cell_get_real_size (GtkTreeViewColumn *tree_column, nat_req.width += tree_column->spacing; } - gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (info->cell), - &min_req, &nat_req); + gtk_extended_cell_get_desired_size (GTK_EXTENDED_CELL (info->cell), + tree_column->tree_view, + &min_req, &nat_req); min_req.width += focus_line_width * 2; min_req.height += focus_line_width * 2; @@ -3826,22 +3823,29 @@ gtk_tree_view_column_get_tree_view (GtkTreeViewColumn *tree_column) return tree_column->tree_view; } -static void -gtk_tree_view_column_extended_layout_get_desired_size (GtkExtendedLayout *layout, - GtkRequisition *minimal_size, - GtkRequisition *desired_size) + +/** + * gtk_tree_view_column_get_desired_size: + * @tree_column: A #GtkTreeViewColumn + * @minimum_size: location for storing the minimum size, or %NULL + * @natural_size: location for storing the preferred size, or %NULL + * + * + * Retreives @tree_column's minimum and natural size. + * + * Since: 3.0 + */ +void +gtk_tree_view_column_get_desired_size (GtkTreeViewColumn *column, + GtkRequisition *minimal_size, + GtkRequisition *desired_size) { - gtk_tree_view_column_cell_get_real_size (GTK_TREE_VIEW_COLUMN (layout), + g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column)); + + gtk_tree_view_column_cell_get_real_size (column, NULL, NULL, NULL, minimal_size, desired_size); } -static void -gtk_tree_view_column_extended_layout_init (GtkExtendedLayoutIface *iface) -{ - iface->get_desired_size = gtk_tree_view_column_extended_layout_get_desired_size; -} - - #define __GTK_TREE_VIEW_COLUMN_C__ #include "gtkaliasdef.c" diff --git a/gtk/gtktreeviewcolumn.h b/gtk/gtktreeviewcolumn.h index 75b4c5afc2..5b9cd2a880 100644 --- a/gtk/gtktreeviewcolumn.h +++ b/gtk/gtktreeviewcolumn.h @@ -229,6 +229,9 @@ void gtk_tree_view_column_cell_get_size (GtkTreeViewCol gint *y_offset, gint *width, gint *height); +void gtk_tree_view_column_get_desired_size (GtkTreeViewColumn *column, + GtkRequisition *minimal_size, + GtkRequisition *desired_size); gboolean gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column); void gtk_tree_view_column_focus_cell (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell);