2 * Stefano Zacchiroli <zack@cs.unibo.it>
3 * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
5 * This file is part of lablgtksourceview, the OCaml binding for the
6 * GtkSourceView widget.
8 * lablgtksourceview is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * lablgtksourceview is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with lablgtksourceview; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 * For details, send a mail to the authors.
32 open OgtkSourceViewProps
35 let get_bool = function `BOOL b -> b | _ -> assert false
37 let get_uint = function `INT i -> i | _ -> assert false
40 class source_view_signals obj_param =
42 inherit widget_signals_impl (obj_param : [> Gtk_sourceview.source_view] obj)
43 inherit GText.view_signals obj_param
44 inherit source_view_sigs
47 class source_view (obj: Gtk_sourceview.source_view obj) =
49 inherit GText.view_skel obj
50 method connect = new source_view_signals obj
51 method set_show_line_numbers x =
52 self#misc#set_property "show_line_numbers" (bool x)
53 method show_line_numbers =
54 get_bool (self#misc#get_property "show_line_numbers")
55 method set_show_line_markers x =
56 self#misc#set_property "show_line_markers" (bool x)
57 method show_line_markers =
58 get_bool (self#misc#get_property "show_line_markers")
59 method set_tabs_width x = self#misc#set_property "tabs_width" (uint x)
60 method tabs_width = get_uint (self#misc#get_property "tabs_width")
61 method set_auto_indent x = self#misc#set_property "auto_indent" (bool x)
62 method auto_indent = get_bool (self#misc#get_property "auto_indent")
63 method set_insert_spaces_instead_of_tabs x =
64 self#misc#set_property "insert_spaces_instead_of_tabs" (bool x)
65 method insert_spaces_instead_of_tabs =
66 get_bool (self#misc#get_property "insert_spaces_instead_of_tabs")
67 method set_show_margin x = self#misc#set_property "show_margin" (bool x)
68 method show_margin = get_bool (self#misc#get_property "show_margin")
69 method set_margin x = self#misc#set_property "margin" (uint x)
70 method margin = get_uint (self#misc#get_property "margin")
71 method set_smart_home_end x = self#misc#set_property "smart_home_end" (bool x)
72 method smart_home_end = get_bool (self#misc#get_property "smart_home_end")
76 SourceView.make_params [] ~cont:(
77 GtkText.View.make_params ~cont:(
78 GContainer.pack_container ~create:(fun pl ->
79 new source_view (SourceView.create pl))))