gtkmm: Gdk::ContentFormats Class Reference
Advertising and negotiating of content exchange formats. More...
#include <gdkmm/contentformats.h>
Public Member Functions | |
void | reference () const |
Increment the reference count for this object. More... | |
void | unreference () const |
Decrement the reference count for this object. More... | |
GdkContentFormats* | gobj () |
Provides access to the underlying C instance. More... | |
const GdkContentFormats* | gobj () const |
Provides access to the underlying C instance. More... | |
GdkContentFormats* | gobj_copy () const |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
ContentFormats ()=delete | |
ContentFormats (const ContentFormats&)=delete | |
ContentFormats& | operator= (const ContentFormats&)=delete |
Glib::ustring | to_string () const |
Prints the given ContentFormats into a string for human consumption. More... | |
std::vector< GType > | get_gtypes () const |
Gets the Types included in the ContentFormats. More... | |
std::vector< Glib::ustring > | get_mime_types () const |
Gets the mime types included in the ContentFormats. More... | |
bool | contain_gtype (GType type) const |
Checks if a given Type is part of the given formats. More... | |
bool | contain_mime_type (const Glib::ustring& mime_type) const |
Checks if a given mime type is part of the given formats. More... | |
Glib::RefPtr< ContentFormats > | join (const Glib::RefPtr< const ContentFormats >& second) const |
Append all missing types from second to *this , in the order they had in second. More... | |
bool | match (const Glib::RefPtr< const ContentFormats >& second) const |
Checks if first and second have any matching formats. More... | |
GType | match_gtype (const Glib::RefPtr< const ContentFormats >& second) const |
Finds the first Type from first that is also contained in second. More... | |
Glib::ustring | match_mime_type (const Glib::RefPtr< const ContentFormats >& second) const |
Finds the first mime type from *this that is also contained in second. More... | |
Static Public Member Functions | |
static Glib::RefPtr< ContentFormats > | create (const std::vector< Glib::ustring >& mime_types={}) |
Creates a new Gdk::ContentFormats from an array of mime types. More... | |
static Glib::RefPtr< ContentFormats > | create (const Glib::ustring& mime_type) |
Creates a new Gdk::ContentFormats from a mime type. More... | |
static Glib::RefPtr< ContentFormats > | create (GType type) |
Creates a new Gdk::ContentFormats from a GType. More... | |
Protected Member Functions | |
void | operator delete (void*, std::size_t) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gdk::ContentFormats > | wrap (GdkContentFormats* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Detailed Description
Advertising and negotiating of content exchange formats.
Gdk::ContentFormats is used to advertise and negotiate the format of content passed between different widgets, windows or applications using for example the clipboard or drag'n'drop.
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.
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 join(), 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.
Gdk::ContentFormats is an immutable object. After creation, you cannot change the types it represents. Instead, new Gdk::ContentFormats have to be created. Gdk::ContentFormatsBuilder is meant to help in this endeavor.
- See also
- Gdk::Drag, Gdk::Drop, Gdk::Clipboard
Constructor & Destructor Documentation
|
delete |
|
delete |
Member Function Documentation
bool Gdk::ContentFormats::contain_gtype | ( | GType | type | ) | const |
Checks if a given Type is part of the given formats.
- Parameters
-
type The Type to search for.
- Returns
true
if the Type was found.
bool Gdk::ContentFormats::contain_mime_type | ( | const Glib::ustring & | mime_type | ) | const |
Checks if a given mime type is part of the given formats.
- Parameters
-
mime_type The mime type to search for.
- Returns
true
if the mime_type was found.
|
static |
Creates a new Gdk::ContentFormats from an array of mime types.
The mime types must be different or the behavior of the return value is undefined. If you cannot guarantee this, use Gdk::ContentFormatsBuilder instead.
- Parameters
-
mime_types A vector of mime types.
- Returns
- The new Gdk::ContentFormats.
|
static |
Creates a new Gdk::ContentFormats from a mime type.
- Parameters
-
mime_type A mime type.
- Returns
- The new Gdk::ContentFormats.
|
static |
Creates a new Gdk::ContentFormats from a GType.
- Parameters
-
type A GType.
- Returns
- The new Gdk::ContentFormats.
std::vector<GType> Gdk::ContentFormats::get_gtypes | ( | ) | const |
Gets the Types included in the ContentFormats.
Note that they may not contain any Types, in particular when they are empty. In that case an empty vector will be returned.
- Returns
- A vector of types included in the ContentFormats. May be empty.
std::vector<Glib::ustring> Gdk::ContentFormats::get_mime_types | ( | ) | const |
Gets the mime types included in the ContentFormats.
Note that they may not contain any mime types, in particular when they are empty. In that case an empty vector will be returned.
- Returns
- A vector of mime types included in the ContentFormats. May be empty.
GdkContentFormats* Gdk::ContentFormats::gobj | ( | ) |
Provides access to the underlying C instance.
const GdkContentFormats* Gdk::ContentFormats::gobj | ( | ) | const |
Provides access to the underlying C instance.
GdkContentFormats* Gdk::ContentFormats::gobj_copy | ( | ) | const |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr<ContentFormats> Gdk::ContentFormats::join | ( | const Glib::RefPtr< const ContentFormats >& | second | ) | const |
Append all missing types from second to *this
, in the order they had in second.
- Parameters
-
second The ContentFormats to merge from.
- Returns
- A new ContentFormats.
bool Gdk::ContentFormats::match | ( | const Glib::RefPtr< const ContentFormats >& | second | ) | const |
Checks if first and second have any matching formats.
- Parameters
-
second The Gdk::ContentFormats to intersect with.
- Returns
true
if a matching format was found.
GType Gdk::ContentFormats::match_gtype | ( | const Glib::RefPtr< const ContentFormats >& | second | ) | const |
Finds the first Type from first that is also contained in second.
If no matching Type is found, G_TYPE_INVALID is returned.
- Parameters
-
second The Gdk::ContentFormats to intersect with.
- Returns
- The first common Type or G_TYPE_INVALID if none.
Glib::ustring Gdk::ContentFormats::match_mime_type | ( | const Glib::RefPtr< const ContentFormats >& | second | ) | const |
Finds the first mime type from *this
that is also contained in second.
If no matching mime type is found, an empty string is returned.
- Parameters
-
second The Gdk::ContentFormats to intersect with.
- Returns
- The first common mime type, or an empty string if none.
|
protected |
|
delete |
void Gdk::ContentFormats::reference | ( | ) | const |
Increment the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.
Glib::ustring Gdk::ContentFormats::to_string | ( | ) | const |
Prints the given ContentFormats into a string for human consumption.
This is meant for debugging and logging.
The form of the representation may change at any time and is not guranteed to stay identical.
- Returns
- A new string.
void Gdk::ContentFormats::unreference | ( | ) | const |
Decrement the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.
Friends And Related Function Documentation
|
related |
A Glib::wrap() method for this object.
- Parameters
-
object The C instance. take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- Returns
- A C++ instance that wraps this C instance.