Module Stk.Tree

A tree widget. Interface is not stable yet.

type 'a tree_spec = {
  1. is_leaf : 'a -> bool;
  2. subs : 'a -> 'a list Lwt.t;
  3. can_select : 'a -> bool;
  4. can_unselect : 'a -> bool;
}
val tree_spec : ?can_select:('a -> bool) -> ?can_unselect:('b -> bool) -> is_leaf:('c -> bool) -> subs:('d -> 'd list Lwt.t) -> unit -> 'c tree_spec
type ('a, 'b) node_label = {
  1. create : Canvas.group -> 'b;
  2. update : selected:bool -> expanded:bool -> 'a -> 'b -> unit;
  3. remove : Canvas.group -> 'b -> unit;
}
val node_label : create:(Canvas.group -> 'a) -> update:(selected:bool -> expanded:bool -> 'b -> 'c -> unit) -> remove:(Canvas.group -> 'd -> unit) -> ('e, 'a) node_label
val text_collapsed : string
val text_expanded : string
module Id : sig ... end
module IMap : sig ... end
module ISet : sig ... end
val key_expand : Tsdl.Sdl.keycode
val key_collapse : Tsdl.Sdl.keycode
val key_select : Tsdl.Sdl.keycode
val key_next : Tsdl.Sdl.keycode
val key_prev : Tsdl.Sdl.keycode
val key_top : Tsdl.Sdl.keycode
val key_bottom : Tsdl.Sdl.keycode
type ('a, 'b) node = {
  1. id : Id.t;
  2. parent : ('a, 'b) node option;
  3. mutable data : 'a;
  4. group : Canvas.group;
  5. fold_btn : Canvas.label option;
  6. label_group : Canvas.group;
  7. label : 'b;
  8. mutable selected : bool;
  9. mutable sub_group : Canvas.group option;
  10. mutable expanded : bool;
  11. mutable children : ('a, 'b) node list;
}
type Events.ev +=
  1. | Node_collapsed : (('a * ('a, 'b) node) -> bool) Events.ev
  2. | Node_expanded : (('a0 * ('a0, 'b0) node) -> bool) Events.ev
  3. | Node_clicked : ((Widget.button_ev * 'a1 * ('a1, 'b1) node) -> bool) Events.ev
  4. | Node_selected : (('a2 * ('a2, 'b2) node) -> bool) Events.ev
  5. | Node_unselected : (('a3 * ('a3, 'b3) node) -> bool) Events.ev
class ['a, 'b] tree : ?class_:string option -> ?name:string option -> ?props:Props.t option -> 'a0 tree_spec -> ('a1, 'b0) node_label -> object ... end
val tree : ?class_:string -> ?name:string -> ?props:Props.t -> ?pack:(Widget.widget -> unit) -> ?selection_mode:Props.selection_mode -> 'a tree_spec -> ('a, 'b) node_label -> ('a, 'b) tree