3 * Copyright (C) 2006 Imendio AB
4 * Contact: Michael Natterer <mitch@imendio.com>
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.
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.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __GTK_TEXT_BUFFER_RICH_TEXT_H__
21 #define __GTK_TEXT_BUFFER_RICH_TEXT_H__
23 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24 #error "Only <gtk/gtk.h> can be included directly."
27 #include <gtk/gtktextbuffer.h>
32 * GtkTextBufferSerializeFunc:
33 * @register_buffer: the #GtkTextBuffer for which the format is registered
34 * @content_buffer: the #GtkTextBuffer to serialize
35 * @start: start of the block of text to serialize
36 * @end: end of the block of text to serialize
37 * @length: Return location for the length of the serialized data
38 * @user_data: user data that was specified when registering the format
40 * A function that is called to serialize the content of a text buffer.
41 * It must return the serialized form of the content.
43 * Returns: a newly-allocated array of guint8 which contains the serialized
44 * data, or %NULL if an error occurred
46 typedef guint8 * (* GtkTextBufferSerializeFunc) (GtkTextBuffer *register_buffer,
47 GtkTextBuffer *content_buffer,
48 const GtkTextIter *start,
49 const GtkTextIter *end,
54 * GtkTextBufferDeserializeFunc:
55 * @register_buffer: the #GtkTextBuffer the format is registered with
56 * @content_buffer: the #GtkTextBuffer to deserialize into
57 * @iter: insertion point for the deserialized text
58 * @data: data to deserialize
59 * @length: length of %data
60 * @create_tags: %TRUE if deserializing may create tags
61 * @user_data: user data that was specified when registering the format
62 * @error: return location for a #GError
64 * A function that is called to deserialize rich text that has been
65 * serialized with gtk_text_buffer_serialize(), and insert it at @iter.
67 * Returns: %TRUE on success, %FALSE otherwise
69 typedef gboolean (* GtkTextBufferDeserializeFunc) (GtkTextBuffer *register_buffer,
70 GtkTextBuffer *content_buffer,
78 GdkAtom gtk_text_buffer_register_serialize_format (GtkTextBuffer *buffer,
79 const gchar *mime_type,
80 GtkTextBufferSerializeFunc function,
82 GDestroyNotify user_data_destroy);
83 GdkAtom gtk_text_buffer_register_serialize_tagset (GtkTextBuffer *buffer,
84 const gchar *tagset_name);
86 GdkAtom gtk_text_buffer_register_deserialize_format (GtkTextBuffer *buffer,
87 const gchar *mime_type,
88 GtkTextBufferDeserializeFunc function,
90 GDestroyNotify user_data_destroy);
91 GdkAtom gtk_text_buffer_register_deserialize_tagset (GtkTextBuffer *buffer,
92 const gchar *tagset_name);
94 void gtk_text_buffer_unregister_serialize_format (GtkTextBuffer *buffer,
96 void gtk_text_buffer_unregister_deserialize_format (GtkTextBuffer *buffer,
99 void gtk_text_buffer_deserialize_set_can_create_tags (GtkTextBuffer *buffer,
101 gboolean can_create_tags);
102 gboolean gtk_text_buffer_deserialize_get_can_create_tags (GtkTextBuffer *buffer,
105 GdkAtom * gtk_text_buffer_get_serialize_formats (GtkTextBuffer *buffer,
107 GdkAtom * gtk_text_buffer_get_deserialize_formats (GtkTextBuffer *buffer,
110 guint8 * gtk_text_buffer_serialize (GtkTextBuffer *register_buffer,
111 GtkTextBuffer *content_buffer,
113 const GtkTextIter *start,
114 const GtkTextIter *end,
116 gboolean gtk_text_buffer_deserialize (GtkTextBuffer *register_buffer,
117 GtkTextBuffer *content_buffer,
126 #endif /* __GTK_TEXT_BUFFER_RICH_TEXT_H__ */