Subclassing Gnome2::Canvas



Hello,

I am able to subclass the aliased canvas and instantiate it while passing a parameter, but I cannot do the same with the anti-aliased canvas :-( . I would have expected to be able to do this with both canvases. Is this a bug or, as usual, am I missing something? Here's a simple example:

package can;

use strict;
use Gtk2;
use Gnome2::Canvas;

use Glib::Object::Subclass
   Gnome2::Canvas::,
   properties => [
Glib::ParamSpec->scalar('melon', 'melon', 'pass in a melon', 'writable'),
          ]
   ;

sub INIT_INSTANCE
{
   my $self = shift(@_);

   print "INIT_INSTANCE\n";
}


package main;

use strict;
use Gtk2 '-init';
use Gnome2::Canvas;

my $window = Gtk2::Window->new();

my $scroller = Gtk2::ScrolledWindow->new();

my $canvas = can->new_aa(melon=>'x');
# my $canvas = can->new(melon=>'x');

$scroller->add($canvas);

$window->add($scroller);

my $root = $canvas->root();

my $ellipse = Gnome2::Canvas::Item->new($root,'Gnome2::Canvas::Ellipse',x1=>10,y1=>10,x2=>40,y2=>40,fill_color=>'red');

$window->signal_connect('destroy'=>sub { Gtk2->main_quit(); } );

$window->show_all();

Gtk2->main();


1;



Thanks for your help.

-James






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