TreeChecker/XmlHandler.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 66 CC 2 SCAR 11.0
CC
2
Cov
0%
DoCreateResource
6.0
new
2.0
CanHandle
2.0
CRAP 3.0
1 #############################################################################
2 ## Name: Wx::Perl::TreeChecker::XmlHandler
3 ## Purpose: XRC handler for Wx::Perl::TreeChecker
4 ## Author: Simon Flack
5 ## Modified by: $Author: simonflack $ on $Date: 2004/04/17 22:17:13 $
6 ## Created: 28/11/2002
7 ## RCS-ID: $Id: XmlHandler.pm,v 1.1 2004/04/17 22:17:13 simonflack Exp $
8 #############################################################################
9  
10 package Wx::Perl::TreeChecker::XmlHandler;
11  
12 use strict;
13 use vars qw/@ISA $VERSION/;
14 use Wx qw(:misc :treectrl);
15  
16 @ISA = 'Wx::PlXmlResourceHandler';
17 $VERSION = sprintf'%d.%02d', q$Revision: 1.1 $ =~ /: (\d+)\.(\d+)/;
18  
19  
20 sub new {
21 my $class = shift;
22 my $self = $class -> SUPER::new(@_);
23 no strict 'refs';
24 for (grep /^wxTR_/, @{$Wx::EXPORT_TAGS{'treectrl'}}) {
25 $self -> AddStyle ($_, &$_);
26 }
27 $self -> AddWindowStyles;
28 return $self;
29 }
30  
31 sub CanHandle {
32 my $self = shift;
33 my ($xmlnode) = @_;
34 return $self -> IsOfClass ($xmlnode, 'Wx::Perl::TreeChecker');
35 }
36  
37 sub DoCreateResource {
38 my $self = shift;
39  
40 my @args = (
41 $self -> GetID,
42 $self -> GetPosition() || wxDefaultPosition,
43 $self -> GetSize() || wxDefaultSize,
44 $self -> GetStyle ('style', 0) || wxTR_HAS_BUTTONS,
45 wxDefaultValidator,
46 $self -> GetName () || 'treeChecker'
47 );
48 my $ctrl;
49 my $parent = $self -> GetInstance() || $self -> GetParentAsWindow();
50 if ($self -> GetInstance()) {
51 $ctrl = Wx::Perl::TreeChecker -> Create ($parent, @args);
52 } else {
53 $ctrl = Wx::Perl::TreeChecker -> new ($parent, @args);
54 }
55  
56 $self -> SetupWindow ($ctrl);
57 $self -> CreateChildren ($ctrl);
58  
59 return $ctrl;
60 }
61  
62  
63 1;
64  
65 =pod
66  
67 =head1 NAME
68  
69 Wx::Perl::TreeChecker::XmlHandler - XRC handler for Wx::Perl::TreeChecker
70  
71 =head1 SYNOPSIS
72  
73 use Wx::Perl::TreeChecker::XmlHandler;
74 $xrc->AddHandler (new Wx::Perl::TreeChecker::XmlHandler);
75  
76 =head1 DESCRIPTION
77  
78 An Wx::XmlHandler for Wx::Perl::TreeChecker objects. Allows you to define tree
79 checkers in your xml resource files.
80  
81 =head1 EXAMPLE
82  
83 <object class="Wx::Perl::TreeChecker" name="my_treechecker"/>
84  
85 =head1 AUTHOR
86  
87 Simon Flack E<lt>simonflk _AT_ cpan.orgE<gt>
88  
89 =head1 COPYRIGHT
90  
91 Copyright 2003 Simon Flack E<lt>simonflk _AT_ cpan.orgE<gt>.
92 All rights reserved
93  
94 You may distribute under the terms of either the GNU General Public License or
95 the Artistic License, as specified in the Perl README file.
96  
97 =cut