Safe Haskell | Safe-Infered |
---|
- type CBMgr = CBMgrCmd -> IO ()
- type CBMgrAction = IORef VPUI -> IO ()
- data CBMgrCmd
- = OnWindowConfigure Window (IORef VPUI -> EventM EConfigure Bool)
- | OnWindowDestroy Window CBMgrAction
- | AfterWindowKeyPress Window (IORef VPUI -> EventM EKey Bool)
- | OnLayoutExpose Layout (IORef VPUI -> EventM EExpose Bool)
- | OnLayoutMouseMove Layout (IORef VPUI -> EventM EMotion Bool)
- | OnLayoutButtonPress Layout (IORef VPUI -> EventM EButton Bool)
- | OnLayoutButtonRelease Layout (IORef VPUI -> EventM EButton Bool)
- | OnMenuItemActivateLeaf MenuItem (VPUI -> IO VPUI)
- | OnEntryActivate Entry CBMgrAction
- | AfterButtonClicked Button CBMgrAction
- | WithUIRef CBMgrAction
- | UMTest
- mkCBMgr :: IORef VPUI -> CBMgr
- data MenuSpec = MenuSpec String [MenuItemSpec]
- data MenuItemSpec
- type MenuItemAction = VPUI -> IO VPUI
- createMenuBar :: [MenuSpec] -> CBMgr -> IO MenuBar
- addMenu :: MenuBar -> CBMgr -> MenuSpec -> IO ()
- createMenu :: MenuSpec -> CBMgr -> IO Menu
- createMenuItem :: Menu -> CBMgr -> MenuItemSpec -> IO ()
- modifyIORefIO :: (a -> IO a) -> IORef a -> IO ()
Documentation
type CBMgr = CBMgrCmd -> IO ()Source
The CBMgr (Callback manager) encapsulates (in an enclosure, no less!) an IORef VPUI. It is used *solely* to set up callbacks and similar stuff in Gtk, where the callback needs access to the IORef. By passing a CBMgr to a function, we can avoid passing the IORef directly, and all the harm and confusion that could result.
We only need *one* CBMgr for the application; however, two CBMgrs with the same IORef are logically equivalent, so there would be no harm in having two as long as they share one IORef.
Commands for the CBMgr
type MenuItemAction = VPUI -> IO VPUISource
createMenuItem :: Menu -> CBMgr -> MenuItemSpec -> IO ()Source
modifyIORefIO :: (a -> IO a) -> IORef a -> IO ()Source
Read an IORef, update with IO, and write the updated value. This is like (flip modifyIORef), but the type of the first argument is (a -> IO a) instead of (a -> a). Note that if a = VPUI, then updateIO :: VPUI -> IO VPUI and consequently modifyIORefIO updateIO :: CBMgrAction.