/usr/share/perl5/Lire/UI/SelectWidget.pm is in lire 2:2.1.1-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | package Lire::UI::SelectWidget;
use strict;
use base qw/ Curses::UI::Popupmenu Lire::UI::Widget /;
use Curses::UI::Common;
use Lire::Utils qw/ item_index check_object_param /;
use Locale::TextDomain 'lire';
use Carp;
use vars qw/@CARP_NOT/;
@CARP_NOT = qw/Curses::UI::Container/;
sub new {
my $class = shift;
my %userargs = @_;
keys_to_lowercase(\%userargs);
check_object_param( $userargs{'value'}, 'value',
'Lire::Config::Scalar' );
my @options = map { $_->name() } $userargs{'value'}->spec()->options();
my $selected;
my $focusable;
if (@options) {
$selected = ( $userargs{'value'}->is_valid()
? item_index( \@options, $userargs{'value'}->get() )
: undef );
$focusable = 1;
} else {
@options = ( __( '-- empty list --' ) );
$selected = 0;
$focusable = 0;
}
my %args = ( %userargs,
'-height' => 1,
'-onchange' => \&_on_change_cb,
'-selected' => $selected,
'-values' => \@options,
'-focusable' => $focusable );
return $class->Curses::UI::Popupmenu::new( %args );
}
sub layout {
my $self = $_[0];
$self->{'-height'} = 1;
return $self->SUPER::layout();
}
# callbacks
sub _on_change_cb {
my $self = $_[0];
$self->{'value'}->set( $self->get() );
$self->run_event( 'onvaluechanged' );
return;
}
1;
|