This page makes a general case for using wxWidgets. For
a discussion about what kind of organisations and individuals
use wxWidgets, please see Who uses wxWidgets?
Cross-platform ability
wxWidgets allows you to target Windows 95/98/ME, Windows NT/2K/XP,
Linux/Unix with the GTK+ toolkit (or plain X11, or Motif), and MacOS.
So, you don't have to worry that your development
investment will be made obsolete by the requirement to target another platform.
Very little platform-specific power is sacrificed by the breadth of coverage, since
missing functionality is often emulated, such as MDI (Multiple Document Interface) frames
and the advanced tree and list controls. If you want, you can even cross-compile
Windows applications without leaving your Linux environment.
Open source
wxWidgets is free and open source. That doesn't mean it's a poor man's tool: it
just means that it is developed by an enthusiastic and talented Internet-based team who are
building a quality toolkit that lives up to their own expectations and standards.
It also means that you don't have to worry about wxWidgets' vendor going broke: there is
no single vendor, and you will always have access to the source code.
The licence for wxWidgets means that anyone can use it, for proprietary or open source (and GPL'ed)
software.
Documentation and samples
wxWidgets has a reference manual running to around 1800 pages, in a format to
suit everyone: HTML, Windows Help, and Acrobat PDF. The user can also get better acquainted
with the API by looking at the selection of over 50 samples.
wxWidgets is documented using Tex2RTF, a free add-on utility with which you
can provide your own applications with cross-platform online help and printed manuals.
Wide range of control and window classes
wxWidgets has the usual basic controls such as text and bitmap buttons, text entry,
scrolling list, combobox, checkbox, and so on, plus more advanced classes including:
- wxTreeCtrl: shows a hierarchy of text or bitmap labels.
- wxListCtrl: shows a list of small or large icons; in report mode, it shows
a header with resizeable elements, and columns of text.
- wxNotebook: shows tabbed pages. The control can be used within dialogs and other windows.
- wxMDIParentFrame, wxMDIChildFrame allow child frames to be viewed inside a main
frame. This is implemented using tabs on non-Windows platforms.
- wxScrolledWindow: implements a convenient scrolling window, though different scrolling
behaviours may be implemented to suit the application.
- wxSplitterWindow and wxSashWindow: support for windows with sashes (divisions).
- wxGauge: supports gauge behaviour using the appropriate look and feel for the platform.
- wxToolBar: on each platform, a good-looking toolbar is available.
- wxPropertyList classes: a family of classes for providing property dialogs, with
a scrolling list of names and values, an edit field, and predefined/custom value editors.
- wxGrid: a basic grid or table class.
Powerful event system
wxWidgets has an event system similar to (but more elegant and powerful than)
MFC's message maps, that allows events to be associated with member functions either
statically (at compile time) or dynamically (at run time). Unlike the Qt toolkit,
this doesn't require a non-standard preprocessor. Custom events may be defined.
Printing facilities
wxWidgets has print/preview facilities, using Windows printing on Windows, and
generating PostScript on Unix.
Debugging facilities
wxWidgets has a memory-checking facility that can detect memory leaks, reporting them
at the end of the program run in debug mode. In MS Developer Studio, clicking on these
error messages loads the appropriate file at the line where the memory was allocated.
wxWidgets also has a set of assertion and debug logging macros and functions.
Compiler support
wxWidgets supports more compilers than probably any other framework. All popular Windows
C++ compilers are supported with the exception of Symantec C++ (this is being worked on),
and on Windows you can use the Cygwin or Mingw32 free compilers. Even the 16-bit versions
of Visual C++ and Borland C++ can be used. On Windows, makefiles are provided, with project
files for VC++ 5 and above.
Just about all known Unix C++ compilers are supported, for the Motif and GTK platforms.
If you have a compiler that isn't supported, with help from the wxWidgets team we should
be able to fix the problem quickly.
Database functionality
wxWidgets has a set of ODBC classes, which work on Windows and Unix (subject to the driver being used).
If ODBC doesn't suit, you can use other libraries, such as the third-party cross-platform Xbase library, a free dBase clone,
or SQLite which now has a GUI client
written with wxWidgets.
Document/view classes
A document/view model is supported, which handles tedious housekeeping duties such
as prompting the user to open and save files. Also, the wxCommand and wxCommandProcessor classes can be used
in a document/view or other application, and help you to implement Undo/Redo in your
program.
Drag and drop
Most ports support clipboard and drag and drop functionality.
Easy UI update
By responding to UI update events, an application can declaratively and simply specify
which menu items or controls need to be enabled or disabled. This turns a potential nightmare of
fiddly logic coding into an easy task, resulting in highly readable code.
Configuration files
A family of configuration files is supplied, so you can use Windows INI files, the Windows
registry, or a portable file format, using the same API.
Multithreading
Like many frameworks, wxWidgets isn't 'thread-safe' in the sense that the programmer
can use GUI code indiscriminately from threads, but it does have a range of thread and mutex
classes for the careful and more ambitious programmer. These classes are under development.
Network programming
wxWidgets comes with a set of TCP/IP classes, including support for popular protocols such as FTP
and HTTP.
HTML classes
wxWidgets has HTML viewing and printing classes built-in - so you can do things like
put formatted text in your 'about' box, show manuals within your application,
generate reports, and so on. This feature can really help set your application apart.
OpenGL integration
A wxGLCanvas package is available to allow wxWidgets applications (currently GTK and Windows only) to support
OpenGL. Very few changes need to be made to existing OpenGL applications.
Diagramming application support
If you need to implement a CASE tool, or model a network, or anything involving
nodes and arcs, you can use the extensive Object Graphics Library (version 3) to make your
task much easier. Please see the Contributions section for
more details.
OLE automation support
If you need full OLE support, with object linking and embedding, structured
storage, ActiveX development and so on, then wxWidgets is not for you. However,
wxWidgets does have an OLE trick up its sleeve: the wxAutomationObject provides
you with easy-to-use support for calling OLE automation servers. In fact it's as easy to use
as automation support in Visual Basic. Obviously, this is limited to the Windows
platform until Microsoft port the technology to other platforms.
Multiple language support
You can now use the wxWidgets API outside C++: wxPython
is becoming a very popular GUI scripting tool, and there are others
listed here.
A user community
The concensus is that support via the mailing list is usually at least as good
as commercial support. As well as users who are keen to help answer questions, the
development team is independent and committed. Bugs are usually fixed very quickly,
whenever possible. You can now get commercial support for
wxWidgets.
What about the other toolkits?
There are other toolkits, but wxWidgets is nudging towards becoming the
de facto standard GUI crossplatform framework. Many people also use it
as a single-platform toolkit, because of the clean and intuitive API
it offers. We leave a detailed comparison between wxWidgets and other tools
up to others; however you can see some comparisons in the feedback page.
Isn't it more efficient to use pure GTK+ or Motif or WIN32 or...?
There may be some areas where there is a slight performance penalty for using
wxWidgets, but this will rarely, if ever, be noticeable. If you find an area
where using the raw API will be better for your application, there is nothing
to stop you coding certain parts unportably but efficiently (the equivalent of dropping down to assembly
language from C++). However, steps have been taken in wxWidgets to make drawing, in particular,
as efficient as possible. The overhead of C++ over C is not something that should
worry you either!
Naturally, programmer efficiency is far better when using wxWidgets instead
of a native toolkit. Another consideration is the documentation: it has been
observed, for example, that the wxWidgets documentation is much better than
the GTK+ documentation. So this is a very good reason to program in wxWidgets even
if you only ever use one platform.
Are there any visual tools for wxWidgets?
Please see the Tools page for a variety of
third-party dialog editors and RAD tools for wxWidgets. The Dialog Editor
in the wxWidgets source tree is deprecated.