NAME

TUI::ColorSel::ColorSelector - interactive color selection view

HIERARCHY

TObject
  TView
    TColorSelector

SYNOPSIS

use TUI::ColorSel;

my $selector = TColorSelector->new(
  bounds  => $bounds,
  selType => csForeground,
);

DESCRIPTION

TColorSelector implements an interactive color selection view used by the TUI::Vision color dialog infrastructure.

The selector displays a palette of available colors and allows the user to choose a foreground or background color using keyboard or mouse input.

In foreground mode, all sixteen BIOS colors are available. In background mode, only the eight supported background colors are selectable.

When the current selection changes, the view broadcasts either cmColorForegroundChanged or cmColorBackgroundChanged, depending on the configured selection type.

The class is typically used together with TColorDisplay and other color dialog components.

ATTRIBUTES

color

Currently selected color index (PositiveOrZeroInt).

selType

Selection mode determining whether foreground or background colors are edited (PositiveOrZeroInt).

Typical values are csForeground and csBackground.

CONSTRUCTORS

new

my $selector = TColorSelector->new(
  bounds  => $bounds,
  selType => $selType,
);

Creates a new color selector view.

bounds

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

selType

Selection mode (PositiveOrZeroInt).

Typically csForeground or csBackground.

new_TColorSelector

my $selector = new_TColorSelector( $bounds, $selType );

Factory-style constructor using positional arguments.

METHODS

draw

$selector->draw();

Draws the color palette and highlights the currently selected color.

handleEvent

$selector->handleEvent($event);

Handles mouse, keyboard and broadcast events.

Keyboard navigation is performed using the cursor keys.

The selector responds to cmColorSet broadcasts and updates its current selection accordingly.

SEE ALSO

TColorDialog, TView, TColorDisplay

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