You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

222 lines
9.2 KiB

  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. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GTK+ Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  26. #error "Only <gtk/gtk.h> can be included directly."
  27. #endif
  28. #ifndef __GTK_SELECTION_H__
  29. #define __GTK_SELECTION_H__
  30. #include <gtk/gtkwidget.h>
  31. #include <gtk/gtktextiter.h>
  32. G_BEGIN_DECLS
  33. typedef struct _GtkTargetList GtkTargetList;
  34. typedef struct _GtkTargetEntry GtkTargetEntry;
  35. #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
  36. #define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type ())
  37. /* The contents of a selection are returned in a GtkSelectionData
  38. * structure. selection/target identify the request. type specifies
  39. * the type of the return; if length < 0, and the data should be
  40. * ignored. This structure has object semantics - no fields should be
  41. * modified directly, they should not be created directly, and
  42. * pointers to them should not be stored beyond the duration of a
  43. * callback. (If the last is changed, we'll need to add reference
  44. * counting.) The time field gives the timestamp at which the data was
  45. * sent.
  46. */
  47. struct _GtkSelectionData
  48. {
  49. GdkAtom GSEAL (selection);
  50. GdkAtom GSEAL (target);
  51. GdkAtom GSEAL (type);
  52. gint GSEAL (format);
  53. guchar *GSEAL (data);
  54. gint GSEAL (length);
  55. GdkDisplay *GSEAL (display);
  56. };
  57. struct _GtkTargetEntry {
  58. gchar *target;
  59. guint flags;
  60. guint info;
  61. };
  62. /* These structures not public, and are here only for the convenience of
  63. * gtkdnd.c
  64. */
  65. typedef struct _GtkTargetPair GtkTargetPair;
  66. /* This structure is a list of destinations, and associated guint id's */
  67. struct _GtkTargetList {
  68. GList *list;
  69. guint ref_count;
  70. };
  71. struct _GtkTargetPair {
  72. GdkAtom target;
  73. guint flags;
  74. guint info;
  75. };
  76. GtkTargetList *gtk_target_list_new (const GtkTargetEntry *targets,
  77. guint ntargets);
  78. GtkTargetList *gtk_target_list_ref (GtkTargetList *list);
  79. void gtk_target_list_unref (GtkTargetList *list);
  80. void gtk_target_list_add (GtkTargetList *list,
  81. GdkAtom target,
  82. guint flags,
  83. guint info);
  84. void gtk_target_list_add_text_targets (GtkTargetList *list,
  85. guint info);
  86. void gtk_target_list_add_rich_text_targets (GtkTargetList *list,
  87. guint info,
  88. gboolean deserializable,
  89. GtkTextBuffer *buffer);
  90. void gtk_target_list_add_image_targets (GtkTargetList *list,
  91. guint info,
  92. gboolean writable);
  93. void gtk_target_list_add_uri_targets (GtkTargetList *list,
  94. guint info);
  95. void gtk_target_list_add_table (GtkTargetList *list,
  96. const GtkTargetEntry *targets,
  97. guint ntargets);
  98. void gtk_target_list_remove (GtkTargetList *list,
  99. GdkAtom target);
  100. gboolean gtk_target_list_find (GtkTargetList *list,
  101. GdkAtom target,
  102. guint *info);
  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. /* Public interface */
  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. void gtk_selection_add_target (GtkWidget *widget,
  116. GdkAtom selection,
  117. GdkAtom target,
  118. guint info);
  119. void gtk_selection_add_targets (GtkWidget *widget,
  120. GdkAtom selection,
  121. const GtkTargetEntry *targets,
  122. guint ntargets);
  123. void gtk_selection_clear_targets (GtkWidget *widget,
  124. GdkAtom selection);
  125. gboolean gtk_selection_convert (GtkWidget *widget,
  126. GdkAtom selection,
  127. GdkAtom target,
  128. guint32 time_);
  129. GdkAtom gtk_selection_data_get_selection (GtkSelectionData *selection_data);
  130. GdkAtom gtk_selection_data_get_target (GtkSelectionData *selection_data);
  131. GdkAtom gtk_selection_data_get_data_type (GtkSelectionData *selection_data);
  132. gint gtk_selection_data_get_format (GtkSelectionData *selection_data);
  133. const guchar *gtk_selection_data_get_data (GtkSelectionData *selection_data);
  134. gint gtk_selection_data_get_length (GtkSelectionData *selection_data);
  135. GdkDisplay *gtk_selection_data_get_display (GtkSelectionData *selection_data);
  136. void gtk_selection_data_set (GtkSelectionData *selection_data,
  137. GdkAtom type,
  138. gint format,
  139. const guchar *data,
  140. gint length);
  141. gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data,
  142. const gchar *str,
  143. gint len);
  144. guchar * gtk_selection_data_get_text (GtkSelectionData *selection_data);
  145. gboolean gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
  146. GdkPixbuf *pixbuf);
  147. GdkPixbuf *gtk_selection_data_get_pixbuf (GtkSelectionData *selection_data);
  148. gboolean gtk_selection_data_set_uris (GtkSelectionData *selection_data,
  149. gchar **uris);
  150. gchar **gtk_selection_data_get_uris (GtkSelectionData *selection_data);
  151. gboolean gtk_selection_data_get_targets (GtkSelectionData *selection_data,
  152. GdkAtom **targets,
  153. gint *n_atoms);
  154. gboolean gtk_selection_data_targets_include_text (GtkSelectionData *selection_data);
  155. gboolean gtk_selection_data_targets_include_rich_text (GtkSelectionData *selection_data,
  156. GtkTextBuffer *buffer);
  157. gboolean gtk_selection_data_targets_include_image (GtkSelectionData *selection_data,
  158. gboolean writable);
  159. gboolean gtk_selection_data_targets_include_uri (GtkSelectionData *selection_data);
  160. gboolean gtk_targets_include_text (GdkAtom *targets,
  161. gint n_targets);
  162. gboolean gtk_targets_include_rich_text (GdkAtom *targets,
  163. gint n_targets,
  164. GtkTextBuffer *buffer);
  165. gboolean gtk_targets_include_image (GdkAtom *targets,
  166. gint n_targets,
  167. gboolean writable);
  168. gboolean gtk_targets_include_uri (GdkAtom *targets,
  169. gint n_targets);
  170. /* Called when a widget is destroyed */
  171. void gtk_selection_remove_all (GtkWidget *widget);
  172. /* Event handlers */
  173. #if !defined(GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
  174. gboolean gtk_selection_clear (GtkWidget *widget,
  175. GdkEventSelection *event);
  176. #endif
  177. gboolean _gtk_selection_request (GtkWidget *widget,
  178. GdkEventSelection *event);
  179. gboolean _gtk_selection_incr_event (GdkWindow *window,
  180. GdkEventProperty *event);
  181. gboolean _gtk_selection_notify (GtkWidget *widget,
  182. GdkEventSelection *event);
  183. gboolean _gtk_selection_property_notify (GtkWidget *widget,
  184. GdkEventProperty *event);
  185. GType gtk_selection_data_get_type (void) G_GNUC_CONST;
  186. GtkSelectionData *gtk_selection_data_copy (GtkSelectionData *data);
  187. void gtk_selection_data_free (GtkSelectionData *data);
  188. GType gtk_target_list_get_type (void) G_GNUC_CONST;
  189. G_END_DECLS
  190. #endif /* __GTK_SELECTION_H__ */