UISF-0.3.0.2: Library for Arrowized Graphical User Interfaces.

Copyright(c) Daniel Winograd-Cort 2014
Licensesee the LICENSE file in the distribution
Maintainerdwc@cs.yale.edu
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

FRP.UISF.UISF

Contents

Description

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

Synopsis

Documentation

uisfSource :: IO b -> UISF () b Source

Lift an IO source to UISF.

uisfSink :: (a -> IO ()) -> UISF a () Source

Lift an IO sink to UISF.

uisfPipe :: (a -> IO b) -> UISF a b Source

Lift an IO pipe to UISF.

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

Lift an IO source to an event-based UISF.

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

Lift an IO sink to an event-based UISF.

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

Lift an IO pipe to an event-based UISF.

UISF Getters

getTime :: UISF () Time Source

Get the time signal from a UISF.

getCTX :: UISF () CTX Source

Get the context signal from a UISF.

getEvents :: UISF () UIEvent Source

Get the UIEvent signal from a UISF.

getFocusData :: UISF () Focus Source

Get the focus data from a UISF.

addTerminationProc :: IO () -> UISF a a Source

Add a termination procedure to a UISF.

getMousePosition :: UISF () Point Source

Get the mouse position from a UISF.

UISF constructors, transformers, and converters

mkUISF :: Layout -> ((CTX, Focus, Time, UIEvent, a) -> (DirtyBit, Focus, Graphic, TerminationProc, b)) -> UISF a b Source

This function creates a UISF with the given parameters.

UISF Lifting

The following two functions are for lifting Automatons to UISFs.

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

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

asyncUISFV :: 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.

Layout Transformers

These functions are UISF transformers that modify the context.

leftRight :: UISF a b -> UISF a b Source

rightLeft :: UISF a b -> UISF a b Source

topDown :: UISF a b -> UISF a b Source

bottomUp :: UISF a b -> UISF a b Source

conjoin :: UISF a b -> UISF a b Source

unconjoin :: UISF a b -> UISF a b Source

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

Set a new layout for this widget.

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

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 b Source

Add space padding around a widget.

Execute UI Program

data UIParams Source

The UIParams data type provides an interface for modifying some of the settings for runUI without forcing runUI to take a zillion arguments. Typical usage will be to modify the below defaultUIParams using record syntax.

Constructors

UIParams 

Fields

uiInitialize :: IO ()

An initialization action.

uiClose :: IO ()

A termination action.

uiTitle :: String

The UI window's title.

uiSize :: Dimension

The size of the UI window.

uiInitFlow :: Flow

The initial Flow setting.

uiTickDelay :: Double

How long the UI will sleep between clock ticks if no events are detected. This should be probably be set to O(milliseconds), but it can be set to 0 for better performance (but also higher CPU usage)

defaultUIParams :: UIParams Source

This is the default UIParams value and what is used in runUI'.

runUI :: UIParams -> UISF () () -> IO () Source

Run the UISF with the given parameters.

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

Run the UISF with the default settings.