SelectionData

The selection mechanism provides the basis for different types of communication between processes. In particular, drag and drop and GtkClipboard work via selections. You will very seldom or never need to use most of the functions in this section directly; GtkClipboard provides a nicer interface to the same functionality.

Some of the datatypes defined this section are used in the GtkClipboard and drag-and-drop API's as well. The GtkTargetEntry structure and GtkTargetList objects represent lists of data types that are supported when sending or receiving data. The GtkSelectionData object is used to store a chunk of data along with the data type and other associated information.

Constructors

this
this(GtkSelectionData* gtkSelectionData)

Sets our main struct and passes it to the parent class

Destructor

~this
~this()
Undocumented in source.

Members

Functions

dataCopy
SelectionData dataCopy()

Makes a copy of a GtkSelectionData structure and its data.

dataFree
void dataFree()

Frees a GtkSelectionData structure returned from gtk_selection_data_copy().

dataGetData
char* dataGetData()

Retrieves the raw data of the selection. Since 2.14

dataGetDataType
GdkAtom dataGetDataType()

Retrieves the data type of the selection. Since 2.14

dataGetDataWithLength
char[] dataGetDataWithLength()

Retrieves the raw data of the selection along with its length.

dataGetDisplay
Display dataGetDisplay()

Retrieves the display of the selection. Since 2.14

dataGetFormat
int dataGetFormat()

Retrieves the format of the selection. Since 2.14

dataGetLength
int dataGetLength()

Retrieves the length of the raw data of the selection. Since 2.14

dataGetPixbuf
Pixbuf dataGetPixbuf()

Gets the contents of the selection data as a GdkPixbuf. Since 2.6

dataGetSelection
GdkAtom dataGetSelection()

Retrieves the selection GdkAtom of the selection data. Since 2.16

dataGetTarget
GdkAtom dataGetTarget()

Retrieves the target of the selection. Since 2.14

dataGetTargets
int dataGetTargets(GdkAtom[] targets)

Gets the contents of selection_data as an array of targets. This can be used to interpret the results of getting the standard TARGETS target that is always supplied for any selection.

dataGetText
char* dataGetText()

Gets the contents of the selection data as a UTF-8 string.

dataGetUris
string[] dataGetUris()

Gets the contents of the selection data as array of URIs. Since 2.6

dataSet
void dataSet(GdkAtom type, int format, char[] data)

Stores new data into a GtkSelectionData object. Should only be called from a selection handler callback. Zero-terminates the stored data.

dataSetPixbuf
int dataSetPixbuf(Pixbuf pixbuf)

Sets the contents of the selection from a GdkPixbuf The pixbuf is converted to the form determined by selection_data->target. Since 2.6

dataSetText
int dataSetText(string str)

Sets the contents of the selection from a UTF-8 encoded string. The string is converted to the form determined by selection_data->target.

dataSetUris
int dataSetUris(string[] uris)

Sets the contents of the selection from a list of URIs. The string is converted to the form determined by selection_data->target. Since 2.6

dataTargetsIncludeImage
int dataTargetsIncludeImage(int writable)

Given a GtkSelectionData object holding a list of targets, determines if any of the targets in targets can be used to provide a GdkPixbuf. Since 2.6

dataTargetsIncludeRichText
int dataTargetsIncludeRichText(TextBuffer buffer)

Given a GtkSelectionData object holding a list of targets, determines if any of the targets in targets can be used to provide rich text. Since 2.10

dataTargetsIncludeText
int dataTargetsIncludeText()

Given a GtkSelectionData object holding a list of targets, determines if any of the targets in targets can be used to provide text.

dataTargetsIncludeUri
int dataTargetsIncludeUri()

Given a GtkSelectionData object holding a list of targets, determines if any of the targets in targets can be used to provide a list or URIs. Since 2.10

getSelectionDataStruct
GtkSelectionData* getSelectionDataStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

Static functions

addTarget
void addTarget(Widget widget, GdkAtom selection, GdkAtom target, uint info)

Appends a specified target to the list of supported targets for a given widget and selection.

addTargets
void addTargets(Widget widget, GdkAtom selection, GtkTargetEntry[] targets)

Prepends a table of targets to the list of supported targets for a given widget and selection.

clearTargets
void clearTargets(Widget widget, GdkAtom selection)

Remove all targets registered for the given selection for the widget.

convert
int convert(Widget widget, GdkAtom selection, GdkAtom target, uint time)

Requests the contents of a selection. When received, a "selection-received" signal will be generated.

ownerSet
int ownerSet(Widget widget, GdkAtom selection, uint time)

Claims ownership of a given selection for a particular widget, or, if widget is NULL, release ownership of the selection.

ownerSetForDisplay
int ownerSetForDisplay(Display display, Widget widget, GdkAtom selection, uint time)

Claim ownership of a given selection for a particular widget, or, if widget is NULL, release ownership of the selection. Since 2.2

removeAll
void removeAll(Widget widget)

Removes all handlers and unsets ownership of all selections for a widget. Called when widget is being destroyed. This function will not generally be called by applications.

Variables

gtkSelectionData
GtkSelectionData* gtkSelectionData;

the main Gtk struct

Inherited Members

From Boxed

boxedCopy
void* boxedCopy(GType boxedType, void* srcBoxed)

Provide a copy of a boxed structure src_boxed which is of type boxed_type.

boxedFree
void boxedFree(GType boxedType, void* boxed)

Free the boxed structure boxed which is of type boxed_type.

boxedTypeRegisterStatic
GType boxedTypeRegisterStatic(string name, GBoxedCopyFunc boxedCopy, GBoxedFreeFunc boxedFree)

This function creates a new G_TYPE_BOXED derived type id for a new boxed type with name name. Boxed type handling functions have to be provided to copy and free opaque boxed structures of this type.

pointerTypeRegisterStatic
GType pointerTypeRegisterStatic(string name)

Creates a new G_TYPE_POINTER derived type id for a new pointer type with name name.

Meta