ContentFormats

The gdk.content_formats.ContentFormats structure is used to advertise and negotiate the format of content.

You will encounter gdk.content_formats.ContentFormats when interacting with objects controlling operations that pass data between different widgets, window or application, like gdk.drag.Drag, gdk.drop.Drop, gdk.clipboard.Clipboard or gdk.content_provider.ContentProvider.

GDK supports content in 2 forms: gobject.types.TYPE_FLAG_RESERVED_ID_BIT and mime type. Using GTypes is meant only for in-process content transfers. Mime types are meant to be used for data passing both in-process and out-of-process. The details of how data is passed is described in the documentation of the actual implementations. To transform between the two forms, gdk.content_serializer.ContentSerializer and gdk.content_deserializer.ContentDeserializer are used.

A gdk.content_formats.ContentFormats describes a set of possible formats content can be exchanged in. It is assumed that this set is ordered. GTypes are more important than mime types. Order between different GTypes or mime types is the order they were added in, most important first. Functions that care about order, such as gdk.content_formats.ContentFormats.union_, will describe in their documentation how they interpret that order, though in general the order of the first argument is considered the primary order of the result, followed by the order of further arguments.

For debugging purposes, the function gdk.content_formats.ContentFormats.toString_ exists. It will print a comma-separated list of formats from most important to least important.

gdk.content_formats.ContentFormats is an immutable struct. After creation, you cannot change the types it represents. Instead, new gdk.content_formats.ContentFormats have to be created. The gdk.content_formats_builder.ContentFormatsBuilder structure is meant to help in this endeavor.

Constructors

this
this(string[] mimeTypes)

Creates a new gdk.content_formats.ContentFormats from an array of mime types.

Members

Functions

containGtype
bool containGtype(gobject.types.GType type)

Checks if a given gobject.types.TYPE_FLAG_RESERVED_ID_BIT is part of the given formats.

containMimeType
bool containMimeType(string mimeType)

Checks if a given mime type is part of the given formats.

getGtypes
gobject.types.GType[] getGtypes()

Gets the gobject.types.TYPE_FLAG_RESERVED_ID_BITs included in formats.

getMimeTypes
string[] getMimeTypes()

Gets the mime types included in formats.

match
bool match(gdk.content_formats.ContentFormats second)

Checks if first and second have any matching formats.

matchGtype
gobject.types.GType matchGtype(gdk.content_formats.ContentFormats second)

Finds the first gobject.types.TYPE_FLAG_RESERVED_ID_BIT from first that is also contained in second.

matchMimeType
string matchMimeType(gdk.content_formats.ContentFormats second)

Finds the first mime type from first that is also contained in second.

print
void print(glib.string_.String string_)

Prints the given formats into a string for human consumption.

toString_
string toString_()

Prints the given formats into a human-readable string.

unionDeserializeGtypes
gdk.content_formats.ContentFormats unionDeserializeGtypes()

Add GTypes for mime types in formats for which deserializers are registered.

unionDeserializeMimeTypes
gdk.content_formats.ContentFormats unionDeserializeMimeTypes()

Add mime types for GTypes in formats for which deserializers are registered.

unionSerializeGtypes
gdk.content_formats.ContentFormats unionSerializeGtypes()

Add GTypes for the mime types in formats for which serializers are registered.

unionSerializeMimeTypes
gdk.content_formats.ContentFormats unionSerializeMimeTypes()

Add mime types for GTypes in formats for which serializers are registered.

union_
gdk.content_formats.ContentFormats union_(gdk.content_formats.ContentFormats second)

Append all missing types from second to first, in the order they had in second.

Static functions

newForGtype
gdk.content_formats.ContentFormats newForGtype(gobject.types.GType type)

Creates a new gdk.content_formats.ContentFormats for a given gobject.types.TYPE_FLAG_RESERVED_ID_BIT.

parse
gdk.content_formats.ContentFormats parse(string string_)

Parses the given string into gdk.content_formats.ContentFormats and returns the formats.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.