gtkclipboard.h 3.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/* GTK - The GIMP Toolkit
 * Copyright (C) 2000 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Global clipboard abstraction. 
 */

#ifndef __GTK_CLIPBOARD_H__
#define __GTK_CLIPBOARD_H__

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <gtk/gtkselection.h>

typedef struct _GtkClipboard GtkClipboard;

33 34 35 36 37 38
typedef void (* GtkClipboardReceivedFunc)        (GtkClipboard     *clipboard,
					          GtkSelectionData *selection_data,
					          gpointer          data);
typedef void (* GtkClipboardTextReceivedFunc)    (GtkClipboard     *clipboard,
					          const gchar      *text,
					          gpointer          data);
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

/* Should these functions have GtkClipboard *clipboard as the first argument?
 * right now for ClearFunc, you may have trouble determining _which_ clipboard
 * was cleared, if you reuse your ClearFunc for multiple clipboards.
 */
typedef void (* GtkClipboardGetFunc)          (GtkClipboard     *clipboard,
					       GtkSelectionData *selection_data,
					       guint             info,
					       gpointer          user_data_or_owner);
typedef void (* GtkClipboardClearFunc)        (GtkClipboard     *clipboard,
					       gpointer          user_data_or_owner);
  
GtkClipboard *gtk_clipboard_get (GdkAtom selection);

gboolean gtk_clipboard_set_with_data  (GtkClipboard          *clipboard,
				       const GtkTargetEntry  *targets,
				       guint                  n_targets,
				       GtkClipboardGetFunc    get_func,
				       GtkClipboardClearFunc  clear_func,
				       gpointer               user_data);
gboolean gtk_clipboard_set_with_owner (GtkClipboard          *clipboard,
				       const GtkTargetEntry  *targets,
				       guint                  n_targets,
				       GtkClipboardGetFunc    get_func,
				       GtkClipboardClearFunc  clear_func,
				       GObject               *owner);
GObject *gtk_clipboard_get_owner      (GtkClipboard          *clipboard);
void     gtk_clipboard_clear          (GtkClipboard          *clipboard);
void     gtk_clipboard_set_text       (GtkClipboard          *clipboard,
				       const gchar           *text,
				       gint                   len);

71 72 73 74 75 76 77
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);
78 79 80 81 82

GtkSelectionData *gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
						   GdkAtom       target);
gchar *           gtk_clipboard_wait_for_text     (GtkClipboard *clipboard);

83 84
gboolean gtk_clipboard_wait_is_text_available   (GtkClipboard         *clipboard);

85 86 87 88
#ifdef __cplusplus
}
#endif /* __cplusplus */

89
#endif /* __GTK_CLIPBOARD_H__ */