Re: size_request/size_allocate question
- From: Jaap Karssenberg <j g karssenberg student utwente nl>
- To: muppet <scott asofyet org>
- Cc: gtk-perl-list gnome org
- Subject: Re: size_request/size_allocate question
- Date: Fri, 14 Oct 2005 15:17:13 +0200
muppet wrote:
.. 8< ..
The way to do this, then, is to override the "class closure" for the
signal.
See also: http://gtk2-perl.sourceforge.net/doc/
subclassing_widgets_in_perl.html (which explains the above situation)
and http://gtk2-perl.sourceforge.net/doc/examples/ histogramplot.pl.html
(which has a size-request override).
Thanks for the hint
Also, as you'd written it, the constructor was completely broken.
SUPER::new would find Gtk2::HBox::new(), which unconditionally calls
gtk_hbox_new(), giving you an actual GtkHBox blessed as a Gtk2::HBox.
Your own methods would not be found, and your new subclass would not be
created (the GType is wrong). The correct way to instantiate GObject
subclasses is to use Glib::Object::new(); Glib::Object::Subclass will
alias this for you, so you don't need to provide a constructor.
Well, I actually tested this and the constructor works :)
Without the constructor I get Glib::Object::new() which doesn't use the
same arguments as HBox::new(). I guess the SUPER call in my constructor
ends up in Glib::Object because I get a properly blessed object from my
constructor. I also use INIT_INSTANCE for some bootstrap thingies.
..8<..
-- Jaap
--
) ( Jaap Karssenberg || Pardus [Larus] | |0| |
: : http://pardus-larus.student.utwente.nl/~pardus | | |0|
) \ / ( |0|0|0|
",.*'*.," Proud owner of "Perl6 Essentials" 1st edition :) wannabe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]