A derived Gtk::Builder must have its own constructor and create() method
or methods. See ExampleApplication in
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/menus/main_menu
for an example.
But I recommend another solution. You say that "there seems to be no way
to get the widget name in the derived widget." That's not true. What you
really mean, I guess, is that there is no way to get the widget name
into*the constructor* of the derived widget. When you derive a widget,
you can give it any methods you like, e.g. an init(const Glib::ustring&
name) method where most of the initialization is done.
DerivedWidget* pWidget = nullptr;
refBuilder->get_widget_derived(widget_name, pWidget);
if (pWidget)
pWidget->init(widget_name);
Kjell
Den 2015-07-31 05:19, Markus Kolb skrev:
Hi,
how can I derive from Gtk::Builder?
I've problems to cast the Glib::RefPtr<Gtk::Builder> to the
G::R<Derived>:
/usr/include/glibmm-2.4/glibmm/refptr.h:237:3: error: cannot
initialize a member
subobject of type 'Derived *' with an rvalue of type
'Gtk::Builder *'
pCppObject_ (src.operator->())
I need to overwrite
get_widget_derived(const Glib::ustring& name, T_Widget*& widget)
because there seems to be no way to get the widget name in the derived
widget.
There is a method get_name(), but there I only get something like
Gtk__Button
and not the unique id set in the glade file and requested with the
name argument.
So I'd like to store the name argument when calling get_widget_derived
from
AppBuilder in an instance variable.
The derived widget could then use the derived Builder to have access
to the
name.
Thanks.
_
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list