summaryrefslogtreecommitdiff
path: root/gtk/gtkclipboard.h
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2006-03-07 13:46:11 +0000
committerMichael Natterer <mitch@src.gnome.org>2006-03-07 13:46:11 +0000
commit6c1d990adc5eea803b4cb28956befb83e89468ee (patch)
treeca25230f26a27da2bde3f6cf1c3e9910c0e7487d /gtk/gtkclipboard.h
parent1f5c294851a009295c9d331110512e47324d09c0 (diff)
downloadgdk-pixbuf-6c1d990adc5eea803b4cb28956befb83e89468ee.tar.gz
Add infrastructure for copy/paste and DND of rich text for GtkTextBuffer.
2006-03-07 Michael Natterer <mitch@imendio.com> Add infrastructure for copy/paste and DND of rich text for GtkTextBuffer. Fixes bug #324177. * gtk/gtktextbufferrichtext.[ch]: new files implementing a per-buffer registry of rich text formats. * gtk/gtk.h: #include gtktextbufferrichtext.h * gtk/gtktextbufferserialize.[ch]: new files implementing an internal serialization format that can handle all of a text buffer's tags and pixbufs. It's not useful for anything except tranfer between instances of GtkTextBuffer (Anders Carlsson). * gtk/Makefile.am: build the new files. * gtk/gtkclipboard.[ch]: added convenience APIs for rich text, just as they exist for plain text and pixbufs. * gtk/gtkselection.[ch]: added rich text convenience APIs here too. Return the target list from gtk_target_list_ref(). Register GtkTargetList as boxed type. Added gtk_target_table_new_from_list() and gtk_target_table_free(), which make converting between GtkTargetList and arrays of GtkTargetEntry considerably easier. * gtk/gtktextutil.[ch]: added _gtk_text_util_create_rich_drag_icon() which creates a fancy rich text icon (Matthias Clasen). * gtk/gtktextbuffer.[ch]: use all the new stuff above and implement copy and paste of rich text. Added APIs for getting the target lists used for copy and paste. Added public enum GtkTextBufferTargetInfo which contains the "info" IDs associated with the entries of the target lists. * gtk/gtktextview.c: use the new rich text APIs and GtkTextBuffer's new target list API to enable DND of rich text chunks. * gtk/gtk.symbols: export all the new symbols added. * tests/testtext.c: added rich text testing stuff.
Diffstat (limited to 'gtk/gtkclipboard.h')
-rw-r--r--gtk/gtkclipboard.h93
1 files changed, 54 insertions, 39 deletions
diff --git a/gtk/gtkclipboard.h b/gtk/gtkclipboard.h
index 9be35a636..46e9ea6b3 100644
--- a/gtk/gtkclipboard.h
+++ b/gtk/gtkclipboard.h
@@ -30,19 +30,24 @@ G_BEGIN_DECLS
#define GTK_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CLIPBOARD, GtkClipboard))
#define GTK_IS_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CLIPBOARD))
-typedef void (* GtkClipboardReceivedFunc) (GtkClipboard *clipboard,
- GtkSelectionData *selection_data,
- gpointer data);
-typedef void (* GtkClipboardTextReceivedFunc) (GtkClipboard *clipboard,
- const gchar *text,
- gpointer data);
-typedef void (* GtkClipboardImageReceivedFunc) (GtkClipboard *clipboard,
- GdkPixbuf *pixbuf,
- gpointer data);
-typedef void (* GtkClipboardTargetsReceivedFunc) (GtkClipboard *clipboard,
- GdkAtom *atoms,
- gint n_atoms,
- gpointer data);
+typedef void (* GtkClipboardReceivedFunc) (GtkClipboard *clipboard,
+ GtkSelectionData *selection_data,
+ gpointer data);
+typedef void (* GtkClipboardTextReceivedFunc) (GtkClipboard *clipboard,
+ const gchar *text,
+ gpointer data);
+typedef void (* GtkClipboardRichTextReceivedFunc) (GtkClipboard *clipboard,
+ GdkAtom format,
+ const guint8 *text,
+ gsize length,
+ gpointer data);
+typedef void (* GtkClipboardImageReceivedFunc) (GtkClipboard *clipboard,
+ GdkPixbuf *pixbuf,
+ gpointer data);
+typedef void (* GtkClipboardTargetsReceivedFunc) (GtkClipboard *clipboard,
+ GdkAtom *atoms,
+ gint n_atoms,
+ gpointer data);
/* Should these functions have GtkClipboard *clipboard as the first argument?
* right now for ClearFunc, you may have trouble determining _which_ clipboard
@@ -86,32 +91,42 @@ void gtk_clipboard_set_text (GtkClipboard *clipboard,
void gtk_clipboard_set_image (GtkClipboard *clipboard,
GdkPixbuf *pixbuf);
-void gtk_clipboard_request_contents (GtkClipboard *clipboard,
- GdkAtom target,
- GtkClipboardReceivedFunc callback,
- gpointer user_data);
-void gtk_clipboard_request_text (GtkClipboard *clipboard,
- GtkClipboardTextReceivedFunc callback,
- gpointer user_data);
-void gtk_clipboard_request_image (GtkClipboard *clipboard,
- GtkClipboardImageReceivedFunc callback,
- gpointer user_data);
-void gtk_clipboard_request_targets (GtkClipboard *clipboard,
- GtkClipboardTargetsReceivedFunc callback,
- gpointer user_data);
-
-GtkSelectionData *gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
- GdkAtom target);
-gchar * gtk_clipboard_wait_for_text (GtkClipboard *clipboard);
-GdkPixbuf * gtk_clipboard_wait_for_image (GtkClipboard *clipboard);
-gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard,
- GdkAtom **targets,
- gint *n_targets);
-
-gboolean gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard);
-gboolean gtk_clipboard_wait_is_image_available (GtkClipboard *clipboard);
-gboolean gtk_clipboard_wait_is_target_available (GtkClipboard *clipboard,
- GdkAtom target);
+void gtk_clipboard_request_contents (GtkClipboard *clipboard,
+ GdkAtom target,
+ GtkClipboardReceivedFunc callback,
+ gpointer user_data);
+void gtk_clipboard_request_text (GtkClipboard *clipboard,
+ GtkClipboardTextReceivedFunc callback,
+ gpointer user_data);
+void gtk_clipboard_request_rich_text (GtkClipboard *clipboard,
+ GtkTextBuffer *buffer,
+ GtkClipboardRichTextReceivedFunc callback,
+ gpointer user_data);
+void gtk_clipboard_request_image (GtkClipboard *clipboard,
+ GtkClipboardImageReceivedFunc callback,
+ gpointer user_data);
+void gtk_clipboard_request_targets (GtkClipboard *clipboard,
+ GtkClipboardTargetsReceivedFunc callback,
+ gpointer user_data);
+
+GtkSelectionData *gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
+ GdkAtom target);
+gchar * gtk_clipboard_wait_for_text (GtkClipboard *clipboard);
+guint8 * gtk_clipboard_wait_for_rich_text (GtkClipboard *clipboard,
+ GtkTextBuffer *buffer,
+ GdkAtom *format,
+ gsize *size);
+GdkPixbuf * gtk_clipboard_wait_for_image (GtkClipboard *clipboard);
+gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard,
+ GdkAtom **targets,
+ gint *n_targets);
+
+gboolean gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard);
+gboolean gtk_clipboard_wait_is_rich_text_available (GtkClipboard *clipboard,
+ GtkTextBuffer *buffer);
+gboolean gtk_clipboard_wait_is_image_available (GtkClipboard *clipboard);
+gboolean gtk_clipboard_wait_is_target_available (GtkClipboard *clipboard,
+ GdkAtom target);
void gtk_clipboard_set_can_store (GtkClipboard *clipboard,