]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/contrib/otherlibs/labltk/examples_camltk/winskel.ml
update
[l4.git] / l4 / pkg / ocaml / contrib / otherlibs / labltk / examples_camltk / winskel.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                 MLTk, Tcl/Tk interface of Objective Caml            *)
4 (*                                                                     *)
5 (*    Francois Rouaix, Francois Pessaux, Jun Furuse and Pierre Weis    *)
6 (*               projet Cristal, INRIA Rocquencourt                    *)
7 (*            Jacques Garrigue, Kyoto University RIMS                  *)
8 (*                                                                     *)
9 (*  Copyright 2002 Institut National de Recherche en Informatique et   *)
10 (*  en Automatique and Kyoto University.  All rights reserved.         *)
11 (*  This file is distributed under the terms of the GNU Library        *)
12 (*  General Public License, with the special exception on linking      *)
13 (*  described in file LICENSE found in the Objective Caml source tree. *)
14 (*                                                                     *)
15 (***********************************************************************)
16 (* This examples is based on Ousterhout's book (fig 16.15) *)
17 open Camltk
18
19 let main () =
20  let top = opentk() in
21  let mbar = Frame.create top [Relief Raised; BorderWidth (Pixels 2)] 
22  and dummy = 
23     Frame.create top [Width (Centimeters 10.); Height (Centimeters 5.)] in
24     pack [mbar; dummy] [Side Side_Top; Fill Fill_X];
25  let file = Menubutton.create mbar [Text "File"; UnderlinedChar 0]
26  and edit = Menubutton.create mbar [Text "Edit"; UnderlinedChar 0]
27  and graphics = Menubutton.create mbar [Text "Graphics"; UnderlinedChar 0]
28  and text = Menubutton.create mbar [Text "Text"; UnderlinedChar 0]
29  and view = Menubutton.create mbar [Text "View"; UnderlinedChar 0]
30  and help = Menubutton.create mbar [Text "Help"; UnderlinedChar 0] in
31    pack [file;edit;graphics;text;view] [Side Side_Left];
32    pack [help] [Side Side_Right];
33    (* same code as chap16-14 *)
34   let m = Menu.create text [] in
35    let bold = Textvariable.create() 
36    and italic = Textvariable.create() 
37    and underline = Textvariable.create() in
38    Menu.add_checkbutton m [Label "Bold"; Variable bold];
39    Menu.add_checkbutton m [Label "Italic"; Variable italic];
40    Menu.add_checkbutton m [Label "Underline"; Variable underline];
41    Menu.add_separator m;
42    let font = Textvariable.create() in
43    Menu.add_radiobutton m [Label "Times"; Variable font; Value "times"];
44    Menu.add_radiobutton m [Label "Helvetica"; Variable font; Value "helvetica"]
45 ;
46    Menu.add_radiobutton m [Label "Courier"; Variable font; Value "courier"];
47    Menu.add_separator m;
48    Menu.add_command m [Label "Insert Bullet";
49                         Command (function () -> 
50                                   print_string "Insert Bullet\n"; 
51                                   flush stdout)];   
52    Menu.add_command m [Label "Margins and Tags...";
53                         Command (function () -> 
54                                   print_string "margins\n"; 
55                                   flush stdout)]; 
56    Menubutton.configure text [Menu m];
57
58     mainLoop()
59
60
61
62 let _ =
63  Printexc.catch main ()