1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
31 #ifndef __GTK_SELECTION_H__
32 #define __GTK_SELECTION_H__
35 #include <gtk/gtkwidget.h>
36 #include <gtk/gtktextiter.h>
41 typedef struct _GtkTargetList GtkTargetList;
42 typedef struct _GtkTargetEntry GtkTargetEntry;
44 #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
45 #define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type ())
47 /* The contents of a selection are returned in a GtkSelectionData
48 * structure. selection/target identify the request. type specifies
49 * the type of the return; if length < 0, and the data should be
50 * ignored. This structure has object semantics - no fields should be
51 * modified directly, they should not be created directly, and
52 * pointers to them should not be stored beyond the duration of a
53 * callback. (If the last is changed, we'll need to add reference
54 * counting.) The time field gives the timestamp at which the data was
58 struct _GtkSelectionData
60 GdkAtom GSEAL (selection);
61 GdkAtom GSEAL (target);
66 GdkDisplay *GSEAL (display);
69 struct _GtkTargetEntry
76 /* These structures not public, and are here only for the convenience of
80 typedef struct _GtkTargetPair GtkTargetPair;
82 /* This structure is a list of destinations, and associated guint id's */
83 struct _GtkTargetList {
88 struct _GtkTargetPair {
94 GtkTargetList *gtk_target_list_new (const GtkTargetEntry *targets,
96 GtkTargetList *gtk_target_list_ref (GtkTargetList *list);
97 void gtk_target_list_unref (GtkTargetList *list);
98 void gtk_target_list_add (GtkTargetList *list,
102 void gtk_target_list_add_text_targets (GtkTargetList *list,
104 void gtk_target_list_add_rich_text_targets (GtkTargetList *list,
106 gboolean deserializable,
107 GtkTextBuffer *buffer);
108 void gtk_target_list_add_image_targets (GtkTargetList *list,
111 void gtk_target_list_add_uri_targets (GtkTargetList *list,
113 void gtk_target_list_add_table (GtkTargetList *list,
114 const GtkTargetEntry *targets,
116 void gtk_target_list_remove (GtkTargetList *list,
118 gboolean gtk_target_list_find (GtkTargetList *list,
122 GtkTargetEntry * gtk_target_table_new_from_list (GtkTargetList *list,
124 void gtk_target_table_free (GtkTargetEntry *targets,
127 /* Public interface */
129 gboolean gtk_selection_owner_set (GtkWidget *widget,
132 gboolean gtk_selection_owner_set_for_display (GdkDisplay *display,
137 void gtk_selection_add_target (GtkWidget *widget,
141 void gtk_selection_add_targets (GtkWidget *widget,
143 const GtkTargetEntry *targets,
145 void gtk_selection_clear_targets (GtkWidget *widget,
147 gboolean gtk_selection_convert (GtkWidget *widget,
152 GdkAtom gtk_selection_data_get_selection (GtkSelectionData *selection_data);
153 GdkAtom gtk_selection_data_get_target (GtkSelectionData *selection_data);
154 GdkAtom gtk_selection_data_get_data_type (GtkSelectionData *selection_data);
155 gint gtk_selection_data_get_format (GtkSelectionData *selection_data);
156 const guchar *gtk_selection_data_get_data (GtkSelectionData *selection_data);
157 gint gtk_selection_data_get_length (GtkSelectionData *selection_data);
158 GdkDisplay *gtk_selection_data_get_display (GtkSelectionData *selection_data);
160 void gtk_selection_data_set (GtkSelectionData *selection_data,
165 gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data,
168 guchar * gtk_selection_data_get_text (GtkSelectionData *selection_data);
169 gboolean gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
171 GdkPixbuf *gtk_selection_data_get_pixbuf (GtkSelectionData *selection_data);
172 gboolean gtk_selection_data_set_uris (GtkSelectionData *selection_data,
174 gchar **gtk_selection_data_get_uris (GtkSelectionData *selection_data);
176 gboolean gtk_selection_data_get_targets (GtkSelectionData *selection_data,
179 gboolean gtk_selection_data_targets_include_text (GtkSelectionData *selection_data);
180 gboolean gtk_selection_data_targets_include_rich_text (GtkSelectionData *selection_data,
181 GtkTextBuffer *buffer);
182 gboolean gtk_selection_data_targets_include_image (GtkSelectionData *selection_data,
184 gboolean gtk_selection_data_targets_include_uri (GtkSelectionData *selection_data);
185 gboolean gtk_targets_include_text (GdkAtom *targets,
187 gboolean gtk_targets_include_rich_text (GdkAtom *targets,
189 GtkTextBuffer *buffer);
190 gboolean gtk_targets_include_image (GdkAtom *targets,
193 gboolean gtk_targets_include_uri (GdkAtom *targets,
196 /* Called when a widget is destroyed */
198 void gtk_selection_remove_all (GtkWidget *widget);
201 gboolean _gtk_selection_clear (GtkWidget *widget,
202 GdkEventSelection *event);
203 gboolean _gtk_selection_request (GtkWidget *widget,
204 GdkEventSelection *event);
205 gboolean _gtk_selection_incr_event (GdkWindow *window,
206 GdkEventProperty *event);
207 gboolean _gtk_selection_notify (GtkWidget *widget,
208 GdkEventSelection *event);
209 gboolean _gtk_selection_property_notify (GtkWidget *widget,
210 GdkEventProperty *event);
212 GType gtk_selection_data_get_type (void) G_GNUC_CONST;
213 GtkSelectionData *gtk_selection_data_copy (GtkSelectionData *data);
214 void gtk_selection_data_free (GtkSelectionData *data);
216 GType gtk_target_entry_get_type (void) G_GNUC_CONST;
218 GtkTargetEntry *gtk_target_entry_new (const char *target, guint flags, guint info);
219 GtkTargetEntry *gtk_target_entry_copy (GtkTargetEntry *data);
220 void gtk_target_entry_free (GtkTargetEntry *data);
222 GType gtk_target_list_get_type (void) G_GNUC_CONST;
226 #endif /* __GTK_SELECTION_H__ */