wxWidgets Logo
 
 

Docs

 
  Tutorials
FAQ
Licence
 
 
About wxEmbedded: wxWidgets for embedded applications

wxEmulator Screenshot
wxEmulator running the wxX11 toolbar sample under the Matchbox WM

Contents

1. Introduction to wxEmbedded

2. The ports explained

3. Host tools

4. Enhancements to wxUniversal

5. An application suite

6. Getting started with wxX11

7. Practical issues

8. Main participants

9. Further information

1. Introduction to wxEmbedded

wxEmbedded wxWidgets is going embedded! After years of wishing, several recent projects have brought this closer to being a reality. Here are the current strands in the wxEmbedded strategy. Some are already working, some are works in progress.

    wxWidgets for X11 (wxX11)
    wxWidgets for DirectFB (wxDFB)
    wxWidgets for GTK+ (wxGTK)
    wxWidgets for Nano-X (wxNano-X)
    wxWidgets for Microwindows (wxMicrowindows)
    wxWidgets for SciTech MGL (wxMGL)
    wxWidgets for MS Windows CE (wxWinCE)
    Host tools, such as wxEmulator

Of the four ports listed, all but wxWinCE and wxGTK use the wxUniversal themed widget set, which implements the widgets entirely using wxWidgets primitives. The WIN32 theme is a very authentic reproduction of the Win9x look and feel, and users would be hard pressed to tell the difference.

2. The ports explained

To see which port currently supports which wxWidgets class, please see the supported classes page.

Let's examine each of the embedded ports in turn.

2.1 wxWidgets for X11

wxWidgets for X11 is a port to the X11 windowing system (essentially, Xlib). This port can be used as a wxGTK replacement on the desktop, and as an embedded GUI in conjunction with an X server such as Tiny-X, as used by the Familiar Linux distribution. wxWidgets for X11 is recommended for Linux-based solutions over wxWidgets for GTK+, because of its dependence only on X11.

wxX11 can optionally be compiled in Unicode mode, and text will be rendered using Pango.

Status: this port is 95% working, with a small number of areas that need attention, such as clipboard, text selection, tab navigation and speed optimization.

To get and build wxWidgets for X11, download wxWidgets from the SVN repository, and follow the instructions in docs/x11/install.txt. See also Getting Started for notes on downloading and using the ARM cross-compiler.

2.2 wxWidgets for DirectFB

wxDFB is a port especially suitable for devices with too few ressources for running an X11 server. It requires just a Unix system with a framebuffer driver supported by DirectFB. wxDFB supports black-and-white as well as colour displays and has the least overhead of all embedded Unix ports. See the docs/dfb/install.txt file for more information about using this port.

Status: wxDFB is relatively new and is still work in progress but is already used on commercially available embedded devices.

2.3 wxWidgets for GTK+

Life! on GPE
The wxWidgets Life! demo
under GPE on the iPaq
wxWidgets for GTK+ is the standard desktop port, which can be cross-compiled for targets that have enough memory to run an X server and the GTK+ and GDK libraries. This port can be used in conjunction with an X server such as Tiny-X, as used by the Familiar Linux distribution.

To get and build wxWidgets for GTK+, go to the download page. You can also download from the SVN repository. See the instructions in docs/gtk/install.txt.

2.4 wxWidgets for Nano-X

wxWidgets for Nano-X is a port to the Microwindows Nano-X API.

This is similar enough to X11 to allow the port to use the X11 code, with API replacements and some #ifdefing.

Status: this port is 70% working, with areas that need attention including transparent pixmap drawing, clipboard, text selection, tab navigation and speed optimization.

To get and build wxWidgets for Nano-X, download wxWidgets from the SVN repository, and follow the instructions in docs/x11/install.txt and docs/x11/readme-nanox.txt.

2.5 wxWidgets for Microwindows

wxWidgets for Microwindows is a port to the Microwindows WIN32 API.

Essentially it's the wxMSW (desktop WIN32) port, with compatibility files and #ifdefs for Microwindows, and using wxUniversal for the widgets. Unlike the Nano-X API, only one process can use the Microwindows WIN32 API at a time, because the GUI calls are not marshalled. This severely restricts the usefulness of this port, although several applications can be merged into one to emulate a multi-process environment.

Status: this port is 70% working, with areas that need attention including transparent pixmap drawing, clipboard, text selection, tab navigation and speed optimization. Because of the limitations discussed above, this port is not being actively maintained and so tweaking may be required to get it to compile from SVN.

To get and build wxWidgets for Microwindows, download wxWidgets from the SVN repository, or get the latest wxMSW development snapshot from here, and follow the instructions in docs/microwin/readme.txt.

2.6 wxWidgets for MGL

wxWidgets for MGL is a port to the SciTech Software's MGL API, SciTech's graphics portability layer, supporting Windows, Linux, DOS, OS/2, QNX, SMX, RT-Target and other embedded operating systems.

wxMGL is the port that wxUniversal was originally written to support. SciTech Software have done us an enormous favour by sponsoring wxMGL and wxUniversal.

Status: this port is 99% working, with samples running on DOS. Issues remaining include minor window manager refresh problems. See SciTech's wxMGL page for information and screenshots. You can download MGL from here.

To get and build wxWidgets for MGL, download wxWidgets from the SVN repository, and follow the instructions in docs/mgl/install.txt (instructions coming soon).

2.7 wxWidgets for MS Windows CE

wxWidgets for Windows CE is a port to Microsoft Windows CE 3.0 and above. Unlike the other embedded ports, wxWinCE mostly uses native widgets, rather than using wxUniversal.

Status: the minimal sample and others are running under emulation using eVC++ 3 and 4 and the latest wxWidgets SVN (or wxWidgets 2.5.2). For a screenshot of the minimal sample running on an iPAQ and industrial hardware, see this page.

To compile wxWinCE:

  1. Get the latest version of wxWidgets 2.5.x from SVN HEAD.
  2. Download and install Embedded Visual Tools 3 or 4 if you don't already have it. Download SDKs for PocketPC and SmartPhone if you are interested in these.
  3. Using project files from 2.5.2, open build/wince/wx.vcw, select the appropriate configuration, and compile. There may be long delays while VC++ computes dependencies. Ignore warning messages about missing paths.
  4. Open samples/minimal/minimal.vcw, select the appropriate configuration, and compile.

For more information, including a to-do list, please visit (and contribute to) the wxWinCE Wiki page.

2.8 wxWidgets for Palm OS

Our contest offering a free Tungsten T5 to the first person to show the minimal sample running on Palm OS 6 (simulated or real) has been won by William Osborne - so we now have a firm basis for a wxPalmOS port.

3. Host tools

wxEmulator Screenshot
wxEmulator with an iPAQ skin
We intend to provide some host tool support for embedded application developers. Currently there is one such: wxEmulator. This is a wxX11 application that can show a virtual X desktop window to emulate the small display of a PDA or other target. It reads simple configuration files to tailor the virtual display size and background. wxEmbedded uses a standard Xnest binary to achieve this embedded X server capability.

wxEmulator will help developers to see how their host-targetted applications will behave on a PDA-style screen. Since the target will be running an X server (and Linux kernel) with similar capabilities to the host, this is a reasonable way to do development before cross-compiling and uploading to the target. It also makes life easier for developers who don't have access to hardware, or people just wishing to experiment. Of course, it doesn't emulate the available memory on the target or other target-specific features, since the applications simply run on the host.

A screenshot of wxEmulator with an iPAQ skin running twm and the wxWidgets fractal demo is here.

A screenshot of wxEmulator running Matchbox and the wxWidgets toolbar demo is here.

To compile wxEmulator, download the wxX11 distribution and compile utils/emulator/src. You will need to have Xnest in your path; you can download Xnest from the XFree86 site. See utils/emulator/docs/readme.txt for more information. There is currently a problem on some Linux systems whereby the Xnest window does not integrate with the emulator window: fixes are invited for this!

The existing desktop application development tools can be used too, including:

  • Poedit: an internationalization tool for editing translations
  • Tex2RTF: a documentation tool (distributed with wxWidgets)
  • wxDesigner: a commercial sizer-based dialog editor and RAD tool

4. Enhancements to wxUniversal

There are various enhancements that we can make to wxUniversal, to make it more suited to embedded environments. Here's a selection.
  • A special wxUniversal theme that makes best use of available space, with simpler border styles in particular.

  • Ability to set system-wide font, so we can easily shrink font sizes.

  • Provide options in the common dialogs for simplified, smaller dialogs. This could also be implemented by querying a global setting (e.g. in wxSystemSettings).

  • A combined toolbar/menubar class as in Windows CE.

  • Add missing controls such as wxTabCtrl, wxSpinCtrl.

5. An application suite

We aim to build up a suite of applications suited to a PDA environment, so that eventually we can offer a complete wxWidgets-based PDA solution. For those interested in more industrial embedded applications, the suite will serve as an effective wxEmbedded demo. It will also be an excellent test suite for the developers of wxEmbedded.

The suite might include components such as:

  • Notepad;
  • Diary;
  • Contact list;
  • Database;
  • Alarm clock/time zone viewer;
  • photo album;
  • Hierarchical note database, like Squirrel;
  • Simple web browser based on wxHTML;
  • Mail client (such as a cut-down version of Mahogany);
  • HTML-based e-book reader;
  • Control panel;
  • Synchronisation utility.

6. Getting started with wxX11

Life! on the iPAQ
The Life! demo running on the iPAQ

You can see further screenshots of the wxWidgets 'Life!' demo working on the iPAQ, here.

Cross-compiling

This tool-chain allows cross-compilation of X11 based apps for the Linux/ARM architecture. The ARM chip is used in many handhelds and embedded devices, notably the iPaq and all other StrongARM based PocketPCs.

Download the cross-compiler archive here (27 Mb) and copy it (as root) into

/usr/local

Unpack it by calling

tar -xzvf ArmX11ToolChain.tar.bz2

which will create a new directory called arm. Set the path like this:

export PATH=/usr/local/arm:/usr/local/arm/bin:$PATH

Configure your package with:

configure --x-includes=/usr/local/arm/X11R6/include --x-libraries=/usr/local/arm/X11R6/lib --host=arm-linux --build=i586-linux

Compiling wxX11

Get the sources from our downloads page.

Configure with the options given above. For reasons of efficiency and for removing features which make no sense for PDAs, we suggest adding the following switches to the configure command:

--with-x11 --without-gtk --prefix=/usr/local/arm --enable-no_rtti --enable-no_exceptions --disable-threads --disable-sockets --disable-joystick --disable-mdi --disable-printarch --disable-postscript --disable-resources --disable-prologio --with-zlib=builtin --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --prefix=/usr/local/arm

For compiling your own programme set the PATH environment variable as described above and use the wx-config utility to get the compile options and link flags.

Further information

There many places to look at; some important starting points would be www.LinuxDevices.com, and www.HandHelds.org which features the Linux Familiar distribution.

For a particularly easy way to install a dual boot system for WindowsCE and Familiar look here.

For more information about cross-compilation, see Building TinyX for Handhelds and Building X Client Programs for the iPAQ on the handhelds.org site.

Instead of cross-compiling, you can use the Public Development Cluster at Compaq's Cambridge Research Laboratory.

7. Practical issues

Code size

When statically linked against wxWidgets for X11, the minimal sample is around 1MB in size (in release mode). However, increasing sample complexity makes little difference to the size, so it would seem the linker includes most wxWidgets functionality even in a small sample.

You can reduce code size by configuring with only the wxWidgets classes and features that you need. You may also wish to add new options to the configuration system to increase the granularity. For example, you could make the themes configurable - at present all themes are compiled into wxWidgets, and each theme represents a substantial amount of code.

If you wish to run several wxWidgets applications on your target, then it makes sense to use the shared library version of wxWidgets. The shared library is about 2.5 MB.

wxWidgets for X11 does not require GTK+, GDK or even the Xt toolkit, so you may be able to remove these components from your embedded Linux distribution.

User interface issues

Here are some tips for GUI programming on typical embedded targets. We will add to this over time.

  • Consider using a window manager that shows one window at a time, such as Matchbox (see link below). It's impractical for the user to shuffle multiple windows on a very small screen. Of course, your target might have a large screen that makes a conventional overlapping window manager more appropriate.

  • Use sizers, and populate your dialogs with fewer (and smaller) controls than usual. You can use wxNotebook to split up your dialogs into more manageable pieces.

  • Consider using just a toolbar instead of a toolbar and menubar. You could use one or more of the buttons to pop up a menu with further options. Consider also writing a combined toolbar/menubar class as in Windows CE.

  • Use smaller fonts than usual.

  • Write your code so that only the left mouse button is required.

8. Main participants

  • Julian Smart is an independent software consultant, and former member of the eCos embedded operating system group at Red Hat. Julian started the wxWidgets project in 1992, and the X11 port 10 years later in 2002. He has written the wxEmulator wrapper for Xnest.

  • Robert Roebling is the main author of the wxWidgets for GTK+ port and creator of the wxDesigner dialog editor and RAD tool.

  • Vadim Zeitlin has been energetically improving and maintaining wxWidgets for many years; he wrote the wxUniversal widget set sponsored by SciTech Software, and core to the wxEmbedded strategy.

  • Vaclav Slavik wrote the wxWidgets HTML help system, and the wxMGL port.

9. Further information

 
 

Quick Links

 
  Documentation
Hello, world!
Stable manual
Latest manual
Change log

Community

Mailing Lists
wxBlog
wxCode (Add-ons)
wxForum
wxWiki

Development

Sources
wxTrac
New ticket
Roadmap
 
 
 
 

wxSolutions

 
   
 
 
 

wxBook

 
 

Buy it From:
Amazon.com
Amazon.co.uk

 
 

Site design and update scripts by Kevin Ollivier, with special thanks to Brad Anderson for his improvements to the sidebar, intro table and navbar designs, Bryan Petty for the new wxWidgets blocks graphics and logo text, and to the wxWidgets community for all their helpful suggestions, comments and testing!