Class DragSource.Builder<B extends DragSource.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
DragSource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theDragSource
object.onDragBegin
(DragSource.DragBeginCallback handler) Emitted on the drag source when a drag is started.Emitted on the drag source when a drag has failed.onDragEnd
(DragSource.DragEndCallback handler) Emitted on the drag source when a drag is finished.onPrepare
(DragSource.PrepareCallback handler) Emitted when a drag is about to be initiated.setActions
(Set<DragAction> actions) The actions that are supported by drag operations from the source.setActions
(DragAction... actions) The actions that are supported by drag operations from the source.setContent
(ContentProvider content) The data that is offered by drag operations from this source.Methods inherited from class org.gnome.gtk.GestureSingle.Builder
setButton, setExclusive, setTouchOnly
Methods inherited from class org.gnome.gtk.Gesture.Builder
onBegin, onCancel, onEnd, onSequenceStateChanged, onUpdate, setNPoints
Methods inherited from class org.gnome.gtk.EventController.Builder
setName, setPropagationLimit, setPropagationPhase
Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theDragSource
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toDragSource
.- Overrides:
build
in classGestureSingle.Builder<B extends DragSource.Builder<B>>
- Returns:
- a new instance of
DragSource
with the properties that were set in the Builder object.
-
setActions
The actions that are supported by drag operations from the source.Note that you must handle the
Gtk.DragSource::drag-end
signal if the actions includeDragAction.MOVE
.- Parameters:
actions
- the value for theactions
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setContent
The data that is offered by drag operations from this source.- Parameters:
content
- the value for thecontent
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setActions
The actions that are supported by drag operations from the source.Note that you must handle the
Gtk.DragSource::drag-end
signal if the actions includeDragAction.MOVE
.- Parameters:
actions
- the value for theactions
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onDragBegin
Emitted on the drag source when a drag is started.It can be used to e.g. set a custom drag icon with
DragSource.setIcon(org.gnome.gdk.Paintable, int, int)
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onDragCancel
Emitted on the drag source when a drag has failed.The signal handler may handle a failed drag operation based on the type of error. It should return
true
if the failure has been handled and the default "drag operation failed" animation should not be shown.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onDragEnd
Emitted on the drag source when a drag is finished.A typical reason to connect to this signal is to undo things done in
Gtk.DragSource::prepare
orGtk.DragSource::drag-begin
handlers.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onPrepare
Emitted when a drag is about to be initiated.It returns the
GdkContentProvider
to use for the drag that is about to start. The default handler for this signal returns the value of theGtk.DragSource:content
property, so if you set up that property ahead of time, you don't need to connect to this signal.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-