App-Chart
view release on metacpan or search on metacpan
lib/App/Chart/Gtk2/Graph.pm view on Meta::CPAN
# size_allocate => \&_do_size_allocate,
scroll_event => \&_do_scroll_event,
# GtkToolbar in gtk 2.14.7 has a bug in its finalize
# provoking a ref_count>0 log error if anyone is hooked onto
# 'parent-set', even if in an unrelated class, so use notify
# instead
#
# parent_set => \&_do_parent_set,
#
# notify => \&_do_notify,
set_scroll_adjustments =>
{ param_types => ['Gtk2::Adjustment',
'Gtk2::Adjustment'],
return_type => undef,
class_closure => \&_do_set_scroll_adjustments },
start_drag => { param_types => ['Glib::Int'],
return_type => undef,
class_closure => \&_do_start_drag,
flags => ['run-first','action'] },
start_lasso => { param_types => ['Glib::Int'],
return_type => undef,
class_closure => \&_do_start_lasso,
flags => ['run-first','action'] },
start_annotation_drag =>
{ param_types => ['Glib::Int'],
return_type => undef,
class_closure => \&_do_start_annotation_drag,
flags => ['run-first','action'] },
},
properties => [Glib::ParamSpec->object
('hadjustment',
Locale::Messages::dgettext('gtk20-properties',
'Horizontal adjustment'), # per Gtk2::ScrolledWindow
'Blurb',
'Gtk2::Adjustment',
Glib::G_PARAM_READWRITE),
Glib::ParamSpec->object
('vadjustment',
Locale::Messages::dgettext('gtk20-properties',
'Vertical adjustment'), # per Gtk2::ScrolledWindow
'Blurb',
'Gtk2::Adjustment',
Glib::G_PARAM_READWRITE),
Glib::ParamSpec->scalar
('series-list',
'Series list',
'Arrayref of perl App::Chart::Series objects.',
Glib::G_PARAM_READWRITE),
];
App::Chart::Gtk2::GUI::chart_style_class (__PACKAGE__);
# priority level "gtk" treating this as widget level default, for overriding
# by application or user RC
Gtk2::Rc->parse_string (<<'HERE');
binding "App__Chart__Gtk2__Graph_keys" {
bind "<Shift>Pointer_Button1" { "start_lasso" (1) }
bind "Pointer_Button1" { "start_drag" (1) }
bind "Pointer_Button2" { "start_annotation_drag" (2) }
}
class "App__Chart__Gtk2__Graph" binding:gtk "App__Chart__Gtk2__Graph_keys"
HERE
#------------------------------------------------------------------------------
sub INIT_INSTANCE {
my ($self) = @_;
$self->{'series_list'} = [];
$self->set_double_buffered (0);
$self->set_app_paintable (1);
$self->add_events (['button-press-mask',
'button-motion-mask',
'button-release-mask']);
$self->{'waiting_initial_allocate'} = 1;
}
sub SET_PROPERTY {
my ($self, $pspec, $newval) = @_;
my $pname = $pspec->get_name;
### Graph SET_PROPERTY(): $pname
my $oldval = $self->{$pname};
$self->{$pname} = $newval; # per default GET_PROPERTY
if ($pname eq 'hadjustment') {
my $hadj = $newval;
my $ref_weak_self = App::Chart::Glib::Ex::MoreUtils::ref_weak($self);
$self->{'hadjustment_ids'} = $hadj && Glib::Ex::SignalIds->new
($hadj,
$hadj->signal_connect(value_changed => \&_do_hadj_value_changed,
$ref_weak_self),
$hadj->signal_connect(changed => \&_do_hadj_other_changed,
$ref_weak_self));
} elsif ($pname eq 'vadjustment') {
my $vadj = $newval;
my $ref_weak_self = App::Chart::Glib::Ex::MoreUtils::ref_weak($self);
$self->{'vadjustment_ids'} = $vadj && Glib::Ex::SignalIds->new
($vadj,
$vadj->signal_connect (value_changed => \&_do_vadj_changed,
$ref_weak_self),
$vadj->signal_connect (changed => \&_do_vadj_changed,
$ref_weak_self));
} elsif ($pname eq 'series_list') {
# initial page size and position when going from empty to non-empty
### Graph set series_list, count: scalar(@$newval)
if (@$newval && ! @$oldval) {
$self->initial_scale;
}
$self->queue_draw;
}
}
# sub _do_parent_set {
# my ($self, $parent) = @_;
# if (! $parent) {
# $self->{'waiting_initial_allocate'} = 1;
# }
( run in 0.412 second using v1.01-cache-2.11-cpan-2398b32b56e )