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__
34 #include <gtk/gtkwidget.h>
35 #include <gtk/gtktextiter.h>
42 * A #GtkTargetList structure is a reference counted list
43 * of #GtkTargetPair. It is used to represent the same
44 * information as a table of #GtkTargetEntry, but in
45 * an efficient form. This structure should be treated as
48 typedef struct _GtkTargetList GtkTargetList;
49 typedef struct _GtkTargetEntry GtkTargetEntry;
51 #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
52 #define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type ())
56 * @target: a string representation of the target type
57 * @flags: #GtkTargetFlags for DND
58 * @info: an application-assigned integer ID which will
59 * get passed as a parater to e.g the #GtkWiget::selection-get
60 * signal. It allows the application to identify the target
61 * type without extensive string compares.
63 * A #GtkTargetEntry structure represents a single type of
64 * data than can be supplied for by a widget for a selection
65 * or for supplied or received during drag-and-drop.
67 struct _GtkTargetEntry
74 GType gtk_target_list_get_type (void) G_GNUC_CONST;
75 GtkTargetList *gtk_target_list_new (const GtkTargetEntry *targets,
77 GtkTargetList *gtk_target_list_ref (GtkTargetList *list);
78 void gtk_target_list_unref (GtkTargetList *list);
79 void gtk_target_list_add (GtkTargetList *list,
83 void gtk_target_list_add_text_targets (GtkTargetList *list,
85 void gtk_target_list_add_rich_text_targets (GtkTargetList *list,
87 gboolean deserializable,
88 GtkTextBuffer *buffer);
89 void gtk_target_list_add_image_targets (GtkTargetList *list,
92 void gtk_target_list_add_uri_targets (GtkTargetList *list,
94 void gtk_target_list_add_table (GtkTargetList *list,
95 const GtkTargetEntry *targets,
97 void gtk_target_list_remove (GtkTargetList *list,
99 gboolean gtk_target_list_find (GtkTargetList *list,
103 GtkTargetEntry * gtk_target_table_new_from_list (GtkTargetList *list,
105 void gtk_target_table_free (GtkTargetEntry *targets,
108 gboolean gtk_selection_owner_set (GtkWidget *widget,
111 gboolean gtk_selection_owner_set_for_display (GdkDisplay *display,
116 void gtk_selection_add_target (GtkWidget *widget,
120 void gtk_selection_add_targets (GtkWidget *widget,
122 const GtkTargetEntry *targets,
124 void gtk_selection_clear_targets (GtkWidget *widget,
126 gboolean gtk_selection_convert (GtkWidget *widget,
130 void gtk_selection_remove_all (GtkWidget *widget);
132 GdkAtom gtk_selection_data_get_selection (const GtkSelectionData *selection_data);
133 GdkAtom gtk_selection_data_get_target (const GtkSelectionData *selection_data);
134 GdkAtom gtk_selection_data_get_data_type (const GtkSelectionData *selection_data);
135 gint gtk_selection_data_get_format (const GtkSelectionData *selection_data);
136 const guchar *gtk_selection_data_get_data (const GtkSelectionData *selection_data);
137 gint gtk_selection_data_get_length (const GtkSelectionData *selection_data);
138 const guchar *gtk_selection_data_get_data_with_length
139 (const GtkSelectionData *selection_data,
142 GdkDisplay *gtk_selection_data_get_display (const GtkSelectionData *selection_data);
144 void gtk_selection_data_set (GtkSelectionData *selection_data,
149 gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data,
152 guchar * gtk_selection_data_get_text (const GtkSelectionData *selection_data);
153 gboolean gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
155 GdkPixbuf *gtk_selection_data_get_pixbuf (const GtkSelectionData *selection_data);
156 gboolean gtk_selection_data_set_uris (GtkSelectionData *selection_data,
158 gchar **gtk_selection_data_get_uris (const GtkSelectionData *selection_data);
160 gboolean gtk_selection_data_get_targets (const GtkSelectionData *selection_data,
163 gboolean gtk_selection_data_targets_include_text (const GtkSelectionData *selection_data);
164 gboolean gtk_selection_data_targets_include_rich_text (const GtkSelectionData *selection_data,
165 GtkTextBuffer *buffer);
166 gboolean gtk_selection_data_targets_include_image (const GtkSelectionData *selection_data,
168 gboolean gtk_selection_data_targets_include_uri (const GtkSelectionData *selection_data);
169 gboolean gtk_targets_include_text (GdkAtom *targets,
171 gboolean gtk_targets_include_rich_text (GdkAtom *targets,
173 GtkTextBuffer *buffer);
174 gboolean gtk_targets_include_image (GdkAtom *targets,
177 gboolean gtk_targets_include_uri (GdkAtom *targets,
181 GType gtk_selection_data_get_type (void) G_GNUC_CONST;
182 GtkSelectionData *gtk_selection_data_copy (const GtkSelectionData *data);
183 void gtk_selection_data_free (GtkSelectionData *data);
185 GType gtk_target_entry_get_type (void) G_GNUC_CONST;
186 GtkTargetEntry *gtk_target_entry_new (const gchar *target,
189 GtkTargetEntry *gtk_target_entry_copy (GtkTargetEntry *data);
190 void gtk_target_entry_free (GtkTargetEntry *data);
194 #endif /* __GTK_SELECTION_H__ */