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