Maintainer | Malte Harder <malte.harder@gmail.com> |
---|
The UI functions of Craftwerk allow quick display of figures. They also support the creation of a simple user interface to control parameters of the figures that are displayed.
- data Option
- data RenderContext = RenderContext {}
- renderFigure :: Double -> Double -> (Map String Option -> IO Figure) -> RenderContext
- displayRender :: [(String, Option)] -> RenderContext -> IO ()
- displayMultiple :: [(String, Option)] -> [(String, RenderContext)] -> IO ()
- renderWindow :: [(String, Option)] -> [(String, RenderContext)] -> IO Window
- value :: Option -> Double
- choice :: Option -> Int
- choices :: Option -> [String]
- isSet :: Option -> Bool
Data types
Describing options for a user interface.
NumberOption Double | |
RangeOption Double Double Double Double | A range: min, max, step and initial value. |
BoolOption Bool | |
ChoiceOption [String] Int | An option of choices with a default selection. |
data RenderContext Source
Combined cairo and tikz rendering functions depending on the options.
Display figures
:: Double | Width of the coordinate system of the GTK widget |
-> Double | Height of the coordinate system of the GTK widget |
-> (Map String Option -> IO Figure) | The render function |
-> RenderContext |
Renders an 'IO Figure' into a render context with the given dimensions.
displayRender :: [(String, Option)] -> RenderContext -> IO ()Source
Display a render context in a Gtk window, starts the Gtk main loop. The first argument contains a list of named options whose UI values are passed to the render context.
displayMultiple :: [(String, Option)] -> [(String, RenderContext)] -> IO ()Source
Display multiple render contexts in a Gtk window, starts the Gtk main loop. The first argument contains a list of named options whose UI values are passed to the render context.
renderWindow :: [(String, Option)] -> [(String, RenderContext)] -> IO WindowSource
Same as displayMultiple
except that the Gtk main loop is not started or
initialized. The window is not visible upon return.