NAME

TUI::App::Background - background view for Turbo Vision applications

HIERARCHY

TObject
  TView
    TBackground

SYNOPSIS

use TUI::App;

my $bg = TBackground->new(
  bounds  => $bounds,
  pattern => chr(0xFF)
);

DESCRIPTION

TBackground represents the background view that forms the visual backdrop of a Turbo Vision application. It fills its bounding rectangle by repeatedly drawing a single character pattern.

Background views are typically created and managed automatically by the desktop. Applications rarely need to interact with TBackground directly unless a custom background is desired.

Commonly Used Features

Most programs use TBackground indirectly through TDeskTop; the default desktop creation path already instantiates a background object with the global desktop pattern. Direct usage is uncommon and usually limited to customizing appearance by overriding TDeskTop::initBackground() and returning a background with a different pattern character.

For custom backgrounds, the typical workflow is: derive a desktop class, override initBackground() to create <TBackground-new(bounds => ..., pattern => ... )>>, then return that desktop from the application's initDeskTop() override.

CONSTRUCTOR

new

my $background = TBackground->new(
  bounds  => $bounds,
  pattern => $pattern
);

Creates a new background view.

bounds

Bounding rectangle defining the area covered by the background (TRect).

pattern

Single-character string used as the background pattern (Str).

ATTRIBUTES

The following attributes are managed internally and exposed as read-only accessors.

pattern

The character pattern replicated to fill the background (Str).

METHODS

draw

$background->draw();

Draws the background pattern across the view area.

getPalette

my $palette = $background->getPalette();

Returns the color palette used to draw the background.

EXAMPLE

The following example demonstrates how to override the desktop background by providing a custom TBackground implementation.

package TSampleProgram;
use parent 'TApplication';

package TNewDeskTop;
use parent 'TDeskTop';

sub TNewDeskTop::initBackground {
  my ($self, $bounds) = @_;

  return TBackground->new(
    bounds  => $bounds,
    pattern => chr(0xFF)
  );
}

sub TSampleProgram::initDeskTop {
  my ($self, $bounds) = @_;

  $bounds->{a}{y}++;
  $bounds->{b}{y}--;

  return TNewDeskTop->new(bounds => $bounds);
}

package main;

my $app = TSampleProgram->new;
$app->run;

SEE ALSO

TUI::App::DeskTop, TUI::Views::View, TUI::Objects::Rect

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

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