On Jun 13, 2010, at 3:00 PM, Krzysztof KosiĆski wrote:
When using Gtk::manage for all widgets in a dialog, the widgets that need to be accessed after creation can be added to the .h file as pointers to partially specified types; this provides consistency without requiring header bloat, e.g.
class SomeWidget; class SomeDialog { ... private: SomeWidget *_widget_that_needs_to_be_accessed_after_creation; };
However, I see no point in specifying *all* widgets as members of the dialog. The advantages are unclear and at the same time it makes dialog coding very tedious.
Yes, there generally is not a need to specify all widgets as members. I did state that in my mail.
However, there are some additional risks associated with using a pointer as opposed to just a stock gtkmm member. Among those are a risk for dangling pointers and destruction sequence errors. Gtkmm handles that more robustly with non-pointer.
A bigger gain than just using raw pointers is to follow one of the standard encapsulating patterns and not expose *any* members in the public .h file. For simplicity, non-pointer members give better management and safety. Generally one of those two overall considerations should be the driving ones.