add _gtk_tree_view_column_autosize

Fri Apr 19 23:38:16 2002  Kristian Rietveld  <kris@gtk.org>

        * gtk/gtktreeprivate.h: add _gtk_tree_view_column_autosize

        * gtk/gtktreeview.c: privately export _gtk_tree_view_column_autosize,
        and add a small note about that function,
        (gtk_tree_view_button_press): check for double click and
        "not having an autosize" column before autosizing the column,

        * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_min_width):
        call _gtk_tree_view_column_autosize to update autosized column width
        (gtk_tree_view_column_set_max_width): ditto
This commit is contained in:
Kristian Rietveld 2002-04-19 23:41:37 +00:00 committed by Kristian Rietveld
parent 7614512195
commit 3e0a1a5190
9 changed files with 115 additions and 23 deletions

View File

@ -1,3 +1,16 @@
Fri Apr 19 23:38:16 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_autosize
* gtk/gtktreeview.c: privately export _gtk_tree_view_column_autosize,
and add a small note about that function,
(gtk_tree_view_button_press): check for double click and
"not having an autosize" column before autosizing the column,
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_min_width):
call _gtk_tree_view_column_autosize to update autosized column width
(gtk_tree_view_column_set_max_width): ditto
2002-04-20 Matthias Clasen <maclas@gmx.de>
* TODO, TODO.xml, README.nanox, docs/Changes-1.2.txt,

View File

@ -1,3 +1,16 @@
Fri Apr 19 23:38:16 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_autosize
* gtk/gtktreeview.c: privately export _gtk_tree_view_column_autosize,
and add a small note about that function,
(gtk_tree_view_button_press): check for double click and
"not having an autosize" column before autosizing the column,
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_min_width):
call _gtk_tree_view_column_autosize to update autosized column width
(gtk_tree_view_column_set_max_width): ditto
2002-04-20 Matthias Clasen <maclas@gmx.de>
* TODO, TODO.xml, README.nanox, docs/Changes-1.2.txt,

View File

@ -1,3 +1,16 @@
Fri Apr 19 23:38:16 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_autosize
* gtk/gtktreeview.c: privately export _gtk_tree_view_column_autosize,
and add a small note about that function,
(gtk_tree_view_button_press): check for double click and
"not having an autosize" column before autosizing the column,
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_min_width):
call _gtk_tree_view_column_autosize to update autosized column width
(gtk_tree_view_column_set_max_width): ditto
2002-04-20 Matthias Clasen <maclas@gmx.de>
* TODO, TODO.xml, README.nanox, docs/Changes-1.2.txt,

View File

@ -1,3 +1,16 @@
Fri Apr 19 23:38:16 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_autosize
* gtk/gtktreeview.c: privately export _gtk_tree_view_column_autosize,
and add a small note about that function,
(gtk_tree_view_button_press): check for double click and
"not having an autosize" column before autosizing the column,
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_min_width):
call _gtk_tree_view_column_autosize to update autosized column width
(gtk_tree_view_column_set_max_width): ditto
2002-04-20 Matthias Clasen <maclas@gmx.de>
* TODO, TODO.xml, README.nanox, docs/Changes-1.2.txt,

View File

@ -1,3 +1,16 @@
Fri Apr 19 23:38:16 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_autosize
* gtk/gtktreeview.c: privately export _gtk_tree_view_column_autosize,
and add a small note about that function,
(gtk_tree_view_button_press): check for double click and
"not having an autosize" column before autosizing the column,
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_min_width):
call _gtk_tree_view_column_autosize to update autosized column width
(gtk_tree_view_column_set_max_width): ditto
2002-04-20 Matthias Clasen <maclas@gmx.de>
* TODO, TODO.xml, README.nanox, docs/Changes-1.2.txt,

View File

@ -1,3 +1,16 @@
Fri Apr 19 23:38:16 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_autosize
* gtk/gtktreeview.c: privately export _gtk_tree_view_column_autosize,
and add a small note about that function,
(gtk_tree_view_button_press): check for double click and
"not having an autosize" column before autosizing the column,
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_min_width):
call _gtk_tree_view_column_autosize to update autosized column width
(gtk_tree_view_column_set_max_width): ditto
2002-04-20 Matthias Clasen <maclas@gmx.de>
* TODO, TODO.xml, README.nanox, docs/Changes-1.2.txt,

View File

@ -311,7 +311,10 @@ gboolean _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
void _gtk_tree_view_column_start_editing (GtkTreeViewColumn *tree_column,
GtkCellEditable *editable_widget);
void _gtk_tree_view_column_stop_editing (GtkTreeViewColumn *tree_column);
void _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view);
void _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view);
void _gtk_tree_view_column_autosize (GtkTreeView *tree_view,
GtkTreeViewColumn *column);
gboolean _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column);
GtkCellRenderer *_gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column);

View File

@ -347,8 +347,6 @@ static void gtk_tree_view_real_set_cursor (GtkTreeView
GtkTreePath *path,
gboolean clear_and_select,
gboolean clamp_node);
static void gtk_tree_view_column_autosize (GtkTreeView *tree_view,
GtkTreeViewColumn *tree_column);
/* interactive search */
static void gtk_tree_view_search_dialog_destroy (GtkWidget *search_dialog,
@ -1947,9 +1945,10 @@ gtk_tree_view_button_press (GtkWidget *widget,
{
gpointer drag_data;
if (event->type == GDK_2BUTTON_PRESS)
if (event->type == GDK_2BUTTON_PRESS &&
gtk_tree_view_column_get_sizing (column) != GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{
gtk_tree_view_column_autosize (tree_view, column);
_gtk_tree_view_column_autosize (tree_view, column);
break;
}
@ -4225,6 +4224,28 @@ _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view)
install_presize_handler (tree_view);
}
/**
* This function works synchronously (due to the while (do_validate_rows...)
* loop).
*
* There was a check for column_type != GTK_TREE_VIEW_COLUMN_AUTOSIZE
* here. You now need to check that yourself.
*/
void
_gtk_tree_view_column_autosize (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column));
_gtk_tree_view_column_cell_set_dirty (column, FALSE);
do_presize_handler (tree_view);
while (do_validate_rows (tree_view));
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
/* Drag-and-drop */
static void
@ -7803,24 +7824,6 @@ gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
g_object_notify (G_OBJECT (tree_view), "headers_visible");
}
static void
gtk_tree_view_column_autosize (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column));
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
return;
_gtk_tree_view_column_cell_set_dirty (column, FALSE);
do_presize_handler (tree_view);
while (do_validate_rows (tree_view));
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
/**
* gtk_tree_view_columns_autosize:
* @tree_view: A #GtkTreeView.

View File

@ -1711,6 +1711,10 @@ gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column,
}
g_object_notify (G_OBJECT (tree_column), "min_width");
g_object_thaw_notify (G_OBJECT (tree_column));
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
_gtk_tree_view_column_autosize (GTK_TREE_VIEW (tree_column->tree_view),
tree_column);
}
/**
@ -1767,6 +1771,10 @@ gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
}
g_object_notify (G_OBJECT (tree_column), "max_width");
g_object_thaw_notify (G_OBJECT (tree_column));
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
_gtk_tree_view_column_autosize (GTK_TREE_VIEW (tree_column->tree_view),
tree_column);
}
/**