1 (* Copyright (C) 2004, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
26 open MathitaGeneratedGui
30 (* creation order _is_ relevant for windows placement *)
31 let toolbar = new toolBarWin ~file () in
32 let main = new mainWin ~file () in
33 let about = new aboutWin ~file () in
34 let dialog = new genericDialog ~file () in
35 let uriChoice = new uriChoiceDialog ~file () in
36 let interpChoice = new interpChoiceDialog ~file () in
37 let fileSel = new fileSelectionWin ~file () in
38 let proof = new proofWin ~file () in
39 let keyBindingBoxes = (* event boxes which should receive global key events *)
40 [ toolbar#toolBarEventBox; proof#proofWinEventBox ]
44 (* glade's check widgets *)
45 List.iter (fun w -> w#check_widgets ())
46 (let c w = (w :> <check_widgets: unit -> unit>) in
47 [ c about; c dialog; c fileSel; c main; c proof; c toolbar;
48 c uriChoice; c interpChoice ]);
49 (* show/hide commands *)
50 toggle_visibility toolbar#toolBarWin main#showToolBarMenuItem;
51 toggle_visibility proof#proofWin main#showProofMenuItem;
52 (* "global" key bindings *)
53 List.iter (fun (key, callback) -> self#addKeyBinding key callback)
55 toggle_win ~check:main#showProofMenuItem proof#proofWin;
58 ignore (about#aboutWin#event#connect#delete (fun _ -> true));
59 ignore (main#aboutMenuItem#connect#activate (fun _ ->
60 about#aboutWin#show ()));
61 ignore (about#aboutDismissButton#connect#clicked (fun _ ->
62 about#aboutWin#misc#hide ()));
64 List.iter (fun w -> w#misc#set_sensitive false)
65 [ main#saveMenuItem; main#saveAsMenuItem ];
66 main#helpMenu#set_right_justified true;
70 method toolbar = toolbar
73 method dialog = dialog
74 method uriChoice = uriChoice
75 method interpChoice = interpChoice
76 method fileSel = fileSel
79 method private addKeyBinding key callback =
80 List.iter (fun evbox -> add_key_binding key callback evbox)
83 method setQuitCallback callback =
84 ignore (main#toplevel#connect#destroy callback);
85 ignore (main#quitMenuItem#connect#activate callback);
86 self#addKeyBinding GdkKeysyms._q callback