NAME

TUI::Dialogs::HistInit - initializer for history list viewer creation

SYNOPSIS

package MyHistoryWindow;

use MyListViewer;
use TUI::Dialogs::HistInit;

# Callback creating a list viewer
my $cb = sub {
  my ($extent, $win, $historyId) = @_;
  return MyListViewer->new(
    bounds    => $extent,
    owner     => $win,
    historyId => $historyId,
  );
};

# Used in our window class
sub new {
  ...
  my $historyId = $args->{historyId};
  my $extent = $self->getExtent();

  # Initializer object
  my $init = THistInit->new(cListViewer => $cb);
  my $listViewer = $init->createListViewer($extent, $self, $historyId);
  $self->insert($listViewer);
  ...
}

DESCRIPTION

TUI::Dialogs::HistInit encapsulates the initialization logic required to create history list viewer objects in Turbo Vision dialogs.

The class stores a user-supplied callback which is invoked whenever a list viewer needs to be constructed. This allows dialogs to customize the concrete list viewer implementation while keeping dialog initialization code simple and decoupled.

HistInit is not a view and does not participate in the view hierarchy. It exists solely as a helper for dialog setup.

CONSTRUCTOR

new

my $init = THistInit->new(
  createListViewer => \&callback
);

Creates a new history initializer.

createListViewer

A code reference that is called with three arguments:

($extent, $window, $historyId)

The callback must return a list viewer object suitable for insertion into the owning dialog.

new_THistInit

my $init = new_THistInit(\&callback);

Factory-style constructor using a positional argument for the callback.

METHODS

createListViewer

my $listViewer = $init->createListViewer($extent, $window, $historyId);

Invokes the stored callback and returns a newly created list viewer object.

SEE ALSO

TUI::Dialogs::History, TUI::Dialogs::ListBox

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) 2026 the "AUTHORS" as listed above.

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