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_root ~root =
49 if not (MathView.load_root obj ~root:((root : Gdome.element)#as_Element)) 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 structure_changed element = MathView.structure_changed obj ((element : Gdome.element)#as_Element)
57 method attribute_changed element ~name = MathView.attribute_changed obj ((element : Gdome.element)#as_Element) ((name : Gdome.domString)#as_DOMString)
58 method get_bounding_box = MathView.get_bounding_box obj
59 method get_width = MathView.get_width obj
60 method get_height = MathView.get_height obj
61 method get_top = MathView.get_top obj
62 method set_top x y = MathView.set_top obj x y
63 method set_adjustments adj1 adj2 = MathView.set_adjustments obj (GData.as_adjustment adj1) (GData.as_adjustment adj2)
64 method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj)
65 method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj)
66 method get_buffer = MathView.get_buffer obj
67 method get_drawing_area = new GMisc.drawing_area (MathView.get_drawing_area obj)
68 method set_font_size = MathView.set_font_size obj
69 method get_font_size = MathView.get_font_size obj
70 method set_log_verbosity = MathView.set_log_verbosity obj
71 method get_log_verbosity = MathView.get_log_verbosity obj
74 class math_view_signals obj = object
75 inherit GContainer.container_signals_impl obj
76 inherit math_view_sigs
79 class math_view obj = object
80 inherit math_view_skel (obj : Gtk_mathview.math_view obj)
81 method connect = new math_view_signals obj
84 let math_view ?hadjustment ?vadjustment ?font_size ?log_verbosity =
85 GtkBase.Container.make_params ~cont:(
86 OgtkMathViewProps.pack_return
87 (fun p -> OgtkMathViewProps.set_params (new math_view (MathView.create p)) ~font_size ~log_verbosity)) []