GUI-Toolkits
Introduction
People often ask me what toolkit one should use for building GUI-applications, what IDE is best under Linux, ... Since I've done some stuff with Qt I mostly told them something about that, and mentioned that there are other toolkits out there.
Since people keep asking me the same things, and would like to see some example code I decided some time ago to build a page describing all usable GUI-toolkits I know, giving some tips what to use on what situation, and showing some sample code. If you have any comments about this page, please drop me a note. I know that this page is far from being complete -- simply due to the lack of time. I appreciate sample code snippets, comments about toolkits, hints to toolkits I forgot to mention, ....
As mentioned above, people want to know something about devtools, too. I'll add page containing that stuff as soon as I have time to do so.
Overview
| Name | Language | License | Platforms | Language wrappers | URL |
|---|---|---|---|---|---|
| GTK | C | LGPL | UNIX/X11 | C++, Perl | http://www.gtk.org |
| Motif | C | Commercial (Motif), proprietary (OpenMotif) | UNIX/X11 | http://www.opengroup.org/motif/, http://www.opengroup.org/openmotif/ | |
| LessTif | C | LGPL | UNIX/X11 | http://www.lesstif.org | |
| Qt | C++ | GPL, Commercial | UNIX/X11, Win32, Mac OS X, Embedded Linux | http://www.trolltech.com/products/qt/index.html | |
| fox | C++ | LGPL | UNIX/X11, Win32 | http://www.fox-toolkit.org | |
| FLTK | C++ | LGPL | UNIX/X11, Win32, OpenGL | http://www.fltk.org |
Why use a GUI-Toolkit?
One of the problems every toolkit has is speed -- since toolkits are always wrappers around a native API they are slower than applications using the native API. Depending on what operation system and toolkit you are using you might notice speed differences -- or not.
The most important pro for GUI-toolkits is platform independence. Some toolkits do not only provide GUI-elements, but wrappers around nearly every possible system call -- sockets, threads, ...; that means, with some toolkits you can build complex applications without even one line of platform dependent code, but with the drawback of wrapping (faster) native functions.
Another reason why one might want to use GUI-toolkits is their API. Some toolkits provide a very well-formed API, as a result of a structured design. Most toolkits are way better to use than for example the native Windows API.
Toolkits for C
GTK
GTK is a free C-toolkit once developed to build the image manipulation tool GIMP. Meanwhile it is used by many applications, most prominent example might be the GNOME framework. You can get it from gtk.org
One GTK-problem is the not very well designed API -- on the other hand, GTK is nearly the only available C-toolkit, and there are wrappers to use GTK from nearly every script language important under UNIX. It works under UNIX/X11 and Windows, but since it does not provide a native Windows look and feel you most likely don't want to use it for cross platform development.
Motif
Motif is a toolkit well-known from older commercial applications. For many people the way Motif looks was the way X11/UNIX has to look. History is the only reason to mention Motif here. Due to its commercial nature Motif was about to die -- when some idiots decided to release it as open source, thus providing even free software developers with the chance to feel what pain in the ass it is.
Motifs API aims hard to suck more then the native Win32 C-API. Don't start new applications with Motif. Try to rip Motif out of older applications, even GTK would be better. If you have to take part in a project using Motif better think about committing suicide.
LessTif
LessTif tries to be source compatible to Motif. In contrast to Motif LessTif is licensed under LGPL. For general description see Motif.
Toolkits for C++
Qt
Qt is a C++-Toolkit from Trolltech.
It is available for Windows, UNIX/X11, Mac and Linux/Embedded, then using
framebuffer. While there are GPLed versions for X11 and Mac available
they provide only a `free edition' for windows -- which runs with visual
c++ only and is outdated by now. (
Qt provides Skins and Themes, it comes with some default themes to provide native look and feel under Windows, Mac, UNIX (Motif), ...; If you need to build applications for all of these operating systems, and you need to provide applications with a native look and feel Qt is most likely the best choice for you. In my opinion Qt is currently the toolkit with the best API out there.
Another nice thing is the encapsulation of sockets, threads, SQL DBMS access, ..., making it possible to work completely independent from the underlying OS -- as long as you can afford some performance loss. If you have to port a native Win32-application to Qt there are some compatibility layers to help you.
If you are doing open source development and would like to build applications for UNIX and Windows better think about using any of the toolkits mentioned below -- the Qt Free Edition for Windows is really outdated by now, and there are no signs it will be updated soon. When I had contact to some Trolltech-guys some time ago they told me they'll most likely release versions of their free edition for other compilers like the one from Borland -- but nothing happened since about 2 years. I don't know anything about the reasons why they do not provide usable free Qt releases for Windows, but it seems they don't want to give away the windows edition for free anymore.
For commercial development Qt is most likely the toolkit of choice.
Fox
FOX is a free C++-Toolkit, you can get it here. It stands under LGPL, i.e. you can link it with closed source applications. It is available for UNIX/X11 and Windows, on windows all of the most important compilers are supported.
Its look and feel is very similar to the one known from Windows, which makes it a great choice for cross platform development if you don't' want to use Qt Free / Visual C++. On the other hand, hardcore UNIX users might not like the look and feel that much. In my opinion the API of Qt is a tad cleaner. For opensource without intentions to leave UNIX I'd suggest to use Qt, for crossplattform open source use Fox. For commercial development it might be tempting to use Fox for not having to pay license fees -- you should think about it twice. You'd be limited to UNIX/X11 and Windows, with Windows-look everywhere.
GTKmm
GTKmm is a C++ Wrapper around GTK. Remember what I said about wrappers at the beginning of this page?
The GTKmm people claim to provide an ISO C++ compliant API I'd not use GTKmm knowing of the underlying dirt (GTK)
fltk
TODO
TCL/TK
TODO