]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/lablgtksourceview/gSourceView.ml
lablgtksourceview: first checkin, almost nothing bound ...
[helm.git] / helm / DEVEL / lablgtksourceview / gSourceView.ml
diff --git a/helm/DEVEL/lablgtksourceview/gSourceView.ml b/helm/DEVEL/lablgtksourceview/gSourceView.ml
new file mode 100644 (file)
index 0000000..9a4534f
--- /dev/null
@@ -0,0 +1,62 @@
+(* Copyright (C) 2005:
+ *     Stefano Zacchiroli     <zack@cs.unibo.it>
+ *     Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ *
+ * This file is part of lablgtksourceview, the OCaml binding for the
+ * GtkSourceView widget.
+ * 
+ * lablgtksourceview is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * lablgtksourceview is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with lablgtksourceview; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ * 
+ * For details, send a mail to the authors.
+ *)
+
+open Gaux
+open Gtk_sourceview
+open Gobject
+open Gtk
+open GtkBase
+open GtkSourceView
+open OgtkSourceViewProps
+open GObj
+
+let get_bool = function
+  | `BOOL b -> b
+  | _ -> assert false
+
+class source_view_signals obj_param =
+object
+  inherit widget_signals_impl (obj_param : [> Gtk_sourceview.source_view] obj)
+(*   inherit OgtkTextProps.text_view_sigs *)
+  inherit GText.view_signals obj_param
+  inherit source_view_sigs
+end
+
+class source_view (obj: Gtk_sourceview.source_view obj) =
+object (self)
+  inherit GText.view_skel obj
+  method connect = new source_view_signals obj
+  method show_line_numbers =
+    get_bool (self#misc#get_property "show_line_numbers")
+  method set_show_line_numbers b =
+    self#misc#set_property "show_line_numbers" (`BOOL b)
+end
+
+let source_view =
+  SourceView.make_params [] ~cont:(
+    GtkText.View.make_params ~cont:(
+      GContainer.pack_container ~create:(fun pl ->
+        new source_view (SourceView.create pl))))
+