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, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23 #error "Only <gtk/gtk.h> can be included directly."
26 #ifndef __GTK_TEXT_BUFFER_RICH_TEXT_H__
27 #define __GTK_TEXT_BUFFER_RICH_TEXT_H__
29 #include <gtk/gtktextbuffer.h>
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
42 * A function that is called to serialize the content of a text buffer.
43 * It must return the serialized form of the content.
45 * Returns: a newly-allocated array of guint8 which contains the serialized
46 * data, or %NULL if an error occurred
48 typedef guint8 * (* GtkTextBufferSerializeFunc) (GtkTextBuffer *register_buffer,
49 GtkTextBuffer *content_buffer,
50 const GtkTextIter *start,
51 const GtkTextIter *end,
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
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.
69 * Returns: %TRUE on success, %FALSE otherwise
71 typedef gboolean (* GtkTextBufferDeserializeFunc) (GtkTextBuffer *register_buffer,
72 GtkTextBuffer *content_buffer,
80 GdkAtom gtk_text_buffer_register_serialize_format (GtkTextBuffer *buffer,
81 const gchar *mime_type,
82 GtkTextBufferSerializeFunc function,
84 GDestroyNotify user_data_destroy);
85 GdkAtom gtk_text_buffer_register_serialize_tagset (GtkTextBuffer *buffer,
86 const gchar *tagset_name);
88 GdkAtom gtk_text_buffer_register_deserialize_format (GtkTextBuffer *buffer,
89 const gchar *mime_type,
90 GtkTextBufferDeserializeFunc function,
92 GDestroyNotify user_data_destroy);
93 GdkAtom gtk_text_buffer_register_deserialize_tagset (GtkTextBuffer *buffer,
94 const gchar *tagset_name);
96 void gtk_text_buffer_unregister_serialize_format (GtkTextBuffer *buffer,
98 void gtk_text_buffer_unregister_deserialize_format (GtkTextBuffer *buffer,
101 void gtk_text_buffer_deserialize_set_can_create_tags (GtkTextBuffer *buffer,
103 gboolean can_create_tags);
104 gboolean gtk_text_buffer_deserialize_get_can_create_tags (GtkTextBuffer *buffer,
107 GdkAtom * gtk_text_buffer_get_serialize_formats (GtkTextBuffer *buffer,
109 GdkAtom * gtk_text_buffer_get_deserialize_formats (GtkTextBuffer *buffer,
112 guint8 * gtk_text_buffer_serialize (GtkTextBuffer *register_buffer,
113 GtkTextBuffer *content_buffer,
115 const GtkTextIter *start,
116 const GtkTextIter *end,
118 gboolean gtk_text_buffer_deserialize (GtkTextBuffer *register_buffer,
119 GtkTextBuffer *content_buffer,
128 #endif /* __GTK_TEXT_BUFFER_RICH_TEXT_H__ */