class Gdk::Drop
- Gdk::Drop
- GObject::Object
- Reference
- Object
Overview
The 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_DRAG_ENTER, %GDK_DRAG_LEAVE,
%GDK_DRAG_MOTION and %GDK_DROP_START. The Gdk::Drop
object can be obtained
from these Gdk::Event
types using Gdk::DNDEvent#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:
Gdk::Drop#read_async
or Gdk::Drop#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. See the "Drag and Drop" section of the GTK documentation for more information.
Defined in:
lib/gi-crystal/src/auto/gdk-4.0/drop.crConstructors
-
.new
Initialize a new
Drop
. - .new(*, actions : Gdk::DragAction | Nil = nil, device : Gdk::Device | Nil = nil, display : Gdk::Display | Nil = nil, drag : Gdk::Drag | Nil = nil, formats : Gdk::ContentFormats | Nil = nil, surface : Gdk::Surface | Nil = nil)
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#actions : Gdk::DragAction
Returns the possible actions for this
Gdk::Drop
. - #actions=(value : Gdk::DragAction) : Gdk::DragAction
-
#device : Gdk::Device
Returns the
Gdk::Device
performing the drop. - #device=(value : Gdk::Device | Nil) : Gdk::Device | Nil
-
#display : Gdk::Display
Gets the
Gdk::Display
that self was created for. -
#drag : Gdk::Drag | Nil
If this is an in-app drag-and-drop operation, returns the
Gdk::Drag
that corresponds to this drop. - #drag=(value : Gdk::Drag | Nil) : Gdk::Drag | Nil
-
#finish(action : Gdk::DragAction) : Nil
Ends the drag operation after a drop.
-
#formats : Gdk::ContentFormats
Returns the
Gdk::ContentFormats
that the drop offers the data to be read in. - #formats=(value : Gdk::ContentFormats | Nil) : Gdk::ContentFormats | Nil
-
#hash(hasher)
See
Object#hash(hasher)
-
#read_async(mime_types : Enumerable(String), io_priority : Int32, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Asynchronously read the dropped data from a
Gdk::Drop
in a format that complies with one of the mime types. -
#read_finish(result : Gio::AsyncResult, out_mime_type : String) : Gio::InputStream | Nil
Finishes an async drop read operation.
-
#read_value_async(type : UInt64, io_priority : Int32, cancellable : Gio::Cancellable | Nil, &callback : Gio::AsyncReadyCallback) : Nil
Asynchronously request the drag operation's contents converted to the given type.
-
#read_value_finish(result : Gio::AsyncResult) : GObject::Value
Finishes an async drop read.
-
#status(actions : Gdk::DragAction, preferred : Gdk::DragAction) : Nil
Selects all actions that are potentially supported by the destination.
-
#surface : Gdk::Surface
Returns the
Gdk::Surface
performing the drop. - #surface=(value : Gdk::Surface | Nil) : Gdk::Surface | Nil
Instance methods inherited from class GObject::Object
==(other : self)
==,
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void) | Nil
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
hash(hasher)
hash,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void) | Nil
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void) | Nil) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void) | Nil
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void) | Nil
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
cast?(obj : GObject::Object) : self | Nil
cast?,
compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Macros inherited from class GObject::Object
previous_vfunc(*args)
previous_vfunc,
previous_vfunc!(*args)
previous_vfunc!,
signal(signature)
signal
Constructor Detail
Class Method Detail
Returns the type id (GType) registered in GLib type system.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Returns the possible actions for this Gdk::Drop
.
If this value contains multiple actions - i.e.
Gdk::DragAction#is_unique?
returns false
for the result -
Gdk::Drop#finish
must choose the action to use when
accepting the drop. This will only happen if you passed
%GDK_ACTION_ASK as one of the possible actions in
Gdk::Drop#status
. %GDK_ACTION_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
Gdk::Drop#status
or Gdk::Drop#finish
. The source
side will not change this value anymore once a drop has started.
If this is an in-app drag-and-drop operation, returns the Gdk::Drag
that corresponds to this drop.
If it is not, nil
is returned.
Ends the drag operation after a drop.
The action must be a single action selected from the actions
available via Gdk::Drop#actions
.
Returns the Gdk::ContentFormats
that the drop offers the data
to be read in.
Asynchronously read the dropped data from a Gdk::Drop
in a format that complies with one of the mime types.
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 g_input_stream_read_bytes_async().
See Gdk::Drop#read_async
.
Asynchronously request the drag operation's contents converted to the given type.
When the operation is finished callback will be called. You must
then call Gdk::Drop#read_value_finish
to get the resulting
GValue
.
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.
Finishes an async drop read.
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 Gdk::Drop#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_DRAG_ENTER or %GDK_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.