Gtk2-Ex-Graph-GD
view release on metacpan or search on metacpan
lib/Gtk2/Ex/Graph/GD.pm view on Meta::CPAN
$y -= ($imageallocatedsize[3] - $self->{imagesize}->[1])/2;
my $hotspot;
if ($self->{graphtype} eq 'bars') {
$hotspot = $self->_check_bars_hotspot($x,$y);
} elsif ($self->{graphtype} eq 'lines' or $self->{graphtype} eq 'linespoints') {
$hotspot = $self->_check_lines_hotspot($x,$y);
}
&{ $self->{signals}->{'clicked'} } ($hotspot)
if $self->{signals}->{'clicked'} && $hotspot;
return FALSE unless $event->button == 3;
$self->{optionsmenu}->popup(
undef, # parent menu shell
undef, # parent menu item
undef, # menu pos func
undef, # data
$event->button,
$event->time
);
}
);
return $eventbox;
lib/Gtk2/Ex/Graph/GD.pm view on Meta::CPAN
sub _refresh {
my ($self) = @_;
$self->{graph}->set(%{$self->{graphhash}}) if $self->{graphhash};
$self->set_legend(@{$self->{graphlegend}}) if $#{@{$self->{graphlegend}}} >= 0;
$self->get_image($self->{graphdata});
}
sub _init_tooltip {
my ($self) = @_;
my $tooltip_label = Gtk2::Label->new;
my $tooltip = Gtk2::Window->new('popup');
$tooltip->set_decorated(0);
$tooltip->set_position('mouse'); # We'll choose this to start with.
$tooltip->modify_bg ('normal', Gtk2::Gdk::Color->parse('yellow')); # The obligatory yellow
$tooltip->add($tooltip_label);
$self->{tooltip}->{window} = $tooltip;
$self->{tooltip}->{displayed} = FALSE;
$self->{tooltip}->{label} = $tooltip_label;
}
sub set_legend {
lib/Gtk2/Ex/Graph/GD.pm view on Meta::CPAN
foreach my $child (@children) {
$eventbox->remove($child);
}
$eventbox->add ($image);
$eventbox->signal_connect ('button-press-event' =>
sub {
my ($widget, $event) = @_;
return TRUE;
return FALSE unless $event->button == 3;
$self->{optionsmenu}->popup(
undef, # parent menu shell
undef, # parent menu item
undef, # menu pos func
undef, # data
$event->button,
$event->time
);
}
);
$eventbox->show_all;
( run in 1.284 second using v1.01-cache-2.11-cpan-364913b4093 )