@@ -13,7 +13,7 @@ import Reflex.Vty.Widget
13import Reflex.Vty.Widget.Text
13import Reflex.Vty.Widget.Text
15-- | Fill the background with the bottom box style
15-- | Fill the background with the bottom box style
16−hRule :: (HasDisplayRegion t m, HasImageWriter t m, HasTheme t m) => BoxStyle -> m ()
16+hRule :: (HasDisplayRegion t m, HasImageWriter t m) => BoxStyle -> m ()
17hRule boxStyle = fill $ pure (_boxStyle_s boxStyle)
17hRule boxStyle = fill $ pure (_boxStyle_s boxStyle)
19-- | Defines a set of symbols to use to draw the outlines of boxes
19-- | Defines a set of symbols to use to draw the outlines of boxes
@@ -54,7 +54,7 @@ roundedBoxStyle :: BoxStyle
54roundedBoxStyle = BoxStyle '╭' '─' '╮' '│' '╯' '─' '╰' '│'
54roundedBoxStyle = BoxStyle '╭' '─' '╮' '│' '╯' '─' '╰' '│'
56-- | Draws a titled box in the provided style and a child widget inside of that box
56-- | Draws a titled box in the provided style and a child widget inside of that box
57−boxTitle :: (Monad m, Reflex t ,HasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m, HasTheme t m)
57+boxTitle :: (Monad m, Reflex t ,HasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m)
58 => Behavior t BoxStyle
58 => Behavior t BoxStyle
59 -> Behavior t Text
59 -> Behavior t Text
@@ -62,39 +62,36 @@ boxTitle :: (Monad m, Reflex t ,HasDisplayRegion t m, HasImageWriter t m, HasInp
62boxTitle boxStyle title child = do
62boxTitle boxStyle title child = do
63 dh <- displayHeight
63 dh <- displayHeight
64 dw <- displayWidth
64 dw <- displayWidth
66 let boxReg = Region 0 0 <$> dw <*> dh
65 let boxReg = Region 0 0 <$> dw <*> dh
67 innerReg = Region 1 1 <$> (subtract 2 <$> dw) <*> (subtract 2 <$> dh)
66 innerReg = Region 1 1 <$> (subtract 2 <$> dw) <*> (subtract 2 <$> dh)
69− tellImages (boxImages <$> bt <*> title <*> boxStyle <*> current boxReg)
67+ tellImages (boxImages <$> title <*> boxStyle <*> current boxReg)
70− tellImages (ffor2 (current innerReg) bt (\r attr -> [regionBlankImage attr r]))
68+ tellImages (fmap (\r -> [regionBlankImage r]) (current innerReg))
72 pane innerReg (pure True) child
69 pane innerReg (pure True) child
74− boxImages :: V.Attr -> Text -> BoxStyle -> Region -> [Image]
71+ boxImages :: Text -> BoxStyle -> Region -> [Image]
75− boxImages attr title' style (Region left top width height) =
72+ boxImages title' style (Region left top width height) =
76 let right = left + width - 1
73 let right = left + width - 1
77 bottom = top + height - 1
74 bottom = top + height - 1
79 [ withinImage (Region (left + 1) top (width - 2) 1) $
76 [ withinImage (Region (left + 1) top (width - 2) 1) $
80− V.text' attr $
77+ V.text' V.defAttr $
81 hPadText title' (_boxStyle_n style) (width - 2)
78 hPadText title' (_boxStyle_n style) (width - 2)
82 , withinImage (Region right (top + 1) 1 (height - 2)) $
79 , withinImage (Region right (top + 1) 1 (height - 2)) $
83− V.charFill attr (_boxStyle_e style) 1 (height - 2)
80+ V.charFill V.defAttr (_boxStyle_e style) 1 (height - 2)
84 , withinImage (Region (left + 1) bottom (width - 2) 1) $
81 , withinImage (Region (left + 1) bottom (width - 2) 1) $
85− V.charFill attr (_boxStyle_s style) (width - 2) 1
82+ V.charFill V.defAttr (_boxStyle_s style) (width - 2) 1
86 , withinImage (Region left (top + 1) 1 (height - 2)) $
83 , withinImage (Region left (top + 1) 1 (height - 2)) $
87− V.charFill attr (_boxStyle_w style) 1 (height - 2)
84+ V.charFill V.defAttr (_boxStyle_w style) 1 (height - 2)
90 [ withinImage (Region left top 1 1) $
87 [ withinImage (Region left top 1 1) $
91− V.char attr (_boxStyle_nw style)
88+ V.char V.defAttr (_boxStyle_nw style)
92 , withinImage (Region right top 1 1) $
89 , withinImage (Region right top 1 1) $
93− V.char attr (_boxStyle_ne style)
90+ V.char V.defAttr (_boxStyle_ne style)
94 , withinImage (Region right bottom 1 1) $
91 , withinImage (Region right bottom 1 1) $
95− V.char attr (_boxStyle_se style)
92+ V.char V.defAttr (_boxStyle_se style)
96 , withinImage (Region left bottom 1 1) $
93 , withinImage (Region left bottom 1 1) $
97− V.char attr (_boxStyle_sw style)
94+ V.char V.defAttr (_boxStyle_sw style)
99 in sides ++ if width > 1 && height > 1 then corners else []
96 in sides ++ if width > 1 && height > 1 then corners else []
100 hPadText :: T.Text -> Char -> Int -> T.Text
97 hPadText :: T.Text -> Char -> Int -> T.Text
@@ -109,7 +106,7 @@ boxTitle boxStyle title child = do
109 right = mkHalf delta
106 right = mkHalf delta
111-- | A box without a title
108-- | A box without a title
112−box :: (Monad m, Reflex t, HasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m, HasTheme t m)
109+box :: (Monad m, Reflex t, HasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m)
113 => Behavior t BoxStyle
110 => Behavior t BoxStyle
@@ -117,7 +114,7 @@ box boxStyle = boxTitle boxStyle mempty
118-- | A box whose style is static
115-- | A box whose style is static
120− :: (Monad m, Reflex t, HasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m, HasTheme t m)
117+ :: (Monad m, Reflex t, HasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m)
121 => BoxStyle
118 => BoxStyle