-/* this function returns the new width of the column being resized given
- * the column and x position of the cursor; the x cursor position is passed
- * in as a pointer and automagicly corrected if it's beyond min/max limits
- */
-static gint
-gtk_tree_view_new_column_width (GtkTreeView *tree_view,
- gint i,
- gint *x)
-{
- GtkAllocation allocation;
- GtkTreeViewColumn *column;
- GtkRequisition button_req;
- gint max_width, min_width;
- gint width;
- gboolean rtl;
-
- /* first translate the x position from widget->window
- * to clist->clist_window
- */
- rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
- column = g_list_nth (tree_view->priv->columns, i)->data;
- gtk_widget_get_allocation (gtk_tree_view_column_get_button (column), &allocation);
- width = rtl ? (allocation.x + allocation.width - *x) : (*x - allocation.x);
-
- /* Clamp down the value */
- min_width = gtk_tree_view_column_get_min_width (column);
- if (min_width == -1)
- {
- gtk_widget_get_preferred_size (gtk_tree_view_column_get_button (column), &button_req, NULL);
- width = MAX (button_req.width, width);
- }
- else
- width = MAX (min_width, width);
-
- max_width = gtk_tree_view_column_get_max_width (column);
- if (max_width != -1)
- width = MIN (width, max_width);
-
- *x = rtl ? (allocation.x + allocation.width - width) : (allocation.x + width);
-
- return width;
-}
-
-