blib/lib/Gtk2/Ex/MindMapView/HotSpot/Toggle/Round.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 61 CC 2 SCAR 9.8
CC
2
Cov
0%
new
6.0
hotspot_adjust_event_handler
2.0
hotspot_get_image
2.0
CRAP 2.7
1 package Gtk2::Ex::MindMapView::HotSpot::Toggle::Round;
2  
3 our $VERSION = '0.000001';
4  
5 use warnings;
6 use strict;
7 use Carp;
8  
9 use Gtk2::Ex::MindMapView::ArgUtils;
10  
11 use constant IMAGE_RADIUS=>3;
12  
13 use Glib ':constants';
14  
15 use Gnome2::Canvas;
16  
17 use base 'Gtk2::Ex::MindMapView::HotSpot::Toggle';
18  
19 sub new
20 {
21 my ($class, @attributes) = @_;
22  
23 my $self = $class->SUPER::new(@attributes);
24  
25 my %attributes = @attributes;
26  
27 args_valid(\%attributes, qw(item side enabled radius
28 fill_color_gdk outline_color_gdk hotspot_color_gdk));
29  
30 arg_default($self, 'radius', 10);
31  
32 arg_default($self, 'enabled', FALSE);
33  
34 arg_default($self, 'fill_color_gdk', Gtk2::Gdk::Color->parse('white'));
35  
36 arg_default($self, 'outline_color_gdk', Gtk2::Gdk::Color->parse('gray'));
37  
38 arg_default($self, 'hotspot_color_gdk', Gtk2::Gdk::Color->parse('orange'));
39  
40 $self->{image} = $self->hotspot_get_image();
41  
42 if (!$self->{enabled})
43 {
44 $self->{image}->hide();
45 }
46  
47 return $self;
48 }
49  
50  
51  
52 # $self->hotspot_adjust_event_handler($item);
53  
54 sub hotspot_adjust_event_handler
55 {
56 my ($self, $item) = @_;
57  
58 $self->SUPER::hotspot_adjust_event_handler($item);
59  
60 my ($x, $y) = $self->{item}->get_connection_point($self->{side});
61  
62 $self->{image}->set(x1=>$x - IMAGE_RADIUS, y1=>$y - IMAGE_RADIUS,
63 x2=>$x + IMAGE_RADIUS, y2=>$y + IMAGE_RADIUS);
64 }
65  
66  
67 # my $image = $self->hotspot_get_image();
68  
69 sub hotspot_get_image
70 {
71 my $self = shift(@_);
72  
73 return Gnome2::Canvas::Item->new($self->{item}, 'Gnome2::Canvas::Ellipse',
74 fill_color_gdk=>$self->{fill_color_gdk},
75 outline_color_gdk=>$self->{outline_color_gdk});
76 }
77  
78  
79  
80 1; # Magic true value required at end of module
81 __END__