LUI

From HaskellWiki
Revision as of 02:23, 4 June 2009 by Peaker (talk | contribs) (LUI composable widgets)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

LUI is a purely functional widget set.

A LUI widget has a very simple pure semantic model. It is a function from a model that it is editing to an image, size, and mapping of event groups to documentation and new models.

type Widget model = model -> (Image, Size, Map EventGroup (Documentation, Event -> model))

An Image is semantically an "infinite mapping of coordinates to colors", Size is the actual part of the infinite Image that the widget resides in.

The Map documents what each EventGroup does, additionally providing a function to map specific Event values to their handling, which is limited to returning new states of the model.

LUI only has keyboard support as of yet.

The widgets currently exported by LUI are:

* Grid -- places child widgets in a grid, and allows moving the keyboard focus (selected child).
* Box -- Horizontal/Vertical boxes are just specializations of Grids to a size of 1 in one of the dimensions.
* TextEdit -- A standard line text editor
* TextView -- A simple label, cannot be edited
* Space -- A simple spacer widget
* FocusDelegator -- Wrap your widgets with this widget, and the user will be able to select the widget itself (in which state the widget does not have focus, but is selected).
* Adapter -- Allows adapting an existing widget's model (with a Data.Accessor), image or size.
* KeysTable -- Given a map of event handlers, can display the documentation of the event groups to the user.
* Scroll -- A sized "scrolling window" into a larger widget. No scroll bars yet...
* Unfocusable -- Prevent focus from going into the child widget, but still display the child widget.