Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Draggable container for a single item. Useful for adding drag support without
having to implement a custom widget. Usually works in tandem with
DropTarget
.
Synopsis
- type DraggableRender s e = DraggableCfg s e -> WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
- data DraggableCfg s e
- draggableMaxDim :: Double -> DraggableCfg s e
- draggableStyle :: [StyleState] -> DraggableCfg s e
- draggableRender :: DraggableRender s e -> DraggableCfg s e
- draggable :: DragMsg a => a -> WidgetNode s e -> WidgetNode s e
- draggable_ :: DragMsg a => a -> [DraggableCfg s e] -> WidgetNode s e -> WidgetNode s e
Configuration
type DraggableRender s e Source #
= DraggableCfg s e | The configuration of the draggable. |
-> WidgetEnv s e | The widget environment. |
-> WidgetNode s e | The widget node. |
-> Renderer | The renderer. |
-> IO () | The drawing actions. |
Rendering function for the dragged state.
data DraggableCfg s e Source #
Configuration options for draggable:
transparency
: the alpha level to apply when rendering content in drag mode.draggableMaxDim
: the maximum size of the largest axis when dragging. Keeps proportions.draggableStyle
: the style to use when the item is being dragged.draggableRender
: rendering function for the dragged state. Allows customizing this step without implementing a custom widget all the lifecycle steps.
The regular styling of this component apply only when the item is not being dragged. To style the dragged container, use draggableStyle.
The transparency config only applies to the inner content.
Instances
Semigroup (DraggableCfg s e) Source # | |
Defined in Monomer.Widgets.Containers.Draggable (<>) :: DraggableCfg s e -> DraggableCfg s e -> DraggableCfg s e # sconcat :: NonEmpty (DraggableCfg s e) -> DraggableCfg s e # stimes :: Integral b => b -> DraggableCfg s e -> DraggableCfg s e # | |
Monoid (DraggableCfg s e) Source # | |
Defined in Monomer.Widgets.Containers.Draggable mempty :: DraggableCfg s e # mappend :: DraggableCfg s e -> DraggableCfg s e -> DraggableCfg s e # mconcat :: [DraggableCfg s e] -> DraggableCfg s e # | |
Default (DraggableCfg s e) Source # | |
Defined in Monomer.Widgets.Containers.Draggable def :: DraggableCfg s e # | |
CmbTransparency (DraggableCfg s e) Source # | |
Defined in Monomer.Widgets.Containers.Draggable transparency :: Double -> DraggableCfg s e Source # |
draggableMaxDim :: Double -> DraggableCfg s e Source #
Maximum dimension. Useful when aspect ratio needs to be maintained while at the same time restricting growth.
draggableStyle :: [StyleState] -> DraggableCfg s e Source #
The style of the dragged container.
draggableRender :: DraggableRender s e -> DraggableCfg s e Source #
Rendering function for the dragged state.
Constructors
draggable :: DragMsg a => a -> WidgetNode s e -> WidgetNode s e Source #
Creates a draggable container with a single node as child.
draggable_ :: DragMsg a => a -> [DraggableCfg s e] -> WidgetNode s e -> WidgetNode s e Source #
Creates a draggable container with a single node as child. Accepts config.