]> Pileus Git - ~andy/gtk/blob - gtk/gtkselection.h
92aa12b016cfb7efb308c02f5ca26abdf9f27c76
[~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 Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 #ifndef __GTK_SELECTION_H__
19 #define __GTK_SELECTION_H__
20
21
22 #include <gdk/gdk.h>
23 #include <gtk/gtkenums.h>
24 #include <gtk/gtkwidget.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29
30 typedef struct _GtkSelectionData GtkSelectioData;
31
32 /* a callback function that provides the selection. Arguments are:
33    widget: selection owner
34    offset: offset into selection
35    buffer: buffer into which to store selection 
36    length: length of buffer
37    bytes_after: (sizeof(selection) - offset - length ) (return)
38    data:   callback data */
39
40 typedef void (*GtkSelectionFunction) (GtkWidget *widget, 
41                                       GtkSelectionData *selection_data,
42                                       gpointer data);
43
44 /* Public interface */
45
46 gint gtk_selection_owner_set (GtkWidget           *widget,
47                               GdkAtom              selection,
48                               guint32              time);
49 void gtk_selection_add_handler (GtkWidget           *widget, 
50                                 GdkAtom              selection,
51                                 GdkAtom              target,
52                                 GtkSelectionFunction function,
53                                 gpointer             data);
54 void gtk_selection_add_handler_full (GtkWidget           *widget, 
55                                      GdkAtom              selection,
56                                      GdkAtom              target,
57                                      GtkSelectionFunction function,
58                                      GtkCallbackMarshal   marshal,
59                                      gpointer             data,
60                                      GtkDestroyNotify     destroy);
61 gint gtk_selection_convert   (GtkWidget           *widget, 
62                               GdkAtom              selection, 
63                               GdkAtom              target,
64                               guint32              time);
65
66
67 void gtk_selection_data_set (GtkSelectionData *selection_data,
68                              GdkAtom           type,
69                              gint              format,
70                              guchar           *data,
71                              gint              length);
72
73 /* Called when a widget is destroyed */
74
75 void gtk_selection_remove_all      (GtkWidget *widget);
76
77 /* Event handlers */
78
79 gint gtk_selection_clear           (GtkWidget         *widget,
80                                     GdkEventSelection *event);
81 gint gtk_selection_request         (GtkWidget         *widget,
82                                     GdkEventSelection *event);
83 gint gtk_selection_incr_event      (GdkWindow         *window,
84                                     GdkEventProperty  *event);
85 gint gtk_selection_notify          (GtkWidget         *widget,
86                                     GdkEventSelection *event);
87 gint gtk_selection_property_notify (GtkWidget         *widget,
88                                     GdkEventProperty  *event);
89
90
91
92 #ifdef __cplusplus
93 }
94 #endif /* __cplusplus */
95
96
97 #endif /* __GTK_SELECTION_H__ */