Class DragIcon

All Implemented Interfaces:
PointerInterface

public class DragIcon extends Widget
`GtkDragIcon` is a `GtkRoot` implementation for drag icons.

A drag icon moves with the pointer during a Drag-and-Drop operation
and is destroyed when the drag ends.

To set up a drag icon and associate it with an ongoing drag operation,
use [func@Gtk.DragIcon.get_for_drag] to get the icon for a drag. You can
then use it like any other widget and use [method@Gtk.DragIcon.set_child]
to set whatever widget should be used for the drag icon.

Keep in mind that drag icons do not allow user input.

https://docs.gtk.org/gtk4/class.DragIcon.html

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getChild

      public Widget getChild()
      Gets the widget currently used as drag icon.
      Returns:
      The drag icon
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the widget to display as the drag icon.
      Parameters:
      child - a `GtkWidget`
    • createWidgetForValue

      public static Widget createWidgetForValue(@Nonnull Value value)
      Creates a widget that can be used as a drag icon for the given
      @value.

      Supported types include strings, `GdkRGBA` and `GtkTextBuffer`.
      If GTK does not know how to create a widget for a given value,
      it will return %NULL.

      This method is used to set the default drag icon on drag-and-drop
      operations started by `GtkDragSource`, so you don't need to set
      a drag icon using this function there.
      Parameters:
      value - a `GValue`
      Returns:
      A new `GtkWidget` for displaying @value as a drag icon.
    • getForDrag

      public static Widget getForDrag(@Nonnull Drag drag)
      Gets the `GtkDragIcon` in use with @drag.

      If no drag icon exists yet, a new one will be created
      and shown.
      Parameters:
      drag - a `GdkDrag`
      Returns:
      the `GtkDragIcon`
    • setFromPaintable

      public static void setFromPaintable(@Nonnull Drag drag, @Nonnull Paintable paintable, int hot_x, int hot_y)
      Creates a `GtkDragIcon` that shows @paintable, and associates
      it with the drag operation.

      The hotspot position on the paintable is aligned with the
      hotspot of the cursor.
      Parameters:
      drag - a `GdkDrag`
      paintable - a `GdkPaintable` to display
      hot_x - X coordinate of the hotspot
      hot_y - Y coordinate of the hotspot
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • asNative

      public Native asNative()
      Implements interface Native. Call this to get access to interface functions.
      Returns:
      Native
    • asRoot

      public Root asRoot()
      Implements interface Root. Call this to get access to interface functions.
      Returns:
      Root
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()