]> Pileus Git - ~andy/gtk/blob - gtk/gtkselection.h
Changed LGPL address for FSF in all .h and .c files
[~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 #endif /* __cplusplus */
30
31 typedef struct _GtkSelectionData GtkSelectioData;
32
33 /* a callback function that provides the selection. Arguments are:
34    widget: selection owner
35    offset: offset into selection
36    buffer: buffer into which to store selection 
37    length: length of buffer
38    bytes_after: (sizeof(selection) - offset - length ) (return)
39    data:   callback data */
40
41 typedef void (*GtkSelectionFunction) (GtkWidget *widget, 
42                                       GtkSelectionData *selection_data,
43                                       gpointer data);
44
45 /* Public interface */
46
47 gint gtk_selection_owner_set (GtkWidget           *widget,
48                               GdkAtom              selection,
49                               guint32              time);
50 void gtk_selection_add_handler (GtkWidget           *widget, 
51                                 GdkAtom              selection,
52                                 GdkAtom              target,
53                                 GtkSelectionFunction function,
54                                 gpointer             data);
55 void gtk_selection_add_handler_full (GtkWidget           *widget, 
56                                      GdkAtom              selection,
57                                      GdkAtom              target,
58                                      GtkSelectionFunction function,
59                                      GtkCallbackMarshal   marshal,
60                                      gpointer             data,
61                                      GtkDestroyNotify     destroy);
62 gint gtk_selection_convert   (GtkWidget           *widget, 
63                               GdkAtom              selection, 
64                               GdkAtom              target,
65                               guint32              time);
66
67
68 void gtk_selection_data_set (GtkSelectionData *selection_data,
69                              GdkAtom           type,
70                              gint              format,
71                              guchar           *data,
72                              gint              length);
73
74 /* Called when a widget is destroyed */
75
76 void gtk_selection_remove_all      (GtkWidget *widget);
77
78 /* Event handlers */
79
80 gint gtk_selection_clear           (GtkWidget         *widget,
81                                     GdkEventSelection *event);
82 gint gtk_selection_request         (GtkWidget         *widget,
83                                     GdkEventSelection *event);
84 gint gtk_selection_incr_event      (GdkWindow         *window,
85                                     GdkEventProperty  *event);
86 gint gtk_selection_notify          (GtkWidget         *widget,
87                                     GdkEventSelection *event);
88 gint gtk_selection_property_notify (GtkWidget         *widget,
89                                     GdkEventProperty  *event);
90
91
92
93 #ifdef __cplusplus
94 }
95 #endif /* __cplusplus */
96
97
98 #endif /* __GTK_SELECTION_H__ */