NAME

TUI::Views::CommandSet - value type for managing sets of commands

HIERARCHY

TCommandSet (value type)
  used by TView and derived classes

SYNOPSIS

use TUI::Views;

my $cmds = TCommandSet->new;

$cmds->enableCmd(cmQuit);
$cmds->disableCmd(cmDelete);

if ($cmds->has(cmQuit)) {
  ...
}

my $other = TCommandSet->new;
$other->enableCmd(cmCopy);

my $union = $cmds | $other;
my $inter = $cmds & $other;

DESCRIPTION

TCommandSet represents a set of command identifiers. It is used throughout TUI::Vision to enable, disable, and query commands associated with views.

This type is a lightweight value type and is not derived from TObject. Internally, a command set represents up to 256 commands, corresponding to the range of commands that can be selectively enabled or disabled.

TCommandSet supports set-style operations through Perl operator overloading, allowing command sets to be combined, intersected, and compared using natural expressions.

CONSTRUCTOR

new

my $set = TCommandSet->new(
  copy_from => $other | undef
);

Creates a new command set.

copy_from

Optional command set to copy from.

METHODS

clone

my $copy = $set->clone();

Creates and returns a copy of the command set.

disableCmd

$set->disableCmd($cmd | $other);

Disables a command or all commands contained in another command set.

enableCmd

$set->enableCmd($cmd | $other);

Enables a command or all commands contained in another command set.

equal

my $bool = $set->equal($a, $b);

Returns true if two command sets are equal.

Implements the == operator.

exclude

$set = $set->exclude($cmd | $other);

Removes a command or command set from the current set.

Implements the -= operator.

has

my $bool = $set->has($cmd);

Returns true if the specified command is contained in the set.

include

$set = $set->include($cmd | $other);

Adds a command or command set to the current set.

Implements the += operator.

intersect

my $set = $set->intersect($a, $b);

Returns the intersection of two command sets.

Implements the & operator.

intersect_assign

$set = $set->intersect_assign($other);

Assigns the intersection of another command set to the current set.

Implements the &= operator.

isEmpty

my $bool = $set->isEmpty();

Returns true if the command set contains no commands.

not_equal

my $bool = $set->not_equal($a, $b);

Returns true if two command sets are not equal.

Implements the != operator.

union

my $set = $set->union($a, $b);

Returns the union of two command sets.

Implements the | operator.

union_assign

$set = $set->union_assign($other);

Assigns the union of another command set to the current set.

Implements the |= operator.

OPERATOR OVERLOADING

TCommandSet supports set operations via Perl operator overloading.

  • += - include commands

  • -= - exclude commands

  • & - intersection

  • &= - intersection assignment

  • | - union

  • |= - union assignment

  • == - equality comparison

  • != - inequality comparison

SEE ALSO

TUI::Views::View, TUI::Drivers::Event

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