Sifflet.UI.Callback
- type CBMgr = CBMgrCmd -> IO ()
- data CBMgrCmd
- = OnWindowConfigure Window (IORef VPUI -> EventM EConfigure Bool)
- | OnWindowDestroy Window (IORef VPUI -> IO ())
- | OnWindowKeyPress 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 (IORef VPUI -> IO ())
- | AfterButtonClicked Button (IORef VPUI -> IO ())
- | 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 :: IORef a -> (a -> IO 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
Constructors
| OnWindowConfigure Window (IORef VPUI -> EventM EConfigure Bool) | |
| OnWindowDestroy Window (IORef VPUI -> IO ()) | |
| OnWindowKeyPress 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 (IORef VPUI -> IO ()) | |
| AfterButtonClicked Button (IORef VPUI -> IO ()) | |
| UMTest |
Constructors
| MenuSpec String [MenuItemSpec] |
data MenuItemSpec Source
Constructors
| MenuItem String MenuItemAction | |
| SubMenu MenuSpec |
type MenuItemAction = VPUI -> IO VPUISource
createMenuItem :: Menu -> CBMgr -> MenuItemSpec -> IO ()Source