glademm/gtkmm: default constructor handling get_widget()?
barooo_at_gmail.com
Date: 05/13/05
- Next message: Wolfgang Meier: "GPL code modification"
- Previous message: Carsten Fuchs: "Re: Crashes with shared libs - where can I learn more about shared libs and ld?"
- Next in thread: Roger Leigh: "Re: glademm/gtkmm: default constructor handling get_widget()?"
- Reply: Roger Leigh: "Re: glademm/gtkmm: default constructor handling get_widget()?"
- Reply: murrayc_at_murrayc.com: "Re: glademm/gtkmm: default constructor handling get_widget()?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 13 May 2005 08:15:05 -0700
I'd like to be able to subclass a widget in gtkmm and have my widget's
default constructor do the libglademm work, so that a user of my widget
can just do something like:
window1 w;
//do stuff with w
instead of
window1* w;
glademm_xml->get_widget("window1", w);
//do stuff with w.
The best I've come up with is to call the Gtk::Window constructor with
a pointer to the GtkWindow* created by libglademm, something like this
(without handling dynamic_cast failure):
class window1 : public Gtk::Window
{
public:
window1::window1() :
Gtk::Window(dynamic_cast<Gtk::Window*>(Gnome::Glade::Xml::create("window1.glade")
->get_widget("window1"))->gobj()) {};
window1::window1(BaseObjectType* cobject,
const Glib::RefPtr<Gnome::Glade::Xml>& xml)
};
This gives a runtime warning of:
(glade_test:23016): glibmm-WARNING **: This object, of type
gtkmm__GtkWindow, already has a wrapper.
You should use wrap() instead of a constructor.
Is there a way to do what I'm wanting and still have window1 be a
Gtk::Window? Is that warning an indication of a potential memory leak/
crash/ other problem?
- Next message: Wolfgang Meier: "GPL code modification"
- Previous message: Carsten Fuchs: "Re: Crashes with shared libs - where can I learn more about shared libs and ld?"
- Next in thread: Roger Leigh: "Re: glademm/gtkmm: default constructor handling get_widget()?"
- Reply: Roger Leigh: "Re: glademm/gtkmm: default constructor handling get_widget()?"
- Reply: murrayc_at_murrayc.com: "Re: glademm/gtkmm: default constructor handling get_widget()?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|