ContentFormats
Object Hierarchy:
Description:
[ CCode ( ref_function = "gdk_content_formats_ref" , type_id = "gdk_content_formats_get_type ()" , unref_function = "gdk_content_formats_unref" ) ]
[ Compact ]
public class ContentFormats
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.
Content:
Static methods:
Creation methods:
Methods:
- public unowned ContentFormats @ref ()
Increases the reference count of a `GdkContentFormats` by one.
- public bool contain_gtype (Type type)
Checks if a given `GType` is part of the given
this.
- public bool contain_mime_type (string mime_type)
Checks if a given mime type is part of the given
this.
- public unowned Type[]? get_gtypes ()
Gets the `GType`s included in this.
- public unowned string[]? get_mime_types ()
Gets the mime types included in this
.
- public bool is_empty ()
Returns whether the content formats contain any formats.
- public bool match (ContentFormats second)
Checks if this and second
have any matching formats.
- public Type match_gtype (ContentFormats second)
Finds the first `GType` from this
that is also contained in second.
- public unowned string? match_mime_type (ContentFormats second)
Finds the first mime type from this
that is also contained in second.
- public void print (StringBuilder string)
Prints the given this into a string
for human consumption.
- public string to_string ()
Prints the given this into a
human-readable string.
- public ContentFormats union (ContentFormats second)
Append all missing types from second to
this, in the order they had in second.
- public ContentFormats union_deserialize_gtypes ()
Add GTypes for mime types in this
for which deserializers are registered.
- public ContentFormats union_deserialize_mime_types ()
Add mime types for GTypes in this
for which deserializers are registered.
- public ContentFormats union_serialize_gtypes ()
Add GTypes for the mime types in this
for which serializers are registered.
- public ContentFormats union_serialize_mime_types ()
Add mime types for GTypes in this
for which serializers are registered.
- public void unref ()
Decreases the reference count of a `GdkContentFormats` by one.