{-# LANGUAGE CPP #-}
module HyperGraphicsF2(
  module HyperGraphicsF2,
  GfxCommand(..),GfxChange(..),GfxEvent(..),replaceGfx,highlightGfx
 ) where
import AllFudgets
import Data.Maybe(fromJust,mapMaybe)
import HbcUtils(mapFst)
import qualified Data.Map as Map
--import Fudget
--import Defaults(paperColor)
--import InputMsg(inputDone)
--import Utils(swap)
--import Xtypes(ColorName)
--import Loops(loopThroughRightF)
--import SerCompF(mapstateF)
--import Graphic
--import Drawing
--import DrawingOps
--import GraphicsF
--import FDefaults
--import ListUtil(assoc)
--import Sizing(Sizing(..))
--import GCAttrs() -- instances
--import Event(Pressed(..))
--import Maptrace(ctrace) -- debugging
--import SpyF(teeF) -- debugging
--import CompOps((>==<)) -- debugging

#include "../hsrc/exists.h"

hyperGraphicsF2 :: Drawing k leaf -> F (GfxCommand k (Drawing k leaf)) (GfxEvent k)
hyperGraphicsF2 Drawing k leaf
x = (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> Drawing k leaf -> F (GfxCommand k (Drawing k leaf)) (GfxEvent k)
forall leaf k.
(Graphic leaf, Ord k) =>
(GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> Drawing k leaf -> F (GfxCommand k (Drawing k leaf)) (GfxEvent k)
hyperGraphicsF2' GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
forall a. Customiser a
standard Drawing k leaf
x

hyperGraphicsF2' :: (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> Drawing k leaf -> F (GfxCommand k (Drawing k leaf)) (GfxEvent k)
hyperGraphicsF2' GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
custom Drawing k leaf
init =
    F (Either (GfxEvent [Int]) (GfxCommand k (Drawing k leaf)))
  (Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k))
-> F (GfxCommand [Int] (Drawing k leaf)) (GfxEvent [Int])
-> F (GfxCommand k (Drawing k leaf)) (GfxEvent k)
forall a b c d. F (Either a b) (Either c d) -> F c a -> F b d
loopThroughRightF
	(((Map k [Int], Drawing k leaf)
 -> Either (GfxEvent [Int]) (GfxCommand k (Drawing k leaf))
 -> ((Map k [Int], Drawing k leaf),
     [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)]))
-> (Map k [Int], Drawing k leaf)
-> F (Either (GfxEvent [Int]) (GfxCommand k (Drawing k leaf)))
     (Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k))
forall t a b. (t -> a -> (t, [b])) -> t -> F a b
mapstateF (Map k [Int], Drawing k leaf)
-> Either (GfxEvent [Int]) (GfxCommand k (Drawing k leaf))
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)])
forall leaf.
(Map k [Int], Drawing k leaf)
-> Either (GfxEvent [Int]) (GfxCommand k (Drawing k leaf))
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)])
ctrl (Map k [Int], Drawing k leaf)
state0)
	({-teeF show "\n" >==<-} (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> F (GfxCommand [Int] (Drawing k leaf)) (GfxEvent [Int])
forall gfx.
Graphic gfx =>
Customiser (GraphicsF gfx) -> F (GfxFCmd gfx) (GfxEvent [Int])
graphicsDispF' (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
custom (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> GraphicsF (Drawing k leaf)
-> GraphicsF (Drawing k leaf)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
params))
  where
    --tr x = ctrace "hyper" (show x) x -- debugging
    params :: GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
params = Drawing k leaf
-> GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
forall (xxx :: * -> *) a.
HasInitDisp xxx =>
a -> Customiser (xxx a)
setInitDisp Drawing k leaf
init (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> GraphicsF (Drawing k leaf)
-> GraphicsF (Drawing k leaf)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
	     [GfxEventMask]
-> GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
forall gfx. [GfxEventMask] -> Customiser (GraphicsF gfx)
setGfxEventMask [GfxEventMask
GfxButtonMask] (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> (GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf))
-> GraphicsF (Drawing k leaf)
-> GraphicsF (Drawing k leaf)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
	     Sizing -> GraphicsF (Drawing k leaf) -> GraphicsF (Drawing k leaf)
forall xxx. HasSizing xxx => Sizing -> Customiser xxx
setSizing Sizing
Dynamic
    state0 :: (Map k [Int], Drawing k leaf)
state0 = (Drawing k leaf -> Map k [Int]
forall leaf. Drawing k leaf -> Map k [Int]
annotPaths Drawing k leaf
init,Drawing k leaf
init)

    ctrl :: (Map k [Int], Drawing k leaf)
-> Either (GfxEvent [Int]) (GfxCommand k (Drawing k leaf))
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)])
ctrl state :: (Map k [Int], Drawing k leaf)
state@(Map k [Int]
paths,Drawing k leaf
drawing) = (GfxEvent [Int]
 -> ((Map k [Int], Drawing k leaf),
     [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)]))
-> (GfxCommand k (Drawing k leaf)
    -> ((Map k [Int], Drawing k leaf),
        [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)]))
-> Either (GfxEvent [Int]) (GfxCommand k (Drawing k leaf))
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)])
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either GfxEvent [Int]
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)])
forall a.
GfxEvent [Int]
-> ((Map k [Int], Drawing k leaf), [Either a (GfxEvent k)])
gfxEvent GfxCommand k (Drawing k leaf)
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) (GfxEvent k)])
forall b.
GfxCommand k (Drawing k leaf)
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) b])
gfxCommand
      where
        same :: ((Map k [Int], Drawing k leaf), [a])
same = ((Map k [Int], Drawing k leaf)
state,[])
	lbl2path :: k -> [Int]
lbl2path k
lbl = Maybe [Int] -> [Int]
forall a. HasCallStack => Maybe a -> a
fromJust (k -> Map k [Int] -> Maybe [Int]
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup k
lbl Map k [Int]
paths)

        gfxCommand :: GfxCommand k (Drawing k leaf)
-> ((Map k [Int], Drawing k leaf),
    [Either (GfxCommand [Int] (Drawing k leaf)) b])
gfxCommand GfxCommand k (Drawing k leaf)
lcmd =
	    case (k -> [Int])
-> GfxCommand k (Drawing k leaf)
-> GfxCommand [Int] (Drawing k leaf)
forall t path gfx.
(t -> path) -> GfxCommand t gfx -> GfxCommand path gfx
mapGfxCommandPath k -> [Int]
lbl2path GfxCommand k (Drawing k leaf)
lcmd of
	      cmd :: GfxCommand [Int] (Drawing k leaf)
cmd@(ChangeGfx [([Int], GfxChange (Drawing k leaf))]
changes) -> ([([Int], GfxChange (Drawing k leaf))]
-> (Map k [Int], Drawing k leaf)
forall (t :: * -> *).
Foldable t =>
t ([Int], GfxChange (Drawing k leaf))
-> (Map k [Int], Drawing k leaf)
changeState [([Int], GfxChange (Drawing k leaf))]
changes,[GfxCommand [Int] (Drawing k leaf)
-> Either (GfxCommand [Int] (Drawing k leaf)) b
forall a b. a -> Either a b
Left GfxCommand [Int] (Drawing k leaf)
cmd])
	      GfxCommand [Int] (Drawing k leaf)
cmd -> ((Map k [Int], Drawing k leaf)
state,[GfxCommand [Int] (Drawing k leaf)
-> Either (GfxCommand [Int] (Drawing k leaf)) b
forall a b. a -> Either a b
Left GfxCommand [Int] (Drawing k leaf)
cmd])
	  where
	    changeState :: t ([Int], GfxChange (Drawing k leaf))
-> (Map k [Int], Drawing k leaf)
changeState t ([Int], GfxChange (Drawing k leaf))
changes = (Map k [Int]
paths',Drawing k leaf
drawing')
	      where
	        drawing' :: Drawing k leaf
drawing' = (([Int], GfxChange (Drawing k leaf))
 -> Drawing k leaf -> Drawing k leaf)
-> Drawing k leaf
-> t ([Int], GfxChange (Drawing k leaf))
-> Drawing k leaf
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ([Int], GfxChange (Drawing k leaf))
-> Drawing k leaf -> Drawing k leaf
forall lbl leaf.
([Int], GfxChange (Drawing lbl leaf))
-> Drawing lbl leaf -> Drawing lbl leaf
replace Drawing k leaf
drawing t ([Int], GfxChange (Drawing k leaf))
changes

		replace :: ([Int], GfxChange (Drawing lbl leaf))
-> Drawing lbl leaf -> Drawing lbl leaf
replace ([Int]
path,GfxReplace (Bool
_,Just Drawing lbl leaf
d)) Drawing lbl leaf
drawing =
                    Drawing lbl leaf -> [Int] -> Drawing lbl leaf -> Drawing lbl leaf
forall lbl leaf.
Drawing lbl leaf -> [Int] -> Drawing lbl leaf -> Drawing lbl leaf
replacePart Drawing lbl leaf
drawing [Int]
path Drawing lbl leaf
d
                replace ([Int]
path,GfxReplace (Bool, Maybe (Drawing lbl leaf))
_) Drawing lbl leaf
drawing = Drawing lbl leaf
drawing
                replace ([Int]
path,GfxGroup Int
from Int
count) Drawing lbl leaf
drawing =
                    Drawing lbl leaf
-> [Int]
-> (Drawing lbl leaf -> Drawing lbl leaf)
-> Drawing lbl leaf
forall lbl leaf.
Drawing lbl leaf
-> [Int]
-> (Drawing lbl leaf -> Drawing lbl leaf)
-> Drawing lbl leaf
updatePart Drawing lbl leaf
drawing [Int]
path (Int -> Int -> Drawing lbl leaf -> Drawing lbl leaf
forall lbl leaf. Int -> Int -> Drawing lbl leaf -> Drawing lbl leaf
groupParts Int
from Int
count)
                replace ([Int]
path,GfxUngroup Int
pos) Drawing lbl leaf
drawing =
                    Drawing lbl leaf
-> [Int]
-> (Drawing lbl leaf -> Drawing lbl leaf)
-> Drawing lbl leaf
forall lbl leaf.
Drawing lbl leaf
-> [Int]
-> (Drawing lbl leaf -> Drawing lbl leaf)
-> Drawing lbl leaf
updatePart Drawing lbl leaf
drawing [Int]
path (Int -> Drawing lbl leaf -> Drawing lbl leaf
forall lbl leaf. Int -> Drawing lbl leaf -> Drawing lbl leaf
ungroupParts Int
pos)

		paths' :: Map k [Int]
paths' = Drawing k leaf -> Map k [Int]
forall leaf. Drawing k leaf -> Map k [Int]
annotPaths Drawing k leaf
drawing'
			-- Space leak: drawing' isn't used until user clicks
			-- in the window, so the old drawing is retained in
			-- the closure for drawing'

        gfxEvent :: GfxEvent [Int]
-> ((Map k [Int], Drawing k leaf), [Either a (GfxEvent k)])
gfxEvent GfxEvent [Int]
msg = ((Map k [Int], Drawing k leaf)
state,[GfxEvent k -> Either a (GfxEvent k)
forall a b. b -> Either a b
Right GfxEvent k
msg'])
	  where
	    msg' :: GfxEvent k
msg' = ([Int] -> Maybe k) -> GfxEvent [Int] -> GfxEvent k
forall t path. (t -> Maybe path) -> GfxEvent t -> GfxEvent path
mapGfxEventPath [Int] -> Maybe k
path2lbl GfxEvent [Int]
msg

        path2lbl :: [Int] -> Maybe k
path2lbl [Int]
path = do let part :: [Int]
part = Drawing k leaf -> [Int] -> [Int]
forall b leaf. Drawing b leaf -> [Int] -> [Int]
drawingAnnotPart Drawing k leaf
drawing [Int]
path
			   LabelD k
a Drawing k leaf
_ <- Drawing k leaf -> [Int] -> Maybe (Drawing k leaf)
forall lbl leaf.
Drawing lbl leaf -> [Int] -> Maybe (Drawing lbl leaf)
maybeDrawingPart Drawing k leaf
drawing [Int]
part
			   k -> Maybe k
forall (m :: * -> *) a. Monad m => a -> m a
return k
a

    annotPaths :: Drawing k leaf -> Map k [Int]
annotPaths = [(k, [Int])] -> Map k [Int]
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(k, [Int])] -> Map k [Int])
-> (Drawing k leaf -> [(k, [Int])])
-> Drawing k leaf
-> Map k [Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (([Int], k) -> (k, [Int])) -> [([Int], k)] -> [(k, [Int])]
forall a b. (a -> b) -> [a] -> [b]
map ([Int], k) -> (k, [Int])
forall b a. (b, a) -> (a, b)
swap ([([Int], k)] -> [(k, [Int])])
-> (Drawing k leaf -> [([Int], k)])
-> Drawing k leaf
-> [(k, [Int])]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Drawing k leaf -> [([Int], k)]
forall a leaf. Drawing a leaf -> [([Int], a)]
drawingAnnots

mouseClicksSP :: SP (GfxEvent b) b
mouseClicksSP = (GfxEvent b -> Maybe b) -> SP (GfxEvent b) b
forall t b. (t -> Maybe b) -> SP t b
mapFilterSP GfxEvent b -> Maybe b
forall a. GfxEvent a -> Maybe a
isMouseClick

isMouseClick :: GfxEvent a -> Maybe a
isMouseClick GfxEvent a
msg =
    case GfxEvent a
msg of
      GfxButtonEvent { gfxType :: forall path. GfxEvent path -> Pressed
gfxType=Pressed
Pressed, gfxPaths :: forall path. GfxEvent path -> [(path, (Point, Rect))]
gfxPaths=(a
path,(Point, Rect)
_):[(a, (Point, Rect))]
_ } -> a -> Maybe a
forall a. a -> Maybe a
Just a
path
      GfxEvent a
_ -> Maybe a
forall a. Maybe a
Nothing

---

mapGfxCommandPath :: (t -> path) -> GfxCommand t gfx -> GfxCommand path gfx
mapGfxCommandPath t -> path
f GfxCommand t gfx
cmd =
    case GfxCommand t gfx
cmd of
      ChangeGfx [(t, GfxChange gfx)]
changes -> [(path, GfxChange gfx)] -> GfxCommand path gfx
forall path gfx. [(path, GfxChange gfx)] -> GfxCommand path gfx
ChangeGfx ((t -> path) -> [(t, GfxChange gfx)] -> [(path, GfxChange gfx)]
forall t a b. (t -> a) -> [(t, b)] -> [(a, b)]
mapFst t -> path
f [(t, GfxChange gfx)]
changes)
      ShowGfx t
path (Maybe Alignment, Maybe Alignment)
a -> path -> (Maybe Alignment, Maybe Alignment) -> GfxCommand path gfx
forall path gfx.
path -> (Maybe Alignment, Maybe Alignment) -> GfxCommand path gfx
ShowGfx (t -> path
f t
path) (Maybe Alignment, Maybe Alignment)
a
      GetGfxPlaces [t]
paths -> [path] -> GfxCommand path gfx
forall path gfx. [path] -> GfxCommand path gfx
GetGfxPlaces ((t -> path) -> [t] -> [path]
forall a b. (a -> b) -> [a] -> [b]
map t -> path
f [t]
paths)
      -- _ -> cmd -- Operationally, the rest is the same as this line.
      ChangeGfxBg ColorSpec
c -> ColorSpec -> GfxCommand path gfx
forall path gfx. ColorSpec -> GfxCommand path gfx
ChangeGfxBg ColorSpec
c
      ChangeGfxBgPixmap PixmapId
pm Bool
b -> PixmapId -> Bool -> GfxCommand path gfx
forall path gfx. PixmapId -> Bool -> GfxCommand path gfx
ChangeGfxBgPixmap PixmapId
pm Bool
b
#ifdef USE_EXIST_Q
      ChangeGfxBgGfx bg
gfx -> bg -> GfxCommand path gfx
forall path gfx bg. Graphic bg => bg -> GfxCommand path gfx
ChangeGfxBgGfx bg
gfx
#endif
      ChangeGfxCursor CursorId
cursor -> CursorId -> GfxCommand path gfx
forall path gfx. CursorId -> GfxCommand path gfx
ChangeGfxCursor CursorId
cursor
      ChangeGfxFontCursor Int
shape -> Int -> GfxCommand path gfx
forall path gfx. Int -> GfxCommand path gfx
ChangeGfxFontCursor Int
shape
      BellGfx Int
n -> Int -> GfxCommand path gfx
forall path gfx. Int -> GfxCommand path gfx
BellGfx Int
n


mapGfxEventPath :: (t -> Maybe path) -> GfxEvent t -> GfxEvent path
mapGfxEventPath t -> Maybe path
f GfxEvent t
event =
  case GfxEvent t
event of
    GfxButtonEvent Int
t ModState
s Pressed
ty Button
b [(t, (Point, Rect))]
ps -> Int
-> ModState
-> Pressed
-> Button
-> [(path, (Point, Rect))]
-> GfxEvent path
forall path.
Int
-> ModState
-> Pressed
-> Button
-> [(path, (Point, Rect))]
-> GfxEvent path
GfxButtonEvent Int
t ModState
s Pressed
ty Button
b ([(t, (Point, Rect))] -> [(path, (Point, Rect))]
forall b. [(t, b)] -> [(path, b)]
mapPaths [(t, (Point, Rect))]
ps)
    GfxMotionEvent Int
t ModState
s [(t, (Point, Rect))]
ps   -> Int -> ModState -> [(path, (Point, Rect))] -> GfxEvent path
forall path.
Int -> ModState -> [(path, (Point, Rect))] -> GfxEvent path
GfxMotionEvent Int
t ModState
s ([(t, (Point, Rect))] -> [(path, (Point, Rect))]
forall b. [(t, b)] -> [(path, b)]
mapPaths [(t, (Point, Rect))]
ps)
    GfxKeyEvent Int
t ModState
m KeySym
k KeySym
l     -> Int -> ModState -> KeySym -> KeySym -> GfxEvent path
forall path. Int -> ModState -> KeySym -> KeySym -> GfxEvent path
GfxKeyEvent Int
t ModState
m KeySym
k KeySym
l
    GfxFocusEvent Bool
b         -> Bool -> GfxEvent path
forall path. Bool -> GfxEvent path
GfxFocusEvent Bool
b
    GfxPlaces [Rect]
rs            -> [Rect] -> GfxEvent path
forall path. [Rect] -> GfxEvent path
GfxPlaces [Rect]
rs
    GfxResized Point
s            -> Point -> GfxEvent path
forall path. Point -> GfxEvent path
GfxResized Point
s
  where
    -- mapPats :: [(a,(Point,Rect))] -> [(b,(Point,Rect))]
    mapPaths :: [(t, b)] -> [(path, b)]
mapPaths = ((t, b) -> Maybe (path, b)) -> [(t, b)] -> [(path, b)]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (t, b) -> Maybe (path, b)
forall b. (t, b) -> Maybe (path, b)
f'
    -- f' :: (a,(Point,Rect)) -> Maybe (b,(Point,Rect))
    f' :: (t, b) -> Maybe (path, b)
f' (t
path,b
place) = (path -> (path, b)) -> Maybe path -> Maybe (path, b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\path
p->(path
p,b
place)) (t -> Maybe path
f t
path)

-- nullPath = null . gfxPaths -- would be ok if gfxPaths was a total function
nullPath :: GfxEvent path -> Bool
nullPath = Bool
-> ([(path, (Point, Rect))] -> Bool)
-> Maybe [(path, (Point, Rect))]
-> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False [(path, (Point, Rect))] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Maybe [(path, (Point, Rect))] -> Bool)
-> (GfxEvent path -> Maybe [(path, (Point, Rect))])
-> GfxEvent path
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GfxEvent path -> Maybe [(path, (Point, Rect))]
forall path. GfxEvent path -> Maybe [(path, (Point, Rect))]
gfxEventPaths

gfxEventPaths :: GfxEvent path -> Maybe [(path, (Point, Rect))]
gfxEventPaths GfxEvent path
event =
  case GfxEvent path
event of
    -- enumerate all constructors that have a path argument:
    GfxButtonEvent {gfxPaths :: forall path. GfxEvent path -> [(path, (Point, Rect))]
gfxPaths=[(path, (Point, Rect))]
ps} -> [(path, (Point, Rect))] -> Maybe [(path, (Point, Rect))]
forall a. a -> Maybe a
Just [(path, (Point, Rect))]
ps
    GfxMotionEvent {gfxPaths :: forall path. GfxEvent path -> [(path, (Point, Rect))]
gfxPaths=[(path, (Point, Rect))]
ps}  -> [(path, (Point, Rect))] -> Maybe [(path, (Point, Rect))]
forall a. a -> Maybe a
Just [(path, (Point, Rect))]
ps
    GfxEvent path
_ -> Maybe [(path, (Point, Rect))]
forall a. Maybe a
Nothing

isGfxButtonEvent :: GfxEvent path -> Maybe Button
isGfxButtonEvent (GfxButtonEvent {gfxType :: forall path. GfxEvent path -> Pressed
gfxType=Pressed
Pressed,gfxButton :: forall path. GfxEvent path -> Button
gfxButton=Button
b}) = Button -> Maybe Button
forall a. a -> Maybe a
Just Button
b
isGfxButtonEvent GfxEvent path
_ = Maybe Button
forall a. Maybe a
Nothing