]> Pileus Git - ~andy/gtk/blob - gtk/gtktextbufferrichtext.h
Move documentation to inline comments: GtkTextBuffer
[~andy/gtk] / gtk / gtktextbufferrichtext.h
1 /* gtkrichtext.h
2  *
3  * Copyright (C) 2006 Imendio AB
4  * Contact: Michael Natterer <mitch@imendio.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23 #error "Only <gtk/gtk.h> can be included directly."
24 #endif
25
26 #ifndef __GTK_TEXT_BUFFER_RICH_TEXT_H__
27 #define __GTK_TEXT_BUFFER_RICH_TEXT_H__
28
29 #include <gtk/gtktextbuffer.h>
30
31 G_BEGIN_DECLS
32
33 /**
34  * GtkTextBufferSerializeFunc:
35  * @register_buffer: the #GtkTextBuffer for which the format is registered
36  * @content_buffer: the #GtkTextBuffer to serialize
37  * @start: start of the block of text to serialize
38  * @end: end of the block of text to serialize
39  * @length: Return location for the length of the serialized data
40  * @user_data: user data that was specified when registering the format
41  *
42  * A function that is called to serialize the content of a text buffer.
43  * It must return the serialized form of the content.
44  *
45  * Returns: a newly-allocated array of guint8 which contains the serialized
46  *   data, or %NULL if an error occurred
47  */
48 typedef guint8 * (* GtkTextBufferSerializeFunc)   (GtkTextBuffer     *register_buffer,
49                                                    GtkTextBuffer     *content_buffer,
50                                                    const GtkTextIter *start,
51                                                    const GtkTextIter *end,
52                                                    gsize             *length,
53                                                    gpointer           user_data);
54
55 /**
56  * GtkTextBufferDeserializeFunc:
57  * @register_buffer: the #GtkTextBuffer the format is registered with
58  * @content_buffer: the #GtkTextBuffer to deserialize into
59  * @iter: insertion point for the deserialized text
60  * @data: data to deserialize
61  * @length: length of %data
62  * @create_tags: %TRUE if deserializing may create tags
63  * @user_data: user data that was specified when registering the format
64  * @error: return location for a #GError
65  *
66  * A function that is called to deserialize rich text that has been
67  * serialized with gtk_text_buffer_serialize(), and insert it at @iter.
68  *
69  * Returns: %TRUE on success, %FALSE otherwise
70  */
71 typedef gboolean (* GtkTextBufferDeserializeFunc) (GtkTextBuffer     *register_buffer,
72                                                    GtkTextBuffer     *content_buffer,
73                                                    GtkTextIter       *iter,
74                                                    const guint8      *data,
75                                                    gsize              length,
76                                                    gboolean           create_tags,
77                                                    gpointer           user_data,
78                                                    GError           **error);
79
80 GdkAtom   gtk_text_buffer_register_serialize_format   (GtkTextBuffer                *buffer,
81                                                        const gchar                  *mime_type,
82                                                        GtkTextBufferSerializeFunc    function,
83                                                        gpointer                      user_data,
84                                                        GDestroyNotify                user_data_destroy);
85 GdkAtom   gtk_text_buffer_register_serialize_tagset   (GtkTextBuffer                *buffer,
86                                                        const gchar                  *tagset_name);
87
88 GdkAtom   gtk_text_buffer_register_deserialize_format (GtkTextBuffer                *buffer,
89                                                        const gchar                  *mime_type,
90                                                        GtkTextBufferDeserializeFunc  function,
91                                                        gpointer                      user_data,
92                                                        GDestroyNotify                user_data_destroy);
93 GdkAtom   gtk_text_buffer_register_deserialize_tagset (GtkTextBuffer                *buffer,
94                                                        const gchar                  *tagset_name);
95
96 void    gtk_text_buffer_unregister_serialize_format   (GtkTextBuffer                *buffer,
97                                                        GdkAtom                       format);
98 void    gtk_text_buffer_unregister_deserialize_format (GtkTextBuffer                *buffer,
99                                                        GdkAtom                       format);
100
101 void     gtk_text_buffer_deserialize_set_can_create_tags (GtkTextBuffer             *buffer,
102                                                           GdkAtom                    format,
103                                                           gboolean                   can_create_tags);
104 gboolean gtk_text_buffer_deserialize_get_can_create_tags (GtkTextBuffer             *buffer,
105                                                           GdkAtom                    format);
106
107 GdkAtom * gtk_text_buffer_get_serialize_formats       (GtkTextBuffer                *buffer,
108                                                        gint                         *n_formats);
109 GdkAtom * gtk_text_buffer_get_deserialize_formats     (GtkTextBuffer                *buffer,
110                                                        gint                         *n_formats);
111
112 guint8  * gtk_text_buffer_serialize                   (GtkTextBuffer                *register_buffer,
113                                                        GtkTextBuffer                *content_buffer,
114                                                        GdkAtom                       format,
115                                                        const GtkTextIter            *start,
116                                                        const GtkTextIter            *end,
117                                                        gsize                        *length);
118 gboolean  gtk_text_buffer_deserialize                 (GtkTextBuffer                *register_buffer,
119                                                        GtkTextBuffer                *content_buffer,
120                                                        GdkAtom                       format,
121                                                        GtkTextIter                  *iter,
122                                                        const guint8                 *data,
123                                                        gsize                         length,
124                                                        GError                      **error);
125
126 G_END_DECLS
127
128 #endif /* __GTK_TEXT_BUFFER_RICH_TEXT_H__ */