mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-11-09 01:32:44 +03:00
Brick.Main: parameterize simpleApp on drawn widget
This commit is contained in:
parent
acd4bb5a04
commit
cae2ea64b7
@ -131,21 +131,19 @@ simpleMain :: (Ord n)
|
||||
=> Widget n
|
||||
-- ^ The widget to draw.
|
||||
-> IO ()
|
||||
simpleMain w =
|
||||
let app = simpleApp { appDraw = const [w] }
|
||||
in defaultMain app ()
|
||||
simpleMain w = defaultMain (simpleApp w) ()
|
||||
|
||||
-- | A simple application with reasonable defaults to be overridden as
|
||||
-- desired:
|
||||
--
|
||||
-- * Draws nothing
|
||||
-- * Draws only the specified widget
|
||||
-- * Quits on any event other than resizes
|
||||
-- * Has no start event handler
|
||||
-- * Provides no attribute map
|
||||
-- * Never shows any cursors
|
||||
simpleApp :: App s e n
|
||||
simpleApp =
|
||||
App { appDraw = const [C.emptyWidget]
|
||||
simpleApp :: Widget n -> App s e n
|
||||
simpleApp w =
|
||||
App { appDraw = const [w]
|
||||
, appHandleEvent = resizeOrQuit
|
||||
, appStartEvent = return
|
||||
, appAttrMap = const $ attrMap defAttr []
|
||||
|
Loading…
Reference in New Issue
Block a user