ContentFormats

The GdkContentFormats structure is used to advertise and negotiate the format of content.

You will encounter GdkContentFormats when interacting with objects controlling operations that pass data between different widgets, window or application, like [class@Gdk.Drag], [class@Gdk.Drop], [class@Gdk.Clipboard] or [class@Gdk.ContentProvider].

GDK supports content in 2 forms: GType 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, [class@Gdk.ContentSerializer] and [class@Gdk.ContentDeserializer] are used.

A GdkContentFormats 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 [method@Gdk.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 [method@Gdk.ContentFormats.to_string] exists. It will print a comma-separated list of formats from most important to least important.

GdkContentFormats is an immutable struct. After creation, you cannot change the types it represents. Instead, new GdkContentFormats have to be created. The [struct@Gdk.ContentFormatsBuilder]` structure is meant to help in this endeavor.

Constructors

this
this(GdkContentFormats* gdkContentFormats, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(string[] mimeTypes)

Creates a new GdkContentFormats from an array of mime types.

this
this(GType type)

Creates a new GdkContentFormats for a given GType.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

doref
alias doref = ref_
Undocumented in source.
unio
alias unio = union_
Undocumented in source.

Functions

containGtype
bool containGtype(GType type)

Checks if a given GType is part of the given @formats.

containMimeType
bool containMimeType(string mimeType)

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

getContentFormatsStruct
GdkContentFormats* getContentFormatsStruct(bool transferOwnership)

Get the main Gtk struct

getGtypes
GType[] getGtypes()

Gets the GTypes included in @formats.

getMimeTypes
string[] getMimeTypes()

Gets the mime types included in @formats.

getStruct
void* getStruct()

the main Gtk struct as a void*

match
bool match(ContentFormats second)

Checks if @first and @second have any matching formats.

matchGtype
GType matchGtype(ContentFormats second)

Finds the first GType from @first that is also contained in @second.

matchMimeType
string matchMimeType(ContentFormats second)

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

print
void print(StringG string_)

Prints the given @formats into a string for human consumption.

ref_
ContentFormats ref_()

Increases the reference count of a GdkContentFormats by one.

toString
string toString()

Prints the given @formats into a human-readable string.

unionDeserializeGtypes
ContentFormats unionDeserializeGtypes()

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

unionDeserializeMimeTypes
ContentFormats unionDeserializeMimeTypes()

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

unionSerializeGtypes
ContentFormats unionSerializeGtypes()

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

unionSerializeMimeTypes
ContentFormats unionSerializeMimeTypes()

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

union_
ContentFormats union_(ContentFormats second)

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

unref
void unref()

Decreases the reference count of a GdkContentFormats by one.

Static functions

getType
GType getType()

Variables

gdkContentFormats
GdkContentFormats* gdkContentFormats;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta