{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE RankNTypes #-}
module Monomer.Widgets.Single (
module Monomer.Core,
module Monomer.Core.Combinators,
module Monomer.Event,
module Monomer.Graphics,
module Monomer.Widgets.Util,
SingleGetBaseStyle,
SingleGetCurrentStyle,
SingleInitHandler,
SingleMergeHandler,
SingleDisposeHandler,
SingleFindNextFocusHandler,
SingleFindByPointHandler,
SingleEventHandler,
SingleMessageHandler,
SingleGetSizeReqHandler,
SingleResizeHandler,
SingleRenderHandler,
Single(..),
createSingle
) where
import Control.Exception (AssertionFailed(..), throw)
import Control.Lens ((&), (^.), (^?), (.~), (%~), _Just)
import Data.Default
import Data.Maybe
import Data.Sequence (Seq(..), (|>))
import Data.Typeable (Typeable, cast)
import qualified Data.Sequence as Seq
import Monomer.Core
import Monomer.Core.Combinators
import Monomer.Event
import Monomer.Graphics
import Monomer.Helper
import Monomer.Widgets.Util
import qualified Monomer.Core.Lens as L
type SingleGetBaseStyle s e
= GetBaseStyle s e
type SingleGetCurrentStyle s e
= WidgetEnv s e
-> WidgetNode s e
-> StyleState
type SingleInitHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> WidgetResult s e
type SingleMergeHandler s e a
= WidgetEnv s e
-> WidgetNode s e
-> WidgetNode s e
-> a
-> WidgetResult s e
type SingleDisposeHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> WidgetResult s e
type SingleFindNextFocusHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> FocusDirection
-> Path
-> Maybe WidgetNodeInfo
type SingleFindByPointHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> Path
-> Point
-> Maybe WidgetNodeInfo
type SingleEventHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
type SingleMessageHandler s e
= forall i . Typeable i
=> WidgetEnv s e
-> WidgetNode s e
-> Path
-> i
-> Maybe (WidgetResult s e)
type SingleGetSizeReqHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> (SizeReq, SizeReq)
type SingleResizeHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> Rect
-> WidgetResult s e
type SingleRenderHandler s e
= WidgetEnv s e
-> WidgetNode s e
-> Renderer
-> IO ()
data Single s e a = Single {
Single s e a -> Bool
singleAddStyleReq :: Bool,
Single s e a -> Bool
singleFocusOnBtnPressed :: Bool,
Single s e a -> Bool
singleUseCustomCursor :: Bool,
Single s e a -> Bool
singleUseCustomSize :: Bool,
Single s e a -> Bool
singleUseScissor :: Bool,
Single s e a -> SingleGetBaseStyle s e
singleGetBaseStyle :: SingleGetBaseStyle s e,
Single s e a -> SingleGetCurrentStyle s e
singleGetCurrentStyle :: SingleGetCurrentStyle s e,
Single s e a -> SingleInitHandler s e
singleInit :: SingleInitHandler s e,
Single s e a -> SingleMergeHandler s e a
singleMerge :: SingleMergeHandler s e a,
Single s e a -> SingleDisposeHandler s e
singleDispose :: SingleDisposeHandler s e,
Single s e a -> SingleFindNextFocusHandler s e
singleFindNextFocus :: SingleFindNextFocusHandler s e,
Single s e a -> SingleFindByPointHandler s e
singleFindByPoint :: SingleFindByPointHandler s e,
Single s e a -> SingleEventHandler s e
singleHandleEvent :: SingleEventHandler s e,
Single s e a
-> forall i.
Typeable i =>
WidgetEnv s e
-> WidgetNode s e -> Path -> i -> Maybe (WidgetResult s e)
singleHandleMessage :: SingleMessageHandler s e,
Single s e a -> SingleGetSizeReqHandler s e
singleGetSizeReq :: SingleGetSizeReqHandler s e,
Single s e a -> SingleResizeHandler s e
singleResize :: SingleResizeHandler s e,
Single s e a -> SingleRenderHandler s e
singleRender :: SingleRenderHandler s e
}
instance Default (Single s e a) where
def :: Single s e a
def = Single :: forall s e a.
Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> SingleGetBaseStyle s e
-> SingleGetCurrentStyle s e
-> SingleInitHandler s e
-> SingleMergeHandler s e a
-> SingleInitHandler s e
-> SingleFindNextFocusHandler s e
-> SingleFindByPointHandler s e
-> SingleEventHandler s e
-> SingleMessageHandler s e
-> SingleGetSizeReqHandler s e
-> SingleResizeHandler s e
-> SingleRenderHandler s e
-> Single s e a
Single {
singleAddStyleReq :: Bool
singleAddStyleReq = Bool
True,
singleFocusOnBtnPressed :: Bool
singleFocusOnBtnPressed = Bool
True,
singleUseCustomCursor :: Bool
singleUseCustomCursor = Bool
False,
singleUseCustomSize :: Bool
singleUseCustomSize = Bool
False,
singleUseScissor :: Bool
singleUseScissor = Bool
False,
singleGetBaseStyle :: SingleGetBaseStyle s e
singleGetBaseStyle = SingleGetBaseStyle s e
forall s e. SingleGetBaseStyle s e
defaultGetBaseStyle,
singleGetCurrentStyle :: SingleGetCurrentStyle s e
singleGetCurrentStyle = SingleGetCurrentStyle s e
forall s e. SingleGetCurrentStyle s e
defaultGetCurrentStyle,
singleInit :: SingleInitHandler s e
singleInit = SingleInitHandler s e
forall s e. SingleInitHandler s e
defaultInit,
singleMerge :: SingleMergeHandler s e a
singleMerge = SingleMergeHandler s e a
forall s e a. SingleMergeHandler s e a
defaultMerge,
singleDispose :: SingleInitHandler s e
singleDispose = SingleInitHandler s e
forall s e. SingleInitHandler s e
defaultDispose,
singleFindNextFocus :: SingleFindNextFocusHandler s e
singleFindNextFocus = SingleFindNextFocusHandler s e
forall s e. SingleFindNextFocusHandler s e
defaultFindNextFocus,
singleFindByPoint :: SingleFindByPointHandler s e
singleFindByPoint = SingleFindByPointHandler s e
forall s e. SingleFindByPointHandler s e
defaultFindByPoint,
singleHandleEvent :: SingleEventHandler s e
singleHandleEvent = SingleEventHandler s e
forall s e. SingleEventHandler s e
defaultHandleEvent,
singleHandleMessage :: SingleMessageHandler s e
singleHandleMessage = SingleMessageHandler s e
forall s e. SingleMessageHandler s e
defaultHandleMessage,
singleGetSizeReq :: SingleGetSizeReqHandler s e
singleGetSizeReq = SingleGetSizeReqHandler s e
forall s e. SingleGetSizeReqHandler s e
defaultGetSizeReq,
singleResize :: SingleResizeHandler s e
singleResize = SingleResizeHandler s e
forall s e. SingleResizeHandler s e
defaultResize,
singleRender :: SingleRenderHandler s e
singleRender = SingleRenderHandler s e
forall s e. SingleRenderHandler s e
defaultRender
}
createSingle :: WidgetModel a => a -> Single s e a -> Widget s e
createSingle :: a -> Single s e a -> Widget s e
createSingle a
state Single s e a
single = Widget :: forall s e.
(WidgetEnv s e -> WidgetNode s e -> WidgetResult s e)
-> (WidgetEnv s e
-> WidgetNode s e -> WidgetNode s e -> WidgetResult s e)
-> (WidgetEnv s e -> WidgetNode s e -> WidgetResult s e)
-> (WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState)
-> (WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode)
-> (WidgetEnv s e
-> WidgetNode s e
-> FocusDirection
-> Path
-> Maybe WidgetNodeInfo)
-> (WidgetEnv s e
-> WidgetNode s e -> Path -> Point -> Maybe WidgetNodeInfo)
-> (WidgetEnv s e -> WidgetNode s e -> Path -> Seq WidgetNodeInfo)
-> (WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e))
-> (forall i.
Typeable i =>
WidgetEnv s e
-> WidgetNode s e -> Path -> i -> Maybe (WidgetResult s e))
-> (WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq))
-> (WidgetEnv s e
-> WidgetNode s e -> Rect -> (Path -> Bool) -> WidgetResult s e)
-> (WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ())
-> Widget s e
Widget {
widgetInit :: WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
widgetInit = Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
forall a s e.
WidgetModel a =>
Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
initWrapper Single s e a
single,
widgetMerge :: WidgetEnv s e
-> WidgetNode s e -> WidgetNode s e -> WidgetResult s e
widgetMerge = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNode s e
-> WidgetResult s e
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNode s e
-> WidgetResult s e
mergeWrapper Single s e a
single,
widgetDispose :: WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
widgetDispose = Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
forall s e a.
Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
disposeWrapper Single s e a
single,
widgetGetState :: WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState
widgetGetState = a -> WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState
forall i s e.
WidgetModel i =>
i -> WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState
makeState a
state,
widgetGetInstanceTree :: WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
widgetGetInstanceTree = Single s e a
-> WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
getInstanceTreeWrapper Single s e a
single,
widgetFindNextFocus :: WidgetEnv s e
-> WidgetNode s e -> FocusDirection -> Path -> Maybe WidgetNodeInfo
widgetFindNextFocus = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> FocusDirection
-> Path
-> Maybe WidgetNodeInfo
forall s e a. Single s e a -> SingleFindNextFocusHandler s e
singleFindNextFocus Single s e a
single,
widgetFindByPoint :: WidgetEnv s e
-> WidgetNode s e -> Path -> Point -> Maybe WidgetNodeInfo
widgetFindByPoint = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> Point
-> Maybe WidgetNodeInfo
forall s e a. Single s e a -> SingleFindByPointHandler s e
singleFindByPoint Single s e a
single,
widgetFindBranchByPath :: WidgetEnv s e -> WidgetNode s e -> Path -> Seq WidgetNodeInfo
widgetFindBranchByPath = WidgetEnv s e -> WidgetNode s e -> Path -> Seq WidgetNodeInfo
forall s e.
WidgetEnv s e -> WidgetNode s e -> Path -> Seq WidgetNodeInfo
singleFindBranchByPath,
widgetHandleEvent :: WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
widgetHandleEvent = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
handleEventWrapper Single s e a
single,
widgetHandleMessage :: forall i.
Typeable i =>
WidgetEnv s e
-> WidgetNode s e -> Path -> i -> Maybe (WidgetResult s e)
widgetHandleMessage = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> i
-> Maybe (WidgetResult s e)
forall s e a i.
(WidgetModel a, Typeable i) =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> i
-> Maybe (WidgetResult s e)
handleMessageWrapper Single s e a
single,
widgetGetSizeReq :: WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
widgetGetSizeReq = Single s e a
-> WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
getSizeReqWrapper Single s e a
single,
widgetResize :: WidgetEnv s e
-> WidgetNode s e -> Rect -> (Path -> Bool) -> WidgetResult s e
widgetResize = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Rect
-> (Path -> Bool)
-> WidgetResult s e
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Rect
-> (Path -> Bool)
-> WidgetResult s e
resizeHandlerWrapper Single s e a
single,
widgetRender :: WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
widgetRender = Single s e a
-> WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
forall s e a.
Single s e a
-> WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
renderWrapper Single s e a
single
}
defaultGetBaseStyle :: SingleGetBaseStyle s e
defaultGetBaseStyle :: SingleGetBaseStyle s e
defaultGetBaseStyle WidgetEnv s e
wenv WidgetNode s e
node = Maybe Style
forall a. Maybe a
Nothing
defaultGetCurrentStyle :: SingleGetCurrentStyle s e
defaultGetCurrentStyle :: SingleGetCurrentStyle s e
defaultGetCurrentStyle WidgetEnv s e
wenv WidgetNode s e
node = SingleGetCurrentStyle s e
forall s e. SingleGetCurrentStyle s e
currentStyle WidgetEnv s e
wenv WidgetNode s e
node
defaultInit :: SingleInitHandler s e
defaultInit :: SingleInitHandler s e
defaultInit WidgetEnv s e
wenv WidgetNode s e
node = WidgetNode s e -> WidgetResult s e
forall s e. WidgetNode s e -> WidgetResult s e
resultNode WidgetNode s e
node
initWrapper
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetResult s e
initWrapper :: Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
initWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node = WidgetResult s e
newResult where
initHandler :: WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
initHandler = Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
forall s e a.
Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
singleInit Single s e a
single
getBaseStyle :: SingleGetBaseStyle s e
getBaseStyle = Single s e a -> SingleGetBaseStyle s e
forall s e a. Single s e a -> SingleGetBaseStyle s e
singleGetBaseStyle Single s e a
single
styledNode :: WidgetNode s e
styledNode = SingleGetBaseStyle s e
-> WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
forall s e.
GetBaseStyle s e
-> WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
initNodeStyle SingleGetBaseStyle s e
getBaseStyle WidgetEnv s e
wenv WidgetNode s e
node
tmpResult :: WidgetResult s e
tmpResult = WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
initHandler WidgetEnv s e
wenv WidgetNode s e
styledNode
newResult :: WidgetResult s e
newResult = WidgetResult s e
tmpResult
WidgetResult s e
-> (WidgetResult s e -> WidgetResult s e) -> WidgetResult s e
forall a b. a -> (a -> b) -> b
& (WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e)
forall s a. HasNode s a => Lens' s a
L.node ((WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e))
-> WidgetNode s e -> WidgetResult s e -> WidgetResult s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
forall s e. WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
updateSizeReq WidgetEnv s e
wenv (WidgetResult s e
tmpResult WidgetResult s e
-> Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
-> WidgetNode s e
forall s a. s -> Getting a s a -> a
^. Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
forall s a. HasNode s a => Lens' s a
L.node)
defaultMerge :: SingleMergeHandler s e a
defaultMerge :: SingleMergeHandler s e a
defaultMerge WidgetEnv s e
wenv WidgetNode s e
newNode WidgetNode s e
oldState a
oldNode = WidgetNode s e -> WidgetResult s e
forall s e. WidgetNode s e -> WidgetResult s e
resultNode WidgetNode s e
newNode
mergeWrapper
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNode s e
-> WidgetResult s e
mergeWrapper :: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNode s e
-> WidgetResult s e
mergeWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
newNode WidgetNode s e
oldNode = WidgetResult s e
newResult where
mergeHandler :: SingleMergeHandler s e a
mergeHandler = Single s e a -> SingleMergeHandler s e a
forall s e a. Single s e a -> SingleMergeHandler s e a
singleMerge Single s e a
single
oldState :: Maybe WidgetState
oldState = Widget s e -> WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState
forall s e.
Widget s e -> WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState
widgetGetState (WidgetNode s e
oldNode WidgetNode s e
-> Getting (Widget s e) (WidgetNode s e) (Widget s e) -> Widget s e
forall s a. s -> Getting a s a -> a
^. Getting (Widget s e) (WidgetNode s e) (Widget s e)
forall s a. HasWidget s a => Lens' s a
L.widget) WidgetEnv s e
wenv WidgetNode s e
oldNode
oldInfo :: WidgetNodeInfo
oldInfo = WidgetNode s e
oldNode WidgetNode s e
-> Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
-> WidgetNodeInfo
forall s a. s -> Getting a s a -> a
^. Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
forall s a. HasInfo s a => Lens' s a
L.info
nodeHandler :: WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
nodeHandler WidgetEnv s e
wenv WidgetNode s e
styledNode = case Maybe WidgetState -> Maybe a
forall i. WidgetModel i => Maybe WidgetState -> Maybe i
useState Maybe WidgetState
oldState of
Just a
state -> SingleMergeHandler s e a
mergeHandler WidgetEnv s e
wenv WidgetNode s e
styledNode WidgetNode s e
oldNode a
state
Maybe a
_ -> WidgetNode s e -> WidgetResult s e
forall s e. WidgetNode s e -> WidgetResult s e
resultNode WidgetNode s e
styledNode
tmpResult :: WidgetResult s e
tmpResult = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNodeInfo
-> (WidgetEnv s e -> WidgetNode s e -> WidgetResult s e)
-> WidgetResult s e
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNodeInfo
-> (WidgetEnv s e -> WidgetNode s e -> WidgetResult s e)
-> WidgetResult s e
runNodeHandler Single s e a
single WidgetEnv s e
wenv WidgetNode s e
newNode WidgetNodeInfo
oldInfo WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
nodeHandler
newResult :: WidgetResult s e
newResult = WidgetNode s e -> WidgetResult s e -> WidgetResult s e
forall s e. WidgetNode s e -> WidgetResult s e -> WidgetResult s e
handleWidgetIdChange WidgetNode s e
oldNode WidgetResult s e
tmpResult
runNodeHandler
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNodeInfo
-> (WidgetEnv s e -> WidgetNode s e -> WidgetResult s e)
-> WidgetResult s e
runNodeHandler :: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetNodeInfo
-> (WidgetEnv s e -> WidgetNode s e -> WidgetResult s e)
-> WidgetResult s e
runNodeHandler Single s e a
single WidgetEnv s e
wenv WidgetNode s e
newNode WidgetNodeInfo
oldInfo WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
nodeHandler = WidgetResult s e
newResult where
getBaseStyle :: SingleGetBaseStyle s e
getBaseStyle = Single s e a -> SingleGetBaseStyle s e
forall s e a. Single s e a -> SingleGetBaseStyle s e
singleGetBaseStyle Single s e a
single
tempNode :: WidgetNode s e
tempNode = WidgetNode s e
newNode
WidgetNode s e
-> (WidgetNode s e -> WidgetNode s e) -> WidgetNode s e
forall a b. a -> (a -> b) -> b
& (WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> ((WidgetId -> Identity WidgetId)
-> WidgetNodeInfo -> Identity WidgetNodeInfo)
-> (WidgetId -> Identity WidgetId)
-> WidgetNode s e
-> Identity (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WidgetId -> Identity WidgetId)
-> WidgetNodeInfo -> Identity WidgetNodeInfo
forall s a. HasWidgetId s a => Lens' s a
L.widgetId ((WidgetId -> Identity WidgetId)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetId -> WidgetNode s e -> WidgetNode s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ WidgetNodeInfo
oldInfo WidgetNodeInfo
-> Getting WidgetId WidgetNodeInfo WidgetId -> WidgetId
forall s a. s -> Getting a s a -> a
^. Getting WidgetId WidgetNodeInfo WidgetId
forall s a. HasWidgetId s a => Lens' s a
L.widgetId
WidgetNode s e
-> (WidgetNode s e -> WidgetNode s e) -> WidgetNode s e
forall a b. a -> (a -> b) -> b
& (WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> ((Rect -> Identity Rect)
-> WidgetNodeInfo -> Identity WidgetNodeInfo)
-> (Rect -> Identity Rect)
-> WidgetNode s e
-> Identity (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rect -> Identity Rect)
-> WidgetNodeInfo -> Identity WidgetNodeInfo
forall s a. HasViewport s a => Lens' s a
L.viewport ((Rect -> Identity Rect)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> Rect -> WidgetNode s e -> WidgetNode s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ WidgetNodeInfo
oldInfo WidgetNodeInfo -> Getting Rect WidgetNodeInfo Rect -> Rect
forall s a. s -> Getting a s a -> a
^. Getting Rect WidgetNodeInfo Rect
forall s a. HasViewport s a => Lens' s a
L.viewport
WidgetNode s e
-> (WidgetNode s e -> WidgetNode s e) -> WidgetNode s e
forall a b. a -> (a -> b) -> b
& (WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> ((SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo)
-> (SizeReq -> Identity SizeReq)
-> WidgetNode s e
-> Identity (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo
forall s a. HasSizeReqW s a => Lens' s a
L.sizeReqW ((SizeReq -> Identity SizeReq)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> SizeReq -> WidgetNode s e -> WidgetNode s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ WidgetNodeInfo
oldInfo WidgetNodeInfo -> Getting SizeReq WidgetNodeInfo SizeReq -> SizeReq
forall s a. s -> Getting a s a -> a
^. Getting SizeReq WidgetNodeInfo SizeReq
forall s a. HasSizeReqW s a => Lens' s a
L.sizeReqW
WidgetNode s e
-> (WidgetNode s e -> WidgetNode s e) -> WidgetNode s e
forall a b. a -> (a -> b) -> b
& (WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> ((SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo)
-> (SizeReq -> Identity SizeReq)
-> WidgetNode s e
-> Identity (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo
forall s a. HasSizeReqH s a => Lens' s a
L.sizeReqH ((SizeReq -> Identity SizeReq)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> SizeReq -> WidgetNode s e -> WidgetNode s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ WidgetNodeInfo
oldInfo WidgetNodeInfo -> Getting SizeReq WidgetNodeInfo SizeReq -> SizeReq
forall s a. s -> Getting a s a -> a
^. Getting SizeReq WidgetNodeInfo SizeReq
forall s a. HasSizeReqH s a => Lens' s a
L.sizeReqH
styledNode :: WidgetNode s e
styledNode = SingleGetBaseStyle s e
-> WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
forall s e.
GetBaseStyle s e
-> WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
initNodeStyle SingleGetBaseStyle s e
getBaseStyle WidgetEnv s e
wenv WidgetNode s e
tempNode
tmpResult :: WidgetResult s e
tmpResult = WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
nodeHandler WidgetEnv s e
wenv WidgetNode s e
styledNode
newResult :: WidgetResult s e
newResult
| Maybe (WidgetResult s e) -> Bool
forall s e. Maybe (WidgetResult s e) -> Bool
isResizeAnyResult (WidgetResult s e -> Maybe (WidgetResult s e)
forall a. a -> Maybe a
Just WidgetResult s e
tmpResult) = WidgetResult s e
tmpResult
WidgetResult s e
-> (WidgetResult s e -> WidgetResult s e) -> WidgetResult s e
forall a b. a -> (a -> b) -> b
& (WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e)
forall s a. HasNode s a => Lens' s a
L.node ((WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e))
-> WidgetNode s e -> WidgetResult s e -> WidgetResult s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
forall s e. WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
updateSizeReq WidgetEnv s e
wenv (WidgetResult s e
tmpResult WidgetResult s e
-> Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
-> WidgetNode s e
forall s a. s -> Getting a s a -> a
^. Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
forall s a. HasNode s a => Lens' s a
L.node)
| Bool
otherwise = WidgetResult s e
tmpResult
getInstanceTreeWrapper
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetInstanceNode
getInstanceTreeWrapper :: Single s e a
-> WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
getInstanceTreeWrapper Single s e a
container WidgetEnv s e
wenv WidgetNode s e
node = WidgetInstanceNode
instNode where
instNode :: WidgetInstanceNode
instNode = WidgetInstanceNode :: WidgetNodeInfo
-> Maybe WidgetState
-> Seq WidgetInstanceNode
-> WidgetInstanceNode
WidgetInstanceNode {
_winInfo :: WidgetNodeInfo
_winInfo = WidgetNode s e
node WidgetNode s e
-> Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
-> WidgetNodeInfo
forall s a. s -> Getting a s a -> a
^. Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
forall s a. HasInfo s a => Lens' s a
L.info,
_winState :: Maybe WidgetState
_winState = Widget s e -> WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState
forall s e.
Widget s e -> WidgetEnv s e -> WidgetNode s e -> Maybe WidgetState
widgetGetState (WidgetNode s e
node WidgetNode s e
-> Getting (Widget s e) (WidgetNode s e) (Widget s e) -> Widget s e
forall s a. s -> Getting a s a -> a
^. Getting (Widget s e) (WidgetNode s e) (Widget s e)
forall s a. HasWidget s a => Lens' s a
L.widget) WidgetEnv s e
wenv WidgetNode s e
node,
_winChildren :: Seq WidgetInstanceNode
_winChildren = (WidgetNode s e -> WidgetInstanceNode)
-> Seq (WidgetNode s e) -> Seq WidgetInstanceNode
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
forall s e. WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
getChildTree WidgetEnv s e
wenv) (WidgetNode s e
node WidgetNode s e
-> Getting
(Seq (WidgetNode s e)) (WidgetNode s e) (Seq (WidgetNode s e))
-> Seq (WidgetNode s e)
forall s a. s -> Getting a s a -> a
^. Getting
(Seq (WidgetNode s e)) (WidgetNode s e) (Seq (WidgetNode s e))
forall s a. HasChildren s a => Lens' s a
L.children)
}
getChildTree :: WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
getChildTree WidgetEnv s e
wenv WidgetNode s e
child = Widget s e -> WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
forall s e.
Widget s e -> WidgetEnv s e -> WidgetNode s e -> WidgetInstanceNode
widgetGetInstanceTree (WidgetNode s e
child WidgetNode s e
-> Getting (Widget s e) (WidgetNode s e) (Widget s e) -> Widget s e
forall s a. s -> Getting a s a -> a
^. Getting (Widget s e) (WidgetNode s e) (Widget s e)
forall s a. HasWidget s a => Lens' s a
L.widget) WidgetEnv s e
wenv WidgetNode s e
child
defaultDispose :: SingleDisposeHandler s e
defaultDispose :: SingleDisposeHandler s e
defaultDispose WidgetEnv s e
wenv WidgetNode s e
node = WidgetNode s e -> WidgetResult s e
forall s e. WidgetNode s e -> WidgetResult s e
resultNode WidgetNode s e
node
disposeWrapper
:: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> WidgetResult s e
disposeWrapper :: Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
disposeWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node = WidgetResult s e
result where
disposeHandler :: WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
disposeHandler = Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
forall s e a.
Single s e a -> WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
singleDispose Single s e a
single
WidgetResult WidgetNode s e
newNode Seq (WidgetRequest s e)
reqs = WidgetEnv s e -> WidgetNode s e -> WidgetResult s e
disposeHandler WidgetEnv s e
wenv WidgetNode s e
node
widgetId :: WidgetId
widgetId = WidgetNode s e
node WidgetNode s e
-> Getting WidgetId (WidgetNode s e) WidgetId -> WidgetId
forall s a. s -> Getting a s a -> a
^. (WidgetNodeInfo -> Const WidgetId WidgetNodeInfo)
-> WidgetNode s e -> Const WidgetId (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Const WidgetId WidgetNodeInfo)
-> WidgetNode s e -> Const WidgetId (WidgetNode s e))
-> Getting WidgetId WidgetNodeInfo WidgetId
-> Getting WidgetId (WidgetNode s e) WidgetId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting WidgetId WidgetNodeInfo WidgetId
forall s a. HasWidgetId s a => Lens' s a
L.widgetId
newReqs :: Seq (WidgetRequest s e)
newReqs = Seq (WidgetRequest s e)
reqs Seq (WidgetRequest s e)
-> WidgetRequest s e -> Seq (WidgetRequest s e)
forall a. Seq a -> a -> Seq a
|> WidgetId -> WidgetRequest s e
forall s e. WidgetId -> WidgetRequest s e
ResetWidgetPath WidgetId
widgetId
result :: WidgetResult s e
result = WidgetNode s e -> Seq (WidgetRequest s e) -> WidgetResult s e
forall s e.
WidgetNode s e -> Seq (WidgetRequest s e) -> WidgetResult s e
WidgetResult WidgetNode s e
newNode Seq (WidgetRequest s e)
newReqs
defaultFindNextFocus :: SingleFindNextFocusHandler s e
defaultFindNextFocus :: SingleFindNextFocusHandler s e
defaultFindNextFocus WidgetEnv s e
wenv WidgetNode s e
node FocusDirection
direction Path
startFrom
| WidgetNode s e -> Path -> FocusDirection -> Bool
forall s e. WidgetNode s e -> Path -> FocusDirection -> Bool
isFocusCandidate WidgetNode s e
node Path
startFrom FocusDirection
direction = WidgetNodeInfo -> Maybe WidgetNodeInfo
forall a. a -> Maybe a
Just (WidgetNode s e
node WidgetNode s e
-> Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
-> WidgetNodeInfo
forall s a. s -> Getting a s a -> a
^. Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
forall s a. HasInfo s a => Lens' s a
L.info)
| Bool
otherwise = Maybe WidgetNodeInfo
forall a. Maybe a
Nothing
defaultFindByPoint :: SingleFindByPointHandler s e
defaultFindByPoint :: SingleFindByPointHandler s e
defaultFindByPoint WidgetEnv s e
wenv WidgetNode s e
node Path
start Point
point
| Bool
visible Bool -> Bool -> Bool
&& Bool
validPath Bool -> Bool -> Bool
&& WidgetNode s e -> Point -> Bool
forall s e. WidgetNode s e -> Point -> Bool
isPointInNodeVp WidgetNode s e
node Point
point = WidgetNodeInfo -> Maybe WidgetNodeInfo
forall a. a -> Maybe a
Just WidgetNodeInfo
info
| Bool
otherwise = Maybe WidgetNodeInfo
forall a. Maybe a
Nothing
where
info :: WidgetNodeInfo
info = WidgetNode s e
node WidgetNode s e
-> Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
-> WidgetNodeInfo
forall s a. s -> Getting a s a -> a
^. Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
forall s a. HasInfo s a => Lens' s a
L.info
visible :: Bool
visible = WidgetNodeInfo
info WidgetNodeInfo -> Getting Bool WidgetNodeInfo Bool -> Bool
forall s a. s -> Getting a s a -> a
^. Getting Bool WidgetNodeInfo Bool
forall s a. HasVisible s a => Lens' s a
L.visible
path :: Path
path = WidgetNode s e
node WidgetNode s e -> Getting Path (WidgetNode s e) Path -> Path
forall s a. s -> Getting a s a -> a
^. (WidgetNodeInfo -> Const Path WidgetNodeInfo)
-> WidgetNode s e -> Const Path (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Const Path WidgetNodeInfo)
-> WidgetNode s e -> Const Path (WidgetNode s e))
-> ((Path -> Const Path Path)
-> WidgetNodeInfo -> Const Path WidgetNodeInfo)
-> Getting Path (WidgetNode s e) Path
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Path -> Const Path Path)
-> WidgetNodeInfo -> Const Path WidgetNodeInfo
forall s a. HasPath s a => Lens' s a
L.path
validPath :: Bool
validPath = Path -> Path -> Bool
forall a. Eq a => Seq a -> Seq a -> Bool
seqStartsWith Path
start Path
path
singleFindBranchByPath
:: WidgetEnv s e
-> WidgetNode s e
-> Path
-> Seq WidgetNodeInfo
singleFindBranchByPath :: WidgetEnv s e -> WidgetNode s e -> Path -> Seq WidgetNodeInfo
singleFindBranchByPath WidgetEnv s e
wenv WidgetNode s e
node Path
path
| WidgetNodeInfo
info WidgetNodeInfo
-> ((Path -> Const Path Path)
-> WidgetNodeInfo -> Const Path WidgetNodeInfo)
-> Path
forall s a. s -> Getting a s a -> a
^. (Path -> Const Path Path)
-> WidgetNodeInfo -> Const Path WidgetNodeInfo
forall s a. HasPath s a => Lens' s a
L.path Path -> Path -> Bool
forall a. Eq a => a -> a -> Bool
== Path
path = WidgetNodeInfo -> Seq WidgetNodeInfo
forall a. a -> Seq a
Seq.singleton WidgetNodeInfo
info
| Bool
otherwise = Seq WidgetNodeInfo
forall a. Seq a
Seq.empty
where
info :: WidgetNodeInfo
info = WidgetNode s e
node WidgetNode s e
-> Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
-> WidgetNodeInfo
forall s a. s -> Getting a s a -> a
^. Getting WidgetNodeInfo (WidgetNode s e) WidgetNodeInfo
forall s a. HasInfo s a => Lens' s a
L.info
defaultHandleEvent :: SingleEventHandler s e
defaultHandleEvent :: SingleEventHandler s e
defaultHandleEvent WidgetEnv s e
wenv WidgetNode s e
node Path
target SystemEvent
evt = Maybe (WidgetResult s e)
forall a. Maybe a
Nothing
handleEventWrapper
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
handleEventWrapper :: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
handleEventWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node Path
target SystemEvent
evt
| Bool -> Bool
not (WidgetNode s e
node WidgetNode s e -> Getting Bool (WidgetNode s e) Bool -> Bool
forall s a. s -> Getting a s a -> a
^. (WidgetNodeInfo -> Const Bool WidgetNodeInfo)
-> WidgetNode s e -> Const Bool (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Const Bool WidgetNodeInfo)
-> WidgetNode s e -> Const Bool (WidgetNode s e))
-> Getting Bool WidgetNodeInfo Bool
-> Getting Bool (WidgetNode s e) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Bool WidgetNodeInfo Bool
forall s a. HasVisible s a => Lens' s a
L.visible) = Maybe (WidgetResult s e)
forall a. Maybe a
Nothing
| Bool
otherwise = WidgetEnv s e
-> Path
-> StyleState
-> Bool
-> WidgetNode s e
-> SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
forall s e.
WidgetEnv s e
-> Path
-> StyleState
-> Bool
-> WidgetNode s e
-> SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleStyleChange WidgetEnv s e
wenv Path
target StyleState
style Bool
handleCursor WidgetNode s e
node SystemEvent
evt Maybe (WidgetResult s e)
result
where
style :: StyleState
style = Single s e a -> SingleGetCurrentStyle s e
forall s e a. Single s e a -> SingleGetCurrentStyle s e
singleGetCurrentStyle Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node
handleCursor :: Bool
handleCursor = Bool -> Bool
not (Single s e a -> Bool
forall s e a. Single s e a -> Bool
singleUseCustomCursor Single s e a
single)
focusOnPressed :: Bool
focusOnPressed = Single s e a -> Bool
forall s e a. Single s e a -> Bool
singleFocusOnBtnPressed Single s e a
single
handler :: WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
handler = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
forall s e a. Single s e a -> SingleEventHandler s e
singleHandleEvent Single s e a
single
handlerRes :: Maybe (WidgetResult s e)
handlerRes = WidgetEnv s e
-> WidgetNode s e
-> Path
-> SystemEvent
-> Maybe (WidgetResult s e)
handler WidgetEnv s e
wenv WidgetNode s e
node Path
target SystemEvent
evt
sizeResult :: Maybe (WidgetResult s e)
sizeResult = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleSizeReqChange Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node (SystemEvent -> Maybe SystemEvent
forall a. a -> Maybe a
Just SystemEvent
evt) Maybe (WidgetResult s e)
handlerRes
result :: Maybe (WidgetResult s e)
result
| Bool
focusOnPressed = WidgetEnv s e
-> WidgetNode s e
-> SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
forall s e.
WidgetEnv s e
-> WidgetNode s e
-> SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleFocusRequest WidgetEnv s e
wenv WidgetNode s e
node SystemEvent
evt Maybe (WidgetResult s e)
sizeResult
| Bool
otherwise = Maybe (WidgetResult s e)
sizeResult
handleFocusRequest
:: WidgetEnv s e
-> WidgetNode s e
-> SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleFocusRequest :: WidgetEnv s e
-> WidgetNode s e
-> SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleFocusRequest WidgetEnv s e
wenv WidgetNode s e
oldNode SystemEvent
evt Maybe (WidgetResult s e)
mResult = Maybe (WidgetResult s e)
newResult where
node :: WidgetNode s e
node = WidgetNode s e
-> (WidgetResult s e -> WidgetNode s e)
-> Maybe (WidgetResult s e)
-> WidgetNode s e
forall b a. b -> (a -> b) -> Maybe a -> b
maybe WidgetNode s e
oldNode (WidgetResult s e
-> Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
-> WidgetNode s e
forall s a. s -> Getting a s a -> a
^. Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
forall s a. HasNode s a => Lens' s a
L.node) Maybe (WidgetResult s e)
mResult
prevReqs :: Seq (WidgetRequest s e)
prevReqs = Seq (WidgetRequest s e)
-> (WidgetResult s e -> Seq (WidgetRequest s e))
-> Maybe (WidgetResult s e)
-> Seq (WidgetRequest s e)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Seq (WidgetRequest s e)
forall a. Seq a
Empty (WidgetResult s e
-> Getting
(Seq (WidgetRequest s e))
(WidgetResult s e)
(Seq (WidgetRequest s e))
-> Seq (WidgetRequest s e)
forall s a. s -> Getting a s a -> a
^. Getting
(Seq (WidgetRequest s e))
(WidgetResult s e)
(Seq (WidgetRequest s e))
forall s a. HasRequests s a => Lens' s a
L.requests) Maybe (WidgetResult s e)
mResult
isFocusable :: Bool
isFocusable = WidgetNode s e
node WidgetNode s e -> Getting Bool (WidgetNode s e) Bool -> Bool
forall s a. s -> Getting a s a -> a
^. (WidgetNodeInfo -> Const Bool WidgetNodeInfo)
-> WidgetNode s e -> Const Bool (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Const Bool WidgetNodeInfo)
-> WidgetNode s e -> Const Bool (WidgetNode s e))
-> Getting Bool WidgetNodeInfo Bool
-> Getting Bool (WidgetNode s e) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Bool WidgetNodeInfo Bool
forall s a. HasFocusable s a => Lens' s a
L.focusable
btnPressed :: Maybe Button
btnPressed = case SystemEvent
evt of
ButtonAction Point
_ Button
btn ButtonState
BtnPressed Int
_ -> Button -> Maybe Button
forall a. a -> Maybe a
Just Button
btn
SystemEvent
_ -> Maybe Button
forall a. Maybe a
Nothing
isFocusReq :: Bool
isFocusReq = Maybe Button
btnPressed Maybe Button -> Maybe Button -> Bool
forall a. Eq a => a -> a -> Bool
== Button -> Maybe Button
forall a. a -> Maybe a
Just (WidgetEnv s e
wenv WidgetEnv s e -> Getting Button (WidgetEnv s e) Button -> Button
forall s a. s -> Getting a s a -> a
^. Getting Button (WidgetEnv s e) Button
forall s a. HasMainButton s a => Lens' s a
L.mainButton)
Bool -> Bool -> Bool
&& Bool
isFocusable
Bool -> Bool -> Bool
&& Bool -> Bool
not (WidgetEnv s e -> WidgetNode s e -> Bool
forall s e. WidgetEnv s e -> WidgetNode s e -> Bool
isNodeFocused WidgetEnv s e
wenv WidgetNode s e
node)
Bool -> Bool -> Bool
&& WidgetEnv s e -> WidgetNode s e -> Bool
forall s e. WidgetEnv s e -> WidgetNode s e -> Bool
isNodeTopLevel WidgetEnv s e
wenv WidgetNode s e
node
Bool -> Bool -> Bool
&& Maybe Int -> Bool
forall a. Maybe a -> Bool
isNothing ((WidgetRequest s e -> Bool) -> Seq (WidgetRequest s e) -> Maybe Int
forall a. (a -> Bool) -> Seq a -> Maybe Int
Seq.findIndexL WidgetRequest s e -> Bool
forall s e. WidgetRequest s e -> Bool
isFocusRequest Seq (WidgetRequest s e)
prevReqs)
newReq :: WidgetRequest s e
newReq = WidgetId -> WidgetRequest s e
forall s e. WidgetId -> WidgetRequest s e
SetFocus (WidgetNode s e
node WidgetNode s e
-> Getting WidgetId (WidgetNode s e) WidgetId -> WidgetId
forall s a. s -> Getting a s a -> a
^. (WidgetNodeInfo -> Const WidgetId WidgetNodeInfo)
-> WidgetNode s e -> Const WidgetId (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Const WidgetId WidgetNodeInfo)
-> WidgetNode s e -> Const WidgetId (WidgetNode s e))
-> Getting WidgetId WidgetNodeInfo WidgetId
-> Getting WidgetId (WidgetNode s e) WidgetId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting WidgetId WidgetNodeInfo WidgetId
forall s a. HasWidgetId s a => Lens' s a
L.widgetId)
newResult :: Maybe (WidgetResult s e)
newResult
| Bool
isFocusReq Bool -> Bool -> Bool
&& Maybe (WidgetResult s e) -> Bool
forall a. Maybe a -> Bool
isJust Maybe (WidgetResult s e)
mResult = (WidgetResult s e
-> (WidgetResult s e -> WidgetResult s e) -> WidgetResult s e
forall a b. a -> (a -> b) -> b
& (Seq (WidgetRequest s e) -> Identity (Seq (WidgetRequest s e)))
-> WidgetResult s e -> Identity (WidgetResult s e)
forall s a. HasRequests s a => Lens' s a
L.requests ((Seq (WidgetRequest s e) -> Identity (Seq (WidgetRequest s e)))
-> WidgetResult s e -> Identity (WidgetResult s e))
-> (Seq (WidgetRequest s e) -> Seq (WidgetRequest s e))
-> WidgetResult s e
-> WidgetResult s e
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ (Seq (WidgetRequest s e)
-> WidgetRequest s e -> Seq (WidgetRequest s e)
forall a. Seq a -> a -> Seq a
|> WidgetRequest s e
forall s e. WidgetRequest s e
newReq)) (WidgetResult s e -> WidgetResult s e)
-> Maybe (WidgetResult s e) -> Maybe (WidgetResult s e)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (WidgetResult s e)
mResult
| Bool
isFocusReq = WidgetResult s e -> Maybe (WidgetResult s e)
forall a. a -> Maybe a
Just (WidgetResult s e -> Maybe (WidgetResult s e))
-> WidgetResult s e -> Maybe (WidgetResult s e)
forall a b. (a -> b) -> a -> b
$ WidgetNode s e -> [WidgetRequest s e] -> WidgetResult s e
forall s e.
WidgetNode s e -> [WidgetRequest s e] -> WidgetResult s e
resultReqs WidgetNode s e
node [WidgetRequest s e
forall s e. WidgetRequest s e
newReq]
| Bool
otherwise = Maybe (WidgetResult s e)
mResult
defaultHandleMessage :: SingleMessageHandler s e
defaultHandleMessage :: WidgetEnv s e
-> WidgetNode s e -> Path -> i -> Maybe (WidgetResult s e)
defaultHandleMessage WidgetEnv s e
wenv WidgetNode s e
node Path
target i
message = Maybe (WidgetResult s e)
forall a. Maybe a
Nothing
handleMessageWrapper :: forall s e a i . (WidgetModel a, Typeable i)
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> i
-> Maybe (WidgetResult s e)
handleMessageWrapper :: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Path
-> i
-> Maybe (WidgetResult s e)
handleMessageWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node Path
target i
msg = Maybe (WidgetResult s e)
result where
handler :: WidgetEnv s e
-> WidgetNode s e -> Path -> i -> Maybe (WidgetResult s e)
handler = Single s e a
-> forall i.
Typeable i =>
WidgetEnv s e
-> WidgetNode s e -> Path -> i -> Maybe (WidgetResult s e)
forall s e a. Single s e a -> SingleMessageHandler s e
singleHandleMessage Single s e a
single
result :: Maybe (WidgetResult s e)
result = Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleSizeReqChange Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node Maybe SystemEvent
forall a. Maybe a
Nothing
(Maybe (WidgetResult s e) -> Maybe (WidgetResult s e))
-> Maybe (WidgetResult s e) -> Maybe (WidgetResult s e)
forall a b. (a -> b) -> a -> b
$ WidgetEnv s e
-> WidgetNode s e -> Path -> i -> Maybe (WidgetResult s e)
handler WidgetEnv s e
wenv WidgetNode s e
node Path
target i
msg
defaultGetSizeReq :: SingleGetSizeReqHandler s e
defaultGetSizeReq :: SingleGetSizeReqHandler s e
defaultGetSizeReq WidgetEnv s e
wenv WidgetNode s e
node = (SizeReq, SizeReq)
forall a. Default a => a
def
getSizeReqWrapper
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> (SizeReq, SizeReq)
getSizeReqWrapper :: Single s e a
-> WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
getSizeReqWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node = (SizeReq
newReqW, SizeReq
newReqH) where
addStyleReq :: Bool
addStyleReq = Single s e a -> Bool
forall s e a. Single s e a -> Bool
singleAddStyleReq Single s e a
single
handler :: WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
handler = Single s e a
-> WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
forall s e a. Single s e a -> SingleGetSizeReqHandler s e
singleGetSizeReq Single s e a
single
style :: StyleState
style = Single s e a -> SingleGetCurrentStyle s e
forall s e a. Single s e a -> SingleGetCurrentStyle s e
singleGetCurrentStyle Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node
reqs :: (SizeReq, SizeReq)
reqs = WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
handler WidgetEnv s e
wenv WidgetNode s e
node
(SizeReq
tmpReqW, SizeReq
tmpReqH)
| Bool
addStyleReq = StyleState -> (SizeReq, SizeReq) -> (SizeReq, SizeReq)
sizeReqAddStyle StyleState
style (SizeReq, SizeReq)
reqs
| Bool
otherwise = (SizeReq, SizeReq)
reqs
newReqW :: SizeReq
newReqW = SizeReq -> Maybe SizeReq -> SizeReq
forall a. a -> Maybe a -> a
fromMaybe SizeReq
tmpReqW (StyleState
style StyleState
-> Getting (Maybe SizeReq) StyleState (Maybe SizeReq)
-> Maybe SizeReq
forall s a. s -> Getting a s a -> a
^. Getting (Maybe SizeReq) StyleState (Maybe SizeReq)
forall s a. HasSizeReqW s a => Lens' s a
L.sizeReqW)
newReqH :: SizeReq
newReqH = SizeReq -> Maybe SizeReq -> SizeReq
forall a. a -> Maybe a -> a
fromMaybe SizeReq
tmpReqH (StyleState
style StyleState
-> Getting (Maybe SizeReq) StyleState (Maybe SizeReq)
-> Maybe SizeReq
forall s a. s -> Getting a s a -> a
^. Getting (Maybe SizeReq) StyleState (Maybe SizeReq)
forall s a. HasSizeReqH s a => Lens' s a
L.sizeReqH)
updateSizeReq
:: WidgetEnv s e
-> WidgetNode s e
-> WidgetNode s e
updateSizeReq :: WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
updateSizeReq WidgetEnv s e
wenv WidgetNode s e
node = WidgetNode s e
newNode where
(SizeReq
newReqW, SizeReq
newReqH) = Widget s e -> WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
forall s e.
Widget s e -> WidgetEnv s e -> WidgetNode s e -> (SizeReq, SizeReq)
widgetGetSizeReq (WidgetNode s e
node WidgetNode s e
-> Getting (Widget s e) (WidgetNode s e) (Widget s e) -> Widget s e
forall s a. s -> Getting a s a -> a
^. Getting (Widget s e) (WidgetNode s e) (Widget s e)
forall s a. HasWidget s a => Lens' s a
L.widget) WidgetEnv s e
wenv WidgetNode s e
node
newNode :: WidgetNode s e
newNode = WidgetNode s e
node
WidgetNode s e
-> (WidgetNode s e -> WidgetNode s e) -> WidgetNode s e
forall a b. a -> (a -> b) -> b
& (WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> ((SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo)
-> (SizeReq -> Identity SizeReq)
-> WidgetNode s e
-> Identity (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo
forall s a. HasSizeReqW s a => Lens' s a
L.sizeReqW ((SizeReq -> Identity SizeReq)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> SizeReq -> WidgetNode s e -> WidgetNode s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ SizeReq
newReqW
WidgetNode s e
-> (WidgetNode s e -> WidgetNode s e) -> WidgetNode s e
forall a b. a -> (a -> b) -> b
& (WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> ((SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo)
-> (SizeReq -> Identity SizeReq)
-> WidgetNode s e
-> Identity (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizeReq -> Identity SizeReq)
-> WidgetNodeInfo -> Identity WidgetNodeInfo
forall s a. HasSizeReqH s a => Lens' s a
L.sizeReqH ((SizeReq -> Identity SizeReq)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> SizeReq -> WidgetNode s e -> WidgetNode s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ SizeReq
newReqH
handleSizeReqChange
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleSizeReqChange :: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleSizeReqChange Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node Maybe SystemEvent
evt Maybe (WidgetResult s e)
mResult = Maybe (WidgetResult s e)
result where
baseResult :: WidgetResult s e
baseResult = WidgetResult s e -> Maybe (WidgetResult s e) -> WidgetResult s e
forall a. a -> Maybe a -> a
fromMaybe (WidgetNode s e -> WidgetResult s e
forall s e. WidgetNode s e -> WidgetResult s e
resultNode WidgetNode s e
node) Maybe (WidgetResult s e)
mResult
newNode :: WidgetNode s e
newNode = WidgetResult s e
baseResult WidgetResult s e
-> Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
-> WidgetNode s e
forall s a. s -> Getting a s a -> a
^. Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
forall s a. HasNode s a => Lens' s a
L.node
resizeReq :: Bool
resizeReq = Maybe (WidgetResult s e) -> Bool
forall s e. Maybe (WidgetResult s e) -> Bool
isResizeAnyResult Maybe (WidgetResult s e)
mResult
styleChanged :: Bool
styleChanged = Maybe SystemEvent -> Bool
forall a. Maybe a -> Bool
isJust Maybe SystemEvent
evt Bool -> Bool -> Bool
&& WidgetEnv s e -> WidgetNode s e -> SystemEvent -> Bool
forall s e. WidgetEnv s e -> WidgetNode s e -> SystemEvent -> Bool
styleStateChanged WidgetEnv s e
wenv WidgetNode s e
newNode (Maybe SystemEvent -> SystemEvent
forall a. HasCallStack => Maybe a -> a
fromJust Maybe SystemEvent
evt)
result :: Maybe (WidgetResult s e)
result
| Bool
styleChanged Bool -> Bool -> Bool
|| Bool
resizeReq = WidgetResult s e -> Maybe (WidgetResult s e)
forall a. a -> Maybe a
Just (WidgetResult s e -> Maybe (WidgetResult s e))
-> WidgetResult s e -> Maybe (WidgetResult s e)
forall a b. (a -> b) -> a -> b
$ WidgetResult s e
baseResult
WidgetResult s e
-> (WidgetResult s e -> WidgetResult s e) -> WidgetResult s e
forall a b. a -> (a -> b) -> b
& (WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e)
forall s a. HasNode s a => Lens' s a
L.node ((WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e))
-> WidgetNode s e -> WidgetResult s e -> WidgetResult s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
forall s e. WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
updateSizeReq WidgetEnv s e
wenv WidgetNode s e
newNode
| Bool
otherwise = Maybe (WidgetResult s e)
mResult
defaultResize :: SingleResizeHandler s e
defaultResize :: SingleResizeHandler s e
defaultResize WidgetEnv s e
wenv WidgetNode s e
node Rect
viewport = WidgetNode s e -> WidgetResult s e
forall s e. WidgetNode s e -> WidgetResult s e
resultNode WidgetNode s e
node
resizeHandlerWrapper
:: WidgetModel a
=> Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Rect
-> (Path -> Bool)
-> WidgetResult s e
resizeHandlerWrapper :: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Rect
-> (Path -> Bool)
-> WidgetResult s e
resizeHandlerWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node Rect
viewport Path -> Bool
resizeReq = WidgetResult s e
result where
useCustomSize :: Bool
useCustomSize = Single s e a -> Bool
forall s e a. Single s e a -> Bool
singleUseCustomSize Single s e a
single
handler :: SingleResizeHandler s e
handler = Single s e a -> SingleResizeHandler s e
forall s e a. Single s e a -> SingleResizeHandler s e
singleResize Single s e a
single
tmpRes :: WidgetResult s e
tmpRes = SingleResizeHandler s e
handler WidgetEnv s e
wenv WidgetNode s e
node Rect
viewport
lensVp :: (Rect -> Const Rect Rect)
-> WidgetNode s e -> Const Rect (WidgetNode s e)
lensVp = (WidgetNodeInfo -> Const Rect WidgetNodeInfo)
-> WidgetNode s e -> Const Rect (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Const Rect WidgetNodeInfo)
-> WidgetNode s e -> Const Rect (WidgetNode s e))
-> Getting Rect WidgetNodeInfo Rect
-> (Rect -> Const Rect Rect)
-> WidgetNode s e
-> Const Rect (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Rect WidgetNodeInfo Rect
forall s a. HasViewport s a => Lens' s a
L.viewport
newVp :: Rect
newVp
| Bool
useCustomSize = WidgetResult s e
tmpRes WidgetResult s e -> Getting Rect (WidgetResult s e) Rect -> Rect
forall s a. s -> Getting a s a -> a
^. (WidgetNode s e -> Const Rect (WidgetNode s e))
-> WidgetResult s e -> Const Rect (WidgetResult s e)
forall s a. HasNode s a => Lens' s a
L.node ((WidgetNode s e -> Const Rect (WidgetNode s e))
-> WidgetResult s e -> Const Rect (WidgetResult s e))
-> ((Rect -> Const Rect Rect)
-> WidgetNode s e -> Const Rect (WidgetNode s e))
-> Getting Rect (WidgetResult s e) Rect
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rect -> Const Rect Rect)
-> WidgetNode s e -> Const Rect (WidgetNode s e)
lensVp
| Bool
otherwise = Rect
viewport
tmpResult :: Maybe (WidgetResult s e)
tmpResult = WidgetResult s e -> Maybe (WidgetResult s e)
forall a. a -> Maybe a
Just (WidgetResult s e -> Maybe (WidgetResult s e))
-> WidgetResult s e -> Maybe (WidgetResult s e)
forall a b. (a -> b) -> a -> b
$ WidgetResult s e
tmpRes
WidgetResult s e
-> (WidgetResult s e -> WidgetResult s e) -> WidgetResult s e
forall a b. a -> (a -> b) -> b
& (WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e)
forall s a. HasNode s a => Lens' s a
L.node ((WidgetNode s e -> Identity (WidgetNode s e))
-> WidgetResult s e -> Identity (WidgetResult s e))
-> ((Rect -> Identity Rect)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> (Rect -> Identity Rect)
-> WidgetResult s e
-> Identity (WidgetResult s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Identity WidgetNodeInfo)
-> WidgetNode s e -> Identity (WidgetNode s e))
-> ((Rect -> Identity Rect)
-> WidgetNodeInfo -> Identity WidgetNodeInfo)
-> (Rect -> Identity Rect)
-> WidgetNode s e
-> Identity (WidgetNode s e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rect -> Identity Rect)
-> WidgetNodeInfo -> Identity WidgetNodeInfo
forall s a. HasViewport s a => Lens' s a
L.viewport ((Rect -> Identity Rect)
-> WidgetResult s e -> Identity (WidgetResult s e))
-> Rect -> WidgetResult s e -> WidgetResult s e
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rect
newVp
newNode :: WidgetNode s e
newNode = WidgetResult s e
tmpRes WidgetResult s e
-> Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
-> WidgetNode s e
forall s a. s -> Getting a s a -> a
^. Getting (WidgetNode s e) (WidgetResult s e) (WidgetNode s e)
forall s a. HasNode s a => Lens' s a
L.node
result :: WidgetResult s e
result = Maybe (WidgetResult s e) -> WidgetResult s e
forall a. HasCallStack => Maybe a -> a
fromJust (Maybe (WidgetResult s e) -> WidgetResult s e)
-> Maybe (WidgetResult s e) -> WidgetResult s e
forall a b. (a -> b) -> a -> b
$ Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
forall a s e.
WidgetModel a =>
Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Maybe SystemEvent
-> Maybe (WidgetResult s e)
-> Maybe (WidgetResult s e)
handleSizeReqChange Single s e a
single WidgetEnv s e
wenv WidgetNode s e
newNode Maybe SystemEvent
forall a. Maybe a
Nothing Maybe (WidgetResult s e)
tmpResult
defaultRender :: SingleRenderHandler s e
defaultRender :: SingleRenderHandler s e
defaultRender WidgetEnv s e
wenv WidgetNode s e
node Renderer
renderer = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
renderWrapper
:: Single s e a
-> WidgetEnv s e
-> WidgetNode s e
-> Renderer
-> IO ()
renderWrapper :: Single s e a
-> WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
renderWrapper Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node Renderer
renderer =
Renderer -> Bool -> Rect -> IO () -> IO ()
drawInScissor Renderer
renderer Bool
useScissor Rect
viewport (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
Renderer -> Rect -> StyleState -> (Rect -> IO ()) -> IO ()
drawStyledAction Renderer
renderer Rect
viewport StyleState
style ((Rect -> IO ()) -> IO ()) -> (Rect -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Rect
_ ->
WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
handler WidgetEnv s e
wenv WidgetNode s e
node Renderer
renderer
where
handler :: WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
handler = Single s e a
-> WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
forall s e a.
Single s e a
-> WidgetEnv s e -> WidgetNode s e -> Renderer -> IO ()
singleRender Single s e a
single
useScissor :: Bool
useScissor = Single s e a -> Bool
forall s e a. Single s e a -> Bool
singleUseScissor Single s e a
single
style :: StyleState
style = Single s e a -> SingleGetCurrentStyle s e
forall s e a. Single s e a -> SingleGetCurrentStyle s e
singleGetCurrentStyle Single s e a
single WidgetEnv s e
wenv WidgetNode s e
node
viewport :: Rect
viewport = WidgetNode s e
node WidgetNode s e -> Getting Rect (WidgetNode s e) Rect -> Rect
forall s a. s -> Getting a s a -> a
^. (WidgetNodeInfo -> Const Rect WidgetNodeInfo)
-> WidgetNode s e -> Const Rect (WidgetNode s e)
forall s a. HasInfo s a => Lens' s a
L.info ((WidgetNodeInfo -> Const Rect WidgetNodeInfo)
-> WidgetNode s e -> Const Rect (WidgetNode s e))
-> Getting Rect WidgetNodeInfo Rect
-> Getting Rect (WidgetNode s e) Rect
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Rect WidgetNodeInfo Rect
forall s a. HasViewport s a => Lens' s a
L.viewport