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, see <http://www.gnu.org/licenses/>.
16  *
17  * Global clipboard abstraction.
18  */
19 
20 #ifndef __GTK_CLIPBOARD_PRIVATE_H__
21 #define __GTK_CLIPBOARD_PRIVATE_H__
22 
23 #include <gtk/gtkclipboard.h>
24 
25 G_BEGIN_DECLS
26 
27 #define GTK_CLIPBOARD_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CLIPBOARD, GtkClipboardClass))
28 #define GTK_IS_CLIPBOARD_CLASS(klass)	        (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CLIPBOARD))
29 #define GTK_CLIPBOARD_GET_CLASS(obj)            (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CLIPBOARD, GtkClipboardClass))
30 
31 typedef struct _GtkClipboardClass GtkClipboardClass;
32 
33 struct _GtkClipboard
34 {
35   GObject parent_instance;
36 
37   GdkAtom selection;
38 
39   GtkClipboardGetFunc get_func;
40   GtkClipboardClearFunc clear_func;
41   gpointer user_data;
42   gboolean have_owner;
43 
44   guint32 timestamp;
45 
46   gboolean have_selection;
47   GdkDisplay *display;
48 
49   GdkAtom *cached_targets;
50   gint     n_cached_targets;
51 
52   gulong     notify_signal_id;
53   gboolean   storing_selection;
54   GMainLoop *store_loop;
55   guint      store_timeout;
56   gint       n_storable_targets;
57   GdkAtom   *storable_targets;
58 };
59 
60 struct _GtkClipboardClass
61 {
62   GObjectClass parent_class;
63 
64   /* vfuncs */
65   gboolean      (* set_contents)                (GtkClipboard                   *clipboard,
66                                                  const GtkTargetEntry           *targets,
67                                                  guint                           n_targets,
68                                                  GtkClipboardGetFunc             get_func,
69                                                  GtkClipboardClearFunc           clear_func,
70                                                  gpointer                        user_data,
71                                                  gboolean                        have_owner);
72   void          (* clear)                       (GtkClipboard                   *clipboard);
73   void          (* request_contents)            (GtkClipboard                   *clipboard,
74                                                  GdkAtom                         target,
75                                                  GtkClipboardReceivedFunc        callback,
76                                                  gpointer                        user_data);
77   void          (* set_can_store)               (GtkClipboard                   *clipboard,
78                                                  const GtkTargetEntry           *targets,
79                                                  gint                            n_targets);
80   void          (* store)                       (GtkClipboard                   *clipboard);
81 
82   /* signals */
83   void          (* owner_change)                (GtkClipboard                   *clipboard,
84                                                  GdkEventOwnerChange            *event);
85 };
86 void     _gtk_clipboard_handle_event    (GdkEventOwnerChange *event);
87 
88 void     _gtk_clipboard_store_all       (void);
89 
90 
91 G_END_DECLS
92 
93 #endif /* __GTK_CLIPBOARD_PRIVATE_H__ */
94