Delivered-To: garrigue at math.nagoya-u.ac.jp Delivered-To: lablgtk at yquem.inria.fr From: Mike Spivey To: lablgtk at yquem.inria.fr Content-Type: text/plain; charset="UTF-8" Date: Wed, 23 Dec 2009 12:24:20 +0000 Message-ID: <1261571061.5820.12.camel at staysail> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Lablgtk] Patch to add binding for gtk_tree_view_get_visible_range Please eyeball the C primitive before applying this patch. Je ne sais pas tres bien comment vivre en harmonie avec le collecteur de garbage. -- Mike Index: src/gTree.mli =================================================================== --- src/gTree.mli (revision 1495) +++ src/gTree.mli (revision 1496) @@ -398,6 +398,7 @@ x:int -> y:int -> (tree_path * view_column * int * int) option method get_cell_area : ?path:tree_path -> ?col:view_column -> unit -> Gdk.Rectangle.t + method get_visible_range : unit -> (tree_path * tree_path) option method hadjustment : GData.adjustment method headers_visible : bool method insert_column : view_column -> int -> int Index: src/ml_gtktree.c =================================================================== --- src/ml_gtktree.c (revision 1495) +++ src/ml_gtktree.c (revision 1496) @@ -1578,3 +1578,17 @@ } return Val_unit;) } + +CAMLprim value ml_gtk_tree_view_get_visible_range(value treeview) { + CAMLparam1(treeview); + CAMLlocal1(result); + GtkTreePath *startp, *endp; + if (! gtk_tree_view_get_visible_range(GtkTreeView_val(treeview), + &startp, &endp)) + CAMLreturn(Val_unit); + result = alloc_tuple(2); + Store_field(result, 0, Val_GtkTreePath(startp)); + Store_field(result, 1, Val_GtkTreePath(endp)); + CAMLreturn(ml_some(result)); +} + Index: src/gtkTree.props =================================================================== --- src/gtkTree.props (revision 1495) +++ src/gtkTree.props (revision 1496) @@ -36,6 +36,7 @@ "hover-selection" gboolean : Read / Write / NoSet (* new properties in GTK+ 2.12 *) "tooltip-column" gint : Read / Write + method get_visible_range : "(tree_path * tree_path) option" signal columns_changed signal cursor_changed signal expand_collapse_cursor_row : Index: src/gTree.ml =================================================================== --- src/gTree.ml (revision 1495) +++ src/gTree.ml (revision 1496) @@ -419,6 +419,8 @@ | None -> None method get_cell_area ?path ?col () = TreeView.get_cell_area obj ?path ?col:(Gaux.may_map as_column col) () + method get_visible_range () = + TreeView.get_visible_range obj method set_row_separator_func fo = TreeView.set_row_separator_func obj (Gaux.may_map (fun f m -> f (new model m)) fo) _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk