size_request/size_allocate question
- From: Jaap Karssenberg <j g karssenberg student utwente nl>
- To: GTK2-Perl List <gtk-perl-list gnome org>
- Subject: size_request/size_allocate question
- Date: Fri, 14 Oct 2005 11:52:21 +0200
Hello,
I try to subclass Gtk2::HBox and I want to handle size allocation
myself. I figured overloading size_request() and size_allocation() would
do the trick, but these methods don't get called when the widget is
shown :( I've included my code below, does anyone have a suggestion what
I do wrong ?
Thanks,
-- Jaap <pardus cpan org>
# Code listing:
package Gtk2::Ex::ButtonPathBar;
our $VERSION = '0.01';
use strict;
use Gtk2;
use Glib::Object::Subclass Gtk2::HBox:: ;
sub new {
my ($class, $homogeneous, $spacing) = @_;
$homogeneous = 0 unless defined $homogeneous;
$spacing = 5 unless defined $spacing;
$class->SUPER::new(homogeneous => $homogeneous, spacing => $spacing);
}
sub size_request {
my ($self) = @_;
print "Got size request\n";
$self->SUPER::size_request;
}
sub size_allocate {
my ($self, $allocation) = @_;
my ($w, $h) = ($allocation->width, $allocation->height);
print "got allocation for $w, $h\n";
$self->SUPER::size_allocate($allocation);
}
1;
# End Code listing
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]