Re: Cannot `dynamic_cast` custom wrapped widget from Gtk::Builder



On 2020-05-03 20:12, Josh Bialkowski wrote:
Ok, I think I figured it out the m4 include path issue for gmmproc, but I still can't load the widget from GtkBuilder even when using `_CLASS_GTKOBJECT`. I think that with two `-I` in the command line, one must be overriding the other. The following command line seems to work, and generates a reasonable .h file. 

~~~
M4PATH=/usr/lib/x86_64-linux-gnu/glibmm-2.4/proc/m4:/usr/lib/x86_64-linux-gnu/atkmm-1.6/proc/m4:/usr/lib/x86_64-linux-gnu/pangomm-1.4/proc/m4 /usr/lib/x86_64-linux-gnu/glibmm-2.4/proc/gmmproc -I /usr/lib/x86_64-linux-gnu/gtkmm-3.0/proc/m4 panzoomarea mm mm
~~~

I should have realized that gmmproc must be able to find atkmm's and pangomm's m4 files. They are included from convert_gtkmm.m4. gmmproc usually works well if all its input is correct, but it's not always good at telling what's wrong when some input is wrong or missing.

So, now we're back at your first question: Why does the dynamic_cast to Gtk::PanZoomArea* fail?

You said in a previous post that you execute

Glib::wrap_register(gtk_panzoom_area_get_type(), &PanZoomArea_Class::wrap_new);

That's necessary. Still it looks like Glib::wrap_auto() and Glib::wrap_create_new_wrapper() wrap a GtkPanZoomArea in a Gtk::DrawingArea. I don't understand why.

Perhaps you can double-check that Glade and GtkBuilder really give you a GtkPanZoomArea, and not just a GtkDrawingArea. You've said that

GtkPanZoomArea* panzoom_ = GTK_PANZOOM_AREA(builder->get_object("overhead-view")->gobj());

works. I don't know if GTK_PANZOOM_AREA() checks the type, or if it just casts unconditionally.



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