CLASS HIERARCHY

 Curses::UI::Common - base class

SYNOPSIS

package MyPackage;

use Curses::UI::Common; use vars qw(@ISA); @ISA = qw(Curses::UI::Common);

DESCRIPTION

Curses::UI::Common is a collection of methods that is shared between Curses::UI classes.

METHODS

Various methods

  • parent ( ) Returns the data member $this->{-parent}.

  • root ( ) Returns the topmost -parent (the Curses::UI instance).

  • delallwin ( ) This method will walk through all the data members of the class intance. Each data member that is a Curses::Window descendant will be removed.

  • accessor ( \s-1NAME\s0, [\s-1VALUE\s0] ) If \s-1VALUE\s0 is set, the value for the data member $this->{\s-1NAME\s0} will be changed. The method will return the current value for data member $this->{\s-1NAME\s0}.

  • keys_to_lowercase ( \s-1HASHREF\s0 ) All keys in the hash referred to by \s-1HASHREF\s0 will be converted to lower case.

Text processing

split_to_lines ( \s-1TEXT\s0 )

This method will split \s-1TEXT\s0 into a list of separate lines. It returns a reference to this list.

scrlength ( \s-1LINE\s0 )

Returns the screenlength of the string \s-1LINE\s0. The difference with the perl function length() is that this method will expand \s-1TAB\s0 characters. It is exported by this class and it may be called as a stand-alone routine.

text_dimension ( \s-1TEXT\s0 )

This method will return an array containing the width (the length of the longest line) and the height (the number of lines) of the \s-1TEXT\s0.

text_wrap ( \s-1LINE\s0, \s-1LENGTH\s0, \s-1WORDWRAP\s0 )
\s-1WORDWRAP\s0 ( )
\s-1NO_WORDWRAP\s0 ( )

This method will wrap a line of text (\s-1LINE\s0) to a given length (\s-1LENGTH\s0). If the \s-1WORDWRAP\s0 argument is true, wordwrap will be enabled (this is the default for \s-1WORDWRAP\s0). It will return a reference to a list of wrapped lines. It is exported by this class and it may be called as a stand-alone routine. The \s-1WORDWRAP\s0 and \s-1NO_WORDWRAP\s0 routines will return the correct value vor the \s-1WORDWRAP\s0 argument. These routines are exported by this class. Example: $this->text_wrap($line, 50, NO_WORDWRAP);

Reading key input

\s-1CUI_ESCAPE\s0 ( )
\s-1CUI_TAB\s0 ( )
\s-1CUI_SPACE\s0 ( )

These are a couple of routines that are not defined by the Curses module, but which might be useful anyway. These routines are exported by this class.

get_key ( \s-1BLOCKTIME\s0, \s-1CURSOR\s0 )

This method will try to read a key from the keyboard. It will return the key pressed or -1 if no key was pressed. It is exported by this class and it may be called as a stand-alone routine. The \s-1BLOCKTIME\s0 argument can be used to set the curses halfdelay (the time to wait before the routine decides that no key was pressed). \s-1BLOCKTIME\s0 is given in tenths of seconds. The default is 0 (non-blocking key read). Example: my $key = $this->get_key(5)

RELATED TO Curses::UI::Common…

Curses::UI

AUTHOR

Copyright (c) 2001-2002 Maurice Makaay. All rights reserved.

Maintained by Marcus Thiesen ([email protected])

This package is free software and is provided \*(L"as is\*(R" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.