-- | PrettyBorders.hs -- Graphics.Vty.Widgets.Borders with simple replacing border char. module Widgets.PrettyBorders ( pVBorder, pHBorder ) where import Graphics.Vty import Graphics.Vty.Widgets.All -- |A horizontal or vertical border to be placed between widgets. See -- 'pHBorder' and 'pVBorder'. data PrettyBorder = VBorder Attr | HBorder Attr instance Widget PrettyBorder where growVertical (VBorder _) = True growVertical (HBorder _) = False growHorizontal (VBorder _) = False growHorizontal (HBorder _) = True primaryAttribute (VBorder a) = a primaryAttribute (HBorder a) = a render s (VBorder att) = char_fill att '│' 1 (region_height s) render s (HBorder att) = char_fill att '-' (region_width s) 1 withAttribute (VBorder _) att = VBorder att withAttribute (HBorder _) att = HBorder att -- |Create a single-column vertical border. pVBorder :: Attr -> PrettyBorder pVBorder = VBorder -- |Create a single-row horizontal border. pHBorder :: Attr -> PrettyBorder pHBorder = HBorder