brick/programs/PaddingDemo.hs
Jonathan Daugherty 35aa2ad8a4 Monster patch: move most data types to Brick.Types, remove IsString
instance for Widget

- This makes the module layout more predictable since Brick.Widgets.Core
  now (mostly) only contains widgets and widget transformations
- Utility functions closely related to types are now in Brick.Types
- Brick.Types.Internal contains types used internal by the renderer,
  some are re-exported by Brick.Types
2015-08-19 19:40:06 -07:00

61 lines
1.4 KiB
Haskell

{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Default
import qualified Graphics.Vty as V
import Brick.Main (App(..), neverShowCursor, resizeOrQuit, defaultMain)
import Brick.Types
( Widget
, Padding(..)
)
import Brick.Widgets.Core
( vBox
, hBox
, str
, padAll
, padLeft
, padRight
, padTop
, padBottom
, padTopBottom
, padLeftRight
)
import Brick.Widgets.Border as B
import Brick.Widgets.Center as C
ui :: Widget
ui =
vBox [ hBox [ padLeft Max $ vCenter $ str "Left-padded"
, B.vBorder
, padRight Max $ vCenter $ str "Right-padded"
]
, B.hBorder
, hBox [ padTop Max $ hCenter $ str "Top-padded"
, B.vBorder
, padBottom Max $ hCenter $ str "Bottom-padded"
]
, B.hBorder
, hBox [ padLeftRight 2 $ str "Padded by 2 on left/right"
, B.vBorder
, vBox [ padTopBottom 1 $ str "Padded by 1 on top/bottom"
, B.hBorder
]
]
, B.hBorder
, padAll 2 $ str "Padded by 2 on all sides"
]
app :: App () V.Event
app =
App { appDraw = const [ui]
, appHandleEvent = resizeOrQuit
, appStartEvent = return
, appAttrMap = const def
, appChooseCursor = neverShowCursor
, appLiftVtyEvent = id
}
main :: IO ()
main = defaultMain app ()