NAME

TUI::ColorSel::ColorDisplay - color preview view for the color selection dialog

HIERARCHY

TObject
  TView
    TColorDisplay

SYNOPSIS

use TUI::ColorSel;

my $view = TColorDisplay->new(
  bounds => $bounds,
  text   => 'Text ',
);

DESCRIPTION

TColorDisplay displays a sample text using the currently selected color attribute.

It is typically embedded in a color selection dialog and provides a live preview of foreground and background color changes.

ATTRIBUTES

color

Current color attribute (TColorAttr, read-only).

text

Text displayed across the view (Str, read-only).

CONSTRUCTOR

new

my $view = TColorDisplay->new(
  bounds => $bounds,
  text   => 'Text ',
);

Creates a new color preview view.

bounds

Bounding rectangle defining the position and size of the view (TRect).

text

Text displayed across the view (Str).

new_TColorDisplay

my $view = new_TColorDisplay( $bounds, $text );

Factory-style constructor.

METHODS

draw

$view->draw();

Draws the preview text using the current color attribute.

The configured text is repeated across the width of the view.

handleEvent

$view->handleEvent($event);

Handles broadcast color selection events.

The view responds to:

  • cmColorForegroundChanged

  • cmColorBackgroundChanged

and updates the displayed color accordingly.

setColor

$view->setColor(\$color);

Sets a reference to the current color attribute. Foreground and background selection events update the referenced palette entry directly.

The view broadcasts a cmColorSet message and redraws itself.

SEE ALSO

TColorDialog, TView, TColorSelector

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