method set_one_child n c =
begin
match (if n = 1 then child1 else child2) with
None -> ()
| Some c ->
paned#remove (widget_of_contents c)
end;
if n = 1 then child1 <- Some c else child2 <- Some c;
begin
match c with
`View v ->
v#set_on_destroy (fun () -> self#on_child_view_destroy n);
v#set_on_label_change (fun _ -> self#on_child_label_change);
| `Paned gp ->
gp#set_on_destroy (self#on_child_destroy n);
gp#set_on_label_change (fun _ -> self#on_child_label_change);
| `Notebook gn ->
gn#set_on_destroy (self#on_child_destroy n);
gn#set_on_label_change (fun _ -> self#on_child_label_change);
end;
(if n = 1 then paned#add1 else paned#add2) (widget_of_contents c);
self#on_child_label_change;
contents_grab_focus c