WIP work on the clock rendering
This commit is contained in:
parent
9655a8a126
commit
2bcabb3e33
20
app/Main.hs
20
app/Main.hs
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user