/usr/share/perl5/Curses/UI/Window.pm is in libcurses-ui-perl 0.9609-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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | # ----------------------------------------------------------------------
# Curses::UI::Window
#
# (c) 2001-2002 by Maurice Makaay. All rights reserved.
# This file is part of Curses::UI. Curses::UI is free software.
# You can redistribute it and/or modify it under the same terms
# as perl itself.
#
# Currently maintained by Marcus Thiesen
# e-mail: marcus@cpan.thiesenweb.de
# ----------------------------------------------------------------------
package Curses::UI::Window;
use strict;
use Curses;
use Curses::UI::Container;
use Curses::UI::Common;
use vars qw(
$VERSION
@ISA
);
$VERSION = '1.10';
@ISA = qw(
Curses::UI::Container
);
sub new ()
{
my $class = shift;
my %userargs = @_;
keys_to_lowercase(\%userargs);
# Create the window.
my $this = $class->SUPER::new(
-width => undef,
-height => undef,
-x => 0,
-y => 0,
-centered => 0, # Center the window in the display?
%userargs,
-nocursor => 1, # This widget does not use a cursor
-assubwin => 1, # Always constructed as a subwindow
);
return $this;
}
sub layout ()
{
my $this = shift;
# Compute the coordinates of the Window if
# it has to be centered.
if ($this->{-centered})
{
# The maximum available space on the screen.
my $avail_width = $ENV{COLS};
my $avail_height = $ENV{LINES};
# Compute the coordinates for the widget.
my $w = $this->{-width} || 1;
my $h = $this->{-height} || 1;
my $x = int(($avail_width - $w) / 2);
my $y = int(($avail_height - $h) / 2);
$x = 0 if $x < 0;
$y = 0 if $y < 0;
$this->{-x} = $x;
$this->{-y} = $y;
}
$this->SUPER::layout or return;
return $this;
}
1;
=pod
=head1 NAME
Curses::UI::Window - Create and manipulate Window widgets
=head1 CLASS HIERARCHY
Curses::UI::Widget
|
+----Curses::UI::Container
|
+----Curses::UI::Window
=head1 SYNOPSIS
use Curses::UI;
my $cui = new Curses::UI;
my $win = $cui->add(
'window_id', 'Window',
%options,
);
=head1 DESCRIPTION
Curses::UI::Window is a window widget. It can be added to
a Curses::UI instance. After that the window can be filled
with other widgets to create an application window. For
information on how to fill the window with widgets, see
L<Curses::UI::Container|Curses::UI::Container>.
=head1 STANDARD OPTIONS
B<-parent>, B<-x>, B<-y>, B<-width>, B<-height>,
B<-pad>, B<-padleft>, B<-padright>, B<-padtop>, B<-padbottom>,
B<-ipad>, B<-ipadleft>, B<-ipadright>, B<-ipadtop>, B<-ipadbottom>,
B<-title>, B<-titlefullwidth>, B<-titlereverse>, B<-onfocus>,
B<-onblur>
For an explanation of these standard options, see
L<Curses::UI::Widget|Curses::UI::Widget>.
=head1 WIDGET-SPECIFIC OPTIONS
=over 4
=item * B<-centered> < BOOLEAN >
A window can automatically be drawn in the center of the screen.
To enable this option use a true value and to disable it use a
false value. The default is not to center a window. Example:
$cui->add('mywindow', 'Window', -centered => 1);
=back
=head1 METHODS
=over 4
=item * B<new> ( OPTIONS )
=item * B<layout> ( )
=item * B<draw> ( BOOLEAN )
=item * B<focus> ( )
=item * B<onFocus> ( CODEREF )
=item * B<onBlur> ( CODEREF )
=item * B<intellidraw> ( )
These are standard methods. See L<Curses::UI::Widget|Curses::UI::Widget>
for an explanation of these.
=item * B<modalfocus> ( )
If this method is called, the window will get modal focus. This means
that all events will be sent to this window. By calling the
B<loose_focus> method, the window will loose its focus.
=item * B<loose_focus> ( )
This method will have the window loose its focus (using this method
you can also let a modal focused window loose its focus).
=back
=head1 SEE ALSO
L<Curses::UI|Curses::UI>,
L<Curses::UI::Container|Curses::UI::Container>,
L<Curses::UI::Widget|Curses::UI::Widget>
=head1 AUTHOR
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.
|