Paw

 view release on metacpan or  search on metacpan

Paw/Textbox.pm  view on Meta::CPAN

#########################################################################
# Copyright (c) 1999 SuSE Gmbh Nuernberg, Germany.  All rights reserved.
#
# Author  : Uwe Gansert <ug@suse.de>
# License : GPL, see LICENSE File for further information
#
# completely rewritten Code it's shorter now and it works :-)
# thanx to Arthur Corliss (Author of Curses::Widgets Module for Perl)
# for some ideas.
# 

=head1 Textbox

B<$popup=Paw::Textbox->new($height, $width, \$text, [$color], [$cursor_color], [$name], [$edit]);>

B<Parameter>

     $height       => number of rows

     $width        => number of columns

     \$text        => reference to a scalar that contains the text.

     $edit         => text edit able (0/1) default is 0

     $color        => the colorpair must be generated with
                      Curses::init_pair(pair_nr, COLOR_fg, COLOR_bg)
                      [optionally]

     $cursor_color => same like color but only for the cursor

     $name         => Name of the widget [optionally]


B<Example>

  $data=("This is free software with ABSOLUTELY NO WARRANTY.\n");
  $pu=Paw::Textbox->new(height=>20, width=>20, text=>\$text);

=head2 set_border(["shade"])

activates the border of the widget (optionally also with shadows). 

B<Example>

     $widget->set_border("shade"); or $widget->set_border();

=cut

package Paw::Textbox;
use strict;
use Curses;
@Paw::Textbox::ISA = qw(Paw);

sub new {
    my $class  = shift;
    my $this   = Paw->new_widget_base();
    my %params = @_;
    
    $this->{name} = (defined $params{name})?($params{name}):('_auto_textbox');
    $this->{rows} = $params{height};
    $this->{cols} = $params{width};
    $this->{edit_able} = (defined $params{edit})?(1):(0);
    $this->{act_able}    = 1;
    $this->{direction}   = 'v';
    $this->{array_is_dirty} = 1;
    $this->{color_pair} = (defined $params{color})?($params{color}):(undef);
    $this->{cursor_color}= (defined $params{cursor_color})?($params{cursor_color}):(undef);

    bless ($this, $class);
    $this->{text}     = $params{text};
    $this->{cursor}   = 0;
    $this->{top_line} = 0;



( run in 0.491 second using v1.01-cache-2.11-cpan-364913b4093 )