Selections

Description 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.

class Selections {}

Members

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.

clear
int clear(Widget widget, GdkEventSelection* event)

Warning 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 your selection-clear-event handler. Calling this function from any other context is illegal. The default handler for the "selection-clear-event" signal. Since 2.2

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.

dataCopy
GtkSelectionData* dataCopy(GtkSelectionData* data)

Makes a copy of a GtkSelectionData structure and its data.

dataFree
void dataFree(GtkSelectionData* data)

Frees a GtkSelectionData structure returned from gtk_selection_data_copy().

dataGetData
char* dataGetData(GtkSelectionData* selectionData)

Retrieves the raw data of the selection. Since 2.14

dataGetDataType
GdkAtom dataGetDataType(GtkSelectionData* selectionData)

Retrieves the data type of the selection. Since 2.14

dataGetDisplay
Display dataGetDisplay(GtkSelectionData* selectionData)

Retrieves the display of the selection. Since 2.14

dataGetFormat
int dataGetFormat(GtkSelectionData* selectionData)

Retrieves the format of the selection. Since 2.14

dataGetLength
int dataGetLength(GtkSelectionData* selectionData)

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

dataGetPixbuf
Pixbuf dataGetPixbuf(GtkSelectionData* selectionData)

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

dataGetSelection
GdkAtom dataGetSelection(GtkSelectionData* selectionData)

Retrieves the selection GdkAtom of the selection data. Since 2.16

dataGetTarget
GdkAtom dataGetTarget(GtkSelectionData* selectionData)

Retrieves the target of the selection. Since 2.14

dataGetTargets
int dataGetTargets(GtkSelectionData* selectionData, 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(GtkSelectionData* selectionData)

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

dataGetUris
string[] dataGetUris(GtkSelectionData* selectionData)

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

dataSet
void dataSet(GtkSelectionData* selectionData, 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(GtkSelectionData* selectionData, 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(GtkSelectionData* selectionData, string str, int len)

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(GtkSelectionData* selectionData, 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(GtkSelectionData* selectionData, 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(GtkSelectionData* selectionData, 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(GtkSelectionData* selectionData)

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(GtkSelectionData* selectionData)

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

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.

Meta