change gtk_tree_view_column_cell_render, gtk_tree_view_column_cell_focus,

Tue Feb 19 17:36:31 2002  Kristian Rietveld  <kris@gtk.org>

        * gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
        gtk_tree_view_column_cell_render,
        gtk_tree_view_column_cell_focus,
        gtk_tree_view_column_cell_draw_focus and
        gtk_tree_view_column_cell_set_dirty to be private functions.

        * gtktreeviewcolumn.[ch]: add install_handler argument to
        _cell_set_dirty to control if _mark_rows_col_dirty (which calls
        install_presize_handler) gets called, set widths correctly so
        autosizing works (#71870)

        * gtktreeview.c (gtk_tree_view_column_autosize): new function,
        (gtk_tree_view_button_press): make double click on column
        separator resize the row (#71870)
        (gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
        (#71869, suggestion by Anders Carlsson)
This commit is contained in:
Kristian Rietveld 2002-02-19 18:21:50 +00:00 committed by Kristian Rietveld
parent a255d9cd01
commit 601302c7a3
11 changed files with 245 additions and 81 deletions

View File

@ -1,3 +1,22 @@
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
gtk_tree_view_column_cell_render,
gtk_tree_view_column_cell_focus,
gtk_tree_view_column_cell_draw_focus and
gtk_tree_view_column_cell_set_dirty to be private functions.
* gtktreeviewcolumn.[ch]: add install_handler argument to
_cell_set_dirty to control if _mark_rows_col_dirty (which calls
install_presize_handler) gets called, set widths correctly so
autosizing works (#71870)
* gtktreeview.c (gtk_tree_view_column_autosize): new function,
(gtk_tree_view_button_press): make double click on column
separator resize the row (#71870)
(gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
(#71869, suggestion by Anders Carlsson)
Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com> Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.[ch]: Add routines _gtk_find_module(), * gtk/gtkmain.[ch]: Add routines _gtk_find_module(),

View File

@ -1,3 +1,22 @@
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
gtk_tree_view_column_cell_render,
gtk_tree_view_column_cell_focus,
gtk_tree_view_column_cell_draw_focus and
gtk_tree_view_column_cell_set_dirty to be private functions.
* gtktreeviewcolumn.[ch]: add install_handler argument to
_cell_set_dirty to control if _mark_rows_col_dirty (which calls
install_presize_handler) gets called, set widths correctly so
autosizing works (#71870)
* gtktreeview.c (gtk_tree_view_column_autosize): new function,
(gtk_tree_view_button_press): make double click on column
separator resize the row (#71870)
(gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
(#71869, suggestion by Anders Carlsson)
Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com> Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.[ch]: Add routines _gtk_find_module(), * gtk/gtkmain.[ch]: Add routines _gtk_find_module(),

View File

@ -1,3 +1,22 @@
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
gtk_tree_view_column_cell_render,
gtk_tree_view_column_cell_focus,
gtk_tree_view_column_cell_draw_focus and
gtk_tree_view_column_cell_set_dirty to be private functions.
* gtktreeviewcolumn.[ch]: add install_handler argument to
_cell_set_dirty to control if _mark_rows_col_dirty (which calls
install_presize_handler) gets called, set widths correctly so
autosizing works (#71870)
* gtktreeview.c (gtk_tree_view_column_autosize): new function,
(gtk_tree_view_button_press): make double click on column
separator resize the row (#71870)
(gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
(#71869, suggestion by Anders Carlsson)
Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com> Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.[ch]: Add routines _gtk_find_module(), * gtk/gtkmain.[ch]: Add routines _gtk_find_module(),

View File

@ -1,3 +1,22 @@
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
gtk_tree_view_column_cell_render,
gtk_tree_view_column_cell_focus,
gtk_tree_view_column_cell_draw_focus and
gtk_tree_view_column_cell_set_dirty to be private functions.
* gtktreeviewcolumn.[ch]: add install_handler argument to
_cell_set_dirty to control if _mark_rows_col_dirty (which calls
install_presize_handler) gets called, set widths correctly so
autosizing works (#71870)
* gtktreeview.c (gtk_tree_view_column_autosize): new function,
(gtk_tree_view_button_press): make double click on column
separator resize the row (#71870)
(gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
(#71869, suggestion by Anders Carlsson)
Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com> Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.[ch]: Add routines _gtk_find_module(), * gtk/gtkmain.[ch]: Add routines _gtk_find_module(),

View File

@ -1,3 +1,22 @@
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
gtk_tree_view_column_cell_render,
gtk_tree_view_column_cell_focus,
gtk_tree_view_column_cell_draw_focus and
gtk_tree_view_column_cell_set_dirty to be private functions.
* gtktreeviewcolumn.[ch]: add install_handler argument to
_cell_set_dirty to control if _mark_rows_col_dirty (which calls
install_presize_handler) gets called, set widths correctly so
autosizing works (#71870)
* gtktreeview.c (gtk_tree_view_column_autosize): new function,
(gtk_tree_view_button_press): make double click on column
separator resize the row (#71870)
(gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
(#71869, suggestion by Anders Carlsson)
Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com> Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.[ch]: Add routines _gtk_find_module(), * gtk/gtkmain.[ch]: Add routines _gtk_find_module(),

View File

@ -1,3 +1,22 @@
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
gtk_tree_view_column_cell_render,
gtk_tree_view_column_cell_focus,
gtk_tree_view_column_cell_draw_focus and
gtk_tree_view_column_cell_set_dirty to be private functions.
* gtktreeviewcolumn.[ch]: add install_handler argument to
_cell_set_dirty to control if _mark_rows_col_dirty (which calls
install_presize_handler) gets called, set widths correctly so
autosizing works (#71870)
* gtktreeview.c (gtk_tree_view_column_autosize): new function,
(gtk_tree_view_button_press): make double click on column
separator resize the row (#71870)
(gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
(#71869, suggestion by Anders Carlsson)
Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com> Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.[ch]: Add routines _gtk_find_module(), * gtk/gtkmain.[ch]: Add routines _gtk_find_module(),

View File

@ -1,3 +1,22 @@
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
gtk_tree_view_column_cell_render,
gtk_tree_view_column_cell_focus,
gtk_tree_view_column_cell_draw_focus and
gtk_tree_view_column_cell_set_dirty to be private functions.
* gtktreeviewcolumn.[ch]: add install_handler argument to
_cell_set_dirty to control if _mark_rows_col_dirty (which calls
install_presize_handler) gets called, set widths correctly so
autosizing works (#71870)
* gtktreeview.c (gtk_tree_view_column_autosize): new function,
(gtk_tree_view_button_press): make double click on column
separator resize the row (#71870)
(gtk_tree_view_get_dest_row_at_pos): change DnD threshold to 33%
(#71869, suggestion by Anders Carlsson)
Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com> Mon Feb 18 23:16:16 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.[ch]: Add routines _gtk_find_module(), * gtk/gtkmain.[ch]: Add routines _gtk_find_module(),

View File

@ -310,7 +310,22 @@ GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree
void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection, void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
GtkTreeView *tree_view); GtkTreeView *tree_view);
void _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
GdkWindow *window,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
gboolean _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
gint direction);
void _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
GdkWindow *window,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
void _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
gboolean install_handler);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -342,6 +342,8 @@ static gboolean gtk_tree_view_real_expand_row (GtkTreeView
static void gtk_tree_view_real_set_cursor (GtkTreeView *tree_view, static void gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
GtkTreePath *path, GtkTreePath *path,
gboolean clear_and_select); gboolean clear_and_select);
static void gtk_tree_view_column_autosize (GtkTreeView *tree_view,
GtkTreeViewColumn *tree_column);
/* interactive search */ /* interactive search */
static void gtk_tree_view_search_dialog_destroy (GtkWidget *search_dialog, static void gtk_tree_view_search_dialog_destroy (GtkWidget *search_dialog,
@ -1869,6 +1871,12 @@ gtk_tree_view_button_press (GtkWidget *widget,
{ {
gpointer drag_data; gpointer drag_data;
if (event->type == GDK_2BUTTON_PRESS)
{
gtk_tree_view_column_autosize (tree_view, column);
break;
}
if (gdk_pointer_grab (column->window, FALSE, if (gdk_pointer_grab (column->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK | GDK_BUTTON1_MOTION_MASK |
@ -2845,12 +2853,12 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
* level of the tree we're dropping at. * level of the tree we're dropping at.
*/ */
highlight_x = cell_area.x; highlight_x = cell_area.x;
gtk_tree_view_column_cell_render (column, _gtk_tree_view_column_cell_render (column,
event->window, event->window,
&background_area, &background_area,
&cell_area, &cell_area,
&event->area, &event->area,
flags); flags);
if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT) if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT)
{ {
gint x, y; gint x, y;
@ -2863,12 +2871,12 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
} }
else else
{ {
gtk_tree_view_column_cell_render (column, _gtk_tree_view_column_cell_render (column,
event->window, event->window,
&background_area, &background_area,
&cell_area, &cell_area,
&event->area, &event->area,
flags); flags);
} }
if (node == cursor && if (node == cursor &&
((column == tree_view->priv->focus_column && ((column == tree_view->priv->focus_column &&
@ -2876,12 +2884,12 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
GTK_WIDGET_HAS_FOCUS (widget)) || GTK_WIDGET_HAS_FOCUS (widget)) ||
(column == tree_view->priv->edited_column))) (column == tree_view->priv->edited_column)))
{ {
gtk_tree_view_column_cell_draw_focus (column, _gtk_tree_view_column_cell_draw_focus (column,
event->window, event->window,
&background_area, &background_area,
&cell_area, &cell_area,
&event->area, &event->area,
flags); flags);
} }
cell_offset += column->width; cell_offset += column->width;
} }
@ -4775,7 +4783,7 @@ gtk_tree_view_style_set (GtkWidget *widget,
for (list = tree_view->priv->columns; list; list = list->next) for (list = tree_view->priv->columns; list; list = list->next)
{ {
column = list->data; column = list->data;
gtk_tree_view_column_cell_set_dirty (column); _gtk_tree_view_column_cell_set_dirty (column, TRUE);
} }
_gtk_rbtree_mark_invalid (tree_view->priv->tree); _gtk_rbtree_mark_invalid (tree_view->priv->tree);
@ -5020,7 +5028,7 @@ gtk_tree_view_row_changed (GtkTreeModel *model,
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE) if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{ {
gtk_tree_view_column_cell_set_dirty (column); _gtk_tree_view_column_cell_set_dirty (column, TRUE);
} }
} }
@ -5180,7 +5188,7 @@ gtk_tree_view_row_has_child_toggled (GtkTreeModel *model,
if (GTK_TREE_VIEW_COLUMN (list->data)->visible) if (GTK_TREE_VIEW_COLUMN (list->data)->visible)
{ {
GTK_TREE_VIEW_COLUMN (list->data)->dirty = TRUE; GTK_TREE_VIEW_COLUMN (list->data)->dirty = TRUE;
gtk_tree_view_column_cell_set_dirty (GTK_TREE_VIEW_COLUMN (list->data)); _gtk_tree_view_column_cell_set_dirty (GTK_TREE_VIEW_COLUMN (list->data), TRUE);
break; break;
} }
} }
@ -5233,7 +5241,7 @@ gtk_tree_view_row_deleted (GtkTreeModel *model,
for (list = tree_view->priv->columns; list; list = list->next) for (list = tree_view->priv->columns; list; list = list->next)
if (((GtkTreeViewColumn *)list->data)->visible && if (((GtkTreeViewColumn *)list->data)->visible &&
((GtkTreeViewColumn *)list->data)->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE) ((GtkTreeViewColumn *)list->data)->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
gtk_tree_view_column_cell_set_dirty ((GtkTreeViewColumn *)list->data); _gtk_tree_view_column_cell_set_dirty ((GtkTreeViewColumn *)list->data, TRUE);
/* Ensure we don't have a dangling pointer to a dead node */ /* Ensure we don't have a dangling pointer to a dead node */
ensure_unprelighted (tree_view); ensure_unprelighted (tree_view);
@ -5526,7 +5534,7 @@ gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view,
{ {
if (depth * tree_view->priv->expander_size + horizontal_separator + width > column->requested_width) if (depth * tree_view->priv->expander_size + horizontal_separator + width > column->requested_width)
{ {
gtk_tree_view_column_cell_set_dirty (column); _gtk_tree_view_column_cell_set_dirty (column, TRUE);
retval = TRUE; retval = TRUE;
} }
} }
@ -5534,7 +5542,7 @@ gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view,
{ {
if (horizontal_separator + width > column->requested_width) if (horizontal_separator + width > column->requested_width)
{ {
gtk_tree_view_column_cell_set_dirty (column); _gtk_tree_view_column_cell_set_dirty (column, TRUE);
retval = TRUE; retval = TRUE;
} }
} }
@ -6370,7 +6378,7 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
&iter, &iter,
GTK_RBNODE_FLAG_SET (cursor_node, GTK_RBNODE_IS_PARENT), GTK_RBNODE_FLAG_SET (cursor_node, GTK_RBNODE_IS_PARENT),
cursor_node->children?TRUE:FALSE); cursor_node->children?TRUE:FALSE);
if (gtk_tree_view_column_cell_focus (column, count)) if (_gtk_tree_view_column_cell_focus (column, count))
{ {
tree_view->priv->focus_column = column; tree_view->priv->focus_column = column;
found_column = TRUE; found_column = TRUE;
@ -7088,12 +7096,30 @@ gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
g_object_notify (G_OBJECT (tree_view), "headers_visible"); 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);
presize_handler_callback (tree_view);
while (validate_rows_handler (tree_view));
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
/** /**
* gtk_tree_view_columns_autosize: * gtk_tree_view_columns_autosize:
* @tree_view: A #GtkTreeView. * @tree_view: A #GtkTreeView.
* *
* Resizes all columns to their optimal width. * Resizes all columns to their optimal width. Only works after the
* treeview has been realized.
**/ **/
void void
gtk_tree_view_columns_autosize (GtkTreeView *tree_view) gtk_tree_view_columns_autosize (GtkTreeView *tree_view)
@ -7109,7 +7135,7 @@ gtk_tree_view_columns_autosize (GtkTreeView *tree_view)
column = list->data; column = list->data;
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE) if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
continue; continue;
gtk_tree_view_column_cell_set_dirty (column); _gtk_tree_view_column_cell_set_dirty (column, TRUE);
dirty = TRUE; dirty = TRUE;
} }
@ -7252,7 +7278,7 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view,
tmp_column = GTK_TREE_VIEW_COLUMN (list->data); tmp_column = GTK_TREE_VIEW_COLUMN (list->data);
if (tmp_column->visible) if (tmp_column->visible)
gtk_tree_view_column_cell_set_dirty (tmp_column); _gtk_tree_view_column_cell_set_dirty (tmp_column, TRUE);
} }
if (tree_view->priv->n_columns == 0 && if (tree_view->priv->n_columns == 0 &&
@ -7314,7 +7340,7 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view,
{ {
column = GTK_TREE_VIEW_COLUMN (list->data); column = GTK_TREE_VIEW_COLUMN (list->data);
if (column->visible) if (column->visible)
gtk_tree_view_column_cell_set_dirty (column); _gtk_tree_view_column_cell_set_dirty (column, TRUE);
} }
gtk_widget_queue_resize (GTK_WIDGET (tree_view)); gtk_widget_queue_resize (GTK_WIDGET (tree_view));
} }
@ -8075,7 +8101,7 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
if (column->visible == FALSE) if (column->visible == FALSE)
continue; continue;
if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_AUTOSIZE) if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
gtk_tree_view_column_cell_set_dirty (column); _gtk_tree_view_column_cell_set_dirty (column, TRUE);
} }
if (tree_view->priv->destroy_count_func) if (tree_view->priv->destroy_count_func)
@ -9006,7 +9032,7 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView *tree_view,
{ {
gint cell_y; gint cell_y;
gdouble offset_into_row; gdouble offset_into_row;
gdouble quarter; gdouble third;
GdkRectangle cell; GdkRectangle cell;
GtkTreeViewColumn *column = NULL; GtkTreeViewColumn *column = NULL;
GtkTreePath *tmp_path = NULL; GtkTreePath *tmp_path = NULL;
@ -9027,8 +9053,8 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView *tree_view,
if (tree_view->priv->tree == NULL) if (tree_view->priv->tree == NULL)
return FALSE; return FALSE;
/* If in the top quarter of a row, we drop before that row; if /* If in the top third of a row, we drop before that row; if
* in the bottom quarter, drop after that row; if in the middle, * in the bottom third, drop after that row; if in the middle,
* and the row has children, drop into the row. * and the row has children, drop into the row.
*/ */
@ -9053,19 +9079,19 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView *tree_view,
tmp_path = NULL; tmp_path = NULL;
quarter = cell.height / 4.0; third = cell.height / 3.0;
if (pos) if (pos)
{ {
if (offset_into_row < quarter) if (offset_into_row < third)
{ {
*pos = GTK_TREE_VIEW_DROP_BEFORE; *pos = GTK_TREE_VIEW_DROP_BEFORE;
} }
else if (offset_into_row < quarter * 2) else if (offset_into_row < (cell.height / 2.0))
{ {
*pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE; *pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE;
} }
else if (offset_into_row < quarter * 3) else if (offset_into_row < third * 2)
{ {
*pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER; *pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER;
} }
@ -9181,12 +9207,12 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
} }
if (gtk_tree_view_column_cell_is_visible (column)) if (gtk_tree_view_column_cell_is_visible (column))
gtk_tree_view_column_cell_render (column, _gtk_tree_view_column_cell_render (column,
drawable, drawable,
&background_area, &background_area,
&cell_area, &cell_area,
&expose_area, &expose_area,
0); 0);
cell_offset += column->width; cell_offset += column->width;
} }

View File

@ -1210,7 +1210,7 @@ gtk_tree_view_column_add_attribute (GtkTreeViewColumn *tree_column,
info->attributes = g_slist_prepend (info->attributes, g_strdup (attribute)); info->attributes = g_slist_prepend (info->attributes, g_strdup (attribute));
if (tree_column->tree_view) if (tree_column->tree_view)
gtk_tree_view_column_cell_set_dirty (tree_column); _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
} }
@ -1304,7 +1304,7 @@ gtk_tree_view_column_set_cell_data_func (GtkTreeViewColumn *tree_column,
info->destroy = destroy; info->destroy = destroy;
if (tree_column->tree_view) if (tree_column->tree_view)
gtk_tree_view_column_cell_set_dirty (tree_column); _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
} }
@ -1338,7 +1338,7 @@ gtk_tree_view_column_clear_attributes (GtkTreeViewColumn *tree_column,
info->attributes = NULL; info->attributes = NULL;
if (tree_column->tree_view) if (tree_column->tree_view)
gtk_tree_view_column_cell_set_dirty (tree_column); _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
} }
@ -1362,7 +1362,7 @@ gtk_tree_view_column_set_spacing (GtkTreeViewColumn *tree_column,
tree_column->spacing = spacing; tree_column->spacing = spacing;
if (tree_column->tree_view) if (tree_column->tree_view)
gtk_tree_view_column_cell_set_dirty (tree_column); _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
} }
/** /**
@ -2319,12 +2319,12 @@ gtk_tree_view_column_cell_render_or_focus (GtkTreeViewColumn *tree_column,
* #GtkTreeView. * #GtkTreeView.
**/ **/
void void
gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column, _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
GdkWindow *window, GdkWindow *window,
GdkRectangle *background_area, GdkRectangle *background_area,
GdkRectangle *cell_area, GdkRectangle *cell_area,
GdkRectangle *expose_area, GdkRectangle *expose_area,
guint flags) guint flags)
{ {
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column)); g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (background_area != NULL); g_return_if_fail (background_area != NULL);
@ -2391,8 +2391,8 @@ _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
gboolean gboolean
gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column, _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
gint direction) gint direction)
{ {
if (GTK_TREE_VIEW (tree_column->tree_view)->priv->focus_column == tree_column) if (GTK_TREE_VIEW (tree_column->tree_view)->priv->focus_column == tree_column)
return FALSE; return FALSE;
@ -2400,12 +2400,12 @@ gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
} }
void void
gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column, _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
GdkWindow *window, GdkWindow *window,
GdkRectangle *background_area, GdkRectangle *background_area,
GdkRectangle *cell_area, GdkRectangle *cell_area,
GdkRectangle *expose_area, GdkRectangle *expose_area,
guint flags) guint flags)
{ {
gint focus_line_width; gint focus_line_width;
GtkStateType cell_state; GtkStateType cell_state;
@ -2475,7 +2475,8 @@ gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column)
} }
void void
gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column) _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
gboolean install_handler)
{ {
GList *list; GList *list;
@ -2486,12 +2487,17 @@ gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column)
info->requested_width = 0; info->requested_width = 0;
} }
tree_column->dirty = TRUE; tree_column->dirty = TRUE;
tree_column->requested_width = 0; tree_column->resized_width = MAX (tree_column->requested_width, tree_column->button_request);
tree_column->requested_width = -1;
tree_column->width = 0;
if (tree_column->tree_view && if (tree_column->tree_view &&
GTK_WIDGET_REALIZED (tree_column->tree_view)) GTK_WIDGET_REALIZED (tree_column->tree_view))
{ {
_gtk_tree_view_install_mark_rows_col_dirty (GTK_TREE_VIEW (tree_column->tree_view)); if (install_handler)
_gtk_tree_view_install_mark_rows_col_dirty (GTK_TREE_VIEW (tree_column->tree_view));
else
GTK_TREE_VIEW (tree_column->tree_view)->priv->mark_rows_col_dirty = TRUE;
gtk_widget_queue_resize (tree_column->tree_view); gtk_widget_queue_resize (tree_column->tree_view);
} }
} }

View File

@ -210,23 +210,7 @@ void gtk_tree_view_column_cell_get_size (GtkTreeViewCol
gint *y_offset, gint *y_offset,
gint *width, gint *width,
gint *height); gint *height);
void gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
GdkWindow *window,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
gboolean gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
gint direction);
void gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
GdkWindow *window,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
guint flags);
gboolean gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column); gboolean gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column);
void gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column);
#ifdef __cplusplus #ifdef __cplusplus
} }