blob: e6654d8c46803b8f4b1efc502425d7145608bb75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
##ifdef CAMLTK
let create ?name parent title mesg bitmap def buttons =
let w = Widget.new_atom "toplevel" ~parent ?name in
let res = tkEval [|TkToken"tk_dialog";
cCAMLtoTKwidget widget_any_table w;
TkToken title;
TkToken mesg;
cCAMLtoTKbitmap bitmap;
TkToken (string_of_int def);
TkTokenList (List.map (function x -> TkToken x) buttons)|]
in
int_of_string res
;;
let create_named parent name title mesg bitmap def buttons =
let w = Widget.new_atom "toplevel" ~parent ~name in
let res = tkEval [|TkToken"tk_dialog";
cCAMLtoTKwidget widget_any_table w;
TkToken title;
TkToken mesg;
cCAMLtoTKbitmap bitmap;
TkToken (string_of_int def);
TkTokenList (List.map (function x -> TkToken x) buttons)|]
in
int_of_string res
;;
##else
let create ~parent ~title ~message ~buttons ?name
?(bitmap = `Predefined "") ?(default = -1) () =
let w = Widget.new_atom "toplevel" ?name ~parent in
let res = tkEval [|TkToken"tk_dialog";
cCAMLtoTKwidget w;
TkToken title;
TkToken message;
cCAMLtoTKbitmap bitmap;
TkToken (string_of_int default);
TkTokenList (List.map ~f:(fun x -> TkToken x) buttons)|]
in
int_of_string res
;;
##endif
|