Gnome::Gdk4::N-ContentFormats

#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Description

The Gnome::Gdk4::N-ContentFormats structure is used to advertise and negotiate the format of content.

You will encounter Gnome::Gdk4::N-ContentFormats when interacting with objects controlling operations that pass data between different widgets, window or application, like Gnome::Gdk4::Drag, Gnome::Gdk4::Drop, Gnome::Gdk4::Clipboard or Gnome::Gdk4::ContentProvider.

GDK supports content in 2 forms: Gnome::GObject::ContentFormats 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, Gnome::Gdk4::ContentSerializer and Gnome::Gdk4::ContentDeserializer are used.

A Gnome::Gdk4::N-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 .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 .to-string() exists. It will print a comma-separated list of formats from most important to least important.

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

=end rakudoc

#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Class initialization

new

:native-object

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

new-contentformats

Creates a new Gnome::Gdk4::N-ContentFormats from an array of mime types.

The mime types must be valid and different from each other or the behavior of the return value is undefined. If you cannot guarantee this, use Gnome::Gdk4::N-ContentFormatsBuilder instead.

method new-contentformats ( Array[Str] $mime-types, UInt() $n-mime-types --> Gnome::Gdk4::ContentFormats )
  • $mime-types; Pointer to an array of mime types.

  • $n-mime-types; number of entries in $mime-types..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

new-for-gtype

Creates a new Gnome::Gdk4::N-ContentFormats for a given Gnome::GObject::ContentFormats.

method new-for-gtype ( GType $type --> Gnome::Gdk4::ContentFormats )
  • $type; a Gnome::GObject::ContentFormats.

=end rakudoc

#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Methods =end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

contain-gtype

Checks if a given Gnome::GObject::ContentFormats is part of the given $formats.

method contain-gtype ( GType $type --> Bool )
  • $type; the Gnome::GObject::ContentFormats to search for.

Return value; True if the Gnome::GObject::ContentFormats was found.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

contain-mime-type

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

method contain-mime-type ( Str $mime-type --> Bool )
  • $mime-type; the mime type to search for.

Return value; True if the mime_type was found.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-gtypes This function is not yet available

Gets the Gnome::GObject::ContentFormatss included in $formats.

Note that $formats may not contain any Gnome::GObject::ContentFormatss, in particular when they are empty. In that case undefined will be returned.

method get-gtypes ( Array[gsize] $n-gtypes )
  • $n-gtypes; (transfer ownership: full) optional pointer to take the number of Gnome::GObject::ContentFormatss contained in the return value.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-mime-types

Gets the mime types included in $formats.

Note that $formats may not contain any mime types, in particular when they are empty. In that case undefined will be returned.

method get-mime-types ( Array[gsize] $n-mime-types --> Array[Str] )
  • $n-mime-types; (transfer ownership: full) optional pointer to take the number of mime types contained in the return value.

Return value; interned array strings of mime types included in $formats.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

match

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

method match ( N-Object $second --> Bool )
  • $second; the Gnome::Gdk4::N-ContentFormats to intersect with

Return value; True if a matching format was found..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

match-gtype

Finds the first Gnome::GObject::ContentFormats from $first that is also contained in $second.

If no matching Gnome::GObject::ContentFormats is found, G_TYPE_INVALID is returned.

method match-gtype ( N-Object $second --> GType )
  • $second; the Gnome::Gdk4::N-ContentFormats to intersect with

Return value; The first common Gnome::GObject::ContentFormats or G_TYPE_INVALID if none..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

match-mime-type

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

If no matching mime type is found, undefined is returned.

method match-mime-type ( N-Object $second --> Str )
  • $second; the Gnome::Gdk4::N-ContentFormats to intersect with

Return value; The first common mime type or undefined if none.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

print

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

The result of this function can later be parsed with .ContentFormats.parse().ContentFormats.parse() in package Gnome::Gdk4.

method print ( N-Object $string )
  • $string; a Gnome::Glib::N-String to print into

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

ref

Increases the reference count of a Gnome::Gdk4::N-ContentFormats by one.

method ref (--> N-Object )

Return value; the passed in Gnome::Gdk4::N-ContentFormats..

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

to-string

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

The resulting string can be parsed with .ContentFormats.parse().ContentFormats.parse() in package Gnome::Gdk4.

This is a small wrapper around .print() to help when debugging.

method to-string (--> Str )

Return value; a new string.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

union

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

method union ( N-Object $second --> N-Object )
  • $second; the Gnome::Gdk4::N-ContentFormats to merge from

Return value; a new Gnome::Gdk4::N-ContentFormats.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

union-deserialize-gtypes

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

method union-deserialize-gtypes (--> N-Object )

Return value; a new Gnome::Gdk4::N-ContentFormats.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

union-deserialize-mime-types

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

method union-deserialize-mime-types (--> N-Object )

Return value; a new Gnome::Gdk4::N-ContentFormats.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

union-serialize-gtypes

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

method union-serialize-gtypes (--> N-Object )

Return value; a new Gnome::Gdk4::N-ContentFormats.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

union-serialize-mime-types

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

method union-serialize-mime-types (--> N-Object )

Return value; a new Gnome::Gdk4::N-ContentFormats.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

unref

Decreases the reference count of a Gnome::Gdk4::N-ContentFormats by one.

If the resulting reference count is zero, frees the formats.

method unref ( )

=end rakudoc

#------------------------------------------------------------------------------- #--[Functions]------------------------------------------------------------------ #-------------------------------------------------------------------------------

=begin rakudoc

Functions =end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

parse

Parses the given $string into Gnome::Gdk4::N-ContentFormats and returns the formats.

Strings printed via .to-string() can be read in again successfully using this function.

If $string does not describe valid content formats, undefined is returned.

method parse ( Str $string --> N-Object )
  • $string; the string to parse.

Return value; the content formats if $string is valid.

=end rakudoc

Gnome::Gdk4 v0.1.23

Authors

  • Marcel Timmerman

License

Artistic-2.0

Dependencies

Gnome::Gio:api<2>Gnome::GObject:api<2>Gnome::Glib:api<2>Gnome::N:api<2>

Test Dependencies

Provides

  • Gnome::Gdk4::ContentProvider
  • Gnome::Gdk4::Display
  • Gnome::Gdk4::Drag
  • Gnome::Gdk4::Drop
  • Gnome::Gdk4::MemoryTexture
  • Gnome::Gdk4::N-ContentFormats
  • Gnome::Gdk4::N-ContentFormatsBuilder
  • Gnome::Gdk4::N-FileList
  • Gnome::Gdk4::N-RGBA
  • Gnome::Gdk4::N-Rectangle
  • Gnome::Gdk4::R-Paintable
  • Gnome::Gdk4::Snapshot
  • Gnome::Gdk4::Surface
  • Gnome::Gdk4::T-contentformats
  • Gnome::Gdk4::T-drag
  • Gnome::Gdk4::T-enums
  • Gnome::Gdk4::T-keysyms
  • Gnome::Gdk4::T-paintable
  • Gnome::Gdk4::T-rgba
  • Gnome::Gdk4::T-texture
  • Gnome::Gdk4::T-types
  • Gnome::Gdk4::Texture

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.