Gtk Qt Wxwidgets Comparison Essay

Some general notes:

  • wxWidgets not only works for C++, but also has bindings for python, perl, php, 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.


  • Both Qt ( 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
  • 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.



  • FOX website:
  • 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 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 (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:
  • 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 (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.


  • 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 - 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+, 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, 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, )
  • 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 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 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.



  • See:
  • 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 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:
  • 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 is a GUI toolkit designed for the Tcl scripting language and is best used with this language. See: 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:
  • 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 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.



  • See:
  • 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:
  • 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.


This article is designed to give some ideas and direction to developers who have been writing applications in a Windows environment using the Microsoft Foundation Classes (MFC) and who now recognize that they need to support the Linux platform with their applications as well. Articles abound on the Internet that take up the religious fervor of trying to persuade readers why they should develop to either MFC or the various Linux APIs. I happily leave that argument to others. The assumption here is that the reader is not so much interested in the marketing and religious wars, but that they accept that the Linux world represents a vast revenue potential for them and so, irrespective of strengths or weaknesses between the two platforms, they must have their application running on Linux to compete.

First off, it is important to recognize that the developer is going to have to make a choice as to which GUI toolkit they will use when moving to Linux. It is not that different from the Windows developer who has had to choose whether to use Microsoft's MFC or Borland's ObjectWindows Library (OWL), or some other vendor's object libraries. While the options may be plentiful, a few of the options a Linux developer may choose between that I will discuss in this article are

1) wxWidgets -- an open source, cross-platform, C++ GUI toolkit,

2) QT -- another cross-platform, C++ GUI toolkit developed by Trolltech, and

3) GTK+ - another cross-platform, 'C' based GUI toolkit.

A developer will likely choose any one of these toolkits for their application based on experience and development preference rather than technical inadequacies that may exist. All three are available on the SUSE distribution or from the SUSE SDK for end user and development purposes.

One of the obvious differences a Windows developer may notice when they first move to the Linux environment is that, unlike Windows, there is not one single desktop environment that is used in all cases. I guess it could be argued that there are a few possibilities in Windows, since a machine may have Windows 2000 or Windows XP or others. The difference here is that all these originate from the same vendor, whereas the two most popular Linux desktop environments, KDE and GNOME, are developed and managed by different organizations. In fact they really compete with each other for ownership of the desktop. This should not concern a developer, however, since most Linux distributions, and in our case SUSE, ship with both environments and the user can switch between the two at any time. Additionally, all the toolkits mentioned previously will work in both desktop environments.

In this article I will overview each of the three toolkits to see if I can help give some direction to the new Linux developer that needs to write an application for this platform, and has been developing their application using MFC. Of course, it is assumed that tools like WINE, the Open Source implementation of Windows on Linux, have been tested and do not fit the developer's need for some reason. WINE is usually worth investigating early on, since there is a good chance that a Windows application will run without any modifications when using these libraries. However, some developers will choose not to use WINE, even if their application does run for a few common reasons:

1) using WINE gives a Windows look and feel on Linux that frankly may be offensive to some of the user community that the developer is attempting to reach, and

2) at times some dialogs and components are not displayed on Linux in a way that is pleasing to the developer.

The only way to know this is to test it. Fortunately, WINE is included with SUSE distributions, so it is very easily tested.


One of the nicest things to note about wxWidgets, right up front, is that it is a cross-platform tool that uses native libraries to interface with the host system. What this means is that when a wxWidget application is executed on Windows it will conform to the look and feel of other Windows applications, however, when it is run on Linux it will look like other Linux applications, specifically, GTK+/GNOME applications, since that is the set of libraries typically used by wxWidgets for Linux. I don't mean to imply that wxWidgets gives 'binary' compatibility across platforms like you can get with WINE, however, while achieving a high level of source code compatibility, you will still be getting the desired native UI look and feel with your application.

wxWidgets is also one of the more mature open source GUI projects around. It began in 1992 at the Artificial Intelligence Applications Institute (University of Edinburgh) and was called wxWindows. In February of 2004 the name was changed to wxWidgets to help avoid potential confusion with any Microsoft products. It supports most of the prevailing desktop environments, including Windows 95/98/ME, Windows NT/2000/XP, Linux/Unix with the GTK+ toolkit (motif or the X11 APIs can also be used), and MacOS.

Part of this toolkit's attractiveness to developers is that besides being free to use (it uses a GNU GPL compatible license called the wxWindows Library license), it is also very well documented. It has roughly 1800 pages of documentation in HTML, PDF and Windows Help formats. It also has over 50 sample programs that can be used to help learn the tool.

Of the three tools to be discussed in this article, wxWidgets is the one that most closely resembles MFC, and so may represent the most intuitive port. wxWidget, for example, has an event mechanism that is very similar to the message maps used in MFC. When developing an MFC application, the BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros are used to define the messages that are used in your application control. Within the scope of these macros, other macro entries are used to define the particular message-handler function (ON_BN_CLICKED, ON_COMMAND, ON_WM_PAINT, etc.). The DECLARE_MESSAGE_MAP macro is used at the end of the class declaration to build the map of those messages declared in the implementation file (.cpp) within the BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros.

wxWidgets has similar macros to these. The BEGIN_EVENT_TABLE and END_EVENT_TABLE macros are used just as the BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros are in MFC. Likewise within the scope of these macros the developer will include macros such as EVT_MENU, EVT_BUTTON and EVT_INIT_DIALOG to declare the particular messages that will be implemented in the program. If these macros seem unfamiliar, you may want to take a minute and look at your MFC implementation and header files. You will see these macros that I've discussed here. After analyzing these files and becoming comfortable with what they are doing, you should now know that when you port your application to wxWidgets you will use these macros in almost the same fashion (with name changes, etc.)

The following are examples extracted from an MFC project and from a wxWidgets project. Hopefully the similarities are apparent:

MFC -- file.cpp


wxWidgets -- file.cpp

BEGIN_EVENT_TABLE( wxHelloWorldFrame, wxFrame ) EVT_MENU( Menu_File_Quit, wxHelloWorldFrame::OnQuit ) EVT_MENU( Menu_File_About, wxHelloWorldFrame::OnAbout ) END_EVENT_TABLE()

MFC -- file.h

class CLoginDlg : public CDialog { public: // member variables here protected: // Generated message map functions //{{AFX_MSG(CLoginDlg) virtual void OnOK(); virtual BOOL OnInitDialog(); afx_msg void OnUseSslCheck(); afx_msg void OnLoginSaveSettingsChk(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }

wxWidgets -- file.h

class wxHelloWorldFrame : public wxFrame { public: wxHelloWorldFrame( const wxString& title, const wxPoint& pos, const wxSize& pos ); void OnQuit( wxCommandEvent& event ); void OnAbout( wxCommandEvent& event ); private: DECLARE_EVENT_TABLE() }

MFC and wxWidgets also are very similar when you look at a comparison of the core classes. For example, if we look at the Dialog classes in both frameworks we see the following:

The names of these classes alone show their relative similarity. The CCmdTarget and wxEvtHandler classes are both used to handle messages from their respective windowing systems.

Similarities also exist in the various controls for each framework. If we look at the button controls, for example, we see the following:

The wxControl class has only three methods - wxCommand, wxGetLabel, wxSetLabel. MFC includes the equivalent of these methods in the CWnd class (SendDlgItemMsg, GetDlgItemText, SetDlgItemText).

Finally, the two frameworks also share similarities in many of their helper classes such as CString/wxString, and CList/wxList.

Hopefully, with this brief introduction it is apparent that the wxWidget toolkit is a good option for an MFC developer who would like to port their application to run on Linux. In a future article, I will take an MFC application and will port it to Linux, showing some of the tools that a developer may choose to use, and giving some ideas about how a port could possibly be accomplished.


Qt is an object-oriented toolkit that uses native libraries on each of the platforms that it supports. However, where wxWidgets is built on GTK+ in the Linux world, Qt is written to interface directly with X11. Qt is developed privately by Trolltech and so, obviously, does not enjoy the benefit of being developed by the open source community. However, it is still a very powerful and popular toolkit. KDE, one of the desktop options on SUSE distributions, is implemented on the free edition of Qt. This raises the issue that always seems to come up when talking about Qt. It is free when used in non-commercial applications, however, it is not free when developing a commercial, proprietary or non-free software. Likewise it is not free if developing for Windows or embedded systems. At any rate, before using Qt to develop your application, it would be important to understand its licensing model before you begin.

Qt does not look as much like MFC as does wxWidgets, which some would see as its strength. One of the primary differences lies in its event mechanism. Where MFC uses message maps, as was discussed earlier, Qt uses the notion of ?signals? and ?slots?. The visual elements in Qt are called widgets and are derived from the QWidget class. These widgets emit signals when an event occurs. For example, a button will emit a ?clicked? signal after it has been clicked by a user. If a developer wants to perform an action when the signal event occurs, they ?connect? to the signal by creating a function called a ?slot?. Since these are not static mappings the developer can connect and disconnect to various symbols at anytime in their application. Signals and slots are type-safe and so will report type errors rather than crashing the system as MFC might with its message maps. In the following example, the developer has connected the clicked signal from the login button to a slot (method) in his application called LoginUser().

connect( loginButton, SIGNAL(clicked()), qApp, SLOT( LoginUser()) );

Even though MFC and Qt have significant differences, the Trolltech people have made efforts to ease the pain of porting an application from MFC to Qt. They have created a library called the ?Windows Migration Framework?. When using this framework within an MFC application, it is possible to use Qt Widgets and events within the MFC message map model. The premise is that if you already have an MFC application you can leave the existing controls as they are initially. When you add new controls you would use Qt widgets rather than MFC controls. The developer would then begin, one at a time, removing any of the MFC controls in their application and replacing them with Qt widgets. While both types of controls exist in the application, the Windows Migration Framework would still be used to provide cross compatibility, but as soon as all the MFC controls and events are removed, then the framework can be removed and the developer will have a cross platform application. The link at: contains a good reference to see how this can be accomplished.


GTK is a nested acronym for ?GIMP Toolkit?. GIMP stands for ?GNU Image Manipulation Program?, and of course GNU stands for the recursive acronym ?GNU's Not Unix?. GTK+ is free software and is part of the GNU project. The GNU LGPL license that it uses allows it to be used by all developers, even those developing proprietary software, without any license fees or royalties.

Like the other toolkits discussed thus far, GTK+ has the notion of widgets. However, since GTK+ is a 'C' API rather than C++, things are obviously dealt with differently. Porting to GTK+ from MFC would involve much more of a rewrite than it would with the other toolkits. Rather than instantiating classes as you would in C++, this toolkit provides methods that are used to allocated space to structures like ?GTKWidget?. For example the general steps to use a GTKWidget are:

  1. Allocate space for a new widget with one of the gtk_*_new calls
    1. gtk_window_new( GTK_WINDOW_TOPLEVEL);
    2. gtk_button_new();
  2. Connect the appropriate signals to call handling functions
    1. g_signal_connect( G_OBJECT(window), ?destroy?,
                G_CALLBACK(gtk_main_quit), NULL );
    2. g_signal_connect( G_OBJECT(window), ?delete_event?,
                G_CALLBACK(gtk_main_quit), NULL );
    3. g_signal_connect( G_OBJECT(button), ?clicked?,
                (gpointer)?a data string? );
  3. Set the attributes of the widget
    1. gtk_container_set_border_width( GTK_CONTAINER(window), 10 );
    2. gtk_button_set_label( G_OBJECT(button), ?A Kool Button? );
  4. Pack the widget into a container
    1. gtk_container_add( GTK_CONTAINER(window), button );
  5. Show the widget
    1. gtk_widget_show( window) ;

For those developers who want to use GTK+, but really prefer C++, there is an open source project that has created ?gtkmm?. This is a C++ wrapper that sits on top of GTK+ and offers developers a reasonable alternative if they desire to do object oriented development.


What has been delivered in this article is a brief overview of a few of the toolkits a developer may want to look at if they see the need to port their MFC application to a Linux platform. It has not been exhaustive, in fact there are other toolkits that I have not covered, like FOX and FLTK, that could be worth looking into as well. In future articles, I plan to take each of the toolkits covered here and describe them in a bit more depth by actually porting an MFC application to these toolkits. A key aspect that will be covered in these articles, will be to look at a few of the visual designers that are available, like GLADE, Anjuta, BOA Constructor, etc. With these introductions a developer should be reasonably well equipped to begin a porting project.


Borland OWL -
MFC --
wxWidgets --
Qt --
Gtk+ -
gtkmm --
FOX --

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.


Leave a Reply

Your email address will not be published. Required fields are marked *