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 #ifndef __GTK_SELECTION_H__
28 #define __GTK_SELECTION_H__
32 #include <gtk/gtkenums.h>
33 #include <gtk/gtkwidget.h>
37 #endif /* __cplusplus */
39 typedef struct _GtkTargetList GtkTargetList;
40 typedef struct _GtkTargetEntry GtkTargetEntry;
42 /* The contents of a selection are returned in a GtkSelectionData
43 * structure. selection/target identify the request. type specifies
44 * the type of the return; if length < 0, and the data should be
45 * ignored. This structure has object semantics - no fields should be
46 * modified directly, they should not be created directly, and
47 * pointers to them should not be stored beyond the duration of a
48 * callback. (If the last is changed, we'll need to add reference
49 * counting.) The time field gives the timestamp at which the data was
53 struct _GtkSelectionData
63 struct _GtkTargetEntry {
69 /* These structures not public, and are here only for the convenience of
73 typedef struct _GtkTargetPair GtkTargetPair;
75 /* This structure is a list of destinations, and associated guint id's */
76 struct _GtkTargetList {
81 struct _GtkTargetPair {
87 GtkTargetList *gtk_target_list_new (const GtkTargetEntry *targets,
89 void gtk_target_list_ref (GtkTargetList *list);
90 void gtk_target_list_unref (GtkTargetList *list);
91 void gtk_target_list_add (GtkTargetList *list,
95 void gtk_target_list_add_table (GtkTargetList *list,
96 const GtkTargetEntry *targets,
98 void gtk_target_list_remove (GtkTargetList *list,
100 gboolean gtk_target_list_find (GtkTargetList *list,
104 /* Public interface */
106 gboolean gtk_selection_owner_set (GtkWidget *widget,
109 void gtk_selection_add_target (GtkWidget *widget,
113 void gtk_selection_add_targets (GtkWidget *widget,
115 const GtkTargetEntry *targets,
117 void gtk_selection_clear_targets (GtkWidget *widget,
119 gboolean gtk_selection_convert (GtkWidget *widget,
123 void gtk_selection_data_set (GtkSelectionData *selection_data,
128 gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data,
130 guchar * gtk_selection_data_get_text (GtkSelectionData *selection_data);
132 /* Called when a widget is destroyed */
134 void gtk_selection_remove_all (GtkWidget *widget);
138 gboolean gtk_selection_clear (GtkWidget *widget,
139 GdkEventSelection *event);
140 gboolean gtk_selection_request (GtkWidget *widget,
141 GdkEventSelection *event);
142 gboolean gtk_selection_incr_event (GdkWindow *window,
143 GdkEventProperty *event);
144 gboolean gtk_selection_notify (GtkWidget *widget,
145 GdkEventSelection *event);
146 gboolean gtk_selection_property_notify (GtkWidget *widget,
147 GdkEventProperty *event);
148 GtkSelectionData *gtk_selection_data_copy (GtkSelectionData *data);
149 void gtk_selection_data_free (GtkSelectionData *data);
155 #endif /* __cplusplus */
158 #endif /* __GTK_SELECTION_H__ */