Next: , Previous: , Up: Classes   [Index]


ANSIWidgetPane

ANSIWidgetPane Class

ANSIWidgetPane contains methods and instance variables that are useful when creating widgets, which are made up of one or more pane objects for display on ANSI terminals.

Widgets should be designed so they can be displayed either independently or above a main pane object. That means a widget class needs to provide its own methods for rendering the widget, handling input, returning the input to the application program, and cleaning up if necessary.

The ANSIWidgetPane class provides basic methods for these tasks, but subclasses probably will need to implement their own versions of these methods. For example, the ANSITextEntryPane class contains its own handleInput method.

Or, for example, a subclass can provide a withdraw method, as in this method from ANSITextEntryPane, which unmaps the widget pane if it was popped up over another pane. See ANSITextEntryPane.

ANSIWidgetPane instanceMethod withdraw (void) {
  if (self parentPane) {
    self unmap;
  } else {
    self paneStream clear;
  }
  return NULL;
}

A Note About Using Widgets with Serial Terminals.

The ANSIWidgetPane classes do not, at this time, provide any methods for setting terminal parameters for a widget and all subpanes. That means applications must see the terminal parameters of each subwidget, and there does not yet exist a general mechanism for handling the input and output of entire sets of widgets. However, classes can always implement convenience methods if necessary. For an example, see the ANSIMessageBoxPane section. See ANSIMessageBoxPane.

Instance Variables

hasFocus

An Integer that is either TRUE or FALSE depending on whether the subwidget has the input focus. Methods should set and check the isInputPane instance variable, below, to make sure that a subwidget’s class accepts user input.

isInputPane

An Integer that is either TRUE or FALSE depending on whether the pane can take the input focus.

paneID

An Integer that contains an identifier of a widget pane or subpane.

parentPane

A Key object that contains the address of a parent pane, if the widget is displayed over a normal pane. If this variable is set, then the widget needs to map and unmap itself from the parent pane as with a normal child pane.

titleString

An optional String object that can be displayed as the widget’s title.

withdraw

Delete the receiver from the display, by clearing the display if the widget is displayed independently, or by unmapping it from a parent widget.

Instance Methods

addBuffer (Integer width, Integer height,

Integer cellSize) A convenience method that creates the receiver pane’s buffers with the width, height and character cell size given as the arguments. The cellSize argument should almost always be ‘1’. If the pane has buffers created previously by another method, addBuffer deletes the old buffers first.

handleInput

Process InputEvent objects from the receiver’s paneStream input handle. This handleInput definition provides only basic functionality. Subclasses should re-implement this method with the additional functions that the widget needs.

map (void)

Maps the receiver widget pane over another pane that was defined by a previous parent message (below).

mapSubWidget (ANSIWidgetPane subPane)

Maps the receiver widget pane over another pane that was defined by a previous parent message (below), and sets the subPane’s mapped instance variable to TRUE, and adds subWidgetPane, to the parent pane’s children list. subPane may be any subclass of ANSIWidgetPane.

new (paneName1, paneName2, ... paneNameN;)

Create one or more new ANSIWidgetPane objects. The object is similar to an ANSITerminalPane object, but it contains the additional instance variables listed in the previous section. This method also relies on the ANSITerminalPane methods withShadow and withBorder, and the ANSITerminalStream method openInputQueue.

parent (ANSITerminalPane parentPaneObject)

Sets the receiver’s parentPane instance variable to the main ANSITerminalPane (or subclass) object that the receiver is to be mapped over. This method also provides the subWidget with copies of the parent’s input and output stream handles.

title (String titleString)

Set the receiver’s title string to the argument.

unmap (void)

Unmaps the receiver from its parent pane. Used after previous parent and map messages (above).


Next: , Previous: , Up: Classes   [Index]