GuiTV-0.3: src/Interface/TV/UI.hs
{-# OPTIONS -fglasgow-exts #-}
----------------------------------------------------------------------
-- |
-- Module : Interface.TV.UI
-- Copyright : (c) Conal Elliott 2006
-- License : LGPL
--
-- Maintainer : conal@conal.net
-- Stability : experimental
-- Portability : portable
--
-- Graphical 'UI' instances of TV classes, plus UI-specific tools
----------------------------------------------------------------------
module Interface.TV.UI
(
islider , runUI
, UI, module Interface.TV -- re-exports
) where
import Graphics.UI.Phooey.Arrow hiding (runUI,islider)
import qualified Graphics.UI.Phooey.Arrow as Ph (islider)
import Interface.TV
{----------------------------------------------------------
Instances
----------------------------------------------------------}
instance Present UI where
presentPair = fromLeft
presentLambda = fromTop
presentTitle = title
-- presentCompose = id
-- For the Eros version, I'll want presentCompose to replace all inner
-- handles with one outer handle.
instance ToIO UI where toIO = runNamedUI "TV + Phooey"
instance CommonInsOuts UI where
putString = stringDisplay
getString = stringEntry ""
-- | Integer-valued slider, given initial value and bounds
islider :: (Int,Int)
-> Int
-> Input UI Int
islider bounds initial = iPrim (Ph.islider bounds initial)
-- | Type-disambiguating alias for 'runTV'
runUI :: RunTV UI
runUI = runTV