monomer-widgets-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Monomer.Dragboard.DragboardCfg

Synopsis

Re-exported modules

Configuration

data DragboardCfg s e a Source #

Configuration options for dragboard:

  • moveValidator: function to check validity of a move.
  • dragIdOffset: offset for drag and drop event messages.
  • selectColor: color of selected square.
  • disableClick: whether items can be moved only by dragging.
  • renderSource: whether to render the source widget when dragging.
  • duration: how long the animation lasts in ms.
  • checkerConfig: config options for checkerboard container.
  • onFocus: event to raise when focus is received.
  • onFocusReq: WidgetRequest to generate when focus is received.
  • onBlur: event to raise when focus is lost.
  • onBlurReq: WidgetRequest to generate when focus is lost.
  • onChange: event to raise when the board changes.
  • onChangeReq: WidgetRequest to generate when the board changes.

Constructors

DragboardCfg 

Fields

Instances

Instances details
Monoid (DragboardCfg s e a) Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

mempty :: DragboardCfg s e a #

mappend :: DragboardCfg s e a -> DragboardCfg s e a -> DragboardCfg s e a #

mconcat :: [DragboardCfg s e a] -> DragboardCfg s e a #

Semigroup (DragboardCfg s e a) Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

(<>) :: DragboardCfg s e a -> DragboardCfg s e a -> DragboardCfg s e a #

sconcat :: NonEmpty (DragboardCfg s e a) -> DragboardCfg s e a #

stimes :: Integral b => b -> DragboardCfg s e a -> DragboardCfg s e a #

Default (DragboardCfg s e a) Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

def :: DragboardCfg s e a

CmbDuration (DragboardCfg s e a) Millisecond Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

duration :: Millisecond -> DragboardCfg s e a

WidgetEvent e => CmbOnBlur (DragboardCfg s e a) e Path Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

onBlur :: (Path -> e) -> DragboardCfg s e a

WidgetEvent e => CmbOnFocus (DragboardCfg s e a) e Path Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

onFocus :: (Path -> e) -> DragboardCfg s e a

CmbOnBlurReq (DragboardCfg s e a) s e Path Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

onBlurReq :: (Path -> WidgetRequest s e) -> DragboardCfg s e a

CmbOnFocusReq (DragboardCfg s e a) s e Path Source # 
Instance details

Defined in Monomer.Dragboard.DragboardCfg

Methods

onFocusReq :: (Path -> WidgetRequest s e) -> DragboardCfg s e a

moveValidator :: (Info a -> Bool) -> DragboardCfg s e a Source #

Receives previous board, index of a square where item has been dragged to and index of a square where item has been dragged from and returns whether this move is valid or not. If move is not valid then the board state will not change.

dragIdOffset :: Int -> DragboardCfg s e a Source #

When there are multiple dragboards, it is possible to drag an item from one dragboard to another. In order to ignore drop events caused by foreign items or to process them properly, the dragboards should use different offsets (for example, if each dragboard has less than 1000 squares, then multiples of 1000 can be used as offsets):

vgrid
    [ dragboard 3 3 boardState f
    , dragboard_ 3 3 anotherBoardState f [dragIdOffset 1000]
    , dragboard_ 3 3 yetAnotherBoardState f [dragIdOffset 2000]
    ]

selectColor :: Color -> DragboardCfg s e a Source #

Color of selected square which is yellow by default.

disableClick :: DragboardCfg s e a Source #

Allows items to be moved only by dragging.

disableClick_ :: Bool -> DragboardCfg s e a Source #

Whether items can be moved only by dragging.

renderSource :: DragboardCfg s e a Source #

Renders the source widget when dragging.

renderSource_ :: Bool -> DragboardCfg s e a Source #

Whether to render the source widget when dragging.

checkerConfig :: [CheckerboardCfg] -> DragboardCfg s e a Source #

Config options for checkerboard container which is used by dragboard.