lgtk-0.3: lens-based GUI with Gtk backend

Safe HaskellNone

GUI.MLens.Gtk

Contents

Description

The main LGtk interface, ideally users should import only this module.

Synopsis

Lenses and references

GUI combinators

data I m Source

Interface description parametrized by a monad

Constructors

Label (Free m String)

label

Button

button

Fields

label_ :: Free m String
 
action_ :: Free m (Maybe (m ()))

when the Maybe value is Nothing, the button is inactive

Checkbox (Ref m Bool)

checkbox

Combobox [String] (Ref m Int)

combo box

Entry (Ref m String)

entry field

List ListLayout [I m]

group interfaces into row or column

Notebook [(String, I m)]

tabs

forall a . Eq a => Cell

dynamic interface

Fields

remember_content_ :: Bool

remember the content or not? (info for the renderer)

underlying_value_ :: m a
 
dynamic_interface_ :: a -> I m
 
Action (m (I m))

do an action before giving the interface

vcat :: [I m] -> I mSource

hcat :: [I m] -> I mSource

smartButton :: (Eq a, Monad m, Functor m) => Free m String -> (a -> m a) -> Ref m a -> I mSource

Running GUI descriptions

runI :: (forall m. (Functor m, ExtRef m) => I m) -> IO ()Source

Run an interface description

unsafeRunI :: (forall i. I (Ext i IO)) -> IO ()Source

Run an interface description

Unsafe only if you do nasty things in the IO monad, like forking threads

Auxiliary functions

toFree :: (Functor m, Monad m) => m a -> Free m aSource