Alt-Tickit-Widgets-ObjectPad

 view release on metacpan or  search on metacpan

lib/Tickit/OneLineWidget.pm  view on Meta::CPAN


=head1 ACCESSORS

=cut

sub lines
{
   return 1;
}

=head2 valign

   $valign = $widget->valign

=head2 set_valign

   $widget->set_valign( $valign )

Accessor for vertical alignment value.

Gives a value in the range from C<0.0> to C<1.0> to align the content display
within the window. If the window is taller than one line, it will be aligned
according to this value; with C<0.0> at the top, C<1.0> at the bottom, and
other values inbetween.

See also L<Tickit::WidgetRole::Alignable>

=cut

sub render
{
   my $self = shift;
   my %args = @_;

   my $win = $self->window or return;
   $win->is_visible or return;
   my $rect = $args{rect};

   my ( $above ) = $self->_valign_allocation( 1, $win->lines );

   my $cols = $win->cols;

   $win->goto( $_, 0 ), $win->erasech( $cols ) for $rect->top .. $above - 1;

   $win->goto( $above, 0 );
   $self->render_line;

   $win->goto( $_, 0 ), $win->erasech( $cols ) for $above + 1 .. $rect->bottom - 1;
}

=head1 SUBCLASS METHODS

Because this is an abstract class, the constructor must be called on a
subclass which implements the following methods.

=head2 render_line

   $widget->render_line

Called to redraw the widget's content to its window. When invoked, the window
cursor will already be in column C<0> of the required line of the window, as
determined by the C<valign> value.

=cut

=head1 AUTHOR

Paul Evans <leonerd@leonerd.org.uk>

=cut

0x55AA;



( run in 0.871 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )