NAME

TUI::Menus::Menu - container for menu item lists

SYNOPSIS

use TUI::Menus;

my $menu =
    new_TMenu(
      new_TMenuItem('~O~pen', cmOpen)
    + new_TMenuItem('~S~ave', cmSave)
    );

DESCRIPTION

TMenu represents a container used to build menu structures for menu bars and menu boxes. It holds a linked list of TMenuItem objects and an optional default item.

Menu objects are typically created indirectly using helper constructors and combined using the overloaded + operator. The resulting menu structure is passed to menu views such as TMenuBar or TMenuBox.

TMenu is a data structure and does not perform any drawing or event processing itself.

ATTRIBUTES

The following attributes describe the contents of the menu.

items

Reference to the first menu item in the list (TMenuItem).

deflt

Optional reference to the default menu item (TMenuItem). This item may be highlighted or preselected depending on the menu view.

CONSTRUCTOR

new

my $menu = TMenu->new(
  items => $items,
  deflt => $default
);

Creates a new menu container.

items

Optional reference to a list of menu items (TMenuItem).

deflt

Optional default menu item (TMenuItem).

new_TMenu

my $menu = new_TMenu($items | undef, | $default);

Factory-style constructor using positional arguments.

This constructor is equivalent to calling new with named parameters and is provided for compatibility with traditional Turbo Vision construction patterns.

METHODS

deflt

my $item = $menu->deflt();
$menu->deflt($item);

Gets or sets the default menu item.

SEE ALSO

TUI::Menus::MenuItem, TUI::Menus::MenuBar, TUI::Menus::MenuBox

AUTHORS

  • Borland International (original Turbo Vision design)

  • J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2025-2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).