fgui icon indicating copy to clipboard operation
fgui copied to clipboard

GUI toolkit for microcontrollers

fgui - GUI toolkit for microcontrollers

Bjørn Forsman <bjorn (dot) forsman (at) gmail (dot) com>

WARNING: fgui is pre-alpha software.

fgui is a small GUI toolkit written in C. It is designed to run on very small embedded systems, i.e. 8-bit microcontrollers and up, while still providing an easy to use API.

fgui widgets are placed in a tree structure and input events propagate from the currently focused widget and all the way up to the root widget. If a widget signals that it has handled the event, the propagation stops. Widgets that support user callbacks also support a userdata pointer.

To use fgui, the application must initialize its display device and supply an implementation of this function:

fgui_set_pixel(uint16_t x, uint16_t y, uint32_t color)

Then include fgui.h and explore the API. Basic drawing primitives such as line and rectangle are located in fgui_primitives.h. Font drawing is in fgui_font.h and the widgets are located in fgui_<widget>.h. fgui is object-oriented and fgui_widget.h is the base "class" for all widgets.

fgui comes with an http://www.libsdl.org/[SDL] demo program, try it:


$ cd fgui $ mkdir build $ cd build $ cmake .. $ cmake --build . $ ./demo/fgui_demo

Features

  • basic drawing primitives: ** line ** rectangle (empty + filled) ** circle (empty + filled) ** triangle (only empty)
  • monospaced font drawing
  • widgets: ** label ** push button - supports "on click" callback ** lineedit - single line text input ** combobox - supports "item changed" callback
  • no dynamic memory allocation
  • example/demo program using fgui with SDL, http://www.libsdl.org/

Planned features

  • widgets: ** hierarchical menu (submenus and actions)
  • widget coordinates relative to parent
  • make parent widgets draw their children (currently all widgets must be drawn 'manually' by the application)
  • clipping (widgets should not draw anything outside their border)
  • input validators (for textedit)
  • multi-tap input method

License

fgui is released under the MIT open source license. See LICENSE.txt or go to http://www.opensource.org/licenses/MIT for full license text.

Related projects

  • http://www.segger.com/cms/emwin.html[emWin] (not free software)
  • http://www.swellsoftware.com/products/cpeg.php[C/PEG] (not free software)
  • http://www.easygui.com/[easyGUI] (not free software)
  • http://www.contiki-os.org/[Contiki], a whole RTOS, not just GUI
  • http://sourceforge.net/projects/menudesigner/[menuDesigner], GPL
  • http://sourceforge.net/projects/embeddedgui/[EmbeddedGUI], LGPL
  • http://sourceforge.net/projects/pwlib/[pwlib], GPLv2+
  • https://github.com/olikraus/u8glib[u8glib], New BSD License (3-clause)
  • http://www.embeddedlightning.com/ugui/[µGUI], custom open source license (allows commercial use)