/usr/lib/perl5/Tk/LabFrame.pm is in perl-tk 1:804.030-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 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 130 131 132 133 134 135 136 | #
# Labeled frame. Derives from Tk::Frame, but intercepts the labeling
# part.
package Tk::LabFrame;
use vars qw($VERSION);
$VERSION = '4.010'; # $Id: //depot/Tkutf8/Tixish/LabFrame.pm#11 $
use Tk;
use base qw(Tk::Frame);
Tk::Widget->Construct('LabFrame');
sub autoLabel { 0 }
sub Populate {
my ($cw, $args) = @_;
$cw->{m_geoMgr} = "";
my $border = $cw->Component(
Frame => 'border',
-relief => 'groove',
-bd => 2,
);
my $pad = $border->Frame;
$cw->Advertise(pad => $pad);
my $frame = $border->Frame;
$cw->Advertise(frame => $frame);
my $label = $cw->Component(Label => 'label');
$cw->SUPER::Populate($args);
$cw->Delegates(DEFAULT => $frame);
$cw->ConfigSpecs(
-background => [[qw/SELF ADVERTISED/],
qw/background Background/],
-borderwidth => [$border, qw/borderWidth Border 2/],
-font => [$label, qw/font Font/],
-foreground => [$label, qw/foreground Foreground black/],
-label => [{-text => $label}, qw/label Label/],
-labelside => [qw/METHOD labelSide LabelSide acrosstop/],
-labelvariable => [{-textvariable => $label}],
-relief => [$border, qw/relief Relief groove/],
DEFAULT => [$frame]
);
return $cw;
}
use Tk::Submethods(
form => [qw/check forget grid info slaves/],
grid => [qw/bbox columnconfigure configure forget info location
propagate rowconfigure remove size slaves/],
pack => [qw/forget info propagate slaves/],
place => [qw/forget info slaves/]
);
sub labelside {
my ($cw, $side) = @_;
return $cw->{Configure}{-labelside} unless $side;
my $border = $cw->Subwidget('border');
my $pad = $cw->Subwidget('pad');
my $frame = $cw->Subwidget('frame');
my $label = $cw->Subwidget('label');
## packForget/formForget as appropriate
foreach ($border, $label, $pad, $frame) {
$_->formForget if $cw->{m_geoMgr} eq "form";
$_->packForget if ($cw->{m_geoMgr} eq "pack" && $_->ismapped);
}
if ($side eq "acrosstop") {
my $y = $label->reqheight / 2;
my $ph = $y - ($border->cget(-bd));
$ph = 0 if $ph < 0;
$label->form(qw/-top 0 -left 4 -padx 6 -pady 2/);
$border->form(-top => $y,
qw/-bottom -1 -left 0 -right -1 -padx 2 -pady 2/);
$pad->form(-bottom => $ph,
qw/-top 0 -left 0 -right -1/);
$frame->form(-top => $pad,
qw/-bottom -1 -left 0 -right -1 -fill both/);
$cw->{m_geoMgr} = "form";
} else {
$label->pack(-side => $side);
$frame->pack(-expand => 1, -fill => 'both');
$border->pack(-side => $side, -expand => 1, -fill => 'both');
$cw->{m_geoMgr} = "pack";
}
}
sub form {
my $cw = shift;
$cw = $cw->Subwidget('frame')
if (@_ && $_[0] =~ /^(?:slaves)$/);
$cw->SUPER::form(@_);
}
sub grid {
my $cw = shift;
$cw = $cw->Subwidget('frame') if (@_ && $_[0] =~
/^(?:bbox
|columnconfigure
|location
|propagate
|rowconfigure
|size
|slaves)
$/x);
$cw->SUPER::grid(@_);
}
sub pack {
my $cw = shift;
$cw = $cw->Subwidget('frame')
if (@_ && $_[0] =~ /^(?:propagate|slaves)$/);
$cw->SUPER::pack(@_);
}
sub place {
my $cw = shift;
$cw = $cw->Subwidget('frame')
if (@_ && $_[0] =~ /^(?:slaves)$/);
$cw->SUPER::place(@_);
}
1;
|