~alcinnz/CatTrap

ref: 4c05e6f601b07a2cb9851ddf7f382a327ebe5c88 CatTrap/Graphics/Layout/Grid.hs -rw-r--r-- 1.3 KiB
4c05e6f6 — Adrian Cochrane Draft flow layout computation. 1 year, 7 months ago
                                                                                
09970dfc Adrian Cochrane
3dce4d79 Adrian Cochrane
272852e8 Adrian Cochrane
09970dfc Adrian Cochrane
272852e8 Adrian Cochrane
09970dfc Adrian Cochrane
272852e8 Adrian Cochrane
09970dfc Adrian Cochrane
272852e8 Adrian Cochrane
09970dfc Adrian Cochrane
3dce4d79 Adrian Cochrane
272852e8 Adrian Cochrane
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Graphics.Layout.Grid where

import Data.Text (Text)
import Graphics.Layout.Box

data Grid m n = Grid {
    rows :: [(Name, Either m Double)],
    columns :: [(Name, Either n Double)],
    gap :: Size m n,
    gridBox :: PaddedBox m n
}
data GridItem m n = GridItem {
    startRow :: Int, endRow :: Int, startCol :: Int, endCol :: Int,
    gridItemBox :: PaddedBox m n
}

type Name = Text

gridMinWidths :: Double -> Grid y Length -> [GridItem y Length] -> (Double, [Double])
gridNatWidths :: Double -> Grid y Length -> [GridItem y Length] -> (Double, [Double])
gridMaxWidths :: PaddedBox y Double -> Grid y Length -> (Double, [Double])
gridWidths :: PaddedBox y Double -> Grid y Length -> (Double, [Double])
gridNatHeights :: PaddedBox Length Double -> [GridItem Length Double] -> (Double, [Double])
gridMinHeights :: Double -> Grid Length Double -> (Double, [Double])
gridMaxHeights :: Double -> Grid Length Double -> (Double, [Double])
gridHeights :: Double -> Grid Length Double -> (Double, [Double])
gridPosition :: GridLength Double Double -> [GridItem Double Double] -> [Size Double Double]
gridLayout :: PaddedBox Double Double -> Grid Length Length ->
        [GridItem Length Length] -> Bool ->
        (Grid Double Double, [(Size Double Double, GridItem Double Double)])