Introduction to wxWidgets

What wxWidgets is and is not

wxWidgets is a set of libraries that allows C++ applications to compile and run on several different types of computer, with minimal source code changes. There is one library per supported GUI (such as Windows, GTK+, Motif, and Mac). As well as providing a common API (Application Programming Interface) for GUI functionality, it provides functionality for accessing some commonly-used operating system facilities, from copying and deleting files to socket and thread support. wxWidgets is a 'framework' in the sense that it provides a lot of built-in functionality, which the application can use or replace as required, thus saving a great deal of coding effort. Basic data structures such as strings, arrays, linked lists and hash tables are also supported. See wxWidgets 2 Classes for a list of the available classes (a little out of date now, so please also see the online class reference).

wxWidgets is not a translator from one GUI from another; it cannot take a Motif application and generate a Windows application, for example. You need to learn a new API. However, the wxWidgets API has been praised for its intuitiveness and simplicity, and can be far easier to learn and use than a native GUI API such as Motif or Windows. Porting from MFC is particularly easy due to its similarity: one user has ported his CASE tool from MFC to wxWidgets in a couple of weeks.

Such a toolkit is not unique - there are others to choose from - but wxWidgets is free, well-established, well-documented, and very broad in its coverage of GUI functionality. It has some extras that make it stand out from the crowd, such as the many convenience dialogs, built-in HTML display and printing, virtual filesystems, easy-to-use OLE automation controller class, Open GL support, and many other features that make it easier to write modern and user-friendly applications.

A little history
wxWidgets was started in 1992 at the Artificial Intelligence Applications Institute, University of Edinburgh, by Julian Smart. Julian was designing a kind of meta-CASE tool called Hardy which needed to run on Windows as well as X-based Unix workstations. The existing commercial cross-platform tools were deemed too expensive for an in-house experimental project, so the only alternative was to build one. wxWidgets (w for Windows, x for X) started off with support for XView and MFC 1.0, and AIAI allowed it to be released to the Internet. As it became clear that XView was doomed, a Motif port was written. Borland C++ users began to request a version that was not dependent on MFC, so the Windows port was rewritten to use the native Windows API.

Over time, a small but enthusiastic community of wxWidgets users was established and a mailing list set up. Contributions and fixes were sent in, the largest contributions being the Mac and Xt ports. wxWidgets gradually picked up more and more users from all over the world: commercial, government, and - most gratifying of all - company users who found that wxWidgets offered a better product, and better support, than the commercial products they had looked at or used.

During 1995, Markus Holzem released his port of wxWidgets to Xt, the X toolkit. This meant that software could be written that would work on X systems without the need for installing Motif, which is a commercial product.

In 1996 wxWidgets stagnated a little. Julian left AIAI to do freelance consultancy, and there were few new releases. The seemingly unstoppable advance of Java was throwing some doubt on the future of C++ libraries. After many contributions, the wxWidgets code was looking rather tired and in need of a serious rethink. At the start of 1997 it was make or break time - call it a day and move on to other things, or commit to re-engineering wxWidgets with an API that was flexible enough for current and future user interface trends, with more 'widgets', and better use of C++. After an exchange between Julian Smart and Markus Holzem (the author of the Xt port), it was decided that it was worthwhile. Julian would do the Windows port, Markus the combined Motif/Xt port, with both contributing to the generic parts. wxWidgets 2 API ideas and code started to take shape.

During 1997 an effort to produce a standard Linux desktop environment was underway - GNOME. Its widget set was GTK+, built on top of X11 and it looked as though GTK+-based apps were to become the standard in the Linux universe. Its one major problem - GTK+ was C-based, and only a thin (and unportable) C++ wrapper existed for it. In August 1997, Wolfram Gloger made a suggestion that wxWidgets 2 should be ported to GTK+ - Robert Roebling had initial reservations, but in general supported the idea. He became the prime mover for wxGTK and alphas were made available at the beginning of 1998. In May 1998 the Windows and GTK+ ports were merged and put into a CVS repository made available to all contributors to wxWidgets. By now Vadim Zeitlin had become a very active wxWidgets developer, and he remains probably the most energetic of us all.

Markus Holzem had to drop out of the wxWidgets 2 effort in early 1998, but Julian Smart started a new wxMotif port. The idea of an Xt port was dropped, since there remained two possibilities for free Unix programming with wxWidgets: wxGTK, and wxMotif with the Motif clone Lesstif.

Towards the end of 1997, Julian Smart started distributing a CD-ROM of wxWidgets.

In September 1998, Stefan Csomor started a new version of the wxMac 2 port based in part on Greg Whitehead's initial work.

wxWidgets 2.1.11 saw the bundling of Vaclav Slavik's impressive wxHTML classes, with subsequent enhancements including print/preview ability, and a helpview application and help controller class for cross-platform HTML help. wxHTML gives applications easy access to enviable formatted text viewing and reporting capabilities.

Mid-2000 saw the launch of wxDesigner, Robert Roebling's commercial dialog editor and RAD tool, which has proved very popular. 2000 also saw the start of wxUniversal, wxWidgets' own set of widgets for use on platforms that have no widget set of their own. wxUniversal was coded mainly by Vadim Zeitlin and funded by SciTech Software, Inc, who also funded Vaclav Slavik to write a port to their MGL porting layer.

In July 2000, Julian Smart joined Red Hat's Cambridge operation, U.K., and left in February 2002 to pursue his own products when Red Hat decided to jettison the eCos deeply embedded operating system.

From late 2001 to mid-2002, Julian Smart and Robert Roebling added the wxX11 port using the wxUniversal widgets - requiring only Linux and X11, it's suitable for any Linux environment and can be used in fairly low-spec systems. In October 2002 Robert Roebling succeeded in cross-compiling wxX11 for the Familiar Linux distribution running on the iPAQ. Robert also got wxGTK working with GTK+ 2 with Unicode support, opening up wxWidgets to further markets.

In July 2003 wxWidgets started running on Windows CE, and Robert Roebling demonstrated wxGTK applications running on the GPE embedded Linux platform.

The OS/2 port by David Webster and Stefan Neis has been improving slowly but steadily over the last few years.

Where now?
wxWidgets continues to gather significant momentum, with big names and companies adopting wxWidgets and wxPython. As the industry rethinks its dependence on expensive and closed-source Microsoft products, desktop use of Linux continues to grow, and with it the need for wxWidgets. Many people are finding that wxWidgets is the fastest route to porting their MFC applications to Linux, other Unix variants, and Mac. So the future for wxWidgets is brighter than ever.

The wxMotif port will probably become less relevant, as Sun has adopted the GTK+ widget set. It's likely that we'll see wxX11 begin to be adopted in embedded solutions over the coming months, as well as for desktop Linux applications that for whatever reason need to be independent from GTK+ and Motif. It's possible that a port to Windows CE will emerge in 2003.

wxWidgets will continue to be developed and improved by volunteers, who have a range of interests in wxWidgets - some contribute in order to implement a particular application, and some because there is a spin-off benefit in terms of consultancy and exposure within the industry. But for everyone concerned, a major incentive is the satisfaction of building a useful and elegant tool for people like themselves - programmers trying to cut a simplifying path through the ever-growing maze of today's computing industry.


See also: