Re: Creating custom GTK+ widget using C++ -- Ctor/Dtor not called



On Fri, 10 Feb 2012 02:58:53 +0530
Agnel Kurian <agnel kurian gmail com> wrote:
> I am trying to create a custom GTK+ widget using GTK+ 2.4.8 called
> from C++. I find that the constructor and destructor of my widget is
> never called. So...
> 
> 1. Is this expected behaviour?
> 2. What is the usual solution to such a problem (apart from using
> gtkmm)? 3. Any other issues I need to watch out for when using C++
> with GTK+?

If you just want to manage the lifetime of a GtkWidget object using C++
constructors and destructors by containing the Gtk+ object within a C++
object, and add your own interface or specialisations to the GTK+
object, there are some very thin wrapper classes here which will do
this: http://cxx-gtk-utils.sourceforge.net/2.0/index.html.  See in
particular the WinBase class.

gtkmm automatically wraps all the C object's methods into C++ methods,
whereas WinBase assumes you don't want to do this or that you will do
it yourself.  It depends entirely on what you want from it, how UI
intensive your application is, and how rigorously "C++-ized" you want
GTK+ to become.

Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]