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
|
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
|
buildUI
|
||||||
:: WidgetEnv AppModel AppEvent
|
:: WidgetEnv AppModel AppEvent
|
||||||
-> AppModel
|
-> AppModel
|
||||||
-> WidgetNode AppModel AppEvent
|
-> WidgetNode AppModel AppEvent
|
||||||
buildUI _wenv model = widgetTree where
|
buildUI _wenv model = widgetTree where
|
||||||
widgetTree = vstack [
|
widgetTree = vstack [
|
||||||
label $ "Cur time: " <> showt (model ^. curTimeRepresentation),
|
label $ showt (model ^. curTimeRepresentation),
|
||||||
spacer,
|
spacer,
|
||||||
hstack [
|
hstack [
|
||||||
label $ "Click count: " <> showt (model ^. clickCount),
|
label $ "Click count: " <> showt (model ^. clickCount),
|
||||||
|
Loading…
Reference in New Issue
Block a user