| Curses::UI::Searchable - Add 'less'-like search abilities to a widget |
Curses::UI::Searchable - Add 'less'-like search abilities to a widget
Curses::UI::Searchable - base class
package MyWidget;
use Curses::UI::Searchable;
use vars qw(@ISA);
@ISA = qw(Curses::UI::Searchable);
....
sub new () {
# Create class instance $this.
....
$this->set_routine('search-forward', \&search_forward);
$this->set_binding('search-forward', '/');
$this->set_routine('search-backward', \&search_backward);
$this->set_binding('search-backward', '?');
}
sub layout_content() {
my $this = shift;
# Layout your widget's content.
....
return $this;
}
sub number_of_lines() {
my $this = shift;
# Return the number of lines in
# the widget's content.
return ....
}
sub getline_at_ypos($;) {
my $this = shift;
my $ypos = shift;
# Return the content on the line
# where ypos = $ypos
return ....
}
Using Curses::UI::Searchable, you can add 'less'-like search capabilities to your widget.
To make your widget searchable using this class, your widget should meet the following requirements:
-ypos
|
v
+------+
0 |One |
1 |Two |
2 |Three |
+------+
$this->set_routine('search-forward' , \&search_forward);
$this->set_binding('search-forward' , '/');
$this->set_routine('search-backward' , \&search_backward);
$this->set_binding('search-backward' , '?');
Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.
Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)
This package is free software and is provided ``as is'' without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.
| Curses::UI::Searchable - Add 'less'-like search abilities to a widget |