Curses::UI::Container - Create and manipulate container widgets |
Curses::UI::Container - Create and manipulate container widgets
Curses::UI::Widget | +----Curses::UI::Container
use Curses::UI; my $cui = new Curses::UI; my $win = $cui->add('window_id', 'Window');
my $container = $win->add( 'mycontainer', 'Container' );
$container->add( 'contained', 'SomeWidget', ..... );
$container->focus();
A container provides an easy way of managing multiple widgets in a single ``form''. A lot of Curses::UI functionality is built around containers. The main class Curses::UI itself is a container. A Curses::UI::Window is a container. Some of the widgets are implemented as containers.
-parent, -x, -y, -width, -height, -pad, -padleft, -padright, -padtop, -padbottom, -ipad, -ipadleft, -ipadright, -ipadtop, -ipadbottom, -title, -titlefullwidth, -titlereverse, -onfocus, -onblur
For an explanation of these standard options, see Curses::UI::Widget.
The ID is an identifier that you want to use for the added widget. This may be any string you want. If you do not need an ID, you may also us an undefined value. The container will automatically create an ID for you.
The CLASS is the class which you want to add to the container. If CLASS does not contain '::' or CLASS matches 'Dialog::...' then 'Curses::UI' will be prepended to it. This way you do not have to specifiy the full class name for widgets that are in the Curses::UI hierarchy. It is not neccessary to call ``use CLASS'' yourself. The add method will call the usemodule method from Curses::UI to automatically load the module.
The hash OPTIONS contains the options that you want to pass on to the new instance of CLASS.
Example:
$container->add( 'myid', # ID 'Label', # CLASS -text => 'Hello, world!', # OPTIONS -x => 10, -y => 5, );
If the container gets focus, one of the contained widgets will get the focus. The returnvalue of this widget determines what has to be done next. Here are the possible cases:
* The returnvalue is LEAVE_CONTAINER
As soon as a widget returns this value, the container will loose its focus and return the returnvalue and the last pressed key to the caller.
* The returnvalue is STAY_AT_FOCUSPOSITION
The container will not loose focus and the focus will stay at the same widget of the container.
* Any other returnvalue
The focus will go to the next widget in the container.
Since interacting is not handled by the container itself, but by the contained widgets, this class does not have any key bindings.
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.
Curses::UI::Container - Create and manipulate container widgets |