1 (* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
2 * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
4 * This file is part of lablgtkmathview, the Ocaml binding
5 * for the GtkMathView widget.
7 * lablgtkmathview 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 * lablgtkmathview 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 lablgtkmathview; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * For details, send a mail to the author.
30 open OgtkMathViewProps
33 exception ErrorLoadingFile of string;;
34 exception ErrorWritingFile of string;;
35 exception ErrorLoadingDOM;;
37 let option_element_of_option =
40 | Some v -> Some (new Gdome.element v)
42 class math_view_skel obj = object
43 inherit GContainer.container (obj : Gtk_mathview.math_view obj)
44 method freeze = MathView.freeze obj
45 method thaw = MathView.thaw obj
46 method load_uri ~filename =
47 if not (MathView.load_uri obj ~filename) then raise (ErrorLoadingFile filename)
48 method load_doc ~dom =
49 if not (MathView.load_doc obj ~dom:((dom : Gdome.document)#as_Document)) then
51 method unload = MathView.unload obj
52 method select element = MathView.select obj ((element : Gdome.element)#as_Element)
53 method unselect element = MathView.unselect obj ((element : Gdome.element)#as_Element)
54 method is_selected element = MathView.is_selected obj ((element : Gdome.element)#as_Element)
55 method get_element_at x y = option_element_of_option (MathView.get_element_at obj x y)
56 method get_width = MathView.get_width obj
57 method get_height = MathView.get_height obj
58 method get_top = MathView.get_top obj
59 method set_top x y = MathView.set_top obj x y
60 method set_adjustments adj1 adj2 = MathView.set_adjustments obj (GData.as_adjustment adj1) (GData.as_adjustment adj2)
61 method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj)
62 method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj)
63 method get_buffer = MathView.get_buffer obj
64 method get_drawing_area = new GMisc.drawing_area (MathView.get_drawing_area obj)
65 method set_font_size = MathView.set_font_size obj
66 method get_font_size = MathView.get_font_size obj
67 method set_log_verbosity = MathView.set_log_verbosity obj
68 method get_log_verbosity = MathView.get_log_verbosity obj
71 class math_view_signals obj = object
72 inherit GContainer.container_signals_impl obj
73 inherit math_view_sigs
76 class math_view obj = object
77 inherit math_view_skel (obj : Gtk_mathview.math_view obj)
78 method connect = new math_view_signals obj
81 let math_view ?hadjustment ?vadjustment ?font_size ?log_verbosity =
82 GtkBase.Container.make_params ~cont:(
83 OgtkMathViewProps.pack_return
84 (fun p -> OgtkMathViewProps.set_params (new math_view (MathView.create p)) ~font_size ~log_verbosity)) []