raphael.schmid | 3 Jun 12:49 2003

gui.html, second take

Hello again,

one shouldn't proof-read texts in pure HTML. This time I  used an
actual browser. The changes are also much more extensive than 
simple typo corrections. If you don't like them, that's too bad.
I just thought a little "formalising" couldn't hurt.

Find the file attached.

- R.

Fast Cross-platform GUI

by Johannes Roith (johannes <at> jroith.de)

I. Your options

When it comes to graphical user interfaces, the .NET Framework shows its side that makes code unportable. Microsoft does offer one toolkit, called System.Windows.Forms. It is based on the Windows API, which makes it look native. mono:: is implementing System.Windows.Forms for compatiblity reasons, but the implementation is based on Wine, an Open Source implementation of the Windows API on top of X and Unix, and has several disadvantages. First, such an application can be executed with mono::, but needs a special command which embeds Wine. It integrates badly with the rest of the system on operating systems other than Windows, and certainly will not be ported to all platforms.

Secondly, and that's even more of a reason, System.Windows.Forms is not very powerful. While Windows programmers might be used to that, it fixes widgets with coordinates on the form, unlike both Linux desktop's GUI toolkits. Gtk#/Qt# are using an intelligent boxing system, where the user can resize the form and all widgets with it. Internationalization is much easier that way, because if the text doesn't fit, the box is grown automatically.

Java uses "Swing". Swing looks consistent across all platforms (ugly, but your mileage may vary). And it is very slow. In fact that's one of the reasons why people think Java is slow in general. But we have better options. In the UNIX-world there are two "big" GUI toolkits nowadays. One is primarily used by the KDE desktop, the other one by GNOME. Both are ported to Windows and MacOS X, as well as Linux's framebuffer device. GTK+, the GNOME toolkit is even ported to BeOS. Gtk# (the C# binding to GTK+) is very fast, although currently Qt# is even faster. In any case, both are much faster than Swing.

So, what GUI to take? My personal favorite is Gtk#. Why? The Windows and MacOS X versions of Qt are not free, currently. Also, the developers are working on porting the X11 code to Windows, but by the time of this writing that's not done. Besides, I'm a GNOME fan and more used to the GTK+ toolkit.

II. Learning about things

The Mono Handbook has a big section about GNOME.NET. Still, not all of GNOME is multiplatform. But we have clearly marked what is.
Here the list:

  • Gtk# - Widgets & Co.
  • Gdk# - Drawing (display abstraction layer)
  • Pango# - 1st class internationalisation support
  • Atk# - accessiblity support for people with disablities
  • Glade# - Forms, based on XML, that can be changed dynamically
  • Glade Interface Builder - Tools to easily create Glade XML files.
The next step would be to learn about these in chapter 21.