implemented menuControllerWith

This commit is contained in:
Jonathan Lamothe 2019-11-11 20:52:56 -05:00
parent e1f92ce92e
commit d14abdb248

View File

@ -59,12 +59,7 @@ import Mtlstats.Util
-- | Generates a simple 'Controller' for a Menu -- | Generates a simple 'Controller' for a Menu
menuController :: Menu () -> Controller menuController :: Menu () -> Controller
menuController menu = Controller menuController = menuControllerWith $ const $ return ()
{ drawController = const $ drawMenu menu
, handleController = \e -> do
menuHandler menu e
return True
}
-- | Generate a simple 'Controller' for a 'Menu' with a header -- | Generate a simple 'Controller' for a 'Menu' with a header
menuControllerWith menuControllerWith
@ -74,7 +69,14 @@ menuControllerWith
-- ^ The menu -- ^ The menu
-> Controller -> Controller
-- ^ The resulting controller -- ^ The resulting controller
menuControllerWith = undefined menuControllerWith header menu = Controller
{ drawController = \s -> do
header s
drawMenu menu
, handleController = \e -> do
menuHandler menu e
return True
}
-- | The draw function for a 'Menu' -- | The draw function for a 'Menu'
drawMenu :: Menu a -> C.Update C.CursorMode drawMenu :: Menu a -> C.Update C.CursorMode