RefPtr in constructor



Hi there,
I'd like to divide my application into classes but have problems while
passing the RefPtr to the constructor. The main routine looks like:

int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);
  Glib::RefPtr<Gnome::Glade::Xml> refXml;
  try
     refXml = Gnome::Glade::Xml::create("myapp.glade");
  catch (const Gnome::Glade::XmlError& ex) {
     cerr << ex.what() << endl;
     return 1;
  }

  MyApp app(refXml);

  kit.run(app.get_window); // get_window is the MyApp's public method
returning the &m_wWindow
  return 0;
}

and the MyApp class:

6: MyApp::MyApp(Glib::RefPtr<Gnome::Glade::Xml> refXml)
7: {
8:    refXml->get_widget("wndMain", &m_wWindow);
9: }

And now, while compiling I get this:

$ make
g++ -Wall -Wno-deprecated -c  `pkg-config gtkmm-2.4 libglademm-2.4
libxml++-2.6 glibmm-2.4 --cflags` -D_GNU_SOURCE myapp.cpp
myapp.cpp: In constructor 'MyApp::MyApp(Glib::RefPtr<Gnome::Glade::Xml>)':
myapp.cpp:8: error: no matching function for call to
'Gnome::Glade::Xml::get_widget(const char [8], Gtk::Window*)'
/usr/include/libglademm-2.4/libglademm/xml.h:185: note: candidates
are: Gtk::Widget* Gnome::Glade::Xml::get_widget(const Glib::ustring&)
/usr/include/libglademm-2.4/libglademm/xml.h:201: note:
T_Widget* Gnome::Glade::Xml::get_widget(const Glib::ustring&,
T_Widget*&) [with T_Widget = Gtk::Window]

Does it mean that I can't pass the RefPtr to the constructor? How else
can I do this?

Best regards,
teel



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