]> Pileus Git - ~andy/gtk/blob - gtk/gtkselection.h
Initial revision
[~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                                 GtkRemoveFunction    remove_func,
54                                 gpointer             data);
55 gint gtk_selection_convert   (GtkWidget           *widget, 
56                               GdkAtom              selection, 
57                               GdkAtom              target,
58                               guint32              time);
59
60
61 void gtk_selection_data_set (GtkSelectionData *selection_data,
62                              GdkAtom           type,
63                              gint              format,
64                              guchar           *data,
65                              gint              length);
66
67 /* Called when a widget is destroyed */
68
69 void gtk_selection_remove_all      (GtkWidget *widget);
70
71 /* Event handlers */
72
73 gint gtk_selection_clear           (GtkWidget         *widget,
74                                     GdkEventSelection *event);
75 gint gtk_selection_request         (GtkWidget         *widget,
76                                     GdkEventSelection *event);
77 gint gtk_selection_incr_event      (GdkWindow         *window,
78                                     GdkEventProperty  *event);
79 gint gtk_selection_notify          (GtkWidget         *widget,
80                                     GdkEventSelection *event);
81 gint gtk_selection_property_notify (GtkWidget         *widget,
82                                     GdkEventProperty  *event);
83
84
85
86 #ifdef __cplusplus
87 }
88 #endif /* __cplusplus */
89
90
91 #endif /* __GTK_SELECTION_H__ */