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, see <http://www.gnu.org/licenses/>.
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25 #ifndef __GTK_SELECTION_H__
26 #define __GTK_SELECTION_H__
28 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29 #error "Only <gtk/gtk.h> can be included directly."
32 #include <gtk/gtkwidget.h>
33 #include <gtk/gtktextiter.h>
40 * A #GtkTargetList structure is a reference counted list
41 * of #GtkTargetPair. It is used to represent the same
42 * information as a table of #GtkTargetEntry, but in
43 * an efficient form. This structure should be treated as
46 typedef struct _GtkTargetList GtkTargetList;
47 typedef struct _GtkTargetEntry GtkTargetEntry;
49 #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
50 #define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type ())
54 * @target: a string representation of the target type
55 * @flags: #GtkTargetFlags for DND
56 * @info: an application-assigned integer ID which will
57 * get passed as a parameter to e.g the #GtkWidget::selection-get
58 * signal. It allows the application to identify the target
59 * type without extensive string compares.
61 * A #GtkTargetEntry structure represents a single type of
62 * data than can be supplied for by a widget for a selection
63 * or for supplied or received during drag-and-drop.
65 struct _GtkTargetEntry
72 GType gtk_target_list_get_type (void) G_GNUC_CONST;
73 GtkTargetList *gtk_target_list_new (const GtkTargetEntry *targets,
75 GtkTargetList *gtk_target_list_ref (GtkTargetList *list);
76 void gtk_target_list_unref (GtkTargetList *list);
77 void gtk_target_list_add (GtkTargetList *list,
81 void gtk_target_list_add_text_targets (GtkTargetList *list,
83 void gtk_target_list_add_rich_text_targets (GtkTargetList *list,
85 gboolean deserializable,
86 GtkTextBuffer *buffer);
87 void gtk_target_list_add_image_targets (GtkTargetList *list,
90 void gtk_target_list_add_uri_targets (GtkTargetList *list,
92 void gtk_target_list_add_table (GtkTargetList *list,
93 const GtkTargetEntry *targets,
95 void gtk_target_list_remove (GtkTargetList *list,
97 gboolean gtk_target_list_find (GtkTargetList *list,
101 GtkTargetEntry * gtk_target_table_new_from_list (GtkTargetList *list,
103 void gtk_target_table_free (GtkTargetEntry *targets,
106 gboolean gtk_selection_owner_set (GtkWidget *widget,
109 gboolean gtk_selection_owner_set_for_display (GdkDisplay *display,
114 void gtk_selection_add_target (GtkWidget *widget,
118 void gtk_selection_add_targets (GtkWidget *widget,
120 const GtkTargetEntry *targets,
122 void gtk_selection_clear_targets (GtkWidget *widget,
124 gboolean gtk_selection_convert (GtkWidget *widget,
128 void gtk_selection_remove_all (GtkWidget *widget);
130 GdkAtom gtk_selection_data_get_selection (const GtkSelectionData *selection_data);
131 GdkAtom gtk_selection_data_get_target (const GtkSelectionData *selection_data);
132 GdkAtom gtk_selection_data_get_data_type (const GtkSelectionData *selection_data);
133 gint gtk_selection_data_get_format (const GtkSelectionData *selection_data);
134 const guchar *gtk_selection_data_get_data (const GtkSelectionData *selection_data);
135 gint gtk_selection_data_get_length (const GtkSelectionData *selection_data);
136 const guchar *gtk_selection_data_get_data_with_length
137 (const GtkSelectionData *selection_data,
140 GdkDisplay *gtk_selection_data_get_display (const GtkSelectionData *selection_data);
142 void gtk_selection_data_set (GtkSelectionData *selection_data,
147 gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data,
150 guchar * gtk_selection_data_get_text (const GtkSelectionData *selection_data);
151 gboolean gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
153 GdkPixbuf *gtk_selection_data_get_pixbuf (const GtkSelectionData *selection_data);
154 gboolean gtk_selection_data_set_uris (GtkSelectionData *selection_data,
156 gchar **gtk_selection_data_get_uris (const GtkSelectionData *selection_data);
158 gboolean gtk_selection_data_get_targets (const GtkSelectionData *selection_data,
161 gboolean gtk_selection_data_targets_include_text (const GtkSelectionData *selection_data);
162 gboolean gtk_selection_data_targets_include_rich_text (const GtkSelectionData *selection_data,
163 GtkTextBuffer *buffer);
164 gboolean gtk_selection_data_targets_include_image (const GtkSelectionData *selection_data,
166 gboolean gtk_selection_data_targets_include_uri (const GtkSelectionData *selection_data);
167 gboolean gtk_targets_include_text (GdkAtom *targets,
169 gboolean gtk_targets_include_rich_text (GdkAtom *targets,
171 GtkTextBuffer *buffer);
172 gboolean gtk_targets_include_image (GdkAtom *targets,
175 gboolean gtk_targets_include_uri (GdkAtom *targets,
179 GType gtk_selection_data_get_type (void) G_GNUC_CONST;
180 GtkSelectionData *gtk_selection_data_copy (const GtkSelectionData *data);
181 void gtk_selection_data_free (GtkSelectionData *data);
183 GType gtk_target_entry_get_type (void) G_GNUC_CONST;
184 GtkTargetEntry *gtk_target_entry_new (const gchar *target,
187 GtkTargetEntry *gtk_target_entry_copy (GtkTargetEntry *data);
188 void gtk_target_entry_free (GtkTargetEntry *data);
192 #endif /* __GTK_SELECTION_H__ */