Letalis Sonus
Advanced Member
- Joined
- Mar 5, 2009
- Messages
- 1,532
Exactly. If you just need the standard stuff provided by GTK+ you don't need to touch all that GObject stuff and everything looks like ordinary C stuff, so you can use it directly in C++ and you don't need to do any classes, which is enough for most of the stuff one wants to do. And I have to say, it is really easy to work with it.
But if you want to code a custom element (e.g. an analog dial widget with a pointer that the user can drag to set the value as used for the "Creating a widget from scratch" tutorial), you need to put it into a GObject class, which is really not easy (the base structure of a GObject class already contains over 100 lines of C code!), and as the C++ Wrapper Gtkmm surely allows to use C++ classes for this, it will be much easier to do it with a C++ class.
As an alternative, the Gnome guys created Vala, which is a C#/Java like language that generates GObject C code and C++-compatible headers for you which makes it easy to create a GObject class. It is still quite immature and produces lots of redundant code and stuff like that, but it is really nice for learning about the whole GObject system (the generated C code looks very cryptic, though).
But if you want to code a custom element (e.g. an analog dial widget with a pointer that the user can drag to set the value as used for the "Creating a widget from scratch" tutorial), you need to put it into a GObject class, which is really not easy (the base structure of a GObject class already contains over 100 lines of C code!), and as the C++ Wrapper Gtkmm surely allows to use C++ classes for this, it will be much easier to do it with a C++ class.
As an alternative, the Gnome guys created Vala, which is a C#/Java like language that generates GObject C code and C++-compatible headers for you which makes it easy to create a GObject class. It is still quite immature and produces lots of redundant code and stuff like that, but it is really nice for learning about the whole GObject system (the generated C code looks very cryptic, though).
Last edited by a moderator: