WxWidgets Compared To Other Toolkits

From WxWiki
Revision as of 20:55, 4 February 2012 by Auria (Talk | contribs)

Jump to: navigation, search

Some general notes:

  • wxWidgets not only works for C++, but also has bindings for python, perl, java, lua, lisp, erlang, eiffel, C# (.NET), BASIC, ruby and even javascript (see General Information for bindings).
  • It is one of the most complete GUI toolkits. There are many utility classes.
  • There is a lot of documentation (though a bit fragmented in places).
  • Free for personal and commercial use.
  • Whenever possible, wxWidgets uses the native platform SDK and system provided widgets. This means that a program compiled on Windows will have the look and feel of a Windows program, and when compiled on a Linux machine, it will get the look and feel of a Linux program.
    • A positive side effect is that wxWidgets is thus more likely to look, behave and feel native - sometimes including native features for free (e.g. possibility to have spellchecking built-in in all text areas on OS X).
    • A negative side effect of this is that it is more likely that the behaviour is different between platforms; toolkits where widgets are lightweight lose some of the native aspect but also minimize platform-specific code (hence minimizing the risk of different behaviour from platform to platform and also minimizing the risk of platform-specific bugs). Concentrating on native looks also mean wx may not be best suited for applications that want a customized look instead of the system's theme.
  • wxWidgets got bad publicity for large use of macros, especially event tables. It is however to be noted that there are usually non-macro alternatives, and wxWidgets 2.9 (3.0) especially made a lot of efforts to provide alternatives to the old macro-based techniques, using more modern techniques like templates instead. Therefore while you will likely find a lot of old code containing macros, do not let that convince you that this is all wxWidgets can offer


There is also a slashdot thread about cross-platform gui toolkits. Though it is old and, well, it is slashdot :), there are probably some useful insights there.

Qt

  • Both Qt (http://qt.nokia.com/) and wxWidgets have many non-GUI-related classes, such as date/time, containers, networking and OpenGL functionality.
  • Qt4.5 is available on MS Windows, Mac, and GNU/Linux under the LGPL and under a commercial license. All ports of wxWidgets are distributed under a permissive modified (but explicitly OSI-approved) LGPL, which allows development and distribution of proprietary applications without license costs.
  • Qt doesn't have true native ports like wxWidgets does. Qt does not use system provided widgets, but emulates it with themes. What we mean by this is that even though Qt draws them quite realistically, Qt draws its own widgets on each platform. It's worth mentioning though that Qt comes with special styles for Mac OS X and MS Windows XP and Vista that use native APIs (Appeareance Manager on Mac OS X, UxTheme on Windows XP) for drawing standard widget primitives (e.g. scrollbars or buttons) exactly like any native application. Event handling, the resulting visual feedback and widget layout are always implemented by Qt.
    • An approach similar to Qt's is achieved with wxUniversal.
    • It should be noted that on KDE and Qt for Embedded Linux platforms, Qt is the native GUI library.
  • Qt extends the C++ language with what is called the MOC to provide additional features like signal-slots. An advantage is the nicety of signal-slot event processing; a disadvantage is that this invades your build system and makes use of non-standard language features. wxWidgets does not extend the C++ language and as such might be less intrusive to the build system or less surprising to developers expecting standard C++.
  • Qt has a full-featured embeddable GUI (Qt for Embedded Linux) based on GNU/Linux with framebuffer. This means that once you have Linux with /dev/fb you are ready to run examples with no additional pains. Qt for Embedded Linux has a small footprint compared with X11.
  • There are numerous IDEs for Qt, QtDesigner, QtCreator, QDevelop, Edyuk as well as integrations with popular IDEs such as Visual Studio, Eclipse and XCode (though there are also several IDEs for wxWidgets).
  • Qt offers reliable commercial support (but so does wx, see http://www.wxwidgets.org/support/support.htm)
  • There has been a bunch of work done with the goal of a Qt-based port of wxWidgets (see the wxWidgets SVN wxQt branch), so wxWidgets applications aren't required to use GTK-Qt (which hasn't been known to work too well) to build applications that look and feel native for KDE users.

FLTK

FOX

  • FOX website: http://www.fox-toolkit.org/
  • FOX is more light-weight, whereas wxWidgets is more full-featured.
  • wxWidgets has a more complete API, while FOX focuses mainly on GUI features.
  • FOX draws its own widgets on each platform, instead of using the native widgets (like Qt), whereas wxWidgets offers true native ports for all the supported platforms. FOX may be faster because of this, but the provided look-and-feel may not be well integrated into the target platform (e.g. the Windows XP theme is not currently available).
  • FOX lacks printing and I18N support for asian language (it's using UTF-8 internally).
  • Standard Windows dialog boxes are not supported in FOX, but a portable similar feature is available.

Java GUI toolkits

  • Java is a programming language that can be combined with different GUI toolkits, such as
  • wxWidgets is compiled to machine code. So is SWT, Swing and Qt. However, the rest of the applications code can be, for wxWidgets, compiled to machine code, whereas in Java applications, it will be interpreted code. However, SWT also has C++ binding today.
    • There are mixed claims about performance (speed) of Java applications. Java applications usually use more memory than C/C++ applications.
    • Users of Java-based applications must have a JVM installed. In recent years, this has become less of an issue as more computers are being installed with a JVM. However, users that have an older JVM may suffer from performance/security problems.
  • wx4j is a wxWidgets implementation for Java. wx4j is a wxWidgets binding for Java which allows Java programmers to keep their Java language but still have the speed of a C++ written program.
  • wxWidgets can be used by a large number of programming languages, and integrated easily. Java GUI toolkits can be used only by programming languages in the JVM (such as Java, JRuby, Jython, JavaScript, BeanShell).
  • Java programs can be deployed easily via Webstart, allowing users to try out applications (see http://jabref.sourceforge.net/ for instance).

The following claims need to be made more specific: Which Java GUI Toolkit is discussed here?

  • In order to be cross-platform, Java generally targets the least common denominator. Features that are only available or relevant on one platform but not others are left out of the Java APIs. Examples include manipulating the Windows taskbar, the Mac OS menu bar, Unix file attributes, etc.
  • A corollary of the statement above: in a wxWidgets program, you can always write some platform-specific code where necessary, inside of an ifdef that makes it only compile on that one platform. In Java, there's no equivalent of an ifdef, and you have to jump through hoops to access external APIs. Also, wxWidgets emulates certain features that are not avalible on different platforms (such as MDI and tree controls).

SDL

  • http://www.libsdl.org
  • SDL (Simple DirectMedia Layer) is a multimedia C library more suited for when you're writing games and such, and want custom-everything and no convenient general-purpose UI elements. It is made of a lot of C structures starting with SDL_.
  • It is possible to combine using wxWidgets and SDL: http://code.technoplaza.net/wx-sdl/
  • Under the LGPL version 2.
  • Allows only a single window to be opened.
  • Very nice OpenGL integration (or libs that build on OpenGL e.g. OpenSceneGraph, CEGUI)

SFML

  • http://sfml.sourceforge.net/index.php
  • SFML (Simple and Fast Multimedia Library) is a multimedia C++ library more suited for when you're writing games and such and want custom-everything and no convenient general-purpose UI elements
  • It covers a lot of things like  : audio, network or threads ...
  • It is possible to combine using wxWidgets, Qt, X11, etc.

Allegro

  • http://alleg.sourceforge.net
  • Much like SDL, Allegro is a cross-platform c library (with quite a bit of assembly used in the backend) for programming games.
  • Almost as old as wxWidgets (circa 1993).
  • Giftware license (essentially public domain).
  • Requires gcc and an assembler to build.
  • Development has been stuck in the same version for years, there are a lack of core developers (original developer is no longer on the team), and there are some internal disputes which may lead to a fork.
  • Very basic GUI functionality - only supports one window with only bare bones operations supported - you can't move the window, etc.
  • "Controls" are sort of supported in allegro also through functions with (many) variable-length arguments, and are owner drawn much like QT (but don't look as good by default). They can be customized via a relatively easy API (and there are a few sub libraries that already have somewhat fair-looking versions).
  • Drawing routines are much faster than wx, and there is a opengl layer (allegrogl - http://allegrogl.sourceforge.net/) that makes drawing with opengl even easier than it is to begin with.
  • Non-GUI routines (input, etc.) are lower-level and generally faster than wxWidgets' native implementations.
  • Can be used with wxWidgets without too much trouble - since allegro has some platform specific functions to get the window handle, you can create a wxWidgets window from the window handle and do what you want from that from that point on. While wxWindows uses a wxApp to handle platform-specific main/WinMain stuff, Allegro requres you put END_OF_MAIN() after your main function - getting the two to work together is somewhat of a task, but not a very large one.

GTK+

  • http://www.gtk.org
  • GTK+, originally the Gimp toolkit, is a LGPL C-language GUI library for Unix systems.
  • It has been ported to Windows, VMS, and other systems (MacOS X currently possible through Apple's X11.app, native version in development; both are painful to build and especially to package) using the same API. However, primary development and focus is for Unix, with multi-platform development mostly as an afterthought.
  • GTK+ is the primary library used to construct user interfaces in GNOME.
  • Unlike wxWidgets, GTK+ supports C (and there is a C++ wrapper called GTKMM, http://www.gtkmm.org )
  • It's built on top of glib, a general-purpose library (similar in some ways to the C++ STL -- it provides a few data structures, functions to help memory management, etc).
  • It looks and behaves exactly the same on all platforms (unless themes are used). On Windows, it has the ability to get the native appearance with the Wimp theme, which uses UxTheme.
  • Does not use system provided widgets on Windows, but emulates it with themes.

Kylix

  • Kylix hasn't been much of a success for Borland/Inprise, so it's doubtful how long it will be continued to be supported.
  • Kylix is based on Qt, see above :)
  • Fewer platforms are supported by Kylix
  • The IDE, being based on no less than 3 toolkits, is rather unprofessional.

Lazarus

  • Lazarus is a cross-platform and open source RAD IDE, and a library to write GUI software
  • Lazarus is mostly compatible with Borland Delphi and the same code can be compiled with both
  • Lazarus has data aware components for easy local and client server database applications development
  • It only supports variety of (Object) Pascal dialects for language
  • Working in a similar way to wxWidgets, it has support for many underlying widgetsets: gtk1, gtk2, win32api, qt, carbon and winCEapi. Cocoa and an owner drawn widgetset exist(fpgui), but are less progressed.
  • The underlying Free Pascal Compiler supports most OSes and architectures currently in use
  • Currently it supports fewer platforms than wxWidgets
  • The combined Lazarus/FPC project contains nearly a complete deeply integrated toolchain in one project. RAD/IDE, compiler, libraries, XML bindings, database connectivity,
  • Lazarus is slowly getting supported by the Borland/Embarcadero Delphi component market, providing complex and high quality commercial widgets.

Ultimate++

Notus

  • See: http://sourceforge.net/projects/notus
  • wxWidgets actually exists ;)
  • notus is likely to make a lot more use of standard library and modern C++ concepts, such as iterators, templates, namespaces, etc (whereas wxWidgets reimplements or works around many of these things in non-standard ways); and it's also likely to follow the design principles of Boost (which you could consider either a good or bad thing), and work well with the rest of the Boost library. Of course, since it doesn't yet exist(*still* in alpha stage), whether this is true in practice remains to be seen.

MFC

  • MFC is only available for free for Windows
    • A macintosh version was available with Visual C++ Crossplatform Edition (~$800 at last check) but has not been supported by the compiler since version 4.1.
    • There are also UNIX variants such as MainWin, which are extremely expensive, require runtime licenses, and are reported to have problematic support
  • While the source for both wxWidgets and MFC is available, EULAs are not a concern with wxWidgets.
  • MFC has a smaller executable size than wx (generally irrelevant with a decent compiler).
  • MFC has greater range of good quality commercial components.
  • Some say event tables (wxWidgets) are 'better' than message maps (MFC).
  • wx's class hierarchy is more intuitive, while MFC tends to be more consistent among top-level class names.
  • wx provides a far greater abundance of convenience classes, while MFC provides more windows-specific classes.
  • .NET isn't an issue - MFC won't be ported to .NET. On the other hand, wx already has .NET wrappers in alpha stage!
  • MFC has a broader range of components available, especially data-bound controls.
  • Some things are easier with wxWidgets, such as certain types of windows (always on top, etc.), while other things are easier with MFC, such as detachable toolbars.
  • Probably the strongest point to use MFC is MSVC, the IDE, itself.
  • For info on class names and other points, see WxWidgets For MFC Programmers

XUL Framework (Mozilla)

  • See: https://developer.mozilla.org/en/XUL
  • JavaScript, XUL and CSS are all needed to program in Mozilla -- XUL describes the structure (like HTML in Web documents, JavaScript the behaviour, CSS for styling); wxWidgets does all of this in C++.
  • Accessing XUL with C++ (XPCOM) is very difficult; C++ in wxWidgets is easier.

Tk

  • Tk is a GUI toolkit designed for the Tcl scripting language and is best used with this language. See: http://wiki.tcl.tk for more information.
  • There are bindings for other languages like Python, Perl, Ruby and C++.
  • The core of Tk has few widgets, but several extensions are available. For example: BWidgets. There are extensions written in C or pure Tcl.
  • Before 8.5 version Tk looked outdated. Now it has been solved on Windows and Mac OS X with the tile extension and it has been added to Tk 8.5 core as ttk. It has now native look on those platforms. On Linux though it still has the old look. This is work in progress, since they're creating themes for GTK and Qt. You can still use other themes to make it look better though.
  • Tk is the default GUI toolkit for Python. The binding is called Tkinter. See: http://wiki.python.org/moin/TkInter
  • Tk has a powerful canvas widget that allows you to draw anything and even create custom widgets.
  • Tk has a powerful event system.
  • Tk is used by several programmers without the need for a GUI designer since the API is simple and GUI code usually is shorter. Several GUI designers exist though. A window with a "Hello world!" on it is a one liner: pack [ttk::label -text "Hello world!"]
  • A complete GUI program developed in Tcl/Tk can be wrapped in a single binary file (that's about 1 mb) called Starpack and deployed to all major platforms. See http://equi4.com/tclkit/ for more information.
  • Tk has a very liberal BSD license that allows commercial software development.

Why you should use Tk? If you want a free, mature, stable, cross-platform GUI toolkit and you're using a scripting language.

Why you shouldn't use Tk? If you plan on using C++ or require a bigger default widget set it's better to use WxWidgets.

VCF

WideStudio

  • See: http://www.widestudio.org/
  • WideStudio uses its own widgets
  • WideStudio installation comes in a bundle with MinGW and gcc (not optional)
  • WideStudio comes with an IDE/Designer
  • There is an IDE/Designer plugin project (Native Application Builder) for Eclipse (see: http://www.eclipse.org/dsdp/nab/)
  • WideStudio does not have keyboard-navigation through controls integrated
  • WideStudio container classes do not allow referencing by name (myWindow("labelCaption")->Test)
  • WideStudio libraries are less than 10MB total (2008-01-25) and distribution bundles can be <4MB for small applications

Why You Shouldn't Use wxWidgets

  • Lack of commercial GUI components for making nice GUI grids, charts, etc. Look at wxCode though.
  • No support for themes (apart from using the themes of the underlying toolkit) unless you use wxUniversal or wxSkin
  • wxX11 is sub-par compared to other toolkits and unstable. You should use the wxGTK port instead, which builds upon GTK instead of directly onto X11. wxX11 is mostly intended for embedded devices that don't have GTK.
  • wxWidgets tries to support a very expansive feature set, and as a result, some lesser-used components of the toolkit are not as stable/reliable as commonly used components are. As with any open source toolkit, thorough testing is the best solution here.
  • wxWidgets does not provide binaries for any system. You have to compile wxWidgets yourself. wxpack provides wxWidgets binaries for Windows, but you have to download an entire multi-hundred megabyte Development Kit to get them. However you can download the C++ IDE plus WxWidget by downloading WxDev which is relatively smaller. WxDev is supported for both C and C++.
  • The use of native widgets makes it more likely that the same code will behave differently from platform to platform, and also makes it more likely that there will be platform-specific bugs.