monomer-1.3.0.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Monomer.Widgets.Containers.Draggable

Description

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

Configuration

type DraggableRender s e Source #

Arguments

 = 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

Instances details
Semigroup (DraggableCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Draggable

Methods

(<>) :: 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 # 
Instance details

Defined in Monomer.Widgets.Containers.Draggable

Default (DraggableCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Draggable

Methods

def :: DraggableCfg s e #

CmbTransparency (DraggableCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Draggable

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.