UISF-0.4.0.0: 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.Widget

Contents

Description

These are the default, built-in widgets for UISF.

Synopsis

Widgets

label :: UITexty s => s -> UISF a a Source

Labels are always left aligned and vertically centered.

displayField :: UITexty s => WrapSetting -> UISF s () Source

DisplayField is an output widget showing the instantaneous value of a signal of Strings. It will show the String over how ever much space it has available to it. The static argument will decide what to cut off in the case where it does not have space to show the entire String: if given True, it will prefer the older characters (cutting off later text), and if given False, it will prefer the newer characters (cutting off older ones.

displayStr :: UISF String () Source

DisplayStr is an output widget showing the instantaneous value of a signal of strings.

display :: Show a => UISF a () Source

display is a widget that takes any show-able value and displays it.

withDisplay :: Show b => UISF a b -> UISF a b Source

withDisplay is a widget modifier that modifies the given widget so that it also displays its output value.

textbox :: UITexty s => s -> UISF (SEvent s) String Source

The textbox widget creates a one line field where users can enter text. It supports mouse clicks and typing as well as the left, right, end, home, delete, and backspace special keys.

The value displayed can be generated by mouse and keyboard events, but it can also be set programmatically by providing the widget's input stream with an event containing the value to display. By using rec and delay, one can update the contents based on e.g. other widgets.

The static argument provides the textbox with initial text.

textbox' :: UITexty s => UISF s UIText Source

The textbox' variant of textbox contains no internal state about the text it displays. Thus, it must be paired with rec and delay and used bidirectionally to be effective.

textField :: UITexty s => WrapSetting -> s -> UISF (SEvent s) UIText Source

TextFields are like textboxes but can support multiple lines. By default, they are stretchy in the vertical dimension.

textField' :: UITexty s => WrapSetting -> UISF s UIText Source

A variant of textField that contains no internal state about the text it displays.

title :: UITexty s => s -> UISF a b -> UISF a b Source

Title frames a UI by borders, and displays a static title text.

spacer :: UISF a a Source

spacer is an empty widget that will take up empty space without requesting any space. This can be useful for lining up other widgets, for instance if one wants the borders from titles to align even when the titles are bordering widgets of slightly different sizes.

button :: UITexty s => s -> UISF () Bool Source

A button is a focusable input widget with a state of being on or off. It can be activated with either a button press, the enter key, or the space key. Buttons also show a static label.

The regular button is down as long as the mouse button or key press is down and then returns to up.

stickyButton :: UITexty s => s -> UISF () Bool Source

The sticky button, on the other hand, once pressed, remains depressed until is is clicked again to be released. Thus, it looks like a button, but it behaves more like a checkbox.

stickyButtonS :: UITexty s => s -> UISF (SEvent Bool) Bool Source

This variant of stickyButton is settable by its input stream.

checkbox :: UITexty s => s -> Bool -> UISF () Bool Source

Checkbox allows selection or deselection of an item. It has a static label as well as an initial state.

checkboxS :: UITexty s => s -> Bool -> UISF (SEvent Bool) Bool Source

This variant of checkbox is settable by its input stream.

checkGroup :: [(String, a)] -> UISF () [a] Source

The checkGroup widget creates a group of checkboxes that all send their outputs to the same output stream. It takes a static list of labels for the check boxes and assumes they all start unchecked.

The output stream is a list of each a value that was paired with a String value for which the check box is checked.

radio :: UITexty s => [s] -> Int -> UISF () Int Source

Radio button presents a list of choices and only one of them can be selected at a time. It takes a static list of choices (as Strings) and the index of the initially selected one, and the widget itself returns the continuous stream representing the index of the selected choice.

radioS :: UITexty s => [s] -> Int -> UISF (SEvent Int) Int Source

This variant of radio is settable by its input stream.

listbox :: (Eq a, Show a) => [a] -> Int -> UISF (SEvent [a], SEvent Int) Int Source

The listbox widget creates a box with selectable entries. It takes two static values indicating the initial list of data to display and the initial index selected (use -1 for no selection). It takes two event streams that can be used to independently set the list and index. The output stream is the currently selected index.

Note that the index can be greater than the length of the list (simply indicating no choice selected).

listbox' :: (Eq a, Show a) => UISF ([a], Int) Int Source

This variant of listbox does not keep its list or index stored internally and thus accepts a stream of those values. As such, it requires no static initializing parameters. This can be useful when the list or index are being updated frequently.

Sliders

Sliders are input widgets that allow the user to choose a value within a given range. They come in both continuous and discrete flavors as well as in both vertical and horizontal layouts.

Sliders take a boundary argument giving the minimum and maximum possible values for the output as well as an initial value. In addition, discrete (or integral) sliders take a step size as their first argument.

hSlider :: RealFrac a => (a, a) -> a -> UISF () a Source

Horizontal Continuous Slider

vSlider :: RealFrac a => (a, a) -> a -> UISF () a Source

Vertical Continuous Slider

hiSlider :: Integral a => a -> (a, a) -> a -> UISF () a Source

Horizontal Discrete Slider

viSlider :: Integral a => a -> (a, a) -> a -> UISF () a Source

Vertical Discrete Slider

Sliders also come in a programmatically updatable variety.

hSliderS :: RealFrac a => (a, a) -> a -> UISF (SEvent a) a Source

Settable Horizontal Continuous Slider

vSliderS :: RealFrac a => (a, a) -> a -> UISF (SEvent a) a Source

Settable Vertical Continuous Slider

hiSliderS :: Integral a => a -> (a, a) -> a -> UISF (SEvent a) a Source

Settable Horizontal Discrete Slider

viSliderS :: Integral a => a -> (a, a) -> a -> UISF (SEvent a) a Source

Settable Vertical Discrete Slider

Graphs

realtimeGraph :: RealFrac a => Layout -> DeltaT -> Color -> UISF [(a, Time)] () Source

The realtimeGraph widget creates a graph of the data with trailing values. It takes a dimension parameter, the length of the history of the graph measured in time, and a color for the graphed line. The signal function then takes an input stream of (value,time) event pairs, but since there can be zero or more points at once, we use [] rather than SEvent for the type. The values in the (value,time) event pairs should be between -1 and 1.

histogram :: RealFrac a => Layout -> UISF (SEvent [a]) () Source

The histogram widget creates a histogram of the input map. It assumes that the elements are to be displayed linearly and evenly spaced. Also, the values to be plotted must be between 0 and 1 (inclusive).

histogramWithScale :: RealFrac a => Layout -> UISF (SEvent [(a, String)]) () Source

The histogramWithScale widget creates a histogram and an x coordinate scale.

Virtual Real Estate

scrollable :: Layout -> Dimension -> UISF a b -> UISF a b Source

The scrollable function puts sub-widgets into a virtual canvas that can be scrolled using sliders that appear when necessary. The first argument is the actual layout of the scrollable area, and the second argument is the size of the virtual canvas.

Custom Graphics

canvas :: Dimension -> UISF (SEvent Graphic) () Source

Canvas displays any graphics. The input is a signal of graphics events because we only want to redraw the screen when the input is there.

canvas' :: Layout -> (a -> Dimension -> Graphic) -> UISF (SEvent a) () Source

canvas' uses a layout and a graphic generator. This allows it to behave similarly to canvas, but it can adjust in cases with stretchy layouts.