2015-06-29 09:04:27 +03:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Main where
|
|
|
|
|
|
|
|
import Data.Default
|
2015-07-10 23:30:34 +03:00
|
|
|
import qualified Graphics.Vty as V
|
2015-06-29 09:04:27 +03:00
|
|
|
|
2015-07-10 23:30:34 +03:00
|
|
|
import Brick.Main (App(..), neverShowCursor, resizeOrQuit, defaultMain)
|
2015-08-20 05:40:06 +03:00
|
|
|
import Brick.Types
|
2015-07-10 23:30:34 +03:00
|
|
|
( Widget
|
|
|
|
, Padding(..)
|
2015-08-20 05:40:06 +03:00
|
|
|
)
|
|
|
|
import Brick.Widgets.Core
|
|
|
|
( vBox
|
|
|
|
, hBox
|
|
|
|
, str
|
2015-07-10 23:30:34 +03:00
|
|
|
, padAll
|
|
|
|
, padLeft
|
|
|
|
, padRight
|
|
|
|
, padTop
|
|
|
|
, padBottom
|
|
|
|
, padTopBottom
|
|
|
|
, padLeftRight
|
|
|
|
)
|
|
|
|
import Brick.Widgets.Border as B
|
|
|
|
import Brick.Widgets.Center as C
|
2015-06-29 09:04:27 +03:00
|
|
|
|
2016-03-05 01:42:49 +03:00
|
|
|
ui :: Widget ()
|
2015-06-29 09:04:27 +03:00
|
|
|
ui =
|
2015-08-20 05:40:06 +03:00
|
|
|
vBox [ hBox [ padLeft Max $ vCenter $ str "Left-padded"
|
2015-07-10 23:30:34 +03:00
|
|
|
, B.vBorder
|
2015-08-20 05:40:06 +03:00
|
|
|
, padRight Max $ vCenter $ str "Right-padded"
|
2015-06-29 09:04:27 +03:00
|
|
|
]
|
2015-07-10 23:30:34 +03:00
|
|
|
, B.hBorder
|
2015-08-20 05:40:06 +03:00
|
|
|
, hBox [ padTop Max $ hCenter $ str "Top-padded"
|
2015-07-10 23:30:34 +03:00
|
|
|
, B.vBorder
|
2015-08-20 05:40:06 +03:00
|
|
|
, padBottom Max $ hCenter $ str "Bottom-padded"
|
2015-06-29 09:04:27 +03:00
|
|
|
]
|
2015-07-10 23:30:34 +03:00
|
|
|
, B.hBorder
|
2015-08-20 05:40:06 +03:00
|
|
|
, hBox [ padLeftRight 2 $ str "Padded by 2 on left/right"
|
2015-07-10 23:30:34 +03:00
|
|
|
, B.vBorder
|
2015-08-20 05:40:06 +03:00
|
|
|
, vBox [ padTopBottom 1 $ str "Padded by 1 on top/bottom"
|
2015-07-10 23:30:34 +03:00
|
|
|
, B.hBorder
|
2015-07-09 20:19:27 +03:00
|
|
|
]
|
|
|
|
]
|
2015-07-10 23:30:34 +03:00
|
|
|
, B.hBorder
|
2015-08-20 05:40:06 +03:00
|
|
|
, padAll 2 $ str "Padded by 2 on all sides"
|
2015-06-29 09:04:27 +03:00
|
|
|
]
|
|
|
|
|
2016-03-05 01:42:49 +03:00
|
|
|
app :: App () V.Event ()
|
2015-06-29 09:04:27 +03:00
|
|
|
app =
|
2015-06-29 09:07:32 +03:00
|
|
|
App { appDraw = const [ui]
|
2015-06-29 09:04:27 +03:00
|
|
|
, appHandleEvent = resizeOrQuit
|
2015-07-01 05:15:29 +03:00
|
|
|
, appStartEvent = return
|
2015-06-29 09:04:27 +03:00
|
|
|
, appAttrMap = const def
|
|
|
|
, appChooseCursor = neverShowCursor
|
2015-07-10 23:53:21 +03:00
|
|
|
, appLiftVtyEvent = id
|
2015-06-29 09:04:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = defaultMain app ()
|