]> Pileus Git - ~andy/gtk/blob - gtk/gtkclipboard.h
Add change notification for GtkAccelMap, by on-demand instantiating a
[~andy/gtk] / gtk / gtkclipboard.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2000 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Global clipboard abstraction. 
20  */
21
22 #ifndef __GTK_CLIPBOARD_H__
23 #define __GTK_CLIPBOARD_H__
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 #include <gtk/gtkselection.h>
30
31 #define GTK_TYPE_CLIPBOARD            (gtk_clipboard_get_type ())
32 #define GTK_CLIPBOARD(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CLIPBOARD, GtkClipboard))
33 #define GTK_IS_CLIPBOARD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CLIPBOARD))
34
35 typedef void (* GtkClipboardReceivedFunc)        (GtkClipboard     *clipboard,
36                                                   GtkSelectionData *selection_data,
37                                                   gpointer          data);
38 typedef void (* GtkClipboardTextReceivedFunc)    (GtkClipboard     *clipboard,
39                                                   const gchar      *text,
40                                                   gpointer          data);
41 typedef void (* GtkClipboardTargetsReceivedFunc) (GtkClipboard     *clipboard,
42                                                   GdkAtom          *atoms,
43                                                   gint              n_atoms,
44                                                   gpointer          data);
45
46 /* Should these functions have GtkClipboard *clipboard as the first argument?
47  * right now for ClearFunc, you may have trouble determining _which_ clipboard
48  * was cleared, if you reuse your ClearFunc for multiple clipboards.
49  */
50 typedef void (* GtkClipboardGetFunc)          (GtkClipboard     *clipboard,
51                                                GtkSelectionData *selection_data,
52                                                guint             info,
53                                                gpointer          user_data_or_owner);
54 typedef void (* GtkClipboardClearFunc)        (GtkClipboard     *clipboard,
55                                                gpointer          user_data_or_owner);
56
57 GType         gtk_clipboard_get_type (void);
58
59 GtkClipboard *gtk_clipboard_get_for_display (GdkDisplay   *display,
60                                              GdkAtom       selection);
61 #ifndef GDK_MULTIHEAD_SAFE
62 GtkClipboard *gtk_clipboard_get             (GdkAtom       selection);
63 #endif
64
65 GdkDisplay   *gtk_clipboard_get_display     (GtkClipboard *clipboard);
66
67
68 gboolean gtk_clipboard_set_with_data  (GtkClipboard          *clipboard,
69                                        const GtkTargetEntry  *targets,
70                                        guint                  n_targets,
71                                        GtkClipboardGetFunc    get_func,
72                                        GtkClipboardClearFunc  clear_func,
73                                        gpointer               user_data);
74 gboolean gtk_clipboard_set_with_owner (GtkClipboard          *clipboard,
75                                        const GtkTargetEntry  *targets,
76                                        guint                  n_targets,
77                                        GtkClipboardGetFunc    get_func,
78                                        GtkClipboardClearFunc  clear_func,
79                                        GObject               *owner);
80 GObject *gtk_clipboard_get_owner      (GtkClipboard          *clipboard);
81 void     gtk_clipboard_clear          (GtkClipboard          *clipboard);
82 void     gtk_clipboard_set_text       (GtkClipboard          *clipboard,
83                                        const gchar           *text,
84                                        gint                   len);
85
86 void gtk_clipboard_request_contents (GtkClipboard                    *clipboard,
87                                      GdkAtom                          target,
88                                      GtkClipboardReceivedFunc         callback,
89                                      gpointer                         user_data);
90 void gtk_clipboard_request_text     (GtkClipboard                    *clipboard,
91                                      GtkClipboardTextReceivedFunc     callback,
92                                      gpointer                         user_data);
93 void gtk_clipboard_request_targets  (GtkClipboard                    *clipboard,
94                                      GtkClipboardTargetsReceivedFunc  callback,
95                                      gpointer                         user_data);
96
97 GtkSelectionData *gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
98                                                    GdkAtom       target);
99 gchar *           gtk_clipboard_wait_for_text     (GtkClipboard *clipboard);
100
101 gboolean gtk_clipboard_wait_is_text_available   (GtkClipboard         *clipboard);
102
103 gboolean gtk_clipboard_wait_for_targets (GtkClipboard  *clipboard, 
104                                          GdkAtom      **targets,
105                                          gint          *n_targets);
106
107 #ifdef __cplusplus
108 }
109 #endif /* __cplusplus */
110
111 #endif /* __GTK_CLIPBOARD_H__ */