Re: Gtk2 and inheritance

Jörn Reder wrote:

With Gtk this works. Gtk2 stores the objects internally as scalar refs 
(I suppose it's is the corresponding C pointer), while Gtk uses hash 
refs, which could be reblessed without problems

Ok - I crawled the source again and now I know a little more.

The "modification of a read-only value" thing is easy to fix. We just 
have to remove


from _Helpers.c, unless it's not just for safeness. I checked this with
"make test" - it runs without problems, so removing it should be Ok.

(also it was easy to 
attach user data to arbitrary widget objects - but that's not that 
important here... ;)

But here I was mistaken (probably I should get more sleep ;). In fact 
inheritance without the ability of attaching additional attributes to an
object, is useless.

So it would be great if the Gtk2 objects will become hash refs, with a 
_gtk key holding the C pointer (as in Gtk). There are a few macros which
convert a Perl object back to the C object (in 
gtk2-perl-helpers-gtk-autogen.h), and a few methods in _Helper.c which 
create Perl objects from C objects - so probably changing this is 
feasible with less effort (at least for someone who knows all the 
Perl/Gtk2 details better than me... ;)



Joern Reder
Development Head ZYN! Coding Division -

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