Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Drop target container for a single element. Useful for adding drag support without having to implement a custom widget. Usually works in tandem with Monomer.Widgets.Containers.Draggable.
Raises a user provided event when an item is dropped. The type must match with the type of the dragged widget message, otherwise it will not be raised.
target = dropTarget ItemDropped $ vstack itemsRows `styleBasic` [width 200, height 400]
See Tutorial 6 (Composite) for a usage example.
Synopsis
- data DropTargetCfg
- dropTargetStyle :: [StyleState] -> DropTargetCfg
- dropTarget :: (DragMsg a, WidgetEvent e) => (a -> e) -> WidgetNode s e -> WidgetNode s e
- dropTarget_ :: (DragMsg a, WidgetEvent e) => (a -> e) -> [DropTargetCfg] -> WidgetNode s e -> WidgetNode s e
Configuration
data DropTargetCfg Source #
Configuration options for dropTarget:
dropTargetStyle
: The style to apply to the container when a dragged item is on top.
Instances
Monoid DropTargetCfg Source # | |
Defined in Monomer.Widgets.Containers.DropTarget mempty :: DropTargetCfg # mappend :: DropTargetCfg -> DropTargetCfg -> DropTargetCfg # mconcat :: [DropTargetCfg] -> DropTargetCfg # | |
Semigroup DropTargetCfg Source # | |
Defined in Monomer.Widgets.Containers.DropTarget (<>) :: DropTargetCfg -> DropTargetCfg -> DropTargetCfg # sconcat :: NonEmpty DropTargetCfg -> DropTargetCfg # stimes :: Integral b => b -> DropTargetCfg -> DropTargetCfg # | |
Default DropTargetCfg Source # | |
Defined in Monomer.Widgets.Containers.DropTarget def :: DropTargetCfg # |
dropTargetStyle :: [StyleState] -> DropTargetCfg Source #
The style to apply to the container when a dragged item is on top.
Constructors
:: (DragMsg a, WidgetEvent e) | |
=> (a -> e) | The event to raise on drop. |
-> WidgetNode s e | The child node. |
-> WidgetNode s e | The created drop target container. |
Creates a drop target container with a single node as child.
:: (DragMsg a, WidgetEvent e) | |
=> (a -> e) | The event to raise on drop. |
-> [DropTargetCfg] | The config options. |
-> WidgetNode s e | The child node. |
-> WidgetNode s e | The created drop target container. |
Creates a drop target container with a single node as child. Accepts config.