]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/lablgtksourceview/ml_gtk_sourceview.c
snaphot
[helm.git] / helm / DEVEL / lablgtksourceview / ml_gtk_sourceview.c
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 #include <assert.h>
27
28 #include <gtksourceview/gtksourceview.h>
29 #include <gtksourceview/gtksourcelanguagesmanager.h>
30
31 #include <caml/mlvalues.h>
32 #include <caml/alloc.h>
33 #include <caml/memory.h>
34 #include <caml/callback.h>
35 #include <caml/fail.h>
36 #include <caml/custom.h>
37 #include <caml/callback.h>
38
39 #include <wrappers.h>
40 #include <ml_glib.h>
41 #include <ml_gdk.h>
42 #include <ml_gtk.h>
43 #include <ml_gobject.h>
44 #include <ml_gdkpixbuf.h>
45 #include <ml_pango.h>
46 #include <gtk_tags.h>
47 #include <gdk_tags.h>
48
49 /* Init all */
50
51 CAMLprim value ml_gtk_source_language_init(value unit)
52 {       /* Since these are declared const, must force gcc to call them! */
53     GType t = gtk_source_language_get_type();
54     return Val_GType(t);
55 }
56
57 CAMLprim value ml_gtk_source_languages_manager_init(value unit)
58 {       /* Since these are declared const, must force gcc to call them! */
59     GType t = gtk_source_languages_manager_get_type();
60     return Val_GType(t);
61 }
62
63 CAMLprim value ml_gtk_source_buffer_init(value unit)
64 {       /* Since these are declared const, must force gcc to call them! */
65     GType t = gtk_source_buffer_get_type();
66     return Val_GType(t);
67 }
68
69 CAMLprim value ml_gtk_source_view_init(value unit)
70 {       /* Since these are declared const, must force gcc to call them! */
71     GType t = gtk_source_view_get_type();
72     return Val_GType(t);
73 }
74
75 #define GtkSourceLanguage_val(val) check_cast(GTK_SOURCE_LANGUAGE,val)
76 #define GtkSourceLanguagesManager_val(val)\
77         check_cast(GTK_SOURCE_LANGUAGES_MANAGER,val)
78 #define GtkSourceTagTable_val(val) check_cast(GTK_SOURCE_TAG_TABLE,val)
79 #define GtkSourceBuffer_val(val) check_cast(GTK_SOURCE_BUFFER,val)
80 #define GtkSourceView_val(val) check_cast(GTK_SOURCE_VIEW,val)
81
82 ML_1 (gtk_source_language_get_name, GtkSourceLanguage_val, Val_string)
83 ML_1 (gtk_source_language_get_section, GtkSourceLanguage_val, Val_string)
84 ML_1 (gtk_source_language_get_escape_char, GtkSourceLanguage_val, Val_int)
85
86 ML_0 (gtk_source_languages_manager_new, Val_GtkAny_sink)
87 ML_2 (gtk_source_languages_manager_get_language_from_mime_type,
88                 GtkSourceLanguagesManager_val, String_val, Val_GtkAny)
89
90 /* ML_0 (gtk_source_buffer_new, GtkSourceTagTable_val, Val_GtkAny_sink) */
91 /* ML_1 (gtk_source_buffer_new_with_language, GtkSourceLanguage_val,
92                 Val_GtkAny_sink) */
93 ML_1 (gtk_source_buffer_can_undo, GtkSourceBuffer_val, Bool_val)
94 ML_1 (gtk_source_buffer_can_redo, GtkSourceBuffer_val, Bool_val)
95 ML_1 (gtk_source_buffer_undo, GtkSourceBuffer_val, Unit)
96 ML_1 (gtk_source_buffer_redo, GtkSourceBuffer_val, Unit)
97 ML_1 (gtk_source_buffer_begin_not_undoable_action, GtkSourceBuffer_val, Unit)
98 ML_1 (gtk_source_buffer_end_not_undoable_action, GtkSourceBuffer_val, Unit)
99
100 ML_0 (gtk_source_view_new, Val_GtkWidget_sink)
101 ML_1 (gtk_source_view_new_with_buffer, GtkSourceBuffer_val, Val_GtkWidget_sink)
102