May 28, 2009

learning gtkmm

GTK+ is a graphics user interface (GUI) toolkit for C; since I prefer to work with C++ over C, I use its related C++ binding, known as GTK-- or gtkmm. From what I have learned so far, it's actually a very elegant solution to a dilemma that I faced this week: how to build a cross-platform program with a window interface.

The keyword here is "cross-platform". MFC is not an option here, because it's targeted to Windows. In addition, my impression with MFC has been rather... disappointing. It's hard to learn and very cryptic for a new C++ programmer like myself. My past experience with frameworks like .NET has shown me far more elegant ways of graphical programming.

There are just so many ways in which GTK+ is different from MFC... other than the elegance of its structure. For example, I can make windows that are very resizable without putting a lot of effort -- because GTK+ is based on a simple "bin/container" system (where you can drop "controls" or widgets into highly flexible boxes), rather than the absolute-positioning system (specifying precise X, Y, width and height of each control) that MFC uses.

Of course, there are many other options out there besides GTK+, e.g. Qt, but right now I want to focus on one of my options (chosen rather arbitrarily) and work on it. If GTK+ satisfies my needs, then I will most likely stick with it for a while; otherwise, I can just choose another framework to work on (preferably sooner to make code modification easier).

There are so many things that intrigue me about C++ that I can't write down all at once -- it's like discovering a whole new world. I'll try and keep things updated when possible.

0 comments:

Post a Comment