]> Pileus Git - ~andy/gtk/blob - gtk/gtkselection.h
new functions gtk_selection_data_copy and gtk_selection_data_free.
[~andy/gtk] / gtk / gtkselection.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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.
18  */
19 #ifndef __GTK_SELECTION_H__
20 #define __GTK_SELECTION_H__
21
22
23 #include <gdk/gdk.h>
24 #include <gtk/gtkenums.h>
25 #include <gtk/gtkwidget.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #pragma }
30 #endif /* __cplusplus */
31
32 typedef struct _GtkSelectionData GtkSelectioData;
33
34 /* a callback function that provides the selection. Arguments are:
35    widget: selection owner
36    offset: offset into selection
37    buffer: buffer into which to store selection 
38    length: length of buffer
39    bytes_after: (sizeof(selection) - offset - length ) (return)
40    data:   callback data */
41
42 typedef void (*GtkSelectionFunction) (GtkWidget *widget, 
43                                       GtkSelectionData *selection_data,
44                                       gpointer data);
45
46 /* Public interface */
47
48 gint gtk_selection_owner_set (GtkWidget           *widget,
49                               GdkAtom              selection,
50                               guint32              time);
51 void gtk_selection_add_handler (GtkWidget           *widget, 
52                                 GdkAtom              selection,
53                                 GdkAtom              target,
54                                 GtkSelectionFunction function,
55                                 gpointer             data);
56 void gtk_selection_add_handler_full (GtkWidget           *widget, 
57                                      GdkAtom              selection,
58                                      GdkAtom              target,
59                                      GtkSelectionFunction function,
60                                      GtkCallbackMarshal   marshal,
61                                      gpointer             data,
62                                      GtkDestroyNotify     destroy);
63 gint gtk_selection_convert   (GtkWidget           *widget, 
64                               GdkAtom              selection, 
65                               GdkAtom              target,
66                               guint32              time);
67
68
69 void gtk_selection_data_set (GtkSelectionData *selection_data,
70                              GdkAtom           type,
71                              gint              format,
72                              guchar           *data,
73                              gint              length);
74
75 /* Called when a widget is destroyed */
76
77 void gtk_selection_remove_all      (GtkWidget *widget);
78
79 /* Event handlers */
80
81 gint gtk_selection_clear           (GtkWidget         *widget,
82                                     GdkEventSelection *event);
83 gint gtk_selection_request         (GtkWidget         *widget,
84                                     GdkEventSelection *event);
85 gint gtk_selection_incr_event      (GdkWindow         *window,
86                                     GdkEventProperty  *event);
87 gint gtk_selection_notify          (GtkWidget         *widget,
88                                     GdkEventSelection *event);
89 gint gtk_selection_property_notify (GtkWidget         *widget,
90                                     GdkEventProperty  *event);
91 GtkSelectioData *gtk_selection_data_copy (GtkSelectionData *data);
92 void             gtk_selection_data_free (GtkSelectionData *data);
93
94
95
96 #ifdef __cplusplus
97 }
98 #endif /* __cplusplus */
99
100
101 #endif /* __GTK_SELECTION_H__ */