File Coverage

lib/Devel/ebug/Wx/View/Multi.pm
Criterion Covered Total %
statement 6 32 18.7
branch 0 8 0.0
condition n/a
subroutine 2 7 28.5
pod 0 5 0.0
total 8 52 15.3


line stmt bran cond sub pod time code
1             package Devel::ebug::Wx::View::Multi;
2              
3 1     1   799 use strict;
  1         1  
  1         33  
4 1     1   5 use base qw(Devel::ebug::Wx::View::Base);
  1         2  
  1         366  
5              
6             __PACKAGE__->mk_accessors( qw(_tag _index) );
7              
8 0     0 0   sub is_multiview { 1 }
9              
10             sub description {
11 0     0 0   my( $self ) = @_;
12 0           my $description_base = $self->description_base;
13              
14 0 0         return $description_base unless ref $self;
15 0           $self->tag; # hack to set _index...
16 0           return sprintf "%s %d", $description_base, $self->_index;
17             }
18              
19             sub tag {
20 0     0 0   my( $self ) = @_;
21 0           my $tag_base = $self->tag_base;
22              
23 0 0         return $tag_base unless ref $self;
24 0 0         return $self->_tag if $self->_tag;
25             # generate an unused tag
26 0           my $vm = $self->wxebug->view_manager_service;
27 0           for( my $index = 1; $index < 1000; ++$index ) {
28 0           my $tag = $tag_base . $index;
29 0 0         next if $vm->has_view( $tag );
30 0           $self->_index( $index );
31 0           return $self->_tag( $tag );
32             }
33             }
34              
35             sub set_layout_state {
36 0     0 0   my( $self, $state ) = @_;
37 0           $self->SUPER::set_layout_state( $state );
38 0           $self->_tag( $state->{multi}{tag} );
39 0           $self->_index( $state->{multi}{index} );
40             # must do it _AFTER_ setting the tag
41 0           $self->register_view;
42             }
43              
44             sub get_layout_state {
45 0     0 0   my( $self ) = @_;
46 0           my $state = $self->SUPER::get_layout_state;
47 0           $state->{multi}{tag} = $self->tag;
48 0           $state->{multi}{index} = $self->_index;
49              
50 0           return $state;
51             }
52              
53             1;
54