Technical overview
TekUI is not a binding to an existing GUI library, and it makes no attempt to conform to the looks of a host's native GUI (although this can be emulated to a certain degree – see below for details). The implementation comes straight to the point, and it is comparatively fast and resource-friendly, despite its script-heavy nature. Among the benefits for developers are its transparency and modularity; in particular, custom interface elements can be created with little effort. Note, however, that the programming interfaces are not fully stable yet, so be prepared for structural and API changes.
General features
- Automatic layouting and scalability
- Font-sensitivity, support for antialiased fonts
- Full Unicode (UTF-8) support
- Support for cascading style sheets (CSS) and themes
- Allows for multi-windowed, tabbed and fullscreen applications
- Fully incremental refresh logic, backbuffers are not required
- Concurrency thanks to inbuilt support for dispatching to coroutines
- Works unmodified with stock (double precision), single precision and integer versions of the Lua VM
- Supplied with a documentation system supporting tekUI's object model
Supported interface elements
- Canvas
- Checkmark
- Directory lister
- File requester
- Floating text
- Gauge
- Group (horizontal, vertical, grids, in pages, scrollable)
- Handle for group balancing
- Images
- Lister, also multi-column and multi-selection
- Menu (popup and window), also nested
- Popup item, also nested
- Popup list ('combo box')
- Radiobutton
- Scrollgroup
- Slider
- Spacer
- Text button (and label), also multi-line
- Text input (single line)
Deployment
The only language currently supported for writing applications in is Lua, and application programmers will have to use existing Lua modules or create their own C bindings for communicating with their host. Creating C bindings is an easy and well-documented task in Lua, and the tekUI package contains numerous examples.
Future plans
The next development goal is to fold the tekUI framework into a freestanding C library, which enables applications to create asynchronous GUI objects, communicating with their main program using an application-level protocol. From this, the following benefits are envisioned:
- GUIs integrate smoothly even into I/O-burdened applications (clients, servers)
- strict separation of GUI and functionality; the GUI runs in a thread or process of its own
- Faulty GUI application code, as it is written in a safe language, cannot corrupt the heap or otherwise crash the device, even if it is without a MMU.
Lua would continue to act as the toolkit's internal scripting language, which can be used for complex interconnections between GUI elements as well as many application tasks.
Style sheets and themes
tekUI comes with a cascading style sheets (CSS) engine for the import of properties for element classes, custom classes, pseudo classes, as well as for individual, direct and hardcoded class formattings.
The only admission to a more common appearance is that tekUI tries to import the color scheme found in a GTK+ configuration file, if the 'desktop' style sheet is used (which is the default, see also environment variables). If you are using KDE and check the Apply colors to non-KDE applications option, KDE, GTK+ and tekUI all share the same color scheme.
C library
The C library is based on the TEKlib middleware project. All required modules are contained in tekUI's source code distribution, to reduce the hassle of building and installing the software.
The C library isolates from the host and provides performance-critical routines (e.g. the region management and the default layouter). Rendering and input handling are implemented as display drivers, which allow for easy exchangeability.
Aside from the display driver interface, the C library implements OS-like facilities such as portable threads, a timer device and the possibility of a virtual filesystem interface.
Lua, C and object model
Regardless of whether classes are written in Lua or C, they share a common, single-inheritance object model, which is determined by the Lua virtual machine and provides a referencing scheme and automatic memory management.
Classes can be written in Lua and C interchangeably, meaning that they can inherit from each other regardless of the language they are written in. This makes it possible to prototype applications quickly, and, should the need arise, to replace performance-crititcal classes with their counterparts in C. When porting classes to C, there is a certain degree of freedom in how much reliance on the Lua VM and its automatic resource management is desired.
Documentation system
TekUI comes with a documentation generator supporting its own object model. It is capable of generating a function reference and hierarchical class index from specially crafted comments in the source code. To regenerate the full documentation, invoke
# make docs
Note that you need LuaFileSystem for the document generator to process the file system hierarchy.
Fitness for the use in embedded systems
Complete solutions based on tekUI are in the reach of 512kB ROM or flash memory: A typical application and the required modules, if compiled to Lua bytecode, can fit into 256kB. Add to that approx. 128kB for the C modules and another 128kB for the Lua virtual machine.
Generic, unmodified versions of tekUI have been deployed on PPC and ARM based microcontrollers with clock rates as low as 200MHz, while maintaining good reactivity and a pleasant look & feel. Lower clock rates are workable with some adaptations, namely by disabling expensive features like style sheet support, by porting certain classes to C, using display drivers which are more tightly connected to the hardware, etc.