1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
package Padre::Wx::CPAN;
use 5.008;
use strict;
use warnings;
use URI ();
use Scalar::Util qw( blessed );
use Params::Util qw( _INSTANCE );
use Padre::Wx ();
use Padre::Wx::CPAN::Listview ();
our $VERSION = '0.60';
our @ISA = 'Wx::Frame';
use Class::XSAccessor {
accessors => {
listview => 'listview',
entry => 'entry',
cpan => 'cpan',
main => 'main',
},
};
=pod
=head1 NAME
Padre::Wx::CPAN - Wx front-end for L<CPAN>
=head1 DESCRIPTION
User interface for L<CPAN>.
=head1 METHODS
=head2 new
Constructor, see L<Wx::Frame>
=head1 SEE ALSO
L<Padre::CPAN>
=cut
sub new {
my ( $class, $cpan, $main ) = @_;
my $self = $class->SUPER::new(
undef,
-1,
'CPAN',
Wx::wxDefaultPosition,
[ 750, 700 ],
);
$self->{cpan} = $cpan;
$self->{main} = $main;
my $top_s = Wx::BoxSizer->new(Wx::wxVERTICAL);
my $but_s = Wx::BoxSizer->new(Wx::wxHORIZONTAL);
my $entry = Wx::TextCtrl->new(
$self, -1,
'',
Wx::wxDefaultPosition,
Wx::wxDefaultSize,
Wx::wxTE_PROCESS_ENTER
);
$self->{entry} = $entry;
Wx::Event::EVT_TEXT( $self, $entry, \&on_key_pressed );
# Wx::Event::EVT_TEXT_ENTER( $self, $entry,
# sub {
# $self->on_search_text_enter( $entry );
# }
# );
#
my $label = Wx::StaticText->new(
$self, -1, 'Filter',
Wx::wxDefaultPosition, Wx::wxDefaultSize,
Wx::wxALIGN_RIGHT
);
$but_s->Add( $label, 2, Wx::wxALIGN_RIGHT | Wx::wxALIGN_CENTER_VERTICAL );
$but_s->Add( $entry, 1, Wx::wxALIGN_RIGHT | Wx::wxALIGN_CENTER_VERTICAL );
my $listview = Padre::Wx::CPAN::Listview->new($self);
$self->{listview} = $listview;
$top_s->Add( $but_s, 0, Wx::wxEXPAND );
$top_s->Add( $listview, 1, Wx::wxGROW );
$self->SetSizer($top_s);
$self->SetAutoLayout(1);
#$self->_setup_welcome;
$self->listview->show_rows;
return $self;
}
sub on_search_text_enter {
my ( $self, $event ) = @_;
my $text = $event->GetValue;
print STDERR "$text\n";
#$self->help($text);
}
sub show {
shift->Show;
}
sub on_key_pressed {
my ( $self, $text_ctrl, $event ) = @_;
$self->listview->show_rows( $self->{entry}->GetValue );
return;
}
1;
# Copyright 2008-2010 The Padre development team as listed in Padre.pm.
# LICENSE
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl 5 itself.
|