Class: Gtk::DropTarget
- Inherits:
-
EventController
- Object
- EventController
- Gtk::DropTarget
- Defined in:
- lib/gtk4/drop-target.rb
Instance Method Summary collapse
-
#actions ⇒ Gdk::DragAction
The
GdkDragActionsthat this drop target supports. -
#actions=(actions) ⇒ Gdk::DragAction
The
GdkDragActionsthat this drop target supports. -
#current_drop ⇒ Gdk::Drop
The
GdkDropthat is currently being performed. -
#current_drop=(current_drop) ⇒ Gdk::Drop
The
GdkDropthat is currently being performed. -
#drop ⇒ Gdk::Drop
The
GdkDropthat is currently being performed. -
#drop=(drop) ⇒ Gdk::Drop
The
GdkDropthat is currently being performed. -
#formats ⇒ Gdk::ContentFormats
The
GdkContentFormatsthat determine the supported data formats. -
#formats=(formats) ⇒ Gdk::ContentFormats
The
GdkContentFormatsthat determine the supported data formats. -
#get_gtypes(n_types) ⇒ Array<GLib::Type>
Gets the list of supported
GTypes that can be dropped on the target. -
#initialize(type, actions) ⇒ Gtk::DropTarget
constructor
Creates a new
GtkDropTargetobject. -
#initialize_raw ⇒ Gtk::DropTarget
Creates a new
GtkDropTargetobject. -
#preload ⇒ Boolean
Gets whether data should be preloaded on hover.
-
#preload=(preload) ⇒ Boolean
Whether the drop data should be preloaded when the pointer is only hovering over the widget but has not been released.
-
#preload? ⇒ Boolean
Whether the drop data should be preloaded when the pointer is only hovering over the widget but has not been released.
-
#reject ⇒ nil
Rejects the ongoing drop operation.
-
#set_gtypes(types, n_types) ⇒ nil
Sets the supported
GTypes for this drop target. -
#value ⇒ GObject::Value
The value for this drop operation.
-
#value=(value) ⇒ GObject::Value
The value for this drop operation.
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].
20 21 22 23 24 25 26 27 |
# File 'lib/gtk4/drop-target.rb', line 20 def initialize(type, actions) if type.is_a?(Array) initialize_raw(GLib::Type::INVALID, actions) set_gtypes(type) else initialize_raw(type, actions) end end |
Instance Method Details
#actions ⇒ Gdk::DragAction
The GdkDragActions that this drop target supports.
#actions=(actions) ⇒ Gdk::DragAction
The GdkDragActions that this drop target supports.
#current_drop ⇒ Gdk::Drop
The GdkDrop that is currently being performed.
#current_drop=(current_drop) ⇒ Gdk::Drop
The GdkDrop that is currently being performed.
#drop ⇒ Gdk::Drop
The GdkDrop that is currently being performed.
#drop=(drop) ⇒ Gdk::Drop
The GdkDrop that is currently being performed.
#formats ⇒ Gdk::ContentFormats
The GdkContentFormats that determine the supported data formats.
#formats=(formats) ⇒ Gdk::ContentFormats
The GdkContentFormats that determine the supported data 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.
#initialize_raw ⇒ 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].
|
|
# File 'lib/gtk4/drop-target.rb', line 19
|
#preload ⇒ Boolean
Gets whether data should be preloaded on hover.
#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.
#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.
#reject ⇒ nil
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.
#set_gtypes(types, n_types) ⇒ nil
Sets the supported GTypes for this drop target.
#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.
#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.