class Gdk::Drag
- Gdk::Drag
- GObject::Object
- Reference
- Object
Overview
The Gdk::Drag
object represents the source of an ongoing DND operation.
A Gdk::Drag
is created when a drag is started, and stays alive for duration of
the DND operation. After a drag has been started with Gdk::Drag#begin
,
the caller gets informed about the status of the ongoing drag operation
with signals on the Gdk::Drag
object.
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/drag.crConstructors
-
.new
Initialize a new
Drag
. - .new(*, actions : Gdk::DragAction? = nil, content : Gdk::ContentProvider? = nil, device : Gdk::Device? = nil, display : Gdk::Display? = nil, formats : Gdk::ContentFormats? = nil, selected_action : Gdk::DragAction? = nil, surface : Gdk::Surface? = nil)
Class Method Summary
-
.begin(surface : Gdk::Surface, device : Gdk::Device, content : Gdk::ContentProvider, actions : Gdk::DragAction, dx : Float64, dy : Float64) : Gdk::Drag?
Starts a drag and creates a new drag context for it.
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#actions : Gdk::DragAction
Determines the bitmask of possible actions proposed by the source.
- #actions=(value : Gdk::DragAction) : Gdk::DragAction
- #cancel_signal
-
#content : Gdk::ContentProvider
Returns the
Gdk::ContentProvider
associated to theGdk::Drag
object. - #content=(value : Gdk::ContentProvider?) : Gdk::ContentProvider?
-
#device : Gdk::Device
Returns the
Gdk::Device
associated to theGdk::Drag
object. - #device=(value : Gdk::Device?) : Gdk::Device?
-
#display : Gdk::Display
Gets the
Gdk::Display
that the drag object was created for. - #dnd_finished_signal
-
#drag_surface : Gdk::Surface?
Returns the surface on which the drag icon should be rendered during the drag operation.
-
#drop_done(success : Bool) : Nil
Informs GDK that the drop ended.
- #drop_performed_signal
-
#formats : Gdk::ContentFormats
Retrieves the formats supported by this
Gdk::Drag
object. - #formats=(value : Gdk::ContentFormats?) : Gdk::ContentFormats?
-
#selected_action : Gdk::DragAction
Determines the action chosen by the drag destination.
- #selected_action=(value : Gdk::DragAction) : Gdk::DragAction
-
#set_hotspot(hot_x : Int32, hot_y : Int32) : Nil
Sets the position of the drag surface that will be kept under the cursor hotspot.
-
#surface : Gdk::Surface
Returns the
Gdk::Surface
where the drag originates. - #surface=(value : Gdk::Surface?) : Gdk::Surface?
Instance methods inherited from class GObject::Object
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)?
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
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)?
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void)?) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void)?
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void)?
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,
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
compat_control(what : UInt64, data : Pointer(Void)?) : 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
Constructor Detail
Class Method Detail
Starts a drag and creates a new drag context for it.
This function is called by the drag source. After this call, you
probably want to set up the drag icon using the surface returned
by Gdk::Drag#drag_surface
.
This function returns a reference to the Gdk::Drag
object,
but GTK keeps its own reference as well, as long as the DND operation
is going on.
Note: if @actions include %GDK_ACTION_MOVE, you need to listen for
the [signal@Gdk.Drag::dnd-finished] signal and delete the data at
the source if Gdk::Drag#selected_action
returns
%GDK_ACTION_MOVE.
Instance Method Detail
Returns the Gdk::ContentProvider
associated to the Gdk::Drag
object.
Returns the surface on which the drag icon should be rendered during the drag operation.
Note that the surface may not be available until the drag operation has begun. GDK will move the surface in accordance with the ongoing drag operation. The surface is owned by @drag and will be destroyed when the drag operation is over.
Informs GDK that the drop ended.
Passing false
for @success may trigger a drag cancellation
animation.
This function is called by the drag source, and should be the last call before dropping the reference to the @drag.
The Gdk::Drag
will only take the first Gdk::Drag#drop_done
call as effective, if this function is called multiple times,
all subsequent calls will be ignored.
Sets the position of the drag surface that will be kept under the cursor hotspot.
Initially, the hotspot is at the top left corner of the drag surface.