public int getTopIndex () { checkWidget(); int /*long*/ [] path = new int /*long*/ [1]; OS.gtk_widget_realize (handle); if (!OS.gtk_tree_view_get_path_at_pos (handle, 1, 1, path, null, null, null)) return 0; if (path [0] == 0) return 0; int /*long*/ indices = OS.gtk_tree_path_get_indices (path[0]); int[] index = new int [1]; if (indices != 0) OS.memmove (index, indices, 4); // If the topmost item is only partially visible, return the index // of the first completely visible item. GdkRectangle rect = new GdkRectangle(); OS.gtk_tree_view_get_cell_area(handle, path [0], 0, rect); if(rect.y < 0 && index[0] < (itemCount-1)) index[0]++; OS.gtk_tree_path_free (path [0]); return index [0]; }