1 (* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
3 * This file is part of lablgtkmathview, the Ocaml binding
4 * for the GtkMathView widget.
6 * lablgtkmathview is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * lablgtkmathview is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with lablgtkmathview; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * For details, send a mail to the author.
29 external mDOMNode_of_boxed_option :
30 Gpointer.boxed option -> Minidom.mDOMNode =
31 "ml_gtk_math_view_mDOMNode_of_bodex_option"
33 external mDOMNode_option_of_boxed_option :
34 Gpointer.boxed option -> Minidom.mDOMNode option =
35 "ml_gtk_math_view_mDOMNode_option_of_bodex_option"
37 let o_mDOMNode_of_mDOMNode node = new Ominidom.o_mDOMNode node
39 let o_mDOMNode_option_of_mDOMNode_option =
41 | Some x -> Some (o_mDOMNode_of_mDOMNode x)
44 let mDOMNode_option_of_o_mDOMNode_option =
46 | Some x -> Some (x#get_dom_node)
49 module MathView = struct
52 let cast w : math_view obj = Object.try_cast w "GtkMathView"
53 external create : Gtk.adjustment optobj -> Gtk.adjustment optobj ->
54 math_view obj = "ml_gtk_math_view_new"
55 let create ~adjustmenth ~adjustmentv () =
56 create (optboxed adjustmenth) (optboxed adjustmentv)
57 external load : [>`math_view] obj -> filename:string -> bool =
58 "ml_gtk_math_view_load"
59 external unload : [>`math_view] obj -> unit =
60 "ml_gtk_math_view_unload"
61 external raw_get_selection : [>`math_view] obj -> Minidom.mDOMNode option =
62 "ml_gtk_math_view_get_selection"
63 let get_selection obj =
64 o_mDOMNode_option_of_mDOMNode_option (raw_get_selection obj)
65 external raw_set_selection : [>`math_view] obj -> Minidom.mDOMNode option -> unit=
66 "ml_gtk_math_view_set_selection"
67 let set_selection obj node =
68 raw_set_selection obj (mDOMNode_option_of_o_mDOMNode_option node)
69 external get_width : [>`math_view] obj -> int =
70 "ml_gtk_math_view_get_width"
71 external get_height : [>`math_view] obj -> int =
72 "ml_gtk_math_view_get_height"
73 external get_top : [>`math_view] obj -> (int * int) =
74 "ml_gtk_math_view_get_top"
75 external set_top : [>`math_view] obj -> int -> int -> unit =
76 "ml_gtk_math_view_set_top"
77 external set_adjustments : [>`math_view] obj -> Gtk.adjustment obj -> Gtk.adjustment obj -> unit =
78 "ml_gtk_math_view_set_adjustments"
79 external get_hadjustment : [>`math_view] obj -> Gtk.adjustment obj =
80 "ml_gtk_math_view_get_hadjustment"
81 external get_vadjustment : [>`math_view] obj -> Gtk.adjustment obj =
82 "ml_gtk_math_view_get_vadjustment"
83 external get_buffer : [>`math_view] obj -> Gdk.pixmap =
84 "ml_gtk_math_view_get_buffer"
85 external get_frame : [>`math_view] obj -> Gtk.frame obj =
86 "ml_gtk_math_view_get_frame"
87 external set_font_size : [>`math_view] obj -> int -> unit =
88 "ml_gtk_math_view_set_font_size"
89 external get_font_size : [>`math_view] obj -> int =
90 "ml_gtk_math_view_get_font_size"
91 external set_anti_aliasing : [>`math_view] obj -> bool -> unit =
92 "ml_gtk_math_view_set_anti_aliasing"
93 external get_anti_aliasing : [>`math_view] obj -> bool =
94 "ml_gtk_math_view_get_anti_aliasing"
95 external set_kerning : [>`math_view] obj -> bool -> unit =
96 "ml_gtk_math_view_set_kerning"
97 external get_kerning : [>`math_view] obj -> bool =
98 "ml_gtk_math_view_get_kerning"
99 external set_log_verbosity : [>`math_view] obj -> int -> unit =
100 "ml_gtk_math_view_set_log_verbosity"
101 external get_log_verbosity : [>`math_view] obj -> int =
102 "ml_gtk_math_view_get_log_verbosity"
103 external export_to_postscript :
104 [>`math_view] obj -> width:int -> height:int -> x_margin:int -> y_margin:int -> disable_colors:bool -> filename:string -> bool =
105 "ml_gtk_math_view_export_to_postscript_bytecode" "ml_gtk_math_view_export_to_postscript_native"
106 external get_font_manager_type : [>`math_view] obj ->
107 [`font_manager_gtk | `font_manager_t1] =
108 "ml_gtk_math_view_get_font_manager_type"
109 external set_font_manager_type : [>`math_view] obj ->
110 fm_type:[`font_manager_gtk | `font_manager_t1] -> unit =
111 "ml_gtk_math_view_set_font_manager_type"
113 module Signals = struct
116 let clicked : ([>`math_view],_) t =
117 let marshal_clicked f _ =
119 [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node))
120 | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked"
122 { name = "clicked"; marshaller = marshal_clicked }
124 let jump : ([>`math_view],_) t =
125 let marshal_jump f _ =
127 [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node))
128 | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_jump"
130 { name = "jump"; marshaller = marshal_jump }
132 let selection_changed : ([>`math_view],_) t =
133 let marshal_selection_changed f _ =
135 [GtkArgv.POINTER node] -> f (o_mDOMNode_option_of_mDOMNode_option (mDOMNode_option_of_boxed_option node))
136 | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_selection_changed"
138 { name = "selection_changed"; marshaller = marshal_selection_changed }