Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TWindow Class Reference

Implements a window. More...

#include <views.h>

Inheritance diagram for TWindow::

TGroup TWindowInit TView TObject TStreamable TDialog TEditWindow THelpWindow THistoryWindow TChDirDialog TColorDialog TFileDialog List of all members.

Public Methods

 TWindow (const TRect &bounds, const char *aTitle, short aNumber)
 ~TWindow ()
virtual void close ()
virtual TPalettegetPalette () const
virtual const char* getTitle (short maxSize)
virtual void handleEvent (TEvent &event)
virtual void setState (ushort aState, Boolean enable)
virtual void sizeLimits (TPoint &min, TPoint &max)
TScrollBarstandardScrollBar (ushort aOptions)
virtual void zoom ()
virtual void shutDown ()

Static Public Methods

TFrameinitFrame (TRect)
TStreamablebuild ()

Public Attributes

uchar flags
TRect zoomRect
short number
short palette
TFrameframe
const char* title

Static Public Attributes

const char* const name

Protected Methods

 TWindow (StreamableInit)
virtual void write (opstream &os)
virtual void* read (ipstream &is)

Detailed Description

A TWindow object is a specialized group that typically owns a TFrame object, an interior TScroller object, and one or two TScrollBar objects. These attached subviews provide the "visibility" to the TWindow object.

TWindow inherits multiply from TGroup and the virtual base class TWindowInit.

Definition at line 3441 of file views.h.


Constructor & Destructor Documentation

TWindow::TWindow ( const TRect & bounds,
const char * aTitle,
short aNumber )
 

Calls the TGroup constructor to set window bounds to `bounds'. Sets default state to sfShadow. Sets default options to (ofSelectable | ofTopSelect). Sets default growMode to gfGrowAll | gfGrowRel. Sets default flags to (wfMove | wfGrow | wfClose | wfZoom). Sets the title data member to `aTitle' and the number data member to `aNumber'.

Calls initFrame() by default, and if the resulting frame pointer is nonzero, inserts it in this window's group. Finally, the default zoomRect is set to the given bounds.

`aNumber' is the number assigned to this window. If `aNumber' is between 1 and 9, the number will appear in the frame title, and the window can be selected with the Alt-n keys (n = 1 to 9).

Use the constant wnNoNumber to indicate that the window is not to be numbered and cannot be selected via the Alt+number key. wnNoNumber is defined in `views.h' as:

 const ushort wnNoNumber = 0;
 

TWindow::~TWindow ( )
 

Deletes title, then disposes of the window and any subviews by calling the parent destructor(s).

TWindow::TWindow ( StreamableInit ) [protected]
 

Each streamable class needs a "builder" to allocate the correct memory for its objects together with the initialized virtual table pointers. This is achieved by calling this constructor with an argument of type StreamableInit.


Member Function Documentation

TStreamable * TWindow::build ( ) [static]
 

Called to create an object in certain stream-reading situations.

Reimplemented from TGroup.

Reimplemented in TColorDialog, TDialog, TEditWindow, TFileDialog, and TChDirDialog.

void TWindow::close ( ) [virtual]
 

Calls valid(cmClose); if True is returned, the calling window is deleted.

See also:
TGroup::Valid

Reimplemented in TEditWindow.

TPalette & TWindow::getPalette ( ) const [virtual]
 

Returns the palette string given by the palette index in the palette data member.

Reimplemented from TView.

Reimplemented in TDialog, THistoryWindow, and THelpWindow.

const char * TWindow::getTitle ( short maxSize ) [virtual]
 

Returns title data member, the window's title string.

Reimplemented in TEditWindow.

void TWindow::handleEvent ( TEvent & event ) [virtual]
 

First calls TGroup::handleEvent(), and then handles events specific to a TWindow as follows:

  1. The following evCommand events are handled if the flags data member permits that operation:
    • cmResize (move or resize the window using the dragView() member function);
    • cmClose (close the window by creating a cmCancel event);
    • cmZoom (zoom the window using the zoom() member function).
  2. evKeyDown events with a keyCode value of kbTab or kbShiftTab are handled by selecting the next or previous selectable subview (if any).
  3. An evBroadcast event with a command value of cmSelectWindowNum is handled by selecting the window if the `event.infoInt' data member is equal to number data member.

Reimplemented from TGroup.

Reimplemented in TColorDialog, TDialog, TEditWindow, TFileDialog, and TChDirDialog.

TFrame * TWindow::initFrame ( TRect ) [static]
 

Creates a TFrame object for the window and stores a pointer to the frame in the frame data member. TWindow constructor calls initFrame(); it should never be called directly. You can override initFrame() to instantiate a user-defined class derived from TFrame instead of the standard TFrame.

void * TWindow::read ( ipstream & is ) [protected, virtual]
 

Reads from the input stream `is'.

Reimplemented from TGroup.

Reimplemented in TColorDialog, TEditWindow, TFileDialog, and TChDirDialog.

void TWindow::setState ( ushort aState,
Boolean enable ) [virtual]
 

First calls TGroup::setState(aState, enable). Then, if `aState' is equal to sfSelected, activates or deactivates the window and all its subviews using a call to setState(sfActive, enable), and calls enableCommands() or disableCommands() for cmNext, cmPrev, cmResize, cmClose and cmZoom.

See also:
TGroup::setState , TView::state

Reimplemented from TGroup.

void TWindow::shutDown ( ) [virtual]
 

Used internally by TObject::destroy() to ensure correct destruction of derived and related objects. shutDown() is overridden in many classes to ensure the proper setting of related data members when destroy() is called.

Reimplemented from TGroup.

Reimplemented in TFileDialog, and TChDirDialog.

void TWindow::sizeLimits ( TPoint & min,
TPoint & max ) [virtual]
 

Overrides TView::sizeLimits(). First calls TView::sizeLimits(min, max) and then changes `min' to the minimum window size, minWinSize, a TPoint constant defined at the head of file `TWindow.cc'. minWinSize is currently set to (16, 6).

minWinSize defines the minimum size of a TWindow or of any class derived from TWindow. Any change to minWinSize affects all windows, unless a window's sizeLimits() member function is overridden.

Reimplemented from TView.

Reimplemented in TEditWindow.

TScrollBar * TWindow::standardScrollBar ( ushort aOptions )
 

Creates, inserts, and returns a pointer to a "standard" scroll bar for the window. "Standard" means the scroll bar fits onto the frame of the window without covering the corners or the resize icon.

The `aOptions' parameter can be either sbHorizontal to produce a horizontal scroll bar along the bottom of the window or sbVertical to produce a vertical scroll bar along the right side of the window.

Either may be combined with sbHandleKeyboard to allow the scroll bar to respond to arrows and page keys from the keyboard in addition to mouse clicks.

The following values can be passed to standardScrollBar():

 Constant         Value  Meaning

 sbHorizontal     0x0000 Scroll bar is horizontal
 sbVertical       0x0001 Scroll bar is vertical
 sbHandleKeyboard 0x0002 Scroll bar responds to keyboard commands
 

void TWindow::write ( opstream & os ) [protected, virtual]
 

Writes to the output stream `os'.

Reimplemented from TGroup.

Reimplemented in TColorDialog, TEditWindow, TFileDialog, and TChDirDialog.

void TWindow::zoom ( ) [virtual]
 

Zooms the calling window. This member function is usually called in response to a cmZoom command (triggered by a click on the zoom icon). zoom() takes into account the relative sizes of the calling window and its owner, and the value of zoomRect.


Member Data Documentation

uchar TWindow::flags
 

The flags data member contains a combination of mnemonics constants that define bits. If the bits are set, the window will have the corresponding attribute: the window can move, grow, close or zoom.

The window flags are defined as follows:

 Constant Value Meaning

 wfMove   0x01  Window can be moved

 wfGrow   0x02  Window can be resized and has a grow icon in the
                lower-right corner

 wfClose  0x04  Window frame has a close icon that can be mouse-clicked
                to close the window

 wfZoom   0x08  Window frame has a zoom icon that can be mouse-clicked
                to zoom the window
 

If a particular bit is set, the corresponding property is enabled; otherwise that property is disabled.

Definition at line 3604 of file views.h.

TFrame * TWindow::frame
 

Pointer to this window's associated TFrame object.

Definition at line 3635 of file views.h.

const char *const TWindow::name [static]
 

Undocumented.

Reimplemented from TGroup.

Reimplemented in TColorDialog, TDialog, TEditWindow, TFileDialog, and TChDirDialog.

Definition at line 3664 of file views.h.

short TWindow::number
 

The number assigned to this window. If number is between 1 and 9, the number will appear in the frame title, and the window can be selected with the Alt-n keys (n = 1 to 9).

Definition at line 3614 of file views.h.

short TWindow::palette
 

Specifies which palette the window is to use: wpBlueWindow, wpCyanWindow or wpGrayWindow. These constants define the three standard color mapping assignments for windows:

 Constant     Value  Meaning

 wpBlueWindow 0      Window text is yellow on blue
 wpCyanWindow 1      Window text is blue on cyan
 wpGrayWindow 2      Window text is black on gray
 

By default, the TWindow palette is wpBlueWindow. The default for TDialog objects is wpGrayWindow.

Definition at line 3631 of file views.h.

const char * TWindow::title
 

A character string giving the (optional) title that appears on the frame.

Definition at line 3640 of file views.h.

TRect TWindow::zoomRect
 

The normal, unzoomed boundary of the window.

Definition at line 3608 of file views.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:39 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001