68 lines
1.5 KiB
Haskell
68 lines
1.5 KiB
Haskell
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.SelectionList where
|
|
|
|
import Color
|
|
import Control.Lens
|
|
import Data.IntMap.Strict (IntMap)
|
|
import Dodge.Data.CardinalPoint
|
|
import Dodge.Data.ScreenPos
|
|
import Picture.Data
|
|
|
|
data ListDisplayParams = ListDisplayParams
|
|
{ _ldpPos :: ScreenPos
|
|
, _ldpScale :: Float
|
|
, _ldpVerticalGap :: Float
|
|
, _ldpWidth :: SelectionWidth
|
|
}
|
|
|
|
data CursorDisplay
|
|
= BoundaryCursor {_cursSides :: [CardinalPoint]}
|
|
| BackdropCursor
|
|
|
|
data SectionCursor = SectionCursor
|
|
{ _scurPos :: Int
|
|
, _scurSize :: Int
|
|
, _scurColor :: Color
|
|
}
|
|
|
|
data SelectionSection a = SelectionSection
|
|
{ _ssItems :: IntMap (SelectionItem a)
|
|
, _ssOffset :: Int
|
|
, _ssShownItems :: [Picture]
|
|
, _ssIndent :: Int
|
|
}
|
|
|
|
type IMSS a = IntMap (SelectionSection a)
|
|
|
|
data SelectionWidth
|
|
= FixedSelectionWidth Int
|
|
-- | UseMaxSelectionItemWidth
|
|
| UseItemWidth
|
|
|
|
data SelectionItem a
|
|
= SelectionItem
|
|
{ _siPictures :: [String]
|
|
, _siHeight :: Int
|
|
, _siWidth :: Int
|
|
, _siIsSelectable :: Bool
|
|
, _siColor :: Color
|
|
, _siOffX :: Int
|
|
, _siPayload :: a
|
|
}
|
|
| SelectionInfo
|
|
{ _siPictures :: [String]
|
|
, _siHeight :: Int
|
|
, _siWidth :: Int
|
|
, _siIsSelectable :: Bool
|
|
, _siColor :: Color
|
|
, _siOffX :: Int
|
|
}
|
|
|
|
makeLenses ''ListDisplayParams
|
|
makeLenses ''SelectionItem
|
|
makeLenses ''SelectionSection
|
|
makeLenses ''SectionCursor
|
|
makeLenses ''CursorDisplay
|