gtkmm 4.16.0
|
A Gdk::Drop object represents the target of an ongoing DND operation. More...
#include <gdkmm/drop.h>
Public Member Functions | |
Drop (Drop &&src) noexcept | |
Drop & | operator= (Drop &&src) noexcept |
~Drop () noexcept override | |
GdkDrop * | gobj () |
Provides access to the underlying C GObject. | |
const GdkDrop * | gobj () const |
Provides access to the underlying C GObject. | |
GdkDrop * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Glib::RefPtr< Display > | get_display () |
Gets the Gdk::Display that self was created for. | |
Glib::RefPtr< const Display > | get_display () const |
Gets the Gdk::Display that self was created for. | |
Glib::RefPtr< Device > | get_device () |
Returns the Gdk::Device performing the drop. | |
Glib::RefPtr< const Device > | get_device () const |
Returns the Gdk::Device performing the drop. | |
Glib::RefPtr< Surface > | get_surface () |
Returns the Gdk::Surface performing the drop. | |
Glib::RefPtr< const Surface > | get_surface () const |
Returns the Gdk::Surface performing the drop. | |
Glib::RefPtr< ContentFormats > | get_formats () |
Returns the Gdk::ContentFormats that the drop offers the data to be read in. | |
Glib::RefPtr< const ContentFormats > | get_formats () const |
Returns the Gdk::ContentFormats that the drop offers the data to be read in. | |
DragAction | get_actions () const |
Returns the possible actions for this Gdk::Drop . | |
Glib::RefPtr< Drag > | get_drag () |
If this is an in-app drag-and-drop operation, returns the Gdk::Drag that corresponds to this drop. | |
Glib::RefPtr< const Drag > | get_drag () const |
If this is an in-app drag-and-drop operation, returns the Gdk::Drag that corresponds to this drop. | |
void | status (DragAction actions, DragAction preferred) |
Selects all actions that are potentially supported by the destination. | |
void | refuse () |
Indicates that a drop will not be accepted. | |
void | finish (DragAction action) |
Ends the drag operation after a drop. | |
void | failed () |
Ends the drag operation and indicates that the operation failed. | |
void | read_async (const std::vector< Glib::ustring > &mime_types, int io_priority, const Gio::SlotAsyncReady &slot, const Glib::RefPtr< Gio::Cancellable > &cancellable) |
Asynchronously read the dropped data from a Gdk::Drop in a format that complies with one of the mime types. | |
void | read_async (const std::vector< Glib::ustring > &mime_types, int io_priority, const Gio::SlotAsyncReady &slot) |
A read_async() convenience overload. | |
Glib::RefPtr< Gio::InputStream > | read_finish (const Glib::RefPtr< Gio::AsyncResult > &result, Glib::ustring &out_mime_type) |
Finishes an async drop read operation. | |
void | read_value_async (GType type, int io_priority, const Gio::SlotAsyncReady &slot, const Glib::RefPtr< Gio::Cancellable > &cancellable) |
Asynchronously request the drag operation's contents converted to the given type. | |
void | read_value_async (GType type, int io_priority, const Gio::SlotAsyncReady &slot) |
A read_value_async() convenience overload. | |
Glib::ValueBase | read_value_finish (const Glib::RefPtr< Gio::AsyncResult > &result) |
Finishes an async drop read. | |
Glib::PropertyProxy_ReadOnly< DragAction > | property_actions () const |
The possible actions for this drop. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Device > > | property_device () const |
The Gdk::Device performing the drop. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > | property_display () const |
The Gdk::Display that the drop belongs to. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Drag > > | property_drag () const |
The Gdk::Drag that initiated this drop. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > | property_formats () const |
The possible formats that the drop can provide its data in. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Surface > > | property_surface () const |
The Gdk::Surface the drop happens on. | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::Drop > | wrap (GdkDrop *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
A Gdk::Drop object represents the target of an ongoing DND operation.
Possible drop sites get informed about the status of the ongoing drag operation with events of type Gdk::Event::Type::DRAG_ENTER, Gdk::Event::Type::DRAG_LEAVE, Gdk::Event::Type::DRAG_MOTION and Gdk::Event::Type::DROP_START. The Gdk::Drop object can be obtained from a DND event using Gdk::Event::get_dnd_drop().
The actual data transfer is initiated from the target side via an async read, using one of the Gdk::Drop methods for this purpose: read_async() or read_value_async().
GTK provides a higher level abstraction based on top of these functions, and so they are not normally needed in GTK applications.
|
noexcept |
|
overridenoexcept |
void Gdk::Drop::failed | ( | ) |
Ends the drag operation and indicates that the operation failed.
Alternatively, call finish() to indicate which drag action was performed.
void Gdk::Drop::finish | ( | DragAction | action | ) |
Ends the drag operation after a drop.
The action must be a single action selected from the actions available via get_actions().
action | The action performed by the destination or 0 if the drop failed. |
DragAction Gdk::Drop::get_actions | ( | ) | const |
Returns the possible actions for this Gdk::Drop
.
If this value contains multiple actions - i.e. Gdk::Drag::action_is_unique() returns false
for the result - finish() must choose the action to use when accepting the drop. This will only happen if you passed Gdk::DragAction::ASK as one of the possible actions in status(). Gdk::DragAction::ASK itself will not be included in the actions returned by this function.
This value may change over the lifetime of the Gdk::Drop both as a response to source side actions as well as to calls to status() or finish(). The source side will not change this value anymore once a drop has started.
Gdk::DragActions
. Glib::RefPtr< Device > Gdk::Drop::get_device | ( | ) |
Returns the Gdk::Device
performing the drop.
Gdk::Device
performing the drop. Returns the Gdk::Device
performing the drop.
Gdk::Device
performing the drop. Glib::RefPtr< Display > Gdk::Drop::get_display | ( | ) |
Gets the Gdk::Display
that self was created for.
Gdk::Display
. Gets the Gdk::Display
that self was created for.
Gdk::Display
. Glib::RefPtr< Drag > Gdk::Drop::get_drag | ( | ) |
Glib::RefPtr< ContentFormats > Gdk::Drop::get_formats | ( | ) |
Returns the Gdk::ContentFormats
that the drop offers the data to be read in.
Gdk::ContentFormats
. Glib::RefPtr< const ContentFormats > Gdk::Drop::get_formats | ( | ) | const |
Returns the Gdk::ContentFormats
that the drop offers the data to be read in.
Gdk::ContentFormats
. Glib::RefPtr< Surface > Gdk::Drop::get_surface | ( | ) |
Returns the Gdk::Surface
performing the drop.
Gdk::Surface
performing the drop. Returns the Gdk::Surface
performing the drop.
Gdk::Surface
performing the drop.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
GdkDrop * Gdk::Drop::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::PropertyProxy_ReadOnly< DragAction > Gdk::Drop::property_actions | ( | ) | const |
The possible actions for this drop.
Default value: Gdk::DragAction::COPY | Gdk::DragAction::MOVE | Gdk::DragAction::LINK
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Device > > Gdk::Drop::property_device | ( | ) | const |
The Gdk::Device
performing the drop.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > Gdk::Drop::property_display | ( | ) | const |
The Gdk::Display
that the drop belongs to.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Drag > > Gdk::Drop::property_drag | ( | ) | const |
The Gdk::Drag
that initiated this drop.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > Gdk::Drop::property_formats | ( | ) | const |
The possible formats that the drop can provide its data in.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Surface > > Gdk::Drop::property_surface | ( | ) | const |
The Gdk::Surface
the drop happens on.
void Gdk::Drop::read_async | ( | const std::vector< Glib::ustring > & | mime_types, |
int | io_priority, | ||
const Gio::SlotAsyncReady & | slot | ||
) |
A read_async() convenience overload.
void Gdk::Drop::read_async | ( | const std::vector< Glib::ustring > & | mime_types, |
int | io_priority, | ||
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) |
Asynchronously read the dropped data from a Gdk::Drop
in a format that complies with one of the mime types.
mime_types | Pointer to an array of mime types. |
io_priority | The I/O priority for the read operation. |
cancellable | Optional Gio::Cancellable object. |
slot | A SlotAsyncReady to call when the request is satisfied. |
Glib::RefPtr< Gio::InputStream > Gdk::Drop::read_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result, |
Glib::ustring & | out_mime_type | ||
) |
Finishes an async drop read operation.
Note that you must not use blocking read calls on the returned stream in the GTK thread, since some platforms might require communication with GTK to complete the data transfer. You can use async APIs such as Glib::input_stream_read_bytes_async().
See read_async().
result | A Gio::AsyncResult . |
out_mime_type | Return location for the used mime type. |
Gio::InputStream
.Glib::Error |
A read_value_async() convenience overload.
void Gdk::Drop::read_value_async | ( | GType | type, |
int | io_priority, | ||
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) |
Asynchronously request the drag operation's contents converted to the given type.
For local drag-and-drop operations that are available in the given GType
, the value will be copied directly. Otherwise, GDK will try to use gdk_content_deserialize_async() to convert the data.
type | A GType to read. |
io_priority | The I/O priority of the request. |
cancellable | Optional Gio::Cancellable object, nullptr to ignore. |
slot | Callback to call when the request is satisfied. |
Glib::ValueBase Gdk::Drop::read_value_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |
Finishes an async drop read.
See read_value_async().
result | A Gio::AsyncResult . |
Glib::Value
containing the result. void Gdk::Drop::refuse | ( | ) |
Indicates that a drop will not be accepted.
This function may be called by the drag destination in response to Gdk::Event::Type::DRAG_ENTER or Gdk::Event::Type::DRAG_MOTION events. Alternatively, call status() to indicate which drag actions will be accepted.
void Gdk::Drop::status | ( | DragAction | actions, |
DragAction | preferred | ||
) |
Selects all actions that are potentially supported by the destination.
When calling this function, do not restrict the passed in actions to the ones provided by get_actions(). Those actions may change in the future, even depending on the actions you provide here.
The preferred action is a hint to the drag-and-drop mechanism about which action to use when multiple actions are possible.
This function should be called by drag destinations in response to Gdk::Event::Type::DRAG_ENTER or Gdk::Event::Type::DRAG_MOTION events. If the destination does not yet know the exact actions it supports, it should set any possible actions first and then later call this function again.
actions | Supported actions of the destination, or 0 to indicate that a drop will not be accepted. |
preferred | A unique action that's a member of actions indicating the preferred action. |
A Glib::wrap() method for this object.
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. |