Description : Gtk GUI for the selection of linktypes
Copyright : (c) Thiemo Wiedemeyer, Uni Bremen 2008
Maintainer : raider@informatik.uni-bremen.de
This module provides a GUI for the selection of linktypes.
mapEdgeTypesToNames ::
Map.Map String (DGEdgeType, DGEdgeType)
(\ e -> ("cb" ++ getDGEdgeTypeName e, (e, e { isInc = True })))
(filter (not . isInc) listDGEdgeTypes)
-- | Displays the linktype selection window
showLinkTypeChoice :: IORef [String] -> ([DGEdgeType] -> IO ()) -> IO ()
showLinkTypeChoice ioRefDeselect updateFunction = postGUIAsync $ do
window <- xmlGetWidget xml castToWindow "linktypechoice"
ok <- xmlGetWidget xml castToButton "btnOk"
cancel <- xmlGetWidget xml castToButton "btnCancel"
select <- xmlGetWidget xml castToButton "btnSelect"
deselect <- xmlGetWidget xml castToButton "btnDeselect"
invert <- xmlGetWidget xml castToButton "btnInvert"
deselectEdgeTypes <- readIORef ioRefDeselect
cb <- xmlGetWidget xml castToCheckButton name
toggleButtonSetActive cb False
edgeMap = mapEdgeTypesToNames
setAllTo = (\ to -> mapM_ (\ name -> do
cb <- xmlGetWidget xml castToCheckButton name
toggleButtonSetActive cb to'
onClicked select $ setAllTo (\ _ -> return True)
onClicked deselect $ setAllTo (\ _ -> return False)
onClicked invert $ setAllTo (\ cb -> do
selected <- toggleButtonGetActive cb
onClicked cancel $ widgetDestroy window
edgeTypeNames <- filterM (\ name -> do
cb <- xmlGetWidget xml castToCheckButton name
selected <- toggleButtonGetActive cb
writeIORef ioRefDeselect edgeTypeNames
let edgeTypes = foldl (\ eList (e, eI) -> e:eI:eList) []
(error "GtkLinkTypeChoice: lookup error!"))
forkIO_ $ updateFunction edgeTypes