mirror of
https://github.com/fjvallarino/monomer.git
synced 2024-11-14 16:34:16 +03:00
Send unhandled event as message to root element
This commit is contained in:
parent
966dca9a62
commit
fd8d267d98
@ -238,7 +238,7 @@ buildUI wenv model = traceShow "Creating UI" widgetSplitH where
|
|||||||
tooltip "Hello!\nThis is a long message, that will hopefully be split into several lines" (label "Test") `style` [bgColor orange, textSize 20]
|
tooltip "Hello!\nThis is a long message, that will hopefully be split into several lines" (label "Test") `style` [bgColor orange, textSize 20]
|
||||||
]
|
]
|
||||||
widgetSplit = hsplit (button "Button" RunShortTask, button "Button!!!" RunShortTask)
|
widgetSplit = hsplit (button "Button" RunShortTask, button "Button!!!" RunShortTask)
|
||||||
widgetSplitH = keystroke [("C-a", ShowAlert), ("C-c", ShowConfirm), ("C-S-p", ShowConfirm)] $ hsplit (image "assets/images/pecans.jpg" `style` [minWidth 200], widgetTree)
|
widgetSplitH = keystroke [("C-a", ShowAlert), ("C-c", ShowConfirm), ("C-S-p", ShowConfirm)] $ hsplit (image "assets/images/pecans.jpg", widgetTree)
|
||||||
widgetSplitV = vsplit (image "assets/images/pecans.jpg" `style` [rangeHeight 200 400], widgetTree `style` [rangeHeight 200 400])
|
widgetSplitV = vsplit (image "assets/images/pecans.jpg" `style` [rangeHeight 200 400], widgetTree `style` [rangeHeight 200 400])
|
||||||
mkImg i = vstack [
|
mkImg i = vstack [
|
||||||
label ("Image: " <> showt i),
|
label ("Image: " <> showt i),
|
||||||
|
@ -16,7 +16,7 @@ module Monomer.Main.Handlers (
|
|||||||
|
|
||||||
import Control.Concurrent.Async (async)
|
import Control.Concurrent.Async (async)
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
((&), (^.), (^?), (.~), (%~), (.=), (?=), _Just, _1, ix, at, use)
|
((&), (^.), (^?), (.~), (%~), (.=), (?=), _Just, _1, _2, ix, at, use)
|
||||||
import Control.Monad.STM (atomically)
|
import Control.Monad.STM (atomically)
|
||||||
import Control.Concurrent.STM.TChan (TChan, newTChanIO, writeTChan)
|
import Control.Concurrent.STM.TChan (TChan, newTChanIO, writeTChan)
|
||||||
import Control.Applicative ((<|>))
|
import Control.Applicative ((<|>))
|
||||||
@ -557,8 +557,10 @@ handleRaiseEvent
|
|||||||
-> HandlerStep s e
|
-> HandlerStep s e
|
||||||
-> m (HandlerStep s e)
|
-> m (HandlerStep s e)
|
||||||
handleRaiseEvent message step = do
|
handleRaiseEvent message step = do
|
||||||
liftIO $ putStrLn "Invalid state: RaiseEvent reached main handler"
|
let root = step ^. _2
|
||||||
return step
|
let widgetId = root ^. L.info . L.widgetId
|
||||||
|
|
||||||
|
handleSendMessage widgetId message step
|
||||||
|
|
||||||
handleSendMessage
|
handleSendMessage
|
||||||
:: forall s e m msg . (MonomerM s m, Typeable msg)
|
:: forall s e m msg . (MonomerM s m, Typeable msg)
|
||||||
|
10
tasks.md
10
tasks.md
@ -564,16 +564,22 @@
|
|||||||
- Add user documentation
|
- Add user documentation
|
||||||
- Windows build fix
|
- Windows build fix
|
||||||
- https://stackoverflow.com/questions/51275681/how-to-include-a-dependency-c-library-in-haskell-stack
|
- https://stackoverflow.com/questions/51275681/how-to-include-a-dependency-c-library-in-haskell-stack
|
||||||
|
- Simplify Composite. Do not handle events directly, make them go through as a message so they are handled in order
|
||||||
|
- Does it make sense to merge events into requests?
|
||||||
|
- Can s type argument be removed from WidgetRequest?
|
||||||
|
- Better still to add e to make it safer!
|
||||||
|
|
||||||
Next
|
Next
|
||||||
- Add examples
|
- Add examples
|
||||||
- Something of generative art (OpenGL example)
|
- Something of generative art (OpenGL example)
|
||||||
- Simplify Composite. Do not handle events directly, make them go through as a message so they are handled in order
|
- Simplify Composite. Do not handle events directly, make them go through as a message so they are handled in order
|
||||||
- Does it make sense to merge events into requests?
|
|
||||||
- Can type argument be removed from WidgetRequest?
|
|
||||||
- Send unhandled event as message to root element
|
- Send unhandled event as message to root element
|
||||||
|
- Check resize event. Is hsplit broken now?
|
||||||
- Fix test cases
|
- Fix test cases
|
||||||
- Find a way out of currState in getSizeReq (most likely add method back to Widget). It's very confusing and error prone
|
- Find a way out of currState in getSizeReq (most likely add method back to Widget). It's very confusing and error prone
|
||||||
|
- Remove serialization logic
|
||||||
|
- Can Req combinators be removed?
|
||||||
|
- Standardize use of Typeable/WidgetEvent/WidgetModel
|
||||||
- Should cascadeCtx be part of widget interface? Maybe it can be handled on init?
|
- Should cascadeCtx be part of widget interface? Maybe it can be handled on init?
|
||||||
- This could avoid rebuilding listView items when hidden/shown
|
- This could avoid rebuilding listView items when hidden/shown
|
||||||
- Maybe offset should be in node info?
|
- Maybe offset should be in node info?
|
||||||
|
Loading…
Reference in New Issue
Block a user