Gtk-perl: custom cell renderer?
- From: "Xi Yang" <jiandingzhe 163 com>
- To: gtk-app-devel-list gnome org
- Subject: Gtk-perl: custom cell renderer?
- Date: Fri, 6 Jul 2012 09:56:36 +0800 (CST)
Hi everyone! I'm trying to create my customized cell renderer, but occurred some problems.
I'm making the app using Perl. The renderer subclass looks like this: some attribute definitions, and a
trival render function:
################################################
package Gdraw2Gtk::CellRenderer::PlainColor;
use common::sense;
use Gtk2;
use Glib::Object::Subclass(
'Gtk2::CellRenderer',
properties => [
Glib::ParamSpec->long(
'red', '', '', 0, 1, 0, [qw/readable writable/]
),
Glib::ParamSpec->long(
'green', '', '', 0, 1, 0, [qw/readable writable/]
),
Glib::ParamSpec->long(
'blue', '', '', 0, 1, 0, [qw/readable writable/]
),
Glib::ParamSpec->long(
'alpha', '', '', 0, 1, 0, [qw/readable writable/]
),
]
);
sub render {
say "on render: @_";
}
1;
################################################
It was binded to a column while building the GUI:
################################################
my $col_stroke = $builder->get_object('PageTree_StrokeColorCol');
my $r_stroke = Gdraw2Gtk::CellRenderer::PlainColor->new;
$col_stroke->pack_start( $r_stroke, TRUE );
$col_stroke->add_attribute( $r_stroke, 'red' => COL_STROKE_R );
$col_stroke->add_attribute( $r_stroke, 'green' => COL_STROKE_G );
$col_stroke->add_attribute( $r_stroke, 'blue' => COL_STROKE_B );
$col_stroke->add_attribute( $r_stroke, 'alpha' => COL_STROKE_A );
################################################
While running, I created, this error message is shown, and the program exits immediately:
GET_SIZE must return four values -- the x_offset, y_offset, width, and height at
/usr/local/share/perl5/Gdraw2Gtk/App.pm line 895.
I never explicitly called GET_SIZE. Line 895 was the call to Gtk2->main(). So what is the problem?
Thanks!!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]