]> Pileus Git - ~andy/gtk/blob - gtk/gtkselection.h
Move GtkSelection docs inline
[~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 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.
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  * Lesser General Public License for more details.
13  *
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.
18  */
19
20 /*
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/.
25  */
26
27 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #ifndef __GTK_SELECTION_H__
32 #define __GTK_SELECTION_H__
33
34 #include <gtk/gtkwidget.h>
35 #include <gtk/gtktextiter.h>
36
37 G_BEGIN_DECLS
38
39 /**
40  * GtkTargetList:
41  *
42  * A #GtkTargetList structure is a reference counted list
43  * of #GtkTargetPair. It is used to represent the same
44  * information as a table of #GtkTargetEntry, but in
45  * an efficient form. This structure should be treated as
46  * opaque.
47  */
48 typedef struct _GtkTargetList  GtkTargetList;
49 typedef struct _GtkTargetEntry GtkTargetEntry;
50
51 #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
52 #define GTK_TYPE_TARGET_LIST    (gtk_target_list_get_type ())
53
54 /**
55  * GtkTargetEntry:
56  * @target: a string representation of the target type
57  * @flags: #GtkTargetFlags for DND
58  * @info: an application-assigned integer ID which will
59  *     get passed as a parater to e.g the #GtkWiget::selection-get
60  *     signal. It allows the application to identify the target
61  *     type without extensive string compares.
62  *
63  * A #GtkTargetEntry structure represents a single type of
64  * data than can be supplied for by a widget for a selection
65  * or for supplied or received during drag-and-drop.
66  */
67 struct _GtkTargetEntry
68 {
69   gchar *target;
70   guint  flags;
71   guint  info;
72 };
73
74 GType          gtk_target_list_get_type  (void) G_GNUC_CONST;
75 GtkTargetList *gtk_target_list_new       (const GtkTargetEntry *targets,
76                                           guint                 ntargets);
77 GtkTargetList *gtk_target_list_ref       (GtkTargetList  *list);
78 void           gtk_target_list_unref     (GtkTargetList  *list);
79 void           gtk_target_list_add       (GtkTargetList  *list,
80                                           GdkAtom         target,
81                                           guint           flags,
82                                           guint           info);
83 void           gtk_target_list_add_text_targets      (GtkTargetList  *list,
84                                                       guint           info);
85 void           gtk_target_list_add_rich_text_targets (GtkTargetList  *list,
86                                                       guint           info,
87                                                       gboolean        deserializable,
88                                                       GtkTextBuffer  *buffer);
89 void           gtk_target_list_add_image_targets     (GtkTargetList  *list,
90                                                       guint           info,
91                                                       gboolean        writable);
92 void           gtk_target_list_add_uri_targets       (GtkTargetList  *list,
93                                                       guint           info);
94 void           gtk_target_list_add_table (GtkTargetList        *list,
95                                           const GtkTargetEntry *targets,
96                                           guint                 ntargets);
97 void           gtk_target_list_remove    (GtkTargetList  *list,
98                                           GdkAtom         target);
99 gboolean       gtk_target_list_find      (GtkTargetList  *list,
100                                           GdkAtom         target,
101                                           guint          *info);
102
103 GtkTargetEntry * gtk_target_table_new_from_list (GtkTargetList  *list,
104                                                  gint           *n_targets);
105 void             gtk_target_table_free          (GtkTargetEntry *targets,
106                                                  gint            n_targets);
107
108 gboolean gtk_selection_owner_set             (GtkWidget  *widget,
109                                               GdkAtom     selection,
110                                               guint32     time_);
111 gboolean gtk_selection_owner_set_for_display (GdkDisplay *display,
112                                               GtkWidget  *widget,
113                                               GdkAtom     selection,
114                                               guint32     time_);
115
116 void     gtk_selection_add_target    (GtkWidget            *widget,
117                                       GdkAtom               selection,
118                                       GdkAtom               target,
119                                       guint                 info);
120 void     gtk_selection_add_targets   (GtkWidget            *widget,
121                                       GdkAtom               selection,
122                                       const GtkTargetEntry *targets,
123                                       guint                 ntargets);
124 void     gtk_selection_clear_targets (GtkWidget            *widget,
125                                       GdkAtom               selection);
126 gboolean gtk_selection_convert       (GtkWidget            *widget,
127                                       GdkAtom               selection,
128                                       GdkAtom               target,
129                                       guint32               time_);
130 void     gtk_selection_remove_all    (GtkWidget             *widget);
131
132 GdkAtom       gtk_selection_data_get_selection (const GtkSelectionData *selection_data);
133 GdkAtom       gtk_selection_data_get_target    (const GtkSelectionData *selection_data);
134 GdkAtom       gtk_selection_data_get_data_type (const GtkSelectionData *selection_data);
135 gint          gtk_selection_data_get_format    (const GtkSelectionData *selection_data);
136 const guchar *gtk_selection_data_get_data      (const GtkSelectionData *selection_data);
137 gint          gtk_selection_data_get_length    (const GtkSelectionData *selection_data);
138 const guchar *gtk_selection_data_get_data_with_length
139                                                (const GtkSelectionData *selection_data,
140                                                 gint                   *length);
141
142 GdkDisplay   *gtk_selection_data_get_display   (const GtkSelectionData *selection_data);
143
144 void     gtk_selection_data_set      (GtkSelectionData     *selection_data,
145                                       GdkAtom               type,
146                                       gint                  format,
147                                       const guchar         *data,
148                                       gint                  length);
149 gboolean gtk_selection_data_set_text (GtkSelectionData     *selection_data,
150                                       const gchar          *str,
151                                       gint                  len);
152 guchar * gtk_selection_data_get_text (const GtkSelectionData     *selection_data);
153 gboolean gtk_selection_data_set_pixbuf   (GtkSelectionData  *selection_data,
154                                           GdkPixbuf         *pixbuf);
155 GdkPixbuf *gtk_selection_data_get_pixbuf (const GtkSelectionData  *selection_data);
156 gboolean gtk_selection_data_set_uris (GtkSelectionData     *selection_data,
157                                       gchar               **uris);
158 gchar  **gtk_selection_data_get_uris (const GtkSelectionData     *selection_data);
159
160 gboolean gtk_selection_data_get_targets          (const GtkSelectionData  *selection_data,
161                                                   GdkAtom          **targets,
162                                                   gint              *n_atoms);
163 gboolean gtk_selection_data_targets_include_text (const GtkSelectionData  *selection_data);
164 gboolean gtk_selection_data_targets_include_rich_text (const GtkSelectionData *selection_data,
165                                                        GtkTextBuffer    *buffer);
166 gboolean gtk_selection_data_targets_include_image (const GtkSelectionData  *selection_data,
167                                                    gboolean           writable);
168 gboolean gtk_selection_data_targets_include_uri  (const GtkSelectionData  *selection_data);
169 gboolean gtk_targets_include_text                (GdkAtom       *targets,
170                                                   gint           n_targets);
171 gboolean gtk_targets_include_rich_text           (GdkAtom       *targets,
172                                                   gint           n_targets,
173                                                   GtkTextBuffer *buffer);
174 gboolean gtk_targets_include_image               (GdkAtom       *targets,
175                                                   gint           n_targets,
176                                                   gboolean       writable);
177 gboolean gtk_targets_include_uri                 (GdkAtom       *targets,
178                                                   gint           n_targets);
179
180
181 GType             gtk_selection_data_get_type (void) G_GNUC_CONST;
182 GtkSelectionData *gtk_selection_data_copy     (const GtkSelectionData *data);
183 void              gtk_selection_data_free     (GtkSelectionData *data);
184
185 GType             gtk_target_entry_get_type    (void) G_GNUC_CONST;
186 GtkTargetEntry   *gtk_target_entry_new        (const gchar    *target,
187                                                guint           flags,
188                                                guint           info);
189 GtkTargetEntry   *gtk_target_entry_copy       (GtkTargetEntry *data);
190 void              gtk_target_entry_free       (GtkTargetEntry *data);
191
192 G_END_DECLS
193
194 #endif /* __GTK_SELECTION_H__ */