Next: ANSIWidgetPane, Previous: Pane, Up: Classes [Index]
ANSITerminalPane
ClassThe ANSITerminalPane
class allows applications to write output
to multiple panes or windows on ANSI terminals, consoles and
xterm
s.
Printing output to a pane does not immediately update the display;
instead, the pane’s contents are updated, and the pane is displayed
with the refresh
message.
The ANSITerminalPane
class supports the display multiple panes.
Each pane is a child of the initial, or parent, pane. Child panes
attached to the parent pane (with the Pane
: attach
method) inherit the input and output streams of the parent pane.
The map
configures a child pane for display on top of its parent
pane, and the child pane is displayed on top of the parent pane at the
next refresh
message.
Coordinates and dimensions are numbered from 1,1, which is the upper left-hand corner of a terminal or a content region.
ANSITerminalPanes
support bold, blinking, reverse, and
underline text attributes for its contents. Some attributes, like
blinking and underlined text, or foreground and background colors, are
not universally supported.
The program listing shows how to display parent and child
ANSITerminalPane
objects.
int main () { ANSITerminalPane new parentPane; ANSITerminalPane new childPane; /* * Use openOn with the terminal device * to open a remote serial terminal. */ /* parentPane paneStream openOn "/dev/ttya"; */ parentPane initialize 1, 1, 79, 24; parentPane withShadow; parentPane withBorder; parentPane refresh; parentPane gotoXY 29, 10; parentPane printOn "Parent Pane"; parentPane gotoXY 25, 11; parentPane printOn "Please press [Enter]."; parentPane refresh; getchar (); /* Actual apps should use getCh, etc. */ childPane initialize 10, 10, 40, 10; childPane withShadow; childPane withBorder; childPane boldOnOff; parentPane map childPane; parentPane attach childPane; childPane gotoXY 13, 2; childPane printOn "Child Pane"; childPane gotoXY 10, 3; childPane printOn "Please press [Enter]."; parentPane refresh; getchar (); parentPane unmap childPane; parentPane refresh; parentPane paneStream closeStream; childPane delete; parentPane delete; }
paneStream
An ANSITerminalStream
object containing the input and output
channels and parameters for the pane and its child panes. When
created with new
, initializes input and output to the terminal’s
standard input and standard output file handles. Communication
settings, including TTY settings, can be set with methods from the
ANSITerminalStream
class. See ANSITerminalStream.
shadow
If TRUE,
draw a shadow beneath the pane. The shadow is drawn
over the background window and is not part of the pane’s content
region.
border
If TRUE,
draw a border around the edges of the pane. The
border is within the pane’s content region, and it can objscure text
beneath it.
parentOrigin
A Point
object containing the X and Y coordinates of the parent
pane’s origin.
parentClip
A Point
object containing the X and Y dimensions of the parent
pane’s content area.
blinkOnOff (void
)
Toggle the pane’s blinking graphics attribute; if enabled, display blinking text; if disabled, display normal text. Blinking text is not supported on all terminals.
boldOnOff (void
)
Toggle the pane’s bold graphics attribute; if enabled, display bold text; if disabled, display normal text.
childRefresh (void
)
Refresh the receiver, a child pane. This method is called by
refresh
for each of a parent pane’s children.
cursorPos (int
x, int
y)
Position the software cursor at coordinates x, y within
the pane’s content area. This method is a synonym for gotoXY,
below.
delete
The class destructor. This method performs the extra
cleanup that the ANSITerminalPane
class requires.
gotoXY (int
x, int
y)
Position the software cursor at coordinates x, y within the pane’s content area.
initialize (int
x_org, int
y_org, int
x_size, int
y_size)
Initialize the receiver pane’s coordinate instance variables, and screen buffers.
map (ANSITerminalPane
__child)
Enable the display of a child pane, and buffer any screen contents.
The receiver should be a pane that completely encloses the child
pane’s content region and shadow if any. The pane is displayed when
the parent pane receives a refresh
message.
new (char *
__paneName)
Create a new ANSITerminalPane
object. If more than one label
is given in the argument list, create new ANSITerminalPane
objects with those names. This method also creates and initializes
the paneStream
(class ANSITerminalStream
) instance
variable. See ANSITerminalStream.
printOn (char *
__fmt, ...
)
Print the arguments to the pane’s content area at the software cursor
position. The output is displayed after the receiver pane receives a
refresh
message.
putCharXY (int
x, int
y, char
c)
Put character c at coordinates x,y of the pane’s content area. The character is displayed immediately using the pane’s current graphics mode.
refresh (void
)
Display the receiver pane content and decorations like borders and
shadows on the screen. This method also calls childRefresh
for
each child pane that is attached (with attach
, class
Pane
) to the receiver pane. See Pane.
resetGraphics (void
)
Reset the pane’s graphics attributes to normal text; i.e., bold, underline, reverse, and blink attributes are turned off.
reverseOnOff (void
)
Toggle the pane’s reverse graphics attribute; if enabled, display text in inverse video; if disabled, display normal text.
terminalHeight
Returns an Integer
with the terminal’s height in character rows.
Note: If an operating system has a terminal interface that Ctalk doesn’t know about, then the method returns 0.
terminalWidth
Returns an Integer
with the terminal’s width in character columns.
See the note about terminal compatibility in the terminalHeight
entry,
above.
underlineOnOff (void
)
Toggle the pane’s underline graphics attribute; if enabled, display text underlined; if disabled, display normal text. Underlined text is not supported on all terminals.
unmap (ANSITerminalPane
__child)
Hide a child pane, and restore any screen contents that were obscured
when the child pane was displayed. The child pane is withdrawn when
the parent pane receives the next refresh
message.
withBorder (void
)
Enable the display of a border around the edges of the pane’s content area, using ANSI line drawing characters. The border is within the pane’s content area and can obscure text at the edges of the pane.
withShadow (void
)
Enable the display of a shadow underneath the pane. The shadow is outside of the pane’s content area, and should be within the clipping area of the parent pane.
Next: ANSIWidgetPane, Previous: Pane, Up: Classes [Index]