gtkmm 4.16.0
Public Member Functions | Static Public Member Functions | Related Symbols | List of all members
Gdk::Drag Class Reference

A Gdk::Drag object represents the source of an ongoing DND operation. More...

#include <gdkmm/drag.h>

Inheritance diagram for Gdk::Drag:
Inheritance graph
[legend]

Public Member Functions

 Drag (Drag && src) noexcept
 
Dragoperator= (Drag && src) noexcept
 
 ~Drag () noexcept override
 
GdkDrag * gobj ()
 Provides access to the underlying C GObject.
 
const GdkDrag * gobj () const
 Provides access to the underlying C GObject.
 
GdkDrag * 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< Displayget_display ()
 Gets the Gdk::Display that the drag object was created for.
 
Glib::RefPtr< const Displayget_display () const
 Gets the Gdk::Display that the drag object was created for.
 
Glib::RefPtr< Deviceget_device ()
 Returns the Gdk::Device associated to the Gdk::Drag object.
 
Glib::RefPtr< const Deviceget_device () const
 Returns the Gdk::Device associated to the Gdk::Drag object.
 
Glib::RefPtr< ContentFormatsget_formats ()
 Retrieves the formats supported by this Gdk::Drag object.
 
Glib::RefPtr< const ContentFormatsget_formats () const
 Retrieves the formats supported by this Gdk::Drag object.
 
DragAction get_actions () const
 Determines the bitmask of possible actions proposed by the source.
 
DragAction get_selected_action () const
 Determines the action chosen by the drag destination.
 
void drag_drop_done (bool success)
 Informs GDK that the drop ended.
 
Glib::RefPtr< Surfaceget_drag_surface ()
 Returns the surface on which the drag icon should be rendered during the drag operation.
 
Glib::RefPtr< const Surfaceget_drag_surface () const
 See the non-const version.
 
void set_hotspot (int hot_x, int hot_y)
 Sets the position of the drag surface that will be kept under the cursor hotspot.
 
Glib::RefPtr< ContentProviderget_content ()
 Returns the Gdk::ContentProvider associated to the Gdk::Drag object.
 
Glib::RefPtr< const ContentProviderget_content () const
 Returns the Gdk::ContentProvider associated to the Gdk::Drag object.
 
Glib::RefPtr< Surfaceget_surface ()
 Returns the Gdk::Surface where the drag originates.
 
Glib::RefPtr< const Surfaceget_surface () const
 Returns the Gdk::Surface where the drag originates.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentProvider > > property_content () const
 The Gdk::ContentProvider.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Device > > property_device () const
 The Gdk::Device that is performing the drag.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > property_display () const
 The Gdk::Display that the drag belongs to.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > property_formats () const
 The possible formats that the drag can provide its data in.
 
Glib::PropertyProxy< DragActionproperty_selected_action ()
 The currently selected action of the drag.
 
Glib::PropertyProxy_ReadOnly< DragActionproperty_selected_action () const
 The currently selected action of the drag.
 
Glib::PropertyProxy< DragActionproperty_actions ()
 The possible actions of this drag.
 
Glib::PropertyProxy_ReadOnly< DragActionproperty_actions () const
 The possible actions of this drag.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Surface > > property_surface () const
 The surface where the drag originates.
 
Glib::SignalProxy< void(DragCancelReason)> signal_cancel ()
 
Glib::SignalProxy< void()> signal_drop_performed ()
 
Glib::SignalProxy< void()> signal_dnd_finished ()
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static bool action_is_unique (DragAction action)
 Checks if action represents a single action or includes multiple actions.
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gdk::Dragwrap (GdkDrag * object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Detailed Description

A 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 the duration of the DND operation. After a drag has been started with Gdk::Surface::drag_begin_from_point(), 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.

Constructor & Destructor Documentation

◆ Drag()

Gdk::Drag::Drag ( Drag &&  src)
noexcept

◆ ~Drag()

Gdk::Drag::~Drag ( )
overridenoexcept

Member Function Documentation

◆ action_is_unique()

static bool Gdk::Drag::action_is_unique ( DragAction  action)
static

Checks if action represents a single action or includes multiple actions.

When action is 0 - ie no action was given, true is returned.

Parameters
actionA Gdk::DragAction.
Returns
true if exactly one action was given.

◆ drag_drop_done()

void Gdk::Drag::drag_drop_done ( bool  success)

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 drop_done() call as effective, if this function is called multiple times, all subsequent calls will be ignored.

Parameters
successWhether the drag was ultimatively successful.

◆ get_actions()

DragAction Gdk::Drag::get_actions ( ) const

Determines the bitmask of possible actions proposed by the source.

Returns
The Gdk::DragAction flags.

◆ get_content() [1/2]

Glib::RefPtr< ContentProvider > Gdk::Drag::get_content ( )

Returns the Gdk::ContentProvider associated to the Gdk::Drag object.

Returns
The Gdk::ContentProvider associated to drag.

◆ get_content() [2/2]

Glib::RefPtr< const ContentProvider > Gdk::Drag::get_content ( ) const

Returns the Gdk::ContentProvider associated to the Gdk::Drag object.

Returns
The Gdk::ContentProvider associated to drag.

◆ get_device() [1/2]

Glib::RefPtr< Device > Gdk::Drag::get_device ( )

Returns the Gdk::Device associated to the Gdk::Drag object.

Returns
The Gdk::Device associated to drag.

◆ get_device() [2/2]

Glib::RefPtr< const Device > Gdk::Drag::get_device ( ) const

Returns the Gdk::Device associated to the Gdk::Drag object.

Returns
The Gdk::Device associated to drag.

◆ get_display() [1/2]

Glib::RefPtr< Display > Gdk::Drag::get_display ( )

Gets the Gdk::Display that the drag object was created for.

Returns
A Gdk::Display.

◆ get_display() [2/2]

Glib::RefPtr< const Display > Gdk::Drag::get_display ( ) const

Gets the Gdk::Display that the drag object was created for.

Returns
A Gdk::Display.

◆ get_drag_surface() [1/2]

Glib::RefPtr< Surface > Gdk::Drag::get_drag_surface ( )

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 will be destroyed when the drag operation is over.

The returned surface is usually a subclass of Gdk::Surface that implements the Gdk::DragSurface interface. To use drag surface API, do something like

auto surface = drag->get_drag_surface();
if (drag_surface)
drag_surface->do_something();
__shared_ptr< _Tp, _Lp > dynamic_pointer_cast(const __shared_ptr< _Tp1, _Lp > &__r) noexcept
Returns
The drag surface, or an empty RefPtr.

◆ get_drag_surface() [2/2]

Glib::RefPtr< const Surface > Gdk::Drag::get_drag_surface ( ) const

See the non-const version.

◆ get_formats() [1/2]

Glib::RefPtr< ContentFormats > Gdk::Drag::get_formats ( )

Retrieves the formats supported by this Gdk::Drag object.

Returns
A Gdk::ContentFormats.

◆ get_formats() [2/2]

Glib::RefPtr< const ContentFormats > Gdk::Drag::get_formats ( ) const

Retrieves the formats supported by this Gdk::Drag object.

Returns
A Gdk::ContentFormats.

◆ get_selected_action()

DragAction Gdk::Drag::get_selected_action ( ) const

Determines the action chosen by the drag destination.

Returns
A Gdk::DragAction value.

◆ get_surface() [1/2]

Glib::RefPtr< Surface > Gdk::Drag::get_surface ( )

Returns the Gdk::Surface where the drag originates.

Returns
The Gdk::Surface where the drag originates.

◆ get_surface() [2/2]

Glib::RefPtr< const Surface > Gdk::Drag::get_surface ( ) const

Returns the Gdk::Surface where the drag originates.

Returns
The Gdk::Surface where the drag originates.

◆ get_type()

static GType Gdk::Drag::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GdkDrag * Gdk::Drag::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GdkDrag * Gdk::Drag::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GdkDrag * Gdk::Drag::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ operator=()

Drag & Gdk::Drag::operator= ( Drag &&  src)
noexcept

◆ property_actions() [1/2]

Glib::PropertyProxy< DragAction > Gdk::Drag::property_actions ( )

The possible actions of this drag.

Default value: 0

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_actions() [2/2]

Glib::PropertyProxy_ReadOnly< DragAction > Gdk::Drag::property_actions ( ) const

The possible actions of this drag.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_content()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentProvider > > Gdk::Drag::property_content ( ) const

The Gdk::ContentProvider.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_device()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Device > > Gdk::Drag::property_device ( ) const

The Gdk::Device that is performing the drag.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_display()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > Gdk::Drag::property_display ( ) const

The Gdk::Display that the drag belongs to.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_formats()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > Gdk::Drag::property_formats ( ) const

The possible formats that the drag can provide its data in.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_selected_action() [1/2]

Glib::PropertyProxy< DragAction > Gdk::Drag::property_selected_action ( )

The currently selected action of the drag.

Default value: 0

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_selected_action() [2/2]

Glib::PropertyProxy_ReadOnly< DragAction > Gdk::Drag::property_selected_action ( ) const

The currently selected action of the drag.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_surface()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Surface > > Gdk::Drag::property_surface ( ) const

The surface where the drag originates.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_hotspot()

void Gdk::Drag::set_hotspot ( int  hot_x,
int  hot_y 
)

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.

Parameters
hot_xX coordinate of the drag surface hotspot.
hot_yY coordinate of the drag surface hotspot.

◆ signal_cancel()

Glib::SignalProxy< void(DragCancelReason)> Gdk::Drag::signal_cancel ( )
Slot Prototype:
void on_my_cancel(DragCancelReason reason)

Flags: Run Last

Emitted when the drag operation is cancelled.

Parameters
reasonThe reason the drag was cancelled.

◆ signal_dnd_finished()

Glib::SignalProxy< void()> Gdk::Drag::signal_dnd_finished ( )
Slot Prototype:
void on_my_dnd_finished()

Flags: Run Last

Emitted when the destination side has finished reading all data.

The drag object can now free all miscellaneous data.

◆ signal_drop_performed()

Glib::SignalProxy< void()> Gdk::Drag::signal_drop_performed ( )
Slot Prototype:
void on_my_drop_performed()

Flags: Run Last

Emitted when the drop operation is performed on an accepting client.

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gdk::Drag > wrap ( GdkDrag object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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.