lhae-0.0.3: src/View.hs
module View (View(..),onGrid,isGridOpen)
where
import qualified Graphics.UI.WX as WX
import View.Component.Grid (Grid)
import View.Component.TextWindow (TextWindow)
import View.Component.Notebook (Notebook)
data View = View { frame :: WX.Frame ()
, formulaInput :: TextWindow
, notebook :: Notebook
, current :: WX.Var (Maybe Grid)
}
onGrid :: View -> (Grid -> IO a) -> IO a
onGrid view f = WX.varGet (current view) >>= \(Just grid) -> f grid
isGridOpen :: View -> IO Bool
isGridOpen view = do
current <- WX.varGet $ current view
return $ case current of
Nothing -> False
_ -> True