@@ -43,6 +43,7 @@ module Reflex.Vty.Widget
44 , splitVDrag
44 , splitVDrag
48 , hyphenBoxStyle
49 , hyphenBoxStyle
@@ -489,19 +490,19 @@ roundedBoxStyle = BoxStyle '╭' '─' '╮' '│' '╯' '─' '╰' '│'
490-- | Draws a box in the provided style and a child widget inside of that box
491-- | Draws a box in the provided style and a child widget inside of that box
491box :: (Monad m, Reflex t)
492box :: (Monad m, Reflex t)
492− => BoxStyle
493+ => Behavior t BoxStyle
493 -> VtyWidget t m a
494 -> VtyWidget t m a
494 -> VtyWidget t m a
495 -> VtyWidget t m a
495−box style child = do
496+box boxStyle child = do
496 sz <- displaySize
497 sz <- displaySize
497 let boxReg = ffor (current sz) $ \(w,h) -> Region 0 0 w h
498 let boxReg = ffor (current sz) $ \(w,h) -> Region 0 0 w h
498 innerReg = ffor sz $ \(w,h) -> Region 1 1 (w - 2) (h - 2)
499 innerReg = ffor sz $ \(w,h) -> Region 1 1 (w - 2) (h - 2)
499− tellImages (fmap boxImages boxReg)
500+ tellImages (boxImages <$> boxStyle <*> boxReg)
500 tellImages (fmap (\r -> [regionBlankImage r]) (current innerReg))
501 tellImages (fmap (\r -> [regionBlankImage r]) (current innerReg))
501 pane innerReg (pure True) child
502 pane innerReg (pure True) child
503− boxImages :: Region -> [Image]
504+ boxImages :: BoxStyle -> Region -> [Image]
504− boxImages (Region left top width height) =
505+ boxImages style (Region left top width height) =
505 let right = left + width - 1
506 let right = left + width - 1
506 bottom = top + height - 1
507 bottom = top + height - 1
@@ -526,6 +527,14 @@ box style child = do
527 in sides ++ if width > 1 && height > 1 then corners else []
528 in sides ++ if width > 1 && height > 1 then corners else []
530+-- | A box whose style is static
532+ :: (Reflex t, Monad m)
536+boxStatic = box . pure
529-- | Renders text, wrapped to the container width
538-- | Renders text, wrapped to the container width
531 :: (Reflex t, Monad m)
540 :: (Reflex t, Monad m)