NAME
TUI::TextView::TextDevice - abstract base class for text output devices
HIERARCHY
TObject
TView
TScroller
TTextDevice
DESCRIPTION
TTextDevice is an abstract base class for text-based output devices in Turbo Vision. It represents a scrollable, TTY-like text view and provides the common infrastructure required by terminal-style views.
The class itself does not implement a concrete device. Instead, it defines a minimal interface for reading and writing text buffers that must be implemented by derived classes such as TTerminal. In addition to the scrolling behavior inherited from TScroller, TTextDevice integrates with Perl's IO::Handle interface and supports standard output methods such as print, printf, and say.
Most input-related methods are implemented as stubs and return fixed values. Reading support must be provided explicitly by subclasses if required.
ATTRIBUTES
The following attributes are exposed as read-only accessors and are intended for internal use by the text device implementation.
- opened
-
Indicates whether the device is considered open. This attribute defaults to true and is managed internally.
The following attributes are private and not part of the public API. They are documented here for completeness only.
- egress
-
Internal output buffer used for staged writes.
- esize
-
Size of the internal output buffer (default: 2048 bytes).
- autoflush
-
Boolean flag controlling whether output is flushed automatically after each write operation.
METHODS
new_TTextDevice
my $device = new_TTextDevice($bounds, $aHScrollBar, $aVScrollBar);
Factory constructor for creating a new TTextDevice instance. This constructor delegates initialization to TScroller and prepares the object for use as a text output device.
autoflush
my $value = $self->autoflush();
$self->autoflush($value);
Gets or sets the autoflush flag. When enabled, output is flushed automatically after each write operation.
do_sputn
my $num = $self->do_sputn($string, $count);
Abstract output method used internally by syswrite. Derived classes must override this method to perform actual output operations.
my $success = $self->print(@list);
Appends data to the device using syswrite internally.
printf
my $success = $self->printf($format, @list);
Formats data and appends it to the device using syswrite internally.
say
my $success = $self->say(@list);
Appends data followed by a newline and writes it to the device.
printflush
my $success = $self->printflush(@list);
Appends data to the device and forces an immediate flush.
syswrite
my $num | undef = $self->syswrite($scalar, | $length, | $offset);
Writes raw data to the device. This method delegates the actual output operation to do_sputn and mirrors the behavior of the original Turbo Vision runtime.
flush
my $success | undef = $self->flush();
Flushes any buffered output. Returns "0 but true" on success.
name
my $name = $self->name();
Returns the class name ("TTextDevice").
eof
my $bool = $self->eof();
Indicates end-of-file. This implementation always returns true.
error
my $bool = $self->error();
Returns the error state. This implementation always returns false.
clearerr
my $value = $self->clearerr();
Clears the error state. This implementation performs no action.
read
my $num = $self->read($buf, $len, | $offset);
Stub method for reading data. Always returns an empty result in this class.
getline
my $line | undef = $self->getline();
Stub method for reading a line. Always returns an empty result.
getlines
my @lines = $self->getlines();
Stub method for reading all lines. Always returns an empty list.
getc
my $char = $self->getc();
Stub method for reading a single character.
ungetc
my $success = $self->ungetc($ord);
Stub method for pushing a character back into the input stream.
binmode
my $success = $self->binmode(| $layer);
Stub method for enabling binary mode. Always returns true.
blocking
my $bool | undef = $self->blocking(| $bool);
Stub method for controlling blocking mode.
fileno
my $fd = $self->fileno();
Returns the file descriptor number. Always returns -1.
seek
my $success = $self->seek($position, $whence);
Stub method for seeking.
tell
my $pos = $self->tell();
Stub method for retrieving the current position.
truncate
my $success = $self->truncate($length);
Stub method for truncating the device.
stat
my @list = $self->stat();
Stub method for retrieving device statistics.
ioctl
my $success = $self->ioctl($function, $scalar);
Stub method for device control operations.
fcntl
my $success = $self->fcntl($function, $scalar);
Stub method for file control operations.
fdopen
my $success = $self->fdopen($fd, $mode);
Stub method for opening a file descriptor.
new_from_fd
my $obj = $self->new_from_fd();
Stub method for creating a device from a file descriptor. Always returns undef.
SEE ALSO
TUI::TextView::Terminal, TUI::Views::Scroller
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) 2025-2026 the "AUTHORS" as listed above.
This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).