Murray Cumming schrieb:
Christof Petig schrieb:At the time I implemented Toolbars, Dialogs and Menus I simply gave up to bother about member variable order. [variable order is spread between two to three different functions, the ctor code emitter is much more linear and local to write].The other reason is that ctor local variables (and widgets) are not possible with member variables once any member widget needs a reference to it (e.g. spinbuttons and alignments)Why not? Can you give an example?
Currently I do
class X
{
protected:
Gtk::SpinButton b;
public:
X();
};
X::X()
{ Gtk::Adjustment adj=manage(new Gtk::Adjustment(...));
b=manage(new Gtk::SpinButton(adj));
}
If you use member variables, you cannot hide internal widgets from the
class definition and put them locally into the ctor. [The pimpl idiom
might help here]
Concerning smart pointers: The gtkmm infrastructure needs to work well first.Specifically?
Last I heard was that using Glib::RefPtrs on widgets was not advisable since ref counting was difficult to design correctly with widgets (due to the underlying gtk+ library ignoring pending references on destruction IIRC). [That was the state back during the meeting in Berlin, has this changed?]
Christof
Attachment:
signature.asc
Description: OpenPGP digital signature