sifflet-lib-1.0: Library of modules shared by sifflet and its tests and its exporters.Source codeContentsIndex
Sifflet.UI.Callback
Synopsis
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
= MenuItem String MenuItemAction
| SubMenu MenuSpec
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.

data CBMgrCmd Source
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
mkCBMgr :: IORef VPUI -> CBMgrSource
Create the CBMgr
data MenuSpec Source
Constructors
MenuSpec String [MenuItemSpec]
data MenuItemSpec Source
Constructors
MenuItem String MenuItemAction
SubMenu MenuSpec
type MenuItemAction = VPUI -> IO VPUISource
createMenuBar :: [MenuSpec] -> CBMgr -> IO MenuBarSource
addMenu :: MenuBar -> CBMgr -> MenuSpec -> IO ()Source
createMenu :: MenuSpec -> CBMgr -> IO MenuSource
createMenuItem :: Menu -> CBMgr -> MenuItemSpec -> IO ()Source
modifyIORefIO :: IORef a -> (a -> IO a) -> IO ()Source
Read an IORef, update with IO, and write the updated value. This is like modifyIORef, but the type of the second argument is (a -> IO a) instead of (a -> a).
Produced by Haddock version 2.6.1