Class: Gtk::DropTarget

Inherits:
EventController show all
Defined in:
(unknown)

Instance Method Summary collapse

Methods inherited from EventController

#current_event, #current_event_device, #current_event_state, #current_event_time, #name, #name=, #propagation_limit, #propagation_limit=, #propagation_phase, #propagation_phase=, #reset, #static_name=, #widget, #widget=

Constructor Details

#initialize(type, actions) ⇒ Gtk::DropTarget

Creates a new GtkDropTarget object.

If the drop target should support more than 1 type, pass %G_TYPE_INVALID for type and then call [methodGtk.DropTarget.set_gtypes].

Parameters:

  • type (GLib::Type)

    The supported type or %G_TYPE_INVALID

  • actions (Gdk::DragAction)

    the supported actions

Instance Method Details

#actionsGdk::DragAction

The GdkDragActions that this drop target supports.

Returns:

  • (Gdk::DragAction)

    actions

#actions=(actions) ⇒ Gdk::DragAction

The GdkDragActions that this drop target supports.

Parameters:

  • actions (Gdk::DragAction)

Returns:

  • (Gdk::DragAction)

    actions

  • (Gdk::DragAction)

    actions

#current_dropGdk::Drop

The GdkDrop that is currently being performed.

Returns:

  • (Gdk::Drop)

    current-drop

#current_drop=(current_drop) ⇒ Gdk::Drop

The GdkDrop that is currently being performed.

Parameters:

  • current_drop (Gdk::Drop)

Returns:

  • (Gdk::Drop)

    current-drop

  • (Gdk::Drop)

    current-drop

#dropGdk::Drop

The GdkDrop that is currently being performed.

Returns:

  • (Gdk::Drop)

    drop

#drop=(drop) ⇒ Gdk::Drop

The GdkDrop that is currently being performed.

Parameters:

  • drop (Gdk::Drop)

Returns:

  • (Gdk::Drop)

    drop

  • (Gdk::Drop)

    drop

#formatsGdk::ContentFormats

The GdkContentFormats that determine the supported data formats.

Returns:

  • (Gdk::ContentFormats)

    formats

#formats=(formats) ⇒ Gdk::ContentFormats

The GdkContentFormats that determine the supported data formats.

Parameters:

  • formats (Gdk::ContentFormats)

Returns:

  • (Gdk::ContentFormats)

    formats

  • (Gdk::ContentFormats)

    formats

#get_gtypes(n_types) ⇒ Array<GLib::Type>

Gets the list of supported GTypes that can be dropped on the target.

If no types have been set, NULL will be returned.

Parameters:

  • n_types (Integer)

    the number of GTypes contained in the return value

Returns:

  • (Array<GLib::Type>)

    the G_TYPE_INVALID-terminated array of types included in formats

#preloadBoolean

Gets whether data should be preloaded on hover.

Returns:

  • (Boolean)

    true if drop data should be preloaded

#preload=(preload) ⇒ Boolean

Whether the drop data should be preloaded when the pointer is only hovering over the widget but has not been released.

Setting this property allows finer grained reaction to an ongoing drop at the cost of loading more data.

The default value for this property is false to avoid downloading huge amounts of data by accident.

For example, if somebody drags a full document of gigabytes of text from a text editor across a widget with a preloading drop target, this data will be downloaded, even if the data is ultimately dropped elsewhere.

For a lot of data formats, the amount of data is very small (like %GDK_TYPE_RGBA), so enabling this property does not hurt at all. And for local-only Drag-and-Drop operations, no data transfer is done, so enabling it there is free.

Parameters:

  • preload (Boolean)

Returns:

  • (Boolean)

    preload

  • (Boolean)

    preload

#preload?Boolean

Whether the drop data should be preloaded when the pointer is only hovering over the widget but has not been released.

Setting this property allows finer grained reaction to an ongoing drop at the cost of loading more data.

The default value for this property is false to avoid downloading huge amounts of data by accident.

For example, if somebody drags a full document of gigabytes of text from a text editor across a widget with a preloading drop target, this data will be downloaded, even if the data is ultimately dropped elsewhere.

For a lot of data formats, the amount of data is very small (like %GDK_TYPE_RGBA), so enabling this property does not hurt at all. And for local-only Drag-and-Drop operations, no data transfer is done, so enabling it there is free.

Returns:

  • (Boolean)

    preload

#rejectnil

Rejects the ongoing drop operation.

If no drop operation is ongoing, i.e when [propertyGtk.DropTarget:current-drop] is nil, this function does nothing.

This function should be used when delaying the decision on whether to accept a drag or not until after reading the data.

Returns:

  • (nil)

#set_gtypes(types, n_types) ⇒ nil

Sets the supported GTypes for this drop target.

Parameters:

  • types (Array<GLib::Type>)

    all supported GTypes that can be dropped on the target

  • n_types (Integer)

    number of types

Returns:

  • (nil)

#valueGObject::Value

The value for this drop operation.

This is nil if the data has not been loaded yet or no drop operation is going on.

Data may be available before the [signalGtk.DropTarget::drop] signal gets emitted - for example when the [propertyGtk.DropTarget:preload] property is set. You can use the ::notify signal to be notified of available data.

Returns:

  • (GObject::Value)

    value

#value=(value) ⇒ GObject::Value

The value for this drop operation.

This is nil if the data has not been loaded yet or no drop operation is going on.

Data may be available before the [signalGtk.DropTarget::drop] signal gets emitted - for example when the [propertyGtk.DropTarget:preload] property is set. You can use the ::notify signal to be notified of available data.

Parameters:

  • value (GObject::Value)

Returns:

  • (GObject::Value)

    value

  • (GObject::Value)

    value