NAME

TUI::Views::Window - base class for windows in Turbo Vision

HIERARCHY

TObject
  TView
    TGroup
      TWindow

SYNOPSIS

use TUI::Views;

my $window = TWindow->new(
  bounds => $bounds,
  title  => 'Title',
  number => 1
);

DESCRIPTION

TWindow is a core view class used to represent windows in a Turbo Vision application. Windows may contain other views, display optional titles and window numbers, and support standard window operations such as moving, resizing, closing, and zooming.

The class encapsulates the behavior required for managing window frames, handling window-specific commands, and maintaining optional scroll bars. Dialog boxes and many other high-level interface elements are implemented as specialized window descendants.

Most applications interact with TWindow indirectly through subclasses or by responding to window-related events.

VARIABLES

The following global variable defines default size constraints for TWindow.

$minWinSize

Specifies the minimum allowed window size, represented as a TPoint.

ATTRIBUTES

The following attributes define the state and appearance of a window. Unless otherwise noted, attributes are part of the public window state.

flags

Window behavior flags (Int), typically a combination of wfXXXX constants. These flags control whether the window can be moved, resized, closed, or zoomed.

frame

Reference to the window frame object (TFrame). This attribute is created internally and represents the visual border of the window.

number

Window number identifier (Int). If the value is between 1 and 9, the window can be selected directly using the Alt-n key combination.

palette

Palette selector for the window (Int). Determines which predefined window palette is used.

title

Title string displayed in the window frame (Str).

zoomRect

Rectangle storing the window's normal (unzoomed) bounds (TRect). This value is used to restore the window when toggling the zoom state.

CONSTRUCTOR

new

my $obj = TWindow->new(
  bounds => $bounds,
  title  => $title,
  number => $number
);

Creates a new window with the specified bounds, title, and window number.

bounds

Bounding rectangle of the window (TRect).

title

Title string displayed in the window frame (Str).

number

Window number identifier (Int). Values from 1 to 9 allow direct keyboard selection.

new_TWindow

my $obj = new_TWindow($bounds, $aTitle, $aNumber);

Factory-style constructor using positional arguments.

This constructor is provided for compatibility with traditional Turbo Vision construction patterns and is functionally equivalent to calling new with named parameters.

DESTRUCTOR

DEMOLISH

$self->DEMOLISH($in_global_destruction);

Destroys the window and removes it from the view hierarchy.

This method corresponds to the Turbo Vision destructor and is normally invoked automatically by the owning group or application.

METHODS

close

$self->close();

Closes the window. This is functionally equivalent to invoking the window destructor and is typically triggered by the cmClose command.

getPalette

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

Returns the color palette associated with the window.

getTitle

my $str = $self->getTitle($maxSize);

Returns the window title. Subclasses may override this method to truncate or modify the title if it exceeds the specified maximum length.

handleEvent

$self->handleEvent($event);

Handles events directed at the window. Applications commonly override this method to intercept window-related commands such as close or zoom.

initFrame

my $frame = $self->initFrame($bounds);

Creates and initializes the window frame. Subclasses may override this method to provide a custom frame implementation.

setState

$self->setState($state, $enable);

Sets or clears state flags and performs additional window-specific processing when the window becomes active or inactive.

shutDown

$self->shutDown();

Shuts down the window and releases associated resources.

sizeLimits

$self->sizeLimits($min, $max);

Determines the minimum and maximum size limits for the window.

standardScrollBar

my $scrollBar = $self->standardScrollBar($options);

Creates and inserts a standard scroll bar into the window. The $options parameter specifies orientation and keyboard handling using sbXXXX constants.

zoom

$self->zoom();

Toggles the window between its zoomed state and its normal size stored in "zoomRect".

SEE ALSO

TUI::Views::View, TUI::Views::Group, TUI::Views::Frame

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