spade-0.1.0.0: src/UI/Widgets/NullWidget.hs
module UI.Widgets.NullWidget where
import Common
import UI.Widgets.Common
data NullWidget = NullWidget { nwDimensions :: Dimensions, nwPos :: ScreenPos }
instance Widget NullWidget where
hasCapability (DrawableCap _) = Just Dict
hasCapability (MoveableCap _) = Just Dict
hasCapability _ = Nothing
instance Moveable NullWidget where
move _ _ = pure ()
getPos r = nwPos <$> readWRef r
getDim r = nwDimensions <$> readWRef r
resize r fn = modifyWRef r (\w -> w { nwDimensions = fn (nwDimensions w) })
instance Drawable NullWidget where
setVisibility _ _ = pure ()
getVisibility _ = pure True
draw _ = pure ()
nullWidget :: NullWidget
nullWidget = NullWidget (Dimensions 0 0) (ScreenPos 0 0)