line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=============================================================================== |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# PODNAME: CLI::Gwrapper::Wx::App |
4
|
|
|
|
|
|
|
# ABSTRACT: Wx::App for CLI::Gwrap |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# AUTHOR: Reid Augustin |
7
|
|
|
|
|
|
|
# EMAIL: reid@LucidPort.com |
8
|
|
|
|
|
|
|
# CREATED: 07/08/2013 12:08:30 PM |
9
|
|
|
|
|
|
|
#=============================================================================== |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package CLI::Gwrapper::Wx::App; |
12
|
1
|
|
|
1
|
|
893
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
13
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
14
|
1
|
|
|
1
|
|
16
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
579
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
3230
|
use Moo 1.000; |
|
1
|
|
|
|
|
21044
|
|
|
1
|
|
|
|
|
7
|
|
17
|
1
|
|
|
1
|
|
3277
|
use Types::Standard qw( Str InstanceOf ); |
|
1
|
|
|
|
|
84214
|
|
|
1
|
|
|
|
|
15
|
|
18
|
|
|
|
|
|
|
# use MooseX::NonMoose; |
19
|
|
|
|
|
|
|
# Help with combining Moose and Wx was found at http://cl.ly/197f818fd93974d07d60 |
20
|
1
|
|
|
1
|
|
1534
|
use Wx; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
extends 'Wx::App'; |
22
|
|
|
|
|
|
|
use Carp; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.030'; # VERSION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has frame => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => InstanceOf['Wx::Frame'], |
29
|
|
|
|
|
|
|
builder => '_frame_builder', |
30
|
|
|
|
|
|
|
lazy => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
has panel => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
isa => InstanceOf['Wx::Panel'], |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
has title => ( |
37
|
|
|
|
|
|
|
is => 'rw', |
38
|
|
|
|
|
|
|
isa => Str, |
39
|
|
|
|
|
|
|
default => 'Gwrap Frame', |
40
|
|
|
|
|
|
|
trigger => sub { |
41
|
|
|
|
|
|
|
my ($self, $title) = @_; |
42
|
|
|
|
|
|
|
$self->frame->SetTitle($title); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Convert Moose-style constructor args to Wx::App constructor args |
48
|
|
|
|
|
|
|
sub FOREIGNBUILDARGS { |
49
|
|
|
|
|
|
|
return; # Wx::App constructor takes no arguments. |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# we must provide an OnInit method to set up the Wx::App object |
53
|
|
|
|
|
|
|
sub OnInit { |
54
|
|
|
|
|
|
|
my ($self) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
croak("frame not built\n") if (not defined $self->frame); |
57
|
|
|
|
|
|
|
return 1; # true validates success |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _frame_builder { |
61
|
|
|
|
|
|
|
my ($self) = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $frame = Wx::Frame->new( |
64
|
|
|
|
|
|
|
undef, # parent window - this is the top-level window |
65
|
|
|
|
|
|
|
-1, # no window ID |
66
|
|
|
|
|
|
|
'??', # $self->title isn't created yet |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$self->{panel} = Wx::Panel->new( |
70
|
|
|
|
|
|
|
$frame, # parent |
71
|
|
|
|
|
|
|
-1, # no window ID |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
return $frame; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#__PACKAGE__->meta->make_immutable; !! Don't do this for Wx::App !! |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=pod |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
CLI::Gwrapper::Wx::App - Wx::App for CLI::Gwrap |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 VERSION |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
version 0.030 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DESCRIPTION |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
CLI::Gwrapper::Wx::App provides a Moo(se) Wx::App class for a CLI::Gwrap |
95
|
|
|
|
|
|
|
graphics plugin. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SEE ALSO |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
CLI::Gwrap |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Reid Augustin |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Reid Augustin. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
110
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |