blib/lib/Gtk2/Ex/FormFactory/CheckButton.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 57 CC 1 SCAR 6.9
CC
1
Cov
0%
get_type
2.0
get_detach_label
2.0
set_detach_label
2.0
CRAP 2.0
1 package Gtk2::Ex::FormFactory::CheckButton;
2  
3 use strict;
4  
5 use base qw( Gtk2::Ex::FormFactory::Widget );
6  
7 sub get_type { "check_button" }
8  
9 sub get_detach_label { shift->{detach_label} }
10 sub set_detach_label { shift->{detach_label} = $_[1] }
11  
12 sub has_label { ! shift->get_detach_label }
13  
14 sub new {
15 my $class = shift;
16 my %par = @_;
17 my ($detach_label) = $par{'detach_label'};
18  
19 my $self = $class->SUPER::new(@_);
20
21 $self->set_detach_label($detach_label);
22
23 return $self;
24 }
25  
26 sub object_to_widget {
27 my $self = shift;
28
29 $self->get_gtk_widget->set_active($self->get_object_value);
30  
31 1;
32 }
33  
34 sub widget_to_object {
35 my $self = shift;
36  
37 $self->set_object_value ($self->get_gtk_widget->get_active);
38  
39 1;
40 }
41  
42 sub empty_widget {
43 my $self = shift;
44
45 $self->get_gtk_widget->set_active(0);
46
47 1;
48 }
49  
50 sub backup_widget_value {
51 my $self = shift;
52
53 $self->set_backup_widget_value ($self->get_gtk_widget->get_active);
54
55 1;
56 }
57  
58 sub restore_widget_value {
59 my $self = shift;
60
61 $self->get_gtk_widget->set_active($self->get_backup_widget_value);
62
63 1;
64 }
65  
66 sub get_widget_check_value {
67 $_[0]->get_gtk_widget->get_active;
68 }
69  
70 sub connect_changed_signal {
71 my $self = shift;
72
73 $self->get_gtk_widget->signal_connect (
74 toggled => sub { $self->widget_value_changed },
75 );
76
77 1;
78 }
79  
80 1;
81  
82 __END__