wxWidgets 2 Features

Basic GUI classes

As you would expect, wxWidgets has a wide range of classes for creating standard windows and controls: for example, wxFrame, wxDialog, wxButton, wxListBox, wxGauge, wxComboBox, wxTextCtrl, wxTreeCtrl, and so on. Most of these are wrappers around the equivalent native widget; so a wxListBox uses the Motif listbox widget or Windows listbox control. Occasionally additional widget code has been added to the wxWidgets library to support a control, such as the Motif combobox control or the Windows 3.1 gauge implementation.

wxToolBar is supplied on each platform for providing good-looking and convenient toolbars.

wxNotebook can be used for tabbed dialogs and other applications where tabs are required.

wxSplitterWindow allows an application to have two windows with a moveable sash, which when moved completely to one edge triggers code to remove one of the windows, under application control. wxSashWindow provides an even more flexible way to allow window resizing.

wxScrolledWindow implements commonly-used scrolling behaviour, and the programmer can define different scrolling behaviour if required.

Event handling

In wxWidgets, any class derived from wxEvtHandler may respond to events. Command events can be passed up from child to parent. The mapping between events and class member functions can be done either dynamically (using 'Connect') or statically (using event tables). This is similar to the MFC message map, but implemented in a more consistent manner. Event handler objects can be plugged into other objects, supporting a chain of objects each of which handles a different set of events.

Device contexts

wxWidgets follows the Windows method of associating a device context with a window that is to be drawn into. The drawing code operates via the device context, and therefore by parameterising code by wxDC, you can obtain very portable drawing functions that can draw into a variety of device contexts, such as a wxMemoryDC (for drawing onto a bitmap) or wxPrinterDC (for drawing into a printer).

To draw into a device context, an application normally sets a wxPen (for specifying outline style and colour) and wxBrush (fill colour).

Printing

wxWidgets offers a printing and print previewing framework, which make use of the wxPrinter, wxPrintout and wxPreview classes, internally using wxPostScriptDC or wxPrinterDC for printing on Unix or Windows respectively. wxPostScriptDC can be used directly on Windows or Unix.

Bitmaps

wxBitmap supports a variety of bitmap types, which differs according to platform. XPM is implemented on Unix and Windows; and PNG is implemented on both. wxIcon can load ICO or XPM images from file under Windows, and XBM or XPM files under Unix. The wxImage class can load JPEG, TIFF, PCX, GIF, PNM and BMP files and can also rotate and scale images. wxImage is a platform-independent class with emphasis on loading multiple image formats, whereas wxBitmap wraps the appropriate platform-dependent bitmap.

Dialogs

There is a Dialog Editor for wxWidgets to allow interactive positioning of controls. Positioning can also be done programmatically using absolute coordinates or the wxWidgets constraint system. Convenience dialogs are supported, such as wxFileDialog, wxDirDialog, wxMessageBox, wxColourDialog, wxFontDialog, wxPrintDialog, wxPageSetupDialog.

Operating system functionality

A variety of OS functions are supported, such as wxExecute, wxRemoveFile, wxRenameFile, wxCopyFile, wxFileExists. Thread support is handled by a set of classes.

Data structures

wxWidgets offers some commonly-used data structure classes, including wxList, wxStringList, wxString, wxHashTable. It also provides an alternative to the standard C++ stream library, which on some systems is buggy and unreliable (and often non-thread-safe).

Debugging facilities

wxWidgets offers a set of logging functions that can write warnings and error messages to standard output, the Windows debug stream, or to a file. Memory operators are redefined to detect memory leaks, which are reported when the application closes (if compiled in debug mode). Assertion macros are provided to allow you to 'program defensively'.

Online help

wxWidgets applications can support online help, with wxHelpInstance controlling WinHelp under Windows, and Netscape under Unix. The supplied utility Tex2RTF can be used to generate your own RTF, WinHelp RTF, and HTML files from Latex source. wxHTML (see 'Other classes' below) incorporates a help viewer which can be used to implement on-line HTML help on non-Windows platforms.

Interprocess communication

Socket classes are provided on all platforms, plus classes for popular protocols such as HTTP and FTP. On Windows, DDE is encapsulated by a set of classes.

Document/view framework

These (optional) classes can help reduce the amount of tedious housekeeping work that an application has to do. An application derives from wxDocument and wxView and specifies the relationship between them. wxWidgets implements default handlers for many behaviours such as file open, close, new, etc. Also included in this framework, but useable independently of it, is a collection of classes for implementing Undo/Redo.

Database

ODBC is supported on Unix and Windows via a comprehensive set of classes donated by Remstar. wxWidgets users can also use the dBase clone Xbase.

Other classes

As well as the core wxWidgets library, there is a collection of utility classes for implementing grid windows, property dialogs (like Visual Basic property dialogs), structured ASCII text files, application settings, tree and graph layout algorithms, OLE automation controllers (Windows only), and more. wxHTML offers HTML viewing and printing facilities, plus on-line help HTML help. OpenGL is supported via wxGLCanvas. The Object Graphics Library (OGL) makes it easy to implement node-and-arc diagrams.

There are also other contributed classes on the wxWidgets ftp site.

Documentation

A comprehensive reference manual is supplied in HTML, PDF, and WinHelp formats.

Samples

Over 50 samples and full demos are supplied.

Compiler support

Most popular compilers are supported, through makefiles and/or project files. Compatible compilers include VC++ (versions 1.5 up to 6.0), Borland C++, Watcom C++, CodeWarrior, Cygwin (formerly GnuWin32), Mingw32, gcc, egcs, Sun C++.


See also: