Pvoice/EditableRow.pm untested

filter: Statementstmt 0.0% 0 / 52 Branchbran n/a Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 77 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package AAC::Pvoice::EditableRow;
2 use strict;
3 use warnings;
4
5 use Wx qw(:everything);
6 use Wx::Perl::Carp;
7 use Wx::Event qw( EVT_BUTTON );
8 use AAC::Pvoice::Bitmap;
9 use base qw(Wx::Panel);
10
11 our $VERSION = sprintf("%d.%02d", q$Revision: 1.4 $=~/(\d+)\.(\d+)/);
12
13 #----------------------------------------------------------------------
14 sub new
15 {
16 my $class = shift;
17 my ($parent,$maxitems,$items,$wxPos,$wxSize, $itemmaxX, $itemmaxY, $itemspacing, $background, $style,$name) = @_;
18 $wxPos ||= wxDefaultPosition;
19 $wxSize ||= wxDefaultSize;
20 $style ||= 0;
21 $name ||= '';
22 my $self = $class->SUPER::new($parent, -1, $wxPos, $wxSize, $style, $name);
23
24 $self->{maxitems} = $maxitems;
25 $self->{itemspacing}=$itemspacing;
26
27 # Create a new panel
28 my $sizer = Wx::GridSizer->new(1,0);
29 $self->{items} = [];
30 $self->{actions} = [];
31
32 my ($maxX, $maxY) = ($itemmaxX, $itemmaxY);
33
34 # Add the defined keys for this row
35 for (@$items)
36 {
37 my ($id, $img, $sub) = @$_;
38 my $button = Wx::BitmapButton->new
39 ($self, # parent
40 $id, # id
41 $img, # image
42 wxDefaultPosition, # position
43 [$maxX+3, $maxY+3], # size
44 wxBU_AUTODRAW); # style
45 $button->SetBackgroundColour($background);
46 $sizer->Add($button, 0, wxALIGN_CENTRE|wxALL, $self->{itemspacing});
47 push @{$self->{items}}, $button;
48 EVT_BUTTON($self, $id, $sub);
49 }
50 my $totalitems = scalar(@$items);
51 $self->{totalitems} = scalar(@{$self->{items}});
52 $self->SetBackgroundColour($background);
53 $self->SetSizer($sizer);
54 # $self->SetAutoLayout(1);
55 $sizer->Fit($self);
56 return $self;
57 }
58
59 1;
60
61 __END__