gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.DragIcon

Contents

- Exported types
- Methods
  - createWidgetForValue
  - getChild
  - getForDrag
  - setChild
  - setFromPaintable
- Properties
  - child

Description

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 `dragIconGetForDrag` to get the icon for a drag. You can then use it like any other widget and use `dragIconSetChild` to set whatever widget should be used for the drag icon.

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

Synopsis

- newtype DragIcon = DragIcon (ManagedPtr DragIcon)
- class (GObject o, IsDescendantOf DragIcon o) => IsDragIcon o
- toDragIcon :: (MonadIO m, IsDragIcon o) => o -> m DragIcon
- dragIconCreateWidgetForValue :: (HasCallStack, MonadIO m) => GValue -> m (Maybe Widget)
- dragIconGetChild :: (HasCallStack, MonadIO m, IsDragIcon a) => a -> m (Maybe Widget)
- dragIconGetForDrag :: (HasCallStack, MonadIO m, IsDrag a) => a -> m DragIcon
- dragIconSetChild :: (HasCallStack, MonadIO m, IsDragIcon a, IsWidget b) => a -> Maybe b -> m ()
- dragIconSetFromPaintable :: (HasCallStack, MonadIO m, IsDrag a, IsPaintable b) => a -> b -> Int32 -> Int32 -> m ()
- clearDragIconChild :: (MonadIO m, IsDragIcon o) => o -> m ()
- constructDragIconChild :: (IsDragIcon o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getDragIconChild :: (MonadIO m, IsDragIcon o) => o -> m (Maybe Widget)
- setDragIconChild :: (MonadIO m, IsDragIcon o, IsWidget a) => o -> a -> m ()

# Exported types

newtype DragIcon Source #

Memory-managed wrapper type.

Constructors

DragIcon (ManagedPtr DragIcon) |

#### Instances

Instances details

Eq DragIcon Source # |
Instance details Defined in GI.Gtk.Objects.DragIcon Methods (==) :: DragIcon -> DragIcon -> Bool Source # (/=) :: DragIcon -> DragIcon -> Bool Source #
GObject DragIcon Source # |
Instance details Defined in GI.Gtk.Objects.DragIcon
ManagedPtrNewtype DragIcon Source # |
Instance details Defined in GI.Gtk.Objects.DragIcon Methods toManagedPtr :: DragIcon -> ManagedPtr DragIcon Source #
TypedObject DragIcon Source # |
Instance details Defined in GI.Gtk.Objects.DragIcon Methods glibType :: IO GType Source #
HasParentTypes DragIcon Source # |
Instance details Defined in GI.Gtk.Objects.DragIcon
IsGValue (Maybe DragIcon) Source # | Convert `DragIcon` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.DragIcon Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe DragIcon -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe DragIcon) Source #
type ParentTypes DragIcon Source # |
Instance details Defined in GI.Gtk.Objects.DragIcon type ParentTypes DragIcon = '[Widget, Object, Accessible, Buildable, ConstraintTarget, Native, Root]

class (GObject o, IsDescendantOf DragIcon o) => IsDragIcon o Source #

Type class for types which can be safely cast to `DragIcon`, for instance with `toDragIcon`.

#### Instances

Instances details

(GObject o, IsDescendantOf DragIcon o) => IsDragIcon o Source # |
Instance details Defined in GI.Gtk.Objects.DragIcon

toDragIcon :: (MonadIO m, IsDragIcon o) => o -> m DragIcon Source #

Cast to `DragIcon`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocus, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRenderer, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getSurface, getSurfaceTransform, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setCanFocus, setCanTarget, setChild, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocus, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

## createWidgetForValue

dragIconCreateWidgetForValue Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> GValue | `value`: a `GValue`
-> m (Maybe Widget) | Returns: A new `GtkWidget` for displaying `value` as a drag icon.

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 `Nothing`.

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.

## getChild

dragIconGetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragIcon a) |
=> a | `self`: a `GtkDragIcon`
-> m (Maybe Widget) | Returns: The drag icon

Gets the widget currently used as drag icon.

## getForDrag

dragIconGetForDrag Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a) |
=> a | `drag`: a `GdkDrag`
-> m DragIcon | Returns: the `GtkDragIcon`

Gets the `GtkDragIcon` in use with `drag`.

If no drag icon exists yet, a new one will be created and shown.

## setChild

dragIconSetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsDragIcon a, IsWidget b) |
=> a | `self`: a `GtkDragIcon`
-> Maybe b | `child`: a `GtkWidget`
-> m () |

Sets the widget to display as the drag icon.

## setFromPaintable

dragIconSetFromPaintable Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a, IsPaintable b) |
=> a | `drag`: a `GdkDrag`
-> b | `paintable`: a `GdkPaintable` to display
-> Int32 | `hotX`: X coordinate of the hotspot
-> Int32 | `hotY`: Y coordinate of the hotspot
-> m () |

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.

# Properties

## child

The widget to display as drag icon.

clearDragIconChild :: (MonadIO m, IsDragIcon o) => o -> m () Source #

Set the value of the “`child`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #child

constructDragIconChild :: (IsDragIcon o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`child`” property. This is rarely needed directly, but it is used by `new`.

getDragIconChild :: (MonadIO m, IsDragIcon o) => o -> m (Maybe Widget) Source #

Get the value of the “`child`” property. When overloading is enabled, this is equivalent to

    get dragIcon #child

setDragIconChild :: (MonadIO m, IsDragIcon o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`child`” property. When overloading is enabled, this is equivalent to

    set dragIcon [ #child := value ]