Copyright | (c) Daniel Winograd-Cort 2014 |
---|---|
License | see the LICENSE file in the distribution |
Maintainer | dwc@cs.yale.edu |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
These are the default, built-in widgets for UISF.
- label :: UITexty s => s -> UISF a a
- displayField :: UITexty s => WrapSetting -> UISF s ()
- displayStr :: UISF String ()
- display :: Show a => UISF a ()
- withDisplay :: Show b => UISF a b -> UISF a b
- textbox :: UITexty s => s -> UISF (SEvent s) String
- textbox' :: UITexty s => UISF s UIText
- textField :: UITexty s => WrapSetting -> s -> UISF (SEvent s) UIText
- textField' :: UITexty s => WrapSetting -> UISF s UIText
- title :: UITexty s => s -> UISF a b -> UISF a b
- spacer :: UISF a a
- button :: UITexty s => s -> UISF () Bool
- stickyButton :: UITexty s => s -> UISF () Bool
- stickyButtonS :: UITexty s => s -> UISF (SEvent Bool) Bool
- checkbox :: UITexty s => s -> Bool -> UISF () Bool
- checkboxS :: UITexty s => s -> Bool -> UISF (SEvent Bool) Bool
- checkGroup :: [(String, a)] -> UISF () [a]
- radio :: UITexty s => [s] -> Int -> UISF () Int
- radioS :: UITexty s => [s] -> Int -> UISF (SEvent Int) Int
- listbox :: (Eq a, Show a) => [a] -> Int -> UISF (SEvent [a], SEvent Int) Int
- listbox' :: (Eq a, Show a) => UISF ([a], Int) Int
- hSlider :: RealFrac a => (a, a) -> a -> UISF () a
- vSlider :: RealFrac a => (a, a) -> a -> UISF () a
- hiSlider :: Integral a => a -> (a, a) -> a -> UISF () a
- viSlider :: Integral a => a -> (a, a) -> a -> UISF () a
- hSliderS :: RealFrac a => (a, a) -> a -> UISF (SEvent a) a
- vSliderS :: RealFrac a => (a, a) -> a -> UISF (SEvent a) a
- hiSliderS :: Integral a => a -> (a, a) -> a -> UISF (SEvent a) a
- viSliderS :: Integral a => a -> (a, a) -> a -> UISF (SEvent a) a
- realtimeGraph :: RealFrac a => Layout -> DeltaT -> Color -> UISF [(a, Time)] ()
- histogram :: RealFrac a => Layout -> UISF (SEvent [a]) ()
- histogramWithScale :: RealFrac a => Layout -> UISF (SEvent [(a, String)]) ()
- scrollable :: Layout -> Dimension -> UISF a b -> UISF a b
- canvas :: Dimension -> UISF (SEvent Graphic) ()
- canvas' :: Layout -> (a -> Dimension -> Graphic) -> UISF (SEvent a) ()
Widgets
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 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 checkbox
es 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.
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.