Shawn Boyette > Curses-UI-0.9609 > Curses::UI::Menubar

Download:
Curses-UI-0.9609.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  35
Open  6
View/Report Bugs
Module Version: 1.10   Source  

NAME ^

Curses::UI::Menubar - Create and manipulate menubar widgets

CLASS HIERARCHY ^

 Curses::UI::Widget
    |
    +----Curses::UI::Container
            |
            +----Curses::UI::Window
                    |
                    +----Curses::UI::Menubar

SYNOPSIS ^

    use Curses::UI;
    my $cui = new Curses::UI;

    # define the menu datastructure.
    my $menu_data = [....]; 

    my $menu = $cui->add( 
        'menu', 'Menubar',
        -menu => $menu_data
    );

    $menu->focus();

DESCRIPTION ^

This class can be used to add a menubar to Curses::UI. This menubar can contain a complete submenu hierarchy. It looks (remotely :-) like this:

 -------------------------------------
 menu1 | menu2 | menu3 | ....
 -------------------------------------
       +-------------+ 
       |menuitem 1   |
       |menuitem 2   |+--------------+
       |menuitem 3 >>||submenuitem 1 |
       |menuitem 4   ||submenuitem 2 |
       +-------------+|submenuitem 3 | 
                      |submenuitem 4 | 
                      |submenuitem 5 |
                      +--------------+

See exampes/demo-Curses::UI::Menubar in the distribution for a short demo.

STANDARD OPTIONS ^

This class does not use any of the standard options that are provided by Curses::UI::Widget.

WIDGET-SPECIFIC OPTIONS ^

There is only one option: -menu. The value for this option is an ARRAYREF. This ARRAYREF behaves exactly like the one that is described in Curses::UI::MenuListbox. The difference is that for the top-level menu, you will only use -submenu's. Example data structure:

    my $menu1 = [
        { -label => 'option 1', -value => '1-1' },
        { -label => 'option 2', -value => '1-2' },
        { -label => 'option 3', -value => '1-3' },
    ];

    my $menu2 = [
        { -label => 'option 1', -value => \&sel1 },
        { -label => 'option 2', -value => \&sel2 },
        { -label => 'option 3', -value => \&sel3 },
    ];

    my $submenu = [
        { -label => 'suboption 1', -value => '3-3-1' },
        { -label => 'suboption 2', -callback=> \&do_it },
    ];

    my $menu3 = [
        { -label => 'option 1', -value => \&sel2 },
        { -label => 'option 2', -value => \&sel3 },
        { -label => 'submenu 1', -submenu => $submenu },
    ];

    my $menu = [
        { -label => 'menu 1', -submenu => $menu1 },
        { -label => 'menu 2', -submenu => $menu2 }
        { -label => 'menu 3', -submenu => $menu3 }
    ]; 

METHODS ^

DEFAULT BINDINGS ^

SEE ALSO ^

Curses::UI, Curses::UI::MenuListbox, Curses::UI::Listbox

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.

syntax highlighting: