OS.gtk_widget_realize (handle); GdkRectangle cellRect = new GdkRectangle (); OS.gtk_tree_view_get_cell_area (handle, path, 0, cellRect); GdkRectangle visibleRect = new GdkRectangle (); OS.gtk_tree_view_get_visible_rect (handle, visibleRect); OS.gtk_tree_view_scroll_to_cell (handle, path, 0, false, 0f, 0f); int height = Math.min (visibleRect.height, cellRect.height); if (cellRect.y + height > visibleRect.y + visibleRect.height) { int tree_y = visibleRect.y + cellRect.y - visibleRect.height + cellRect.height; OS.gtk_tree_view_scroll_to_point (handle, -1, tree_y);
if (ty[0] < visibleRect.y ) { OS.gtk_tree_view_scroll_to_point (handle, -1, ty[0]); } else { int height = Math.min (visibleRect.height, cellRect.height); if (ty[0] + height > visibleRect.y + visibleRect.height) { OS.gtk_tree_view_scroll_to_point (handle, -1, ty[0] + cellRect.height - visibleRect.height); }
void showItem (int /*long*/ path, boolean scroll) {	int depth = OS.gtk_tree_path_get_depth (path);	if (depth > 1) {		int [] indices = new int [depth - 1];		int /*long*/ indicesPtr = OS.gtk_tree_path_get_indices (path);		OS.memmove (indices, indicesPtr, indices.length * 4);		int /*long*/ tempPath = OS.gtk_tree_path_new ();		for (int i=0; i<indices.length; i++) {			OS.gtk_tree_path_append_index (tempPath, indices [i]);			OS.gtk_tree_view_expand_row (handle, tempPath, false);		}		OS.gtk_tree_path_free (tempPath);			}	if (scroll) {		GdkRectangle rect = new GdkRectangle ();		OS.gtk_widget_realize (handle);		OS.gtk_tree_view_get_cell_area (handle, path, 0, rect);		boolean isHidden = rect.y == 0 && rect.height == 0;		if (!isHidden) {			int [] tx = new int [1], ty = new int [1];			OS.gtk_tree_view_widget_to_tree_coords (handle, rect.x, rect.y, tx, ty);			rect.y = ty[0];			GdkRectangle visRect = new GdkRectangle ();			OS.gtk_tree_view_get_visible_rect (handle, visRect);			if (rect.y < visRect.y || rect.y + rect.height > visRect.y + visRect.height) {				isHidden = true;			} 		}		if (isHidden) {			/*			* This code intentionally commented.			* Bug in GTK.  According to the documentation, gtk_tree_view_scroll_to_cell			* should scroll the minimum amount to show the cell if use_align is false.			* However, what actually happens is the cell is scrolled to the top.			* The fix is to determine the new location and use gtk_tree_view_scroll_to_point.			* If the widget is a pinhead, calling gtk_tree_view_scroll_to_point			* will have no effect. Therefore, it is still neccessary to 			* call gtk_tree_view_scroll_to_cell.			*/			//	OS.gtk_tree_view_scroll_to_cell (handle, path, 0, depth != 1, 0.5f, 0.0f);			if (depth != 1) {				OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0.5f, 0.0f);			} else {				OS.gtk_widget_realize (handle);				GdkRectangle cellRect = new GdkRectangle ();				OS.gtk_tree_view_get_cell_area (handle, path, 0, cellRect);				GdkRectangle visibleRect = new GdkRectangle ();				OS.gtk_tree_view_get_visible_rect (handle, visibleRect);				OS.gtk_tree_view_scroll_to_cell (handle, path, 0, false, 0f, 0f);				int height = Math.min (visibleRect.height, cellRect.height);				if (cellRect.y + height > visibleRect.y + visibleRect.height) {					int tree_y = visibleRect.y + cellRect.y - visibleRect.height + cellRect.height;					OS.gtk_tree_view_scroll_to_point (handle, -1, tree_y);				}			}		}	}}