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

public static class DragSource.Builder<B extends DragSource.Builder<B>> extends GestureSingle.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public DragSource build()
      Finish building the DragSource object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to DragSource.
      Overrides:
      build in class GestureSingle.Builder<B extends DragSource.Builder<B>>
      Returns:
      a new instance of DragSource with the properties that were set in the Builder object.
    • setActions

      public B setActions(Set<DragAction> actions)

      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 include DragAction.MOVE.

      Parameters:
      actions - the value for the actions property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setContent

      public B setContent(ContentProvider content)
      The data that is offered by drag operations from this source.
      Parameters:
      content - the value for the content property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setActions

      public B setActions(DragAction... actions)

      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 include DragAction.MOVE.

      Parameters:
      actions - the value for the actions property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onDragBegin

      public B onDragBegin(DragSource.DragBeginCallback handler)

      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(Paintable, int, int).

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onDragCancel

      public B onDragCancel(DragSource.DragCancelCallback handler)

      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

      public B onDragEnd(DragSource.DragEndCallback handler)

      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 or Gtk.DragSource::drag-begin handlers.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPrepare

      public B onPrepare(DragSource.PrepareCallback handler)

      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 the Gtk.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: