]> Pileus Git - ~andy/gtk/blob - gtk/gtkclipboard.h
Updated Bulgarian translation by Alexander Shopov <ash@contact.bg>
[~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 #include <gtk/gtkselection.h>
26
27 G_BEGIN_DECLS
28
29 #define GTK_TYPE_CLIPBOARD            (gtk_clipboard_get_type ())
30 #define GTK_CLIPBOARD(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CLIPBOARD, GtkClipboard))
31 #define GTK_IS_CLIPBOARD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CLIPBOARD))
32
33 typedef void (* GtkClipboardReceivedFunc)         (GtkClipboard     *clipboard,
34                                                    GtkSelectionData *selection_data,
35                                                    gpointer          data);
36 typedef void (* GtkClipboardTextReceivedFunc)     (GtkClipboard     *clipboard,
37                                                    const gchar      *text,
38                                                    gpointer          data);
39 typedef void (* GtkClipboardRichTextReceivedFunc) (GtkClipboard     *clipboard,
40                                                    GdkAtom           format,
41                                                    const guint8     *text,
42                                                    gsize             length,
43                                                    gpointer          data);
44 typedef void (* GtkClipboardImageReceivedFunc)    (GtkClipboard     *clipboard,
45                                                    GdkPixbuf        *pixbuf,
46                                                    gpointer          data);
47 typedef void (* GtkClipboardTargetsReceivedFunc)  (GtkClipboard     *clipboard,
48                                                    GdkAtom          *atoms,
49                                                    gint              n_atoms,
50                                                    gpointer          data);
51
52 /* Should these functions have GtkClipboard *clipboard as the first argument?
53  * right now for ClearFunc, you may have trouble determining _which_ clipboard
54  * was cleared, if you reuse your ClearFunc for multiple clipboards.
55  */
56 typedef void (* GtkClipboardGetFunc)          (GtkClipboard     *clipboard,
57                                                GtkSelectionData *selection_data,
58                                                guint             info,
59                                                gpointer          user_data_or_owner);
60 typedef void (* GtkClipboardClearFunc)        (GtkClipboard     *clipboard,
61                                                gpointer          user_data_or_owner);
62
63 GType         gtk_clipboard_get_type (void) G_GNUC_CONST;
64
65 GtkClipboard *gtk_clipboard_get_for_display (GdkDisplay   *display,
66                                              GdkAtom       selection);
67 #ifndef GDK_MULTIHEAD_SAFE
68 GtkClipboard *gtk_clipboard_get             (GdkAtom       selection);
69 #endif
70
71 GdkDisplay   *gtk_clipboard_get_display     (GtkClipboard *clipboard);
72
73
74 gboolean gtk_clipboard_set_with_data  (GtkClipboard          *clipboard,
75                                        const GtkTargetEntry  *targets,
76                                        guint                  n_targets,
77                                        GtkClipboardGetFunc    get_func,
78                                        GtkClipboardClearFunc  clear_func,
79                                        gpointer               user_data);
80 gboolean gtk_clipboard_set_with_owner (GtkClipboard          *clipboard,
81                                        const GtkTargetEntry  *targets,
82                                        guint                  n_targets,
83                                        GtkClipboardGetFunc    get_func,
84                                        GtkClipboardClearFunc  clear_func,
85                                        GObject               *owner);
86 GObject *gtk_clipboard_get_owner      (GtkClipboard          *clipboard);
87 void     gtk_clipboard_clear          (GtkClipboard          *clipboard);
88 void     gtk_clipboard_set_text       (GtkClipboard          *clipboard,
89                                        const gchar           *text,
90                                        gint                   len);
91 void     gtk_clipboard_set_image      (GtkClipboard          *clipboard,
92                                        GdkPixbuf             *pixbuf);
93
94 void gtk_clipboard_request_contents  (GtkClipboard                     *clipboard,
95                                       GdkAtom                           target,
96                                       GtkClipboardReceivedFunc          callback,
97                                       gpointer                          user_data);
98 void gtk_clipboard_request_text      (GtkClipboard                     *clipboard,
99                                       GtkClipboardTextReceivedFunc      callback,
100                                       gpointer                          user_data);
101 void gtk_clipboard_request_rich_text (GtkClipboard                     *clipboard,
102                                       GtkTextBuffer                    *buffer,
103                                       GtkClipboardRichTextReceivedFunc  callback,
104                                       gpointer                          user_data);
105 void gtk_clipboard_request_image     (GtkClipboard                     *clipboard,
106                                       GtkClipboardImageReceivedFunc     callback,
107                                       gpointer                          user_data);
108 void gtk_clipboard_request_targets   (GtkClipboard                     *clipboard,
109                                       GtkClipboardTargetsReceivedFunc   callback,
110                                       gpointer                          user_data);
111
112 GtkSelectionData *gtk_clipboard_wait_for_contents  (GtkClipboard  *clipboard,
113                                                     GdkAtom        target);
114 gchar *           gtk_clipboard_wait_for_text      (GtkClipboard  *clipboard);
115 guint8 *          gtk_clipboard_wait_for_rich_text (GtkClipboard  *clipboard,
116                                                     GtkTextBuffer *buffer,
117                                                     GdkAtom       *format,
118                                                     gsize         *length);
119 GdkPixbuf *       gtk_clipboard_wait_for_image     (GtkClipboard  *clipboard);
120 gboolean          gtk_clipboard_wait_for_targets   (GtkClipboard  *clipboard,
121                                                     GdkAtom      **targets,
122                                                     gint          *n_targets);
123
124 gboolean gtk_clipboard_wait_is_text_available      (GtkClipboard  *clipboard);
125 gboolean gtk_clipboard_wait_is_rich_text_available (GtkClipboard  *clipboard,
126                                                     GtkTextBuffer *buffer);
127 gboolean gtk_clipboard_wait_is_image_available     (GtkClipboard  *clipboard);
128 gboolean gtk_clipboard_wait_is_target_available    (GtkClipboard  *clipboard,
129                                                     GdkAtom        target);
130
131
132 void gtk_clipboard_set_can_store (GtkClipboard         *clipboard,
133                                   const GtkTargetEntry *targets,
134                                   gint                  n_targets);
135
136 void gtk_clipboard_store         (GtkClipboard   *clipboard);
137   
138 /* private */
139 void     _gtk_clipboard_handle_event    (GdkEventOwnerChange *event);
140
141 void     _gtk_clipboard_store_all       (void);
142   
143 G_END_DECLS
144
145 #endif /* __GTK_CLIPBOARD_H__ */