2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gtk-Selections.html
27 * outFile = Selections
50 * - GdkDisplay* -> Display
51 * - GdkPixbuf* -> Pixbuf
52 * - GtkWidget* -> Widget
56 module gtk
.Selections
;
58 private import gtk
.gtktypes
;
60 private import lib
.gtk
;
62 private import glib
.Str
;
63 private import gtk
.Widget
;
64 private import gdk
.Display
;
65 private import gdk
.Pixbuf
;
66 private import glib
.Str
;
70 * The selection mechanism provides the basis for different types
71 * of communication between processes. In particular, drag and drop and
72 * GtkClipboard work via selections. You will very seldom or
73 * never need to use most of the functions in this section directly;
74 * GtkClipboard provides a nicer interface to the same functionality.
75 * Some of the datatypes defined this section are used in
76 * the GtkClipboard and drag-and-drop API's as well. The
77 * GtkTargetEntry structure and GtkTargetList objects represent
78 * lists of data types that are supported when sending or
79 * receiving data. The GtkSelectionData object is used to
80 * store a chunk of data along with the data type and other
81 * associated information.
83 public class Selections
93 * Creates a new GtkTargetList from an array of GtkTargetEntry.
95 * Pointer to an array of GtkTargetEntry
97 * number of entries in targets.
99 * the new GtkTargetList.
101 public static GtkTargetList
* targetListNew(GtkTargetEntry
* targets
, uint ntargets
)
103 // GtkTargetList* gtk_target_list_new (const GtkTargetEntry *targets, guint ntargets);
104 return gtk_target_list_new(targets
, ntargets
);
108 * Increases the reference count of a GtkTargetList by one.
112 * the passed in GtkTargetList.
114 public static GtkTargetList
* targetListRef(GtkTargetList
* list
)
116 // GtkTargetList* gtk_target_list_ref (GtkTargetList *list);
117 return gtk_target_list_ref(list
);
121 * Decreases the reference count of a GtkTargetList by one.
122 * If the resulting reference count is zero, frees the list.
126 public static void targetListUnref(GtkTargetList
* list
)
128 // void gtk_target_list_unref (GtkTargetList *list);
129 gtk_target_list_unref(list
);
133 * Appends another target to a GtkTargetList.
137 * the interned atom representing the target
139 * the flags for this target
141 * an ID that will be passed back to the application
143 public static void targetListAdd(GtkTargetList
* list
, GdkAtom target
, uint flags
, uint info
)
145 // void gtk_target_list_add (GtkTargetList *list, GdkAtom target, guint flags, guint info);
146 gtk_target_list_add(list
, target
, flags
, info
);
150 * Prepends a table of GtkTargetEntry to a target list.
154 * the table of GtkTargetEntry
156 * number of targets in the table
158 public static void targetListAddTable(GtkTargetList
* list
, GtkTargetEntry
* targets
, uint ntargets
)
160 // void gtk_target_list_add_table (GtkTargetList *list, const GtkTargetEntry *targets, guint ntargets);
161 gtk_target_list_add_table(list
, targets
, ntargets
);
165 * Appends the text targets supported by GtkSelection to
166 * the target list. All targets are added with the same info.
170 * an ID that will be passed back to the application
173 public static void targetListAddTextTargets(GtkTargetList
* list
, uint info
)
175 // void gtk_target_list_add_text_targets (GtkTargetList *list, guint info);
176 gtk_target_list_add_text_targets(list
, info
);
180 * Appends the image targets supported by GtkSelection to
181 * the target list. All targets are added with the same info.
185 * an ID that will be passed back to the application
187 * whether to add only targets for which GTK+ knows
188 * how to convert a pixbuf into the format
191 public static void targetListAddImageTargets(GtkTargetList
* list
, uint info
, int writable
)
193 // void gtk_target_list_add_image_targets (GtkTargetList *list, guint info, gboolean writable);
194 gtk_target_list_add_image_targets(list
, info
, writable
);
198 * Appends the URI targets supported by GtkSelection to
199 * the target list. All targets are added with the same info.
203 * an ID that will be passed back to the application
206 public static void targetListAddUriTargets(GtkTargetList
* list
, uint info
)
208 // void gtk_target_list_add_uri_targets (GtkTargetList *list, guint info);
209 gtk_target_list_add_uri_targets(list
, info
);
213 * Appends the rich text targets registered with
214 * gtk_text_buffer_register_serialize_format() or
215 * gtk_text_buffer_register_deserialize_format() to the target list. All
216 * targets are added with the same info.
220 * an ID that will be passed back to the application
222 * if TRUE, then deserializable rich text formats
223 * will be added, serializable formats otherwise.
228 public static void targetListAddRichTextTargets(GtkTargetList
* list
, uint info
, int deserializable
, GtkTextBuffer
* buffer
)
230 // void gtk_target_list_add_rich_text_targets (GtkTargetList *list, guint info, gboolean deserializable, GtkTextBuffer *buffer);
231 gtk_target_list_add_rich_text_targets(list
, info
, deserializable
, buffer
);
235 * Removes a target from a target list.
239 * the interned atom representing the target
241 public static void targetListRemove(GtkTargetList
* list
, GdkAtom target
)
243 // void gtk_target_list_remove (GtkTargetList *list, GdkAtom target);
244 gtk_target_list_remove(list
, target
);
248 * Looks up a given target in a GtkTargetList.
252 * an interned atom representing the target to search for
254 * a pointer to the location to store application info for target
256 * TRUE if the target was found, otherwise FALSE
258 public static int targetListFind(GtkTargetList
* list
, GdkAtom target
, uint* info
)
260 // gboolean gtk_target_list_find (GtkTargetList *list, GdkAtom target, guint *info);
261 return gtk_target_list_find(list
, target
, info
);
265 * This function frees a target table as returned by
266 * gtk_target_table_new_from_list()
268 * a GtkTargetEntry array
270 * the number of entries in the array
273 public static void targetTableFree(GtkTargetEntry
* targets
, int nTargets
)
275 // void gtk_target_table_free (GtkTargetEntry *targets, gint n_targets);
276 gtk_target_table_free(targets
, nTargets
);
280 * This function creates an GtkTargetEntry array that contains the
281 * same targets as the passed list. The returned table is newly
282 * allocated and should be freed using gtk_target_table_free() when no
287 * return location for the number ot targets in the table
292 public static GtkTargetEntry
* targetTableNewFromList(GtkTargetList
* list
, int* nTargets
)
294 // GtkTargetEntry* gtk_target_table_new_from_list (GtkTargetList *list, gint *n_targets);
295 return gtk_target_table_new_from_list(list
, nTargets
);
299 * Claims ownership of a given selection for a particular widget,
300 * or, if widget is NULL, release ownership of the selection.
302 * a GtkWidget, or NULL.
304 * an interned atom representing the selection to claim
306 * timestamp with which to claim the selection
308 * TRUE if the operation succeeded
310 public static int selectionOwnerSet(Widget widget
, GdkAtom selection
, uint time
)
312 // gboolean gtk_selection_owner_set (GtkWidget *widget, GdkAtom selection, guint32 time_);
313 return gtk_selection_owner_set((widget
is null) ?
null : widget
.getWidgetStruct(), selection
, time
);
317 * Claim ownership of a given selection for a particular widget, or,
318 * if widget is NULL, release ownership of the selection.
320 * the Gdkdisplay where the selection is set
322 * new selection owner (a GdkWidget), or NULL.
324 * an interned atom representing the selection to claim.
326 * timestamp with which to claim the selection
328 * TRUE if the operation succeeded
331 public static int selectionOwnerSetForDisplay(Display display
, Widget widget
, GdkAtom selection
, uint time
)
333 // gboolean gtk_selection_owner_set_for_display (GdkDisplay *display, GtkWidget *widget, GdkAtom selection, guint32 time_);
334 return gtk_selection_owner_set_for_display((display
is null) ?
null : display
.getDisplayStruct(), (widget
is null) ?
null : widget
.getWidgetStruct(), selection
, time
);
338 * Appends a specified target to the list of supported targets for a
339 * given widget and selection.
347 * A unsigned integer which will be passed back to the application.
349 public static void selectionAddTarget(Widget widget
, GdkAtom selection
, GdkAtom target
, uint info
)
351 // void gtk_selection_add_target (GtkWidget *widget, GdkAtom selection, GdkAtom target, guint info);
352 gtk_selection_add_target((widget
is null) ?
null : widget
.getWidgetStruct(), selection
, target
, info
);
356 * Prepends a table of targets to the list of supported targets
357 * for a given widget and selection.
363 * a table of targets to add
365 * number of entries in targets
367 public static void selectionAddTargets(Widget widget
, GdkAtom selection
, GtkTargetEntry
* targets
, uint ntargets
)
369 // void gtk_selection_add_targets (GtkWidget *widget, GdkAtom selection, const GtkTargetEntry *targets, guint ntargets);
370 gtk_selection_add_targets((widget
is null) ?
null : widget
.getWidgetStruct(), selection
, targets
, ntargets
);
374 * Remove all targets registered for the given selection for the
379 * an atom representing a selection
381 public static void selectionClearTargets(Widget widget
, GdkAtom selection
)
383 // void gtk_selection_clear_targets (GtkWidget *widget, GdkAtom selection);
384 gtk_selection_clear_targets((widget
is null) ?
null : widget
.getWidgetStruct(), selection
);
388 * Requests the contents of a selection. When received,
389 * a "selection_received" signal will be generated.
391 * The widget which acts as requestor
393 * Which selection to get
395 * Form of information desired (e.g., STRING)
397 * Time of request (usually of triggering event)
398 * In emergency, you could use GDK_CURRENT_TIME
400 * TRUE if requested succeeded. FALSE if we could not process
401 * request. (e.g., there was already a request in process for
404 public static int selectionConvert(Widget widget
, GdkAtom selection
, GdkAtom target
, uint time
)
406 // gboolean gtk_selection_convert (GtkWidget *widget, GdkAtom selection, GdkAtom target, guint32 time_);
407 return gtk_selection_convert((widget
is null) ?
null : widget
.getWidgetStruct(), selection
, target
, time
);
411 * Stores new data into a GtkSelectionData object. Should
412 * only be called from a selection handler callback.
413 * Zero-terminates the stored data.
415 * a pointer to a GtkSelectionData structure.
417 * the type of selection data
419 * format (number of bits in a unit)
421 * pointer to the data (will be copied)
425 public static void selectionDataSet(GtkSelectionData
* selectionData
, GdkAtom type
, int format
, char* data
, int length
)
427 // void gtk_selection_data_set (GtkSelectionData *selection_data, GdkAtom type, gint format, const guchar *data, gint length);
428 gtk_selection_data_set(selectionData
, type
, format
, data
, length
);
432 * Sets the contents of the selection from a UTF-8 encoded string.
433 * The string is converted to the form determined by
434 * selection_data->target.
440 * the length of str, or -1 if str is nul-terminated.
442 * TRUE if the selection was successfully set,
445 public static int selectionDataSetText(GtkSelectionData
* selectionData
, char[] str, int len
)
447 // gboolean gtk_selection_data_set_text (GtkSelectionData *selection_data, const gchar *str, gint len);
448 return gtk_selection_data_set_text(selectionData
, Str
.toStringz(str), len
);
452 * Gets the contents of the selection data as a UTF-8 string.
456 * if the selection data contained a recognized
457 * text type and it could be converted to UTF-8, a newly allocated
458 * string containing the converted text, otherwise NULL.
459 * If the result is non-NULL it must be freed with g_free().
461 public static char* selectionDataGetText(GtkSelectionData
* selectionData
)
463 // guchar* gtk_selection_data_get_text (GtkSelectionData *selection_data);
464 return gtk_selection_data_get_text(selectionData
);
468 * Sets the contents of the selection from a GdkPixbuf
469 * The pixbuf is converted to the form determined by
470 * selection_data->target.
476 * TRUE if the selection was successfully set,
480 public static int selectionDataSetPixbuf(GtkSelectionData
* selectionData
, Pixbuf pixbuf
)
482 // gboolean gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data, GdkPixbuf *pixbuf);
483 return gtk_selection_data_set_pixbuf(selectionData
, (pixbuf
is null) ?
null : pixbuf
.getPixbufStruct());
487 * Gets the contents of the selection data as a GdkPixbuf.
491 * if the selection data contained a recognized
492 * image type and it could be converted to a GdkPixbuf, a
493 * newly allocated pixbuf is returned, otherwise NULL.
494 * If the result is non-NULL it must be freed with g_object_unref().
497 public static Pixbuf
selectionDataGetPixbuf(GtkSelectionData
* selectionData
)
499 // GdkPixbuf* gtk_selection_data_get_pixbuf (GtkSelectionData *selection_data);
500 return new Pixbuf( gtk_selection_data_get_pixbuf(selectionData
) );
504 * Sets the contents of the selection from a list of URIs.
505 * The string is converted to the form determined by
506 * selection_data->target.
510 * a NULL-terminated array of strings hilding URIs
512 * TRUE if the selection was successfully set,
516 public static int selectionDataSetUris(GtkSelectionData
* selectionData
, char** uris
)
518 // gboolean gtk_selection_data_set_uris (GtkSelectionData *selection_data, gchar **uris);
519 return gtk_selection_data_set_uris(selectionData
, uris
);
523 * Gets the contents of the selection data as array of URIs.
527 * if the selection data contains a list of
528 * URIs, a newly allocated NULL-terminated string array
529 * containing the URIs, otherwise NULL. If the result is
530 * non-NULL it must be freed with g_strfreev().
533 public static char** selectionDataGetUris(GtkSelectionData
* selectionData
)
535 // gchar** gtk_selection_data_get_uris (GtkSelectionData *selection_data);
536 return gtk_selection_data_get_uris(selectionData
);
540 * Gets the contents of selection_data as an array of targets.
541 * This can be used to interpret the results of getting
542 * the standard TARGETS target that is always supplied for
545 * a GtkSelectionData object
547 * location to store an array of targets. The result
548 * stored here must be freed with g_free().
550 * location to store number of items in targets.
552 * TRUE if selection_data contains a valid
553 * array of targets, otherwise FALSE.
555 public static int selectionDataGetTargets(GtkSelectionData
* selectionData
, GdkAtom
** targets
, int* nAtoms
)
557 // gboolean gtk_selection_data_get_targets (GtkSelectionData *selection_data, GdkAtom **targets, gint *n_atoms);
558 return gtk_selection_data_get_targets(selectionData
, targets
, nAtoms
);
562 * Given a GtkSelectionData object holding a list of targets,
563 * determines if any of the targets in targets can be used to
564 * provide a GdkPixbuf.
566 * a GtkSelectionData object
568 * whether to accept only targets for which GTK+ knows
569 * how to convert a pixbuf into the format
571 * TRUE if selection_data holds a list of targets,
572 * and a suitable target for images is included, otherwise FALSE.
575 public static int selectionDataTargetsIncludeImage(GtkSelectionData
* selectionData
, int writable
)
577 // gboolean gtk_selection_data_targets_include_image (GtkSelectionData *selection_data, gboolean writable);
578 return gtk_selection_data_targets_include_image(selectionData
, writable
);
582 * Given a GtkSelectionData object holding a list of targets,
583 * determines if any of the targets in targets can be used to
586 * a GtkSelectionData object
588 * TRUE if selection_data holds a list of targets,
589 * and a suitable target for text is included, otherwise FALSE.
591 public static int selectionDataTargetsIncludeText(GtkSelectionData
* selectionData
)
593 // gboolean gtk_selection_data_targets_include_text (GtkSelectionData *selection_data);
594 return gtk_selection_data_targets_include_text(selectionData
);
598 * Given a GtkSelectionData object holding a list of targets,
599 * determines if any of the targets in targets can be used to
600 * provide a list or URIs.
602 * a GtkSelectionData object
604 * TRUE if selection_data holds a list of targets,
605 * and a suitable target for text is included, otherwise FALSE.
608 public static int selectionDataTargetsIncludeUri(GtkSelectionData
* selectionData
)
610 // gboolean gtk_selection_data_targets_include_uri (GtkSelectionData *selection_data);
611 return gtk_selection_data_targets_include_uri(selectionData
);
615 * Given a GtkSelectionData object holding a list of targets,
616 * determines if any of the targets in targets can be used to
619 * a GtkSelectionData object
623 * TRUE if selection_data holds a list of targets,
624 * and a suitable target for rich text is included,
628 public static int selectionDataTargetsIncludeRichText(GtkSelectionData
* selectionData
, GtkTextBuffer
* buffer
)
630 // gboolean gtk_selection_data_targets_include_rich_text (GtkSelectionData *selection_data, GtkTextBuffer *buffer);
631 return gtk_selection_data_targets_include_rich_text(selectionData
, buffer
);
635 * Determines if any of the targets in targets can be used to
636 * provide a GdkPixbuf.
638 * an array of GdkAtoms
640 * the length of targets
642 * whether to accept only targets for which GTK+ knows
643 * how to convert a pixbuf into the format
645 * TRUE if targets include a suitable target for images,
649 public static int targetsIncludeImage(GdkAtom
* targets
, int nTargets
, int writable
)
651 // gboolean gtk_targets_include_image (GdkAtom *targets, gint n_targets, gboolean writable);
652 return gtk_targets_include_image(targets
, nTargets
, writable
);
656 * Determines if any of the targets in targets can be used to
659 * an array of GdkAtoms
661 * the length of targets
663 * TRUE if targets include a suitable target for text,
667 public static int targetsIncludeText(GdkAtom
* targets
, int nTargets
)
669 // gboolean gtk_targets_include_text (GdkAtom *targets, gint n_targets);
670 return gtk_targets_include_text(targets
, nTargets
);
674 * Determines if any of the targets in targets can be used to
675 * provide an uri list.
677 * an array of GdkAtoms
679 * the length of targets
681 * TRUE if targets include a suitable target for uri lists,
685 public static int targetsIncludeUri(GdkAtom
* targets
, int nTargets
)
687 // gboolean gtk_targets_include_uri (GdkAtom *targets, gint n_targets);
688 return gtk_targets_include_uri(targets
, nTargets
);
692 * Determines if any of the targets in targets can be used to
695 * an array of GdkAtoms
697 * the length of targets
701 * TRUE if targets include a suitable target for rich text,
705 public static int targetsIncludeRichText(GdkAtom
* targets
, int nTargets
, GtkTextBuffer
* buffer
)
707 // gboolean gtk_targets_include_rich_text (GdkAtom *targets, gint n_targets, GtkTextBuffer *buffer);
708 return gtk_targets_include_rich_text(targets
, nTargets
, buffer
);
712 * Removes all handlers and unsets ownership of all
713 * selections for a widget. Called when widget is being
714 * destroyed. This function will not generally be
715 * called by applications.
719 public static void selectionRemoveAll(Widget widget
)
721 // void gtk_selection_remove_all (GtkWidget *widget);
722 gtk_selection_remove_all((widget
is null) ?
null : widget
.getWidgetStruct());
727 * gtk_selection_clear has been deprecated since version 2.4 and should not be used in newly-written code. Instead of calling this function, chain up from
728 * your selection_clear_event handler. Calling this function
729 * from any other context is illegal.
730 * The default handler for the GtkWidget::selection_clear_event
737 * TRUE if the event was handled, otherwise false
740 public static int selectionClear(Widget widget
, GdkEventSelection
* event
)
742 // gboolean gtk_selection_clear (GtkWidget *widget, GdkEventSelection *event);
743 return gtk_selection_clear((widget
is null) ?
null : widget
.getWidgetStruct(), event
);
747 * Makes a copy of a GtkSelectionData structure and its data.
749 * a pointer to a GtkSelectionData structure.
751 * a pointer to a copy of data.
753 public static GtkSelectionData
* selectionDataCopy(GtkSelectionData
* data
)
755 // GtkSelectionData* gtk_selection_data_copy (GtkSelectionData *data);
756 return gtk_selection_data_copy(data
);
760 * Frees a GtkSelectionData structure returned from
761 * gtk_selection_data_copy().
763 * a pointer to a GtkSelectionData structure.
766 * Much of the operation of selections happens via
767 * signals for GtkWidget. In particular, if you are
768 * using the functions in this section, you may need
769 * to pay attention to ::selection_get,
770 * ::selection_received, and :selection_clear_event
773 public static void selectionDataFree(GtkSelectionData
* data
)
775 // void gtk_selection_data_free (GtkSelectionData *data);
776 gtk_selection_data_free(data
);