Re: RFC for Gtk2::Ex::ListSwap



On Mon, 2005-03-28 at 12:59 -0500, Jeff 'japhy' Pinyan wrote:

I've just finished the first version of an extension to Gtk-Perl called 
Gtk2::Ex::ListSwap.  I've submitted the code to PerlMonks and I'm asking 
anyone on this list who's interested to try it out and see if it works, 
and suggest features.

Some suggestions to make it behave more like a normal gtk+ widget:

* Use Glib::Type->register_enum and Glib::Type->register_flags for your
constants.

* Split the model into three: Have the base class Gtk2::Ex::ListSwap be
pretty much the same as it now, but add Gtk2::Ex::HListSwap and
Gtk2::Ex::VListSwap that inherit from the base class.  Use
Glib::Object::Subclass in these child classes to make them inherit from
Gtk2::HBox or Gtk2::VBox respectively ... Hrm, I just realized that this
is going to be hard since you defer the actual creation of the widget
until widget() is called -- something that you can't do when you do what
I just suggested.  If you wanted this to work like a normal widget,
you'd really have to implement the size_request and size_allocate
signals yourself.  And at that point the little additional "->widget"
that differentiates your widget from a normal one isn't really worth all
the effort.

If you still want to get this working like a normal widget, let me know.
I have quite a bit of code like this lying around (a Perl port of GtkBox
and GtkHBox, for example).  The Gtk2 module still needs some patching to
make this kind of stuff work, most of which is pretty much ready to go
in, but there are still some problems with inheritance that need to be
taken care of.  Until now no one really wanted to implemented a full
custom container in Perl (or at least they didn't tell us), so there
wasn't enough pressure to actually get this fixed.

-- 
Bye,
-Torsten




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