UISF-0.1.0.0: Library for Arrowized Graphical User Interfaces.

Stabilityexperimental
Maintainerdwc@cs.yale.edu
Safe HaskellNone

FRP.UISF.UISF

Contents

Description

A simple Graphical User Interface with concepts borrowed from Phooey by Conal Elliot.

Synopsis

Documentation

type UISF = MSF UISource

The main UI signal function, built from the UI monad and MSF.

UISF Getters

getTime :: UISF () TimeSource

Get the time signal from a UISF

getCTX :: UISF () CTXSource

Get the context signal from a UISF

getEvents :: UISF () UIEventSource

Get the UIEvent signal from a UISF

getFocusData :: UISF () FocusSource

Get the focus data from a UISF

getMousePosition :: UISF () PointSource

Get the mouse position from a UISF

UISF constructors, transformers, and converters

These fuctions are various shortcuts for creating UISFs. The types pretty much say it all for how they work.

transformUISF :: (UI (c, UISF b c) -> UI (c, UISF b c)) -> UISF b c -> UISF b cSource

initialIOAction :: IO x -> (x -> UISF a b) -> UISF a bSource

Apply the given IO action when this UISF is first run and use its result to produce the UISF to run

uisfSourceE :: IO c -> UISF (SEvent ()) (SEvent c)Source

Generate a source UISF from the IO action.

uisfSinkE :: (b -> IO ()) -> UISF (SEvent b) (SEvent ())Source

Generate a sink UISF from the IO action.

uisfPipeE :: (b -> IO c) -> UISF (SEvent b) (SEvent c)Source

Generate a pipe UISF from the IO action.

UISF Lifting

The following two functions are for lifting SFs to UISFs.

toUISF :: Automaton a b -> UISF a bSource

This is a quick and dirty solution that ignores timing issues.

convertToUISF :: NFData b => Double -> Double -> Automaton a b -> UISF a [(b, Time)]Source

This is the standard one that appropriately keeps track of simulated time vs real time.

The clockrate is the simulated rate of the input signal function. The buffer is the number of time steps the given signal function is allowed to get ahead of real time. The real amount of time that it can get ahead is the buffer divided by the clockrate seconds. The output signal function takes and returns values in real time. The return values are the list of bs generated in the given time step, each time stamped.

Note that the returned list may be long if the clockrate is much faster than real time and potentially empty if it's slower. Note also that the caller can check the time stamp on the element at the end of the list to see if the inner, simulated signal function is performing as fast as it should.

asyncUISF :: NFData b => Automaton a b -> UISF (SEvent a) (SEvent b)Source

We can also lift a signal function to a UISF asynchronously.

Layout Transformers

These functions are UISF transformers that modify the context.

leftRight :: UISF a b -> UISF a bSource

rightLeft :: UISF a b -> UISF a bSource

topDown :: UISF a b -> UISF a bSource

bottomUp :: UISF a b -> UISF a bSource

conjoin :: UISF a b -> UISF a bSource

unconjoin :: UISF a b -> UISF a bSource

setLayout :: Layout -> UISF a b -> UISF a bSource

Set a new layout for this widget.

setSize :: Dimension -> UISF a b -> UISF a bSource

A convenience function for setLayout, setSize sets the layout to a fixed size (in pixels).

pad :: (Int, Int, Int, Int) -> UISF a b -> UISF a bSource

Add space padding around a widget.

Execute UI Program

runUI :: Dimension -> String -> UISF () () -> IO ()Source

Run the UISF

runUI' :: String -> UISF () () -> IO ()Source

Run the UISF with the default size (300 x 300).