[gtkmm] Glib::RefPtr also for Widgets?



Hi,

since I'm again trying to clean up the way glademm handles it's toplevel widgets, I dare to ask a directional question:

Which is the recommended way to create and destroy toplevel widgets (widgets which are not children of another widget (these are handled well via manage))?

1- Gtk::Foo *w = new Foo();  .... destroy w;
2- { Gtk::Foo w = Foo();  ... }
3- { Glib::RefPtr<Foo> w = manage(new Foo()); ... }

each of them certainly has appeal of it's own. [If you embed toplevel widgets inside a class the question is similar.]

So my basic question: Does #3 work as expected for managed widgets? I only found examples for RefPtrs to Gdk objects? And which of 1 or 2 do you prefer for the main window? Or 3?

  Christof

PS: If 3 ... is there a RefPtr<> compatible solution for 1.2 ?




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