Package ch.bailu.gtk.gdk
Class Drop
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gdk.Drop
- All Implemented Interfaces:
PointerInterface
The `GdkDrop` 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 `GdkDrop` object can be obtained
from these [class@Gdk.Event] types using [method@Gdk.DNDEvent.get_drop].
The actual data transfer is initiated from the target side via an async
read, using one of the `GdkDrop` methods for this purpose:
[method@Gdk.Drop.read_async] or [method@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.
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 `GdkDrop` object can be obtained
from these [class@Gdk.Event] types using [method@Gdk.DNDEvent.get_drop].
The actual data transfer is initiated from the target side via an async
read, using one of the `GdkDrop` methods for this purpose:
[method@Gdk.Drop.read_async] or [method@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.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
finish
(int action) Ends the drag operation after a drop.int
Returns the possible actions for this `GdkDrop`.static ClassHandler
Returns the `GdkDevice` performing the drop.Gets the `GdkDisplay` that @self was created for.getDrag()
If this is an in-app drag-and-drop operation, returns the `GdkDrag`
that corresponds to this drop.Returns the `GdkContentFormats` that the drop offers the data
to be read in.static int
static long
static TypeSystem.TypeSize
Returns the `GdkSurface` performing the drop.static long
static TypeSystem.TypeSize
void
readAsync
(Strs mime_types, int io_priority, Cancellable cancellable, Drop.OnAsyncReadyCallback callback, Pointer user_data) Asynchronously read the dropped data from a `GdkDrop`
in a format that complies with one of the mime types.readFinish
(AsyncResult result, Strs out_mime_type) Finishes an async drop read operation.void
readValueAsync
(long type, int io_priority, Cancellable cancellable, Drop.OnAsyncReadyCallback callback, Pointer user_data) Asynchronously request the drag operation's contents converted
to the given @type.readValueFinish
(AsyncResult result) Finishes an async drop read.void
status
(int actions, int preferred) Selects all actions that are potentially supported by the destination.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Drop
-
-
Method Details
-
getClassHandler
-
finish
public void finish(int action) Ends the drag operation after a drop.
The @action must be a single action selected from the actions
available via [method@Gdk.Drop.get_actions].- Parameters:
action
- the action performed by the destination or 0 if the drop failed
-
getActions
public int getActions()Returns the possible actions for this `GdkDrop`.
If this value contains multiple actions - i.e.
[func@Gdk.DragAction.is_unique] returns %FALSE for the result -
[method@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
[method@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 [class@Gdk.Drop]
both as a response to source side actions as well as to calls to
[method@Gdk.Drop.status] or [method@Gdk.Drop.finish]. The source
side will not change this value anymore once a drop has started.- Returns:
- The possible `GdkDragActions`
-
getDevice
Returns the `GdkDevice` performing the drop.- Returns:
- The `GdkDevice` performing the drop.
-
getDisplay
Gets the `GdkDisplay` that @self was created for.- Returns:
- a `GdkDisplay`
-
getDrag
If this is an in-app drag-and-drop operation, returns the `GdkDrag`
that corresponds to this drop.
If it is not, %NULL is returned.- Returns:
- the corresponding `GdkDrag`
-
getFormats
Returns the `GdkContentFormats` that the drop offers the data
to be read in.- Returns:
- The possible `GdkContentFormats`
-
getSurface
Returns the `GdkSurface` performing the drop.- Returns:
- The `GdkSurface` performing the drop.
-
readAsync
public void readAsync(@Nonnull Strs mime_types, int io_priority, @Nullable Cancellable cancellable, Drop.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Asynchronously read the dropped data from a `GdkDrop`
in a format that complies with one of the mime types.- Parameters:
mime_types
- pointer to an array of mime typesio_priority
- the I/O priority for the read operationcancellable
- optional `GCancellable` objectcallback
- a `GAsyncReadyCallback` to call when the request is satisfieduser_data
- the data to pass to @callback
-
readFinish
public InputStream readFinish(@Nonnull AsyncResult result, @Nonnull Strs out_mime_type) throws AllocationError 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 [method@Gdk.Drop.read_async].- Parameters:
result
- a `GAsyncResult`out_mime_type
- return location for the used mime type- Returns:
- the `GInputStream`
- Throws:
AllocationError
-
readValueAsync
public void readValueAsync(long type, int io_priority, @Nullable Cancellable cancellable, Drop.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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 [method@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 [func@Gdk.content_deserialize_async] to convert the data.- Parameters:
type
- a `GType` to readio_priority
- the I/O priority of the request.cancellable
- optional `GCancellable` object, %NULL to ignore.callback
- callback to call when the request is satisfieduser_data
- the data to pass to callback function
-
readValueFinish
Finishes an async drop read.
See [method@Gdk.Drop.read_value_async].- Parameters:
result
- a `GAsyncResult`- Returns:
- a `GValue` containing the result.
- Throws:
AllocationError
-
status
public void status(int actions, int preferred) 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 [method@Gdk.Drop.get_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.- Parameters:
actions
- Supported actions of the destination, or 0 to indicate that a drop will not be acceptedpreferred
- A unique action that's a member of @actions indicating the preferred action
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-