]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/lablgtksourceview/gSourceView.ml
lablgtksourceview: first checkin, almost nothing bound ...
[helm.git] / helm / DEVEL / lablgtksourceview / gSourceView.ml
1 (* Copyright (C) 2005:
2  *      Stefano Zacchiroli     <zack@cs.unibo.it>
3  *      Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
4  *
5  * This file is part of lablgtksourceview, the OCaml binding for the
6  * GtkSourceView widget.
7  * 
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.
12  *
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.
17  *
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
21  * 02111-1307, USA.
22  * 
23  * For details, send a mail to the authors.
24  *)
25
26 open Gaux
27 open Gtk_sourceview
28 open Gobject
29 open Gtk
30 open GtkBase
31 open GtkSourceView
32 open OgtkSourceViewProps
33 open GObj
34
35 let get_bool = function
36   | `BOOL b -> b
37   | _ -> assert false
38
39 class source_view_signals obj_param =
40 object
41   inherit widget_signals_impl (obj_param : [> Gtk_sourceview.source_view] obj)
42 (*   inherit OgtkTextProps.text_view_sigs *)
43   inherit GText.view_signals obj_param
44   inherit source_view_sigs
45 end
46
47 class source_view (obj: Gtk_sourceview.source_view obj) =
48 object (self)
49   inherit GText.view_skel obj
50   method connect = new source_view_signals obj
51   method show_line_numbers =
52     get_bool (self#misc#get_property "show_line_numbers")
53   method set_show_line_numbers b =
54     self#misc#set_property "show_line_numbers" (`BOOL b)
55 end
56
57 let source_view =
58   SourceView.make_params [] ~cont:(
59     GtkText.View.make_params ~cont:(
60       GContainer.pack_container ~create:(fun pl ->
61         new source_view (SourceView.create pl))))
62