Re: GtkTreeView API question

On Sat, Oct 06, 2001 at 10:13:33AM -0700, vishnu pobox com wrote:
> Oh, uh, well, i'm trying to figure out when i need to emit the
> row-changed signal.  There are horrible dependencies in the data
> i'm displaying.  It is fairly expensive to check each row to see
> if something change, so i only want to check the rows which are
> visible.  Does this make sense?

After a good night's sleep, it wasn't so hard after all.  Here's
the code.  i know the order of the rows (it's a list, not a tree)
so i just need the top/bottom indices:

  GdkRectangle vrect;
  gtk_tree_view_get_visible_rect (GTK_TREE_VIEW (tv->iplistview), &vrect);
  gint wx,wy;
  gtk_tree_view_tree_to_widget_coords (GTK_TREE_VIEW (tv->iplistview),
				       vrect.x, vrect.y, &wx, &wy);
  GtkTreePath *path;
  if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tv->iplistview),
				     NULL, wx, wy, &path, NULL, NULL, NULL))

  g_warning ("top=%d", gtk_tree_path_get_indices (path)[0]);
  gtk_tree_path_free (path);

  gtk_tree_view_tree_to_widget_coords (GTK_TREE_VIEW (tv->iplistview),
				       vrect.x, vrect.y+vrect.height,
				       &wx, &wy);
  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tv->iplistview),
				     NULL, wx, wy, &path, NULL, NULL, NULL))
      g_warning ("bot=%d", gtk_tree_path_get_indices (path)[0]);
      gtk_tree_path_free (path);

Victory to the Divine Mother!!

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]