Transparently instantiating derived widgets with Gtk::Builder

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Transparently instantiating derived widgets with Gtk::Builder

Roger Leigh-5
Hi folks,

I'm currently in the process of updating a 15 year old tutorial¹ to the
current GTK+ 3.x release.  Part of that is updating the use of libglade
to use Gtk::Builder.  I have read the documentation about using derived
widgets² and the Gtk::Builder documentation³.  However, I'm not entirely
satisfied with the result.

I would like to be able to instantiate my derived widget directly with
the Gtk::Builder stuff managed internally in the constructor so that the
end user does not need to know about it.  Is this technically possible?
Can I use e.g. move-assignment with wrap() or get_widget_derived?  It
looks possible, but I'm unsure how safe it would be.  Has anyone done
this, or have any examples?

What I'm thinking of is something like:

   Gtk::Builder builder;
   MyWidget *tmp
   build.get_widget_derived(name, tmp);
   *this = std::move(*tmp);

but I'm not sure about the safety of it.

Thanks all,

gtkmm-list mailing list
[hidden email]