WIP work on the clock rendering

This commit is contained in:
Greg Shuflin 2023-03-01 18:32:59 -08:00
parent 9655a8a126
commit 2bcabb3e33

View File

@ -19,13 +19,31 @@ data AppEvent = AppInit | AppIncrease deriving (Show, Eq)
makeLenses 'AppModel
clockWidget :: WidgetNode s e
clockWidget = clockWidget_ def
clockWidget_ def = defaultWidgetNode "clock" newWidget where
newWidget = createSingle () def {
singleMerge = merge,
singleHandleEvent = handleEvent,
singleHandleMessage = handleMessage,
singleGetSizeReq = getSizeReq,
singleRender = render
}
merge wenv node oldNode oldState = result where
newNode = node
& L.widget .~ makeCanvas cfg oldState
result = resultNode newNode
buildUI
:: WidgetEnv AppModel AppEvent
-> AppModel
-> WidgetNode AppModel AppEvent
buildUI _wenv model = widgetTree where
widgetTree = vstack [
label $ "Cur time: " <> showt (model ^. curTimeRepresentation),
label $ showt (model ^. curTimeRepresentation),
spacer,
hstack [
label $ "Click count: " <> showt (model ^. clickCount),