monomer-1.5.1.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 HaskellSafe-Inferred
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 Monomer.Widgets.Containers.DropTarget.

Requires a value to identify the content (used when the item is dropped) and the content to display.

dragItem = draggable "item" $ label "This label is draggable"

See Tutorial 6 (Composite) for a usage example.

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
Monoid (DraggableCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Draggable

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 #

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 Source #

Arguments

:: DragMsg a 
=> a

The identifying value.

-> WidgetNode s e

The child node.

-> WidgetNode s e

The created draggable container.

Creates a draggable container with a single node as child.

draggable_ Source #

Arguments

:: DragMsg a 
=> a

The identifying value.

-> [DraggableCfg s e]

The config options.

-> WidgetNode s e

The child node.

-> WidgetNode s e

The created draggable container.

Creates a draggable container with a single node as child. Accepts config.