location of rows/cells in GtkTreeView



hi again-

after poring over the gtk API reference, and the very informative gtk tree view tutorial (http://scentric.net/tutorial/treeview-tutorial.html), i'm still stumpedon this...

i have a GtkTreeView using GtkListStore with a large number of rows. i want to be able to figure out if an arbitrary row in the list is visible or not (and if not, i want to scroll the list so it _is_ visible). this arbitrary row may or may not be selected - that condition can't be counted upon (in fact, most of the time it _won't_ be selected). i can use gtk_tree_view_get_visible_rect() to find the treeview's visible area, but there doesn't seem to be a good way to get the location of the row in the tree with respect to those coordinates (or in coordinates i can convert). i've tried using gtk_tree_view_get_background_area(), and then multiplying rect.height by the row index, but i have two problems with that: 1) it doesn't take into account the height of the column headers (relatively easy to fix with a fudge factor), and 2) there appears to a be a bug[1] that's preventing it from working reliably. basically, i'm looking for the inverse of gtk_tree_view_get_path_at_pos().

is there any straightforward (or even convoluted) way of doing this that i'm not seeing?

thanks,
brian

[1] in my app, usually one of the rows has PANGO_WEIGHT_BOLD set, which increases the height of that row by 1 pixel (with the font/size i'm using, anyway). for some reason, the height returned in gtk_tree_view_get_background_area() occasionally has the extra pixel included, even when the row path i'm passing _doesn't_ have the bold weight set. it's possible i've screwed something up here (i'll try to make a simple testcase), but i've been over this for hours, and it does appear to be a bug to me.



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