Re: Gtk2 and inheritance
- From: muppet <scott asofyet org>
- To: gtk-perl-list gnome org
- Subject: Re: Gtk2 and inheritance
- Date: 07 Mar 2003 20:34:49 -0500
On Thu, 2003-03-06 at 16:36, JÃrn Reder wrote:
Guillaume Cottenceau wrote:
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.
Use `$object->set_data' and `$object->get_data'.
Ok - I hoped that the solution would be that easy ;) Thanks. It's better
than converting the slim scalar references into fat hash references ;)
So we agree, re-blessing gtk2 objects from perl code is useless :).
Sorry - but here I disagree ;) The re-blessing is still necessary,
otherwise the methods of my class are not visible. I can live with the
fact, that the class has to use the set_data() method to store its
attributes, but the re-blessing is still necessary (and thus the
SvREADONLY_on(obj) needs to be dropped - Goran, is that Ok with you?)
/me has very strong interest in this subject
i'm not intimately familiar (yet) with the way the gtk2-perl type system
bindings work, but my gut feeling tells me they should take care of this
for you through run-time type information and introspection.
after all, if the object has a registered GtkType, Gtk should be able to
*tell* you what class it is, no?
for example, suppose you have a function that returns a widget
reference. it just so happens that the widget it returns is actually an
now, will you need to bless that into your app-defined class in order to
call the class-specific methods, or will the gtk2-perl type bindings be
able to tell to what class it belongs and look them up automagickally?
so the basic question is, will things Just Work (tm) with custom classes
or will you get a "could not find a gtk class for this object, using
[last known member of inheritance tree] instead" warning as you do in
the old gtk-perl?
 as mentioned a few months ago, i have a growing library of custom,
special-purpose widgets and GObject subclasses, some implemented in C
and some that will be implemented in perl, and they all need to play
together at both the perl and C levels. (in fact, i've been help up for
four months from working on gtk2-perl because of working on this C
muppet <scott asofyet org>
] [Thread Prev