Make fail when not realized. (gtk_tree_view_scroll_to_cell): Make work

Sun Jan 21 09:58:00 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
	when not realized.
	(gtk_tree_view_scroll_to_cell): Make work when not realized.
	(gtk_tree_view_realize): add scroll_to support
	(gtk_tree_view_finalize): add a finalize method.  Populate.
	(gtk_tree_view_insert_column): ref and sink the column.
	(gtk_tree_view_append_column): ref and sink the column.
	(gtk_tree_view_queue_draw_node): New function to handle redrawing
	individual nodes.  Should make the code much more efficient, if
	actually used.

gtk_tree_view_queue_draw_node isn't actually used yet, but it should start
making Owen less grumpy.
This commit is contained in:
Jonathan Blandford 2001-01-21 18:45:20 +00:00 committed by Jonathan Blandford
parent ddedf10d15
commit 5f25ae3873
9 changed files with 232 additions and 30 deletions

View File

@ -1,3 +1,16 @@
Sun Jan 21 09:58:00 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
when not realized.
(gtk_tree_view_scroll_to_cell): Make work when not realized.
(gtk_tree_view_realize): add scroll_to support
(gtk_tree_view_finalize): add a finalize method. Populate.
(gtk_tree_view_insert_column): ref and sink the column.
(gtk_tree_view_append_column): ref and sink the column.
(gtk_tree_view_queue_draw_node): New function to handle redrawing
individual nodes. Should make the code much more efficient, if
actually used.
2001-01-19 Havoc Pennington <hp@redhat.com> 2001-01-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display): * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
@ -1106,6 +1119,7 @@ Tue Jan 2 16:23:05 2001 Owen Taylor <otaylor@redhat.com>
Attach the style to the window so that the style it is not Attach the style to the window so that the style it is not
leaked when unrealizing the window. leaked when unrealizing the window.
>>>>>>> 1.1626
2000-12-18 Havoc Pennington <hp@redhat.com> 2000-12-18 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do * gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do
@ -1600,6 +1614,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo, * gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo,
reported by Jeff Franks reported by Jeff Franks
>>>>>>> 1.1623
2000-12-08 Alexander Larsson <alla@lysator.liu.se> 2000-12-08 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open): * gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open):

View File

@ -1,3 +1,16 @@
Sun Jan 21 09:58:00 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
when not realized.
(gtk_tree_view_scroll_to_cell): Make work when not realized.
(gtk_tree_view_realize): add scroll_to support
(gtk_tree_view_finalize): add a finalize method. Populate.
(gtk_tree_view_insert_column): ref and sink the column.
(gtk_tree_view_append_column): ref and sink the column.
(gtk_tree_view_queue_draw_node): New function to handle redrawing
individual nodes. Should make the code much more efficient, if
actually used.
2001-01-19 Havoc Pennington <hp@redhat.com> 2001-01-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display): * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
@ -1106,6 +1119,7 @@ Tue Jan 2 16:23:05 2001 Owen Taylor <otaylor@redhat.com>
Attach the style to the window so that the style it is not Attach the style to the window so that the style it is not
leaked when unrealizing the window. leaked when unrealizing the window.
>>>>>>> 1.1626
2000-12-18 Havoc Pennington <hp@redhat.com> 2000-12-18 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do * gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do
@ -1600,6 +1614,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo, * gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo,
reported by Jeff Franks reported by Jeff Franks
>>>>>>> 1.1623
2000-12-08 Alexander Larsson <alla@lysator.liu.se> 2000-12-08 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open): * gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open):

View File

@ -1,3 +1,16 @@
Sun Jan 21 09:58:00 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
when not realized.
(gtk_tree_view_scroll_to_cell): Make work when not realized.
(gtk_tree_view_realize): add scroll_to support
(gtk_tree_view_finalize): add a finalize method. Populate.
(gtk_tree_view_insert_column): ref and sink the column.
(gtk_tree_view_append_column): ref and sink the column.
(gtk_tree_view_queue_draw_node): New function to handle redrawing
individual nodes. Should make the code much more efficient, if
actually used.
2001-01-19 Havoc Pennington <hp@redhat.com> 2001-01-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display): * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
@ -1106,6 +1119,7 @@ Tue Jan 2 16:23:05 2001 Owen Taylor <otaylor@redhat.com>
Attach the style to the window so that the style it is not Attach the style to the window so that the style it is not
leaked when unrealizing the window. leaked when unrealizing the window.
>>>>>>> 1.1626
2000-12-18 Havoc Pennington <hp@redhat.com> 2000-12-18 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do * gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do
@ -1600,6 +1614,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo, * gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo,
reported by Jeff Franks reported by Jeff Franks
>>>>>>> 1.1623
2000-12-08 Alexander Larsson <alla@lysator.liu.se> 2000-12-08 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open): * gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open):

View File

@ -1,3 +1,16 @@
Sun Jan 21 09:58:00 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
when not realized.
(gtk_tree_view_scroll_to_cell): Make work when not realized.
(gtk_tree_view_realize): add scroll_to support
(gtk_tree_view_finalize): add a finalize method. Populate.
(gtk_tree_view_insert_column): ref and sink the column.
(gtk_tree_view_append_column): ref and sink the column.
(gtk_tree_view_queue_draw_node): New function to handle redrawing
individual nodes. Should make the code much more efficient, if
actually used.
2001-01-19 Havoc Pennington <hp@redhat.com> 2001-01-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display): * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
@ -1106,6 +1119,7 @@ Tue Jan 2 16:23:05 2001 Owen Taylor <otaylor@redhat.com>
Attach the style to the window so that the style it is not Attach the style to the window so that the style it is not
leaked when unrealizing the window. leaked when unrealizing the window.
>>>>>>> 1.1626
2000-12-18 Havoc Pennington <hp@redhat.com> 2000-12-18 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do * gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do
@ -1600,6 +1614,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo, * gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo,
reported by Jeff Franks reported by Jeff Franks
>>>>>>> 1.1623
2000-12-08 Alexander Larsson <alla@lysator.liu.se> 2000-12-08 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open): * gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open):

View File

@ -1,3 +1,16 @@
Sun Jan 21 09:58:00 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
when not realized.
(gtk_tree_view_scroll_to_cell): Make work when not realized.
(gtk_tree_view_realize): add scroll_to support
(gtk_tree_view_finalize): add a finalize method. Populate.
(gtk_tree_view_insert_column): ref and sink the column.
(gtk_tree_view_append_column): ref and sink the column.
(gtk_tree_view_queue_draw_node): New function to handle redrawing
individual nodes. Should make the code much more efficient, if
actually used.
2001-01-19 Havoc Pennington <hp@redhat.com> 2001-01-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display): * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
@ -1106,6 +1119,7 @@ Tue Jan 2 16:23:05 2001 Owen Taylor <otaylor@redhat.com>
Attach the style to the window so that the style it is not Attach the style to the window so that the style it is not
leaked when unrealizing the window. leaked when unrealizing the window.
>>>>>>> 1.1626
2000-12-18 Havoc Pennington <hp@redhat.com> 2000-12-18 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do * gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do
@ -1600,6 +1614,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo, * gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo,
reported by Jeff Franks reported by Jeff Franks
>>>>>>> 1.1623
2000-12-08 Alexander Larsson <alla@lysator.liu.se> 2000-12-08 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open): * gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open):

View File

@ -1,3 +1,16 @@
Sun Jan 21 09:58:00 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
when not realized.
(gtk_tree_view_scroll_to_cell): Make work when not realized.
(gtk_tree_view_realize): add scroll_to support
(gtk_tree_view_finalize): add a finalize method. Populate.
(gtk_tree_view_insert_column): ref and sink the column.
(gtk_tree_view_append_column): ref and sink the column.
(gtk_tree_view_queue_draw_node): New function to handle redrawing
individual nodes. Should make the code much more efficient, if
actually used.
2001-01-19 Havoc Pennington <hp@redhat.com> 2001-01-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display): * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
@ -1106,6 +1119,7 @@ Tue Jan 2 16:23:05 2001 Owen Taylor <otaylor@redhat.com>
Attach the style to the window so that the style it is not Attach the style to the window so that the style it is not
leaked when unrealizing the window. leaked when unrealizing the window.
>>>>>>> 1.1626
2000-12-18 Havoc Pennington <hp@redhat.com> 2000-12-18 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do * gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do
@ -1600,6 +1614,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo, * gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo,
reported by Jeff Franks reported by Jeff Franks
>>>>>>> 1.1623
2000-12-08 Alexander Larsson <alla@lysator.liu.se> 2000-12-08 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open): * gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open):

View File

@ -1,3 +1,16 @@
Sun Jan 21 09:58:00 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): Make fail
when not realized.
(gtk_tree_view_scroll_to_cell): Make work when not realized.
(gtk_tree_view_realize): add scroll_to support
(gtk_tree_view_finalize): add a finalize method. Populate.
(gtk_tree_view_insert_column): ref and sink the column.
(gtk_tree_view_append_column): ref and sink the column.
(gtk_tree_view_queue_draw_node): New function to handle redrawing
individual nodes. Should make the code much more efficient, if
actually used.
2001-01-19 Havoc Pennington <hp@redhat.com> 2001-01-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_line_display): * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
@ -1106,6 +1119,7 @@ Tue Jan 2 16:23:05 2001 Owen Taylor <otaylor@redhat.com>
Attach the style to the window so that the style it is not Attach the style to the window so that the style it is not
leaked when unrealizing the window. leaked when unrealizing the window.
>>>>>>> 1.1626
2000-12-18 Havoc Pennington <hp@redhat.com> 2000-12-18 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do * gtk/gtktextview.c (gtk_text_view_delete_from_cursor): do
@ -1600,6 +1614,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo, * gtk/gtkcolorsel.h (GTK_COLOR_SELECTION_GET_CLASS): fix typo,
reported by Jeff Franks reported by Jeff Franks
>>>>>>> 1.1623
2000-12-08 Alexander Larsson <alla@lysator.liu.se> 2000-12-08 Alexander Larsson <alla@lysator.liu.se>
* gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open): * gdk/linux-fb/gdkmouse-fb.c (gdk_fb_mouse_ms_open):

View File

@ -104,6 +104,12 @@ struct _GtkTreeViewPrivate
gint pressed_button; gint pressed_button;
gint press_start_x; gint press_start_x;
gint press_start_y; gint press_start_y;
/* Scroll-to functionality when unrealized */
GtkTreePath *scroll_to_path;
GtkTreeViewColumn *scroll_to_column;
gfloat scroll_to_row_align;
gfloat scroll_to_col_align;
}; };
#ifdef __GNUC__ #ifdef __GNUC__

View File

@ -52,6 +52,9 @@ struct _GtkTreeViewChild
static void gtk_tree_view_init (GtkTreeView *tree_view); static void gtk_tree_view_init (GtkTreeView *tree_view);
static void gtk_tree_view_class_init (GtkTreeViewClass *klass); static void gtk_tree_view_class_init (GtkTreeViewClass *klass);
/* object signals */
static void gtk_tree_view_finalize (GObject *object);
/* widget signals */ /* widget signals */
static void gtk_tree_view_setup_model (GtkTreeView *tree_view); static void gtk_tree_view_setup_model (GtkTreeView *tree_view);
static void gtk_tree_view_realize (GtkWidget *widget); static void gtk_tree_view_realize (GtkWidget *widget);
@ -145,6 +148,10 @@ static void gtk_tree_view_deleted (GtkTreeModel *model,
gpointer data); gpointer data);
/* Internal functions */ /* Internal functions */
static void gtk_tree_view_queue_draw_node (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GdkRectangle *clip_rect);
static void gtk_tree_view_draw_arrow (GtkTreeView *tree_view, static void gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
GtkRBTree *tree, GtkRBTree *tree,
GtkRBNode *node, GtkRBNode *node,
@ -225,15 +232,20 @@ gtk_tree_view_get_type (void)
static void static void
gtk_tree_view_class_init (GtkTreeViewClass *class) gtk_tree_view_class_init (GtkTreeViewClass *class)
{ {
GObjectClass *o_class;
GtkObjectClass *object_class; GtkObjectClass *object_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkContainerClass *container_class; GtkContainerClass *container_class;
o_class = (GObjectClass *) class;
object_class = (GtkObjectClass *) class; object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class; widget_class = (GtkWidgetClass *) class;
container_class = (GtkContainerClass *) class; container_class = (GtkContainerClass *) class;
parent_class = g_type_class_peek_parent (class); parent_class = g_type_class_peek_parent (class);
o_class->finalize = gtk_tree_view_finalize;
widget_class->realize = gtk_tree_view_realize; widget_class->realize = gtk_tree_view_realize;
widget_class->unrealize = gtk_tree_view_unrealize; widget_class->unrealize = gtk_tree_view_unrealize;
widget_class->map = gtk_tree_view_map; widget_class->map = gtk_tree_view_map;
@ -304,6 +316,29 @@ gtk_tree_view_init (GtkTreeView *tree_view)
_gtk_tree_view_set_size (tree_view, 0, 0); _gtk_tree_view_set_size (tree_view, 0, 0);
} }
/* Object methods
*/
static void
gtk_tree_view_finalize (GObject *object)
{
GtkTreeView *tree_view = (GtkTreeView *) object;
if (tree_view->priv->tree)
_gtk_rbtree_free (tree_view->priv->tree);
if (tree_view->priv->scroll_to_path != NULL)
gtk_tree_path_free (tree_view->priv->scroll_to_path);
if (tree_view->priv->drag_dest_row)
gtk_tree_path_free (tree_view->priv->drag_dest_row);
g_free (tree_view->priv);
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* Widget methods /* Widget methods
*/ */
@ -457,6 +492,22 @@ gtk_tree_view_realize (GtkWidget *widget)
} }
gtk_tree_view_realize_buttons (GTK_TREE_VIEW (widget)); gtk_tree_view_realize_buttons (GTK_TREE_VIEW (widget));
_gtk_tree_view_set_size (GTK_TREE_VIEW (widget), -1, -1); _gtk_tree_view_set_size (GTK_TREE_VIEW (widget), -1, -1);
if (tree_view->priv->scroll_to_path != NULL ||
tree_view->priv->scroll_to_column != NULL)
{
gtk_tree_view_scroll_to_cell (tree_view,
tree_view->priv->scroll_to_path,
tree_view->priv->scroll_to_column,
tree_view->priv->scroll_to_row_align,
tree_view->priv->scroll_to_col_align);
if (tree_view->priv->scroll_to_path)
{
gtk_tree_path_free (tree_view->priv->scroll_to_path);
tree_view->priv->scroll_to_path = NULL;
}
tree_view->priv->scroll_to_column = NULL;
}
} }
static void static void
@ -491,6 +542,7 @@ gtk_tree_view_unrealize (GtkWidget *widget)
gdk_window_destroy (tree_view->priv->header_window); gdk_window_destroy (tree_view->priv->header_window);
tree_view->priv->header_window = NULL; tree_view->priv->header_window = NULL;
gdk_cursor_destroy (tree_view->priv->cursor_drag);
gdk_gc_destroy (tree_view->priv->xor_gc); gdk_gc_destroy (tree_view->priv->xor_gc);
/* GtkWidget::unrealize destroys children and widget->window */ /* GtkWidget::unrealize destroys children and widget->window */
@ -1261,7 +1313,6 @@ do_prelight (GtkTreeView *tree_view,
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_PRELIT); GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_PRELIT);
/* FIXME */
gtk_widget_queue_draw (GTK_WIDGET (tree_view)); gtk_widget_queue_draw (GTK_WIDGET (tree_view));
} }
@ -1274,10 +1325,7 @@ gtk_tree_view_motion (GtkWidget *widget,
GtkRBNode *node; GtkRBNode *node;
gint new_y; gint new_y;
g_return_val_if_fail (widget != NULL, FALSE); tree_view = (GtkTreeView *) widget;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
tree_view = GTK_TREE_VIEW (widget);
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE)) if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE))
{ {
@ -1307,8 +1355,7 @@ gtk_tree_view_motion (GtkWidget *widget,
if (tree_view->priv->tree == NULL) if (tree_view->priv->tree == NULL)
return FALSE; return FALSE;
gtk_tree_view_maybe_begin_dragging_row (tree_view, gtk_tree_view_maybe_begin_dragging_row (tree_view, event);
event);
do_unprelight (tree_view, event->x, event->y); do_unprelight (tree_view, event->x, event->y);
@ -1980,7 +2027,7 @@ gtk_tree_view_focus (GtkContainer *container,
*/ */
if (tree_view->priv->cursor == NULL) if (tree_view->priv->cursor == NULL)
tree_view->priv->cursor = gtk_tree_path_new_root (); tree_view->priv->cursor = gtk_tree_path_new_root ();
if (tree_view->priv->cursor)
gtk_tree_selection_select_path (tree_view->priv->selection, gtk_tree_selection_select_path (tree_view->priv->selection,
tree_view->priv->cursor); tree_view->priv->cursor);
/* FIXME make this more efficient */ /* FIXME make this more efficient */
@ -2011,7 +2058,6 @@ gtk_tree_view_focus (GtkContainer *container,
if (tree_view->priv->cursor == NULL) if (tree_view->priv->cursor == NULL)
tree_view->priv->cursor = gtk_tree_path_new_root (); tree_view->priv->cursor = gtk_tree_path_new_root ();
if (tree_view->priv->cursor)
gtk_tree_selection_select_path (tree_view->priv->selection, gtk_tree_selection_select_path (tree_view->priv->selection,
tree_view->priv->cursor); tree_view->priv->cursor);
/* FIXME make this more efficient */ /* FIXME make this more efficient */
@ -2028,7 +2074,6 @@ gtk_tree_view_focus (GtkContainer *container,
*/ */
tree_view->priv->cursor = gtk_tree_path_new_root (); tree_view->priv->cursor = gtk_tree_path_new_root ();
if (tree_view->priv->cursor)
gtk_tree_selection_select_path (tree_view->priv->selection, gtk_tree_selection_select_path (tree_view->priv->selection,
tree_view->priv->cursor); tree_view->priv->cursor);
gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment),
@ -3021,6 +3066,36 @@ gtk_tree_view_get_arrow_range (GtkTreeView *tree_view,
} }
} }
static void
gtk_tree_view_queue_draw_node (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GdkRectangle *clip_rect)
{
GdkRectangle rect;
rect.x = 0;
rect.width = tree_view->priv->width;
rect.y = _gtk_rbtree_node_find_offset (tree, node) +
TREE_VIEW_VERTICAL_SEPARATOR/2 +
TREE_VIEW_HEADER_HEIGHT (tree_view);
rect.height = GTK_RBNODE_GET_HEIGHT (node) + TREE_VIEW_VERTICAL_SEPARATOR;
if (clip_rect)
{
GdkRectangle new_rect;
gdk_rectangle_intersect (clip_rect, &rect, &new_rect);
gtk_widget_queue_draw_area (GTK_WIDGET (tree_view),
new_rect.x, new_rect.y,
new_rect.width, new_rect.height);
}
else
{
gtk_widget_queue_draw_area (GTK_WIDGET (tree_view),
rect.x, rect.y,
rect.width, rect.height);
}
}
/* x and y are the mouse position /* x and y are the mouse position
*/ */
static void static void
@ -3680,8 +3755,8 @@ gtk_tree_view_append_column (GtkTreeView *tree_view,
g_return_val_if_fail (column->tree_view == NULL, -1); g_return_val_if_fail (column->tree_view == NULL, -1);
g_object_ref (G_OBJECT (column)); g_object_ref (G_OBJECT (column));
tree_view->priv->columns = g_list_append (tree_view->priv->columns, gtk_object_sink (GTK_OBJECT (column));
column); tree_view->priv->columns = g_list_append (tree_view->priv->columns, column);
column->tree_view = GTK_WIDGET (tree_view); column->tree_view = GTK_WIDGET (tree_view);
tree_view->priv->n_columns++; tree_view->priv->n_columns++;
@ -3745,6 +3820,7 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view,
g_return_val_if_fail (column->tree_view == NULL, -1); g_return_val_if_fail (column->tree_view == NULL, -1);
g_object_ref (G_OBJECT (column)); g_object_ref (G_OBJECT (column));
gtk_object_sink (GTK_OBJECT (column));
tree_view->priv->columns = g_list_insert (tree_view->priv->columns, tree_view->priv->columns = g_list_insert (tree_view->priv->columns,
column, position); column, position);
column->tree_view = GTK_WIDGET (tree_view); column->tree_view = GTK_WIDGET (tree_view);
@ -3813,7 +3889,9 @@ gtk_tree_view_get_expander_column (GtkTreeView *tree_view)
* *
* Scrolls the tree view such that the top-left corner of the visible * Scrolls the tree view such that the top-left corner of the visible
* area is @tree_x, @tree_y, where @tree_x and @tree_y are specified * area is @tree_x, @tree_y, where @tree_x and @tree_y are specified
* in tree window coordinates. * in tree window coordinates. The @tree_view must be realized before
* this function is called. If it isn't, you probably want ot be
* using gtk_tree_view_scroll_to_cell.
**/ **/
void void
gtk_tree_view_scroll_to_point (GtkTreeView *tree_view, gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
@ -3824,6 +3902,7 @@ gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
GtkAdjustment *vadj; GtkAdjustment *vadj;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_WIDGET_REALIZED (tree_view));
hadj = tree_view->priv->hadjustment; hadj = tree_view->priv->hadjustment;
vadj = tree_view->priv->vadjustment; vadj = tree_view->priv->vadjustment;
@ -3869,10 +3948,23 @@ gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view,
g_return_if_fail (row_align <= 1.0); g_return_if_fail (row_align <= 1.0);
g_return_if_fail (col_align >= 0.0); g_return_if_fail (col_align >= 0.0);
g_return_if_fail (col_align <= 1.0); g_return_if_fail (col_align <= 1.0);
g_return_if_fail (path != NULL || column != NULL);
row_align = CLAMP (row_align, 0.0, 1.0); row_align = CLAMP (row_align, 0.0, 1.0);
col_align = CLAMP (col_align, 0.0, 1.0); col_align = CLAMP (col_align, 0.0, 1.0);
if (! GTK_WIDGET_REALIZED (tree_view))
{
if (path)
tree_view->priv->scroll_to_path = gtk_tree_path_copy (path);
if (column)
tree_view->priv->scroll_to_column = column;
tree_view->priv->scroll_to_row_align = row_align;
tree_view->priv->scroll_to_col_align = col_align;
return;
}
gtk_tree_view_get_cell_rect (tree_view, path, column, &cell_rect); gtk_tree_view_get_cell_rect (tree_view, path, column, &cell_rect);
gtk_tree_view_get_visible_rect (tree_view, &vis_rect); gtk_tree_view_get_visible_rect (tree_view, &vis_rect);
@ -4793,7 +4885,7 @@ gtk_selection_data_set_tree_row (GtkSelectionData *selection_data,
GtkTreePath *path) GtkTreePath *path)
{ {
return FALSE;
} }
gboolean gboolean
@ -4801,8 +4893,7 @@ gtk_selection_data_get_tree_row (GtkSelectionData *selection_data,
GtkTreeView **tree_view, GtkTreeView **tree_view,
GtkTreePath **path) GtkTreePath **path)
{ {
return FALSE;
} }