NAME

TUI::Menus::SubMenu - submenu item for menu bars and menu boxes

HIERARCHY

TObject
  TMenuItem
    TSubMenu

SYNOPSIS

use TUI::Menus;

my $submenu =
  new_TSubMenu('~F~ile', kbAltF)
    + new_TMenuItem('~O~pen', cmOpen)
    + new_TMenuItem('~S~ave', cmSave)
    + newLine
    + new_TMenuItem('E~x~it', cmQuit);

DESCRIPTION

TSubMenu represents a submenu entry that can be attached to a menu bar or menu box. It is a specialized form of TMenuItem that owns a list of child menu items.

Submenus are typically constructed using operator chaining, allowing menu structures to be built declaratively.

CONSTRUCTOR

new_TSubMenu

my $submenu = new_TSubMenu($title, $key | undef, $helpCtx | undef);

Creates a new submenu item.

title

The displayed submenu title, usually containing a hotkey marker (Str).

key

Optional keyboard shortcut associated with the submenu (Int).

helpCtx

Optional help context identifier (Int).

METHODS

add

my $submenu = $submenu->add($item | $submenu, | $swap);

Adds a menu item or submenu to this submenu.

This method implements the + operator, allowing menu items to be chained together.

USAGE NOTES

TSubMenu is not normally instantiated directly via new. Instead, the factory function new_TSubMenu should be used.

Menu structures are commonly built using chained additions, which preserves the original Turbo Vision menu construction style.

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).