class Gdk::ContentFormats

Overview

The Gdk::ContentFormats structure is used to advertise and negotiate the format of content.

You will encounter Gdk::ContentFormats when interacting with objects controlling operations that pass data between different widgets, window or application, like Gdk::Drag, Gdk::Drop, Gdk::Clipboard or 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, Gdk::ContentSerializer and Gdk::ContentDeserializer are used.

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

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

Defined in:

lib/gi-crystal/src/auto/gdk-4.0/content_formats.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pointer : Pointer(Void), transfer : GICrystal::Transfer) #

[View source]
def self.new(mime_types : Enumerable(String) | Nil) : self #

[View source]
def self.new(*mime_types : String) #

[View source]
def self.new_for_gtype(type : UInt64) : self #

[View source]

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]
def self.parse(string : String) : Gdk::ContentFormats | Nil #

[View source]

Instance Method Detail

def contain_gtype(type : UInt64) : Bool #

[View source]
def contain_mime_type(mime_type : String) : Bool #

[View source]
def finalize #

[View source]
def gtypes : Enumerable(UInt64) | Nil #

[View source]
def match(second : Gdk::ContentFormats) : Bool #

[View source]
def match_gtype(second : Gdk::ContentFormats) : UInt64 #

[View source]
def match_mime_type(second : Gdk::ContentFormats) : String | Nil #

[View source]
def mime_types : Enumerable(String) | Nil #

[View source]
def print(string : GLib::String) : Nil #

[View source]

[View source]
def to_string : String #

[View source]
def to_unsafe : Pointer(Void) #

[View source]
def union(second : Gdk::ContentFormats) : Gdk::ContentFormats #

[View source]
def union_deserialize_gtypes : Gdk::ContentFormats #

[View source]
def union_deserialize_mime_types : Gdk::ContentFormats #

[View source]
def union_serialize_gtypes : Gdk::ContentFormats #

[View source]
def union_serialize_mime_types : Gdk::ContentFormats #

[View source]
def unref : Nil #

[View source]