Re: [glade--] Could raw C++ pointers be eliminated?

Christof Petig <[email protected]> Wed, 20 Oct 2004 11:38:49 +0200
Newsgroups gmane.comp.gnome.glademm
Organization Adolf Petig GmbH & Co. KG
Message-ID <[email protected]>
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

_______________________________________________
glademm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/glademm-list
signature.asc (application/pgp-signature, 251 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQFBdjItng+R+0ucfO0RAg4+AKDRhy05j5FEpUM5iNf23yIOvqwhkQCfa15z
siVm/IwI9HJJ+W9glwPEryg=
=kmdO
-----END PGP SIGNATURE-----