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

TView Class Reference

The base of all visible objects. More...

#include <views.h>

Inheritance diagram for TView::

TObject TStreamable TBackground TButton TCluster TColorDisplay TColorSelector TEditor TFileInfoPane TFrame TGroup THistory TIndicator TInputLine TListViewer TMenuView TScrollBar TScroller TStaticText TStatusLine List of all members.

Public Types

enum  phaseType { phFocused, phPreProcess, phPostProcess }
enum  selectMode { normalSelect, enterSelect, leaveSelect }

Public Methods

 TView (const TRect &bounds)
 ~TView ()
virtual void sizeLimits (TPoint &min, TPoint &max)
TRect getBounds ()
TRect getExtent ()
TRect getClipRect ()
Boolean mouseInView (TPoint mouse)
Boolean containsMouse (TEvent &event)
void locate (TRect &bounds)
virtual void dragView (TEvent &event, uchar mode, TRect &limits, TPoint minSize, TPoint maxSize)
virtual void calcBounds (TRect &bounds, TPoint delta)
virtual void changeBounds (const TRect &bounds)
void growTo (short x, short y)
void moveTo (short x, short y)
void setBounds (const TRect &bounds)
virtual ushort getHelpCtx ()
virtual Boolean valid (ushort command)
void hide ()
void show ()
virtual void draw ()
void drawView ()
Boolean exposed ()
Boolean focus ()
void hideCursor ()
void drawHide (TView *lastView)
void drawShow (TView *lastView)
void drawUnderRect (TRect &r, TView *lastView)
void drawUnderView (Boolean doShadow, TView *lastView)
virtual ushort dataSize ()
virtual void getData (void *rec)
virtual void setData (void *rec)
virtual void awaken ()
void blockCursor ()
void normalCursor ()
virtual void resetCursor ()
void setCursor (int x, int y)
void showCursor ()
void drawCursor ()
void clearEvent (TEvent &event)
Boolean eventAvail ()
virtual void getEvent (TEvent &event)
virtual void handleEvent (TEvent &event)
virtual void putEvent (TEvent &event)
virtual void endModal (ushort command)
virtual ushort execute ()
ushort getColor (ushort color)
virtual TPalettegetPalette () const
uchar mapColor (uchar)
Boolean getState (ushort aState)
void select ()
virtual void setState (ushort aState, Boolean enable)
void keyEvent (TEvent &event)
Boolean mouseEvent (TEvent &event, ushort mask)
TPoint makeGlobal (TPoint source)
TPoint makeLocal (TPoint source)
TView* nextView ()
TView* prevView ()
TView* prev ()
void makeFirst ()
void putInFrontOf (TView *Target)
TView* TopView ()
void writeBuf (short x, short y, short w, short h, const void *b)
void writeBuf (short x, short y, short w, short h, const TDrawBuffer &b)
void writeChar (short x, short y, char c, uchar color, short count)
void writeLine (short x, short y, short w, short h, const TDrawBuffer &b)
void writeLine (short x, short y, short w, short h, const void *b)
void writeStr (short x, short y, const char *str, uchar color)
virtual void shutDown ()

Static Public Methods

Boolean commandEnabled (ushort command)
void disableCommands (TCommandSet &commands)
void enableCommands (TCommandSet &commands)
void disableCommand (ushort command)
void enableCommand (ushort command)
void getCommands (TCommandSet &commands)
void setCommands (TCommandSet &commands)
void setCmdState (TCommandSet &commands, Boolean enable)
TStreamablebuild ()

Public Attributes

TView* next
TPoint size
ushort options
ushort eventMask
ushort state
TPoint origin
TPoint cursor
uchar growMode
uchar dragMode
ushort helpCtx
TGroupowner

Static Public Attributes

Boolean commandSetChanged
TCommandSet curCommandSet
Boolean showMarkers
uchar errorAttr
const char* const name

Protected Methods

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

Detailed Description

The base of all visible objects.

Most programs make use of the TView derivatives: TFrame, TScrollBar, TScroller, TListViewer, TGroup, and TWindow objects.

TView objects are rarely instantiated in TVision programs. The TView class exists to provide basic data and functionality for its derived classes. You'll probably never need to construct an instance of TView itself, but most of the common behavior of visible elements in TVision applications comes from TView.

Definition at line 807 of file views.h.


Member Enumeration Documentation

enum TView::phaseType
 

See also:
TGroup::handleEvent , TGroup::phase

Definition at line 814 of file views.h.

enum TView::selectMode
 

Used internally by TVision.

Definition at line 818 of file views.h.


Constructor & Destructor Documentation

TView::TView ( const TRect & bounds )
 

Creates a TView object with the given `bounds' rectangle. TView constructor calls the TObject constructor and then sets the data members of the new TView to the following values:

 Data member Value

 cursor      (0, 0)
 dragMode    dmLimitLoY
 eventMask   evMouseDown | evKeyDown | evCommand
 growMode    0
 helpCtx     hcNoContext
 next        0
 options     0
 origin      (bounds.A.x, bounds.A.y)
 owner       0
 size        (bounds.B.x - bounds.A.x, bounds.B.y - bounds.A.y)
 state       sfVisible
 

TView::~TView ( )
 

Hides the view and then, if it has an owner, removes it from the group.

TView::TView ( 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

TView * TView::TopView ( )
 

Returns a pointer to the current modal view, or 0 if none such.

void TView::awaken ( ) [virtual]
 

The default awaken() does nothing. When a group is loaded from a stream, the last thing the TGroup::read() function does is call the awaken() methods of all subviews, giving those views a chance to initialize themselves once all subviews have loaded.

If you create objects that depend on other subviews to initialize themselves after being read from a stream, you can override awaken() to perform that initialization.

Reimplemented in TGroup.

void TView::blockCursor ( )
 

Sets sfCursorIns in state data member to change the cursor to a solid block. The cursor will only be visible if sfCursorVis is also set (and the view is visible).

TStreamable * TView::build ( ) [static]
 

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

Reimplemented in TBackground, TDeskTop, TColorSelector, TMonoSelector, TColorDisplay, TColorGroupList, TColorItemList, TColorDialog, TDialog, TInputLine, TButton, TCluster, TRadioButtons, TCheckBoxes, TMultiCheckBoxes, TListBox, TStaticText, TParamText, TLabel, THistory, TIndicator, TEditor, TMemo, TFileEditor, TEditWindow, TMenuView, TMenuBar, TMenuBox, TStatusLine, TOutlineViewer, TOutline, TFileInputLine, TSortedListBox, TFileList, TFileInfoPane, TFileDialog, TDirListBox, TChDirDialog, TFrame, TScrollBar, TScroller, TListViewer, TGroup, and TWindow.

void TView::calcBounds ( TRect & bounds,
TPoint delta ) [virtual]
 

When a view's owner changes size, the owner repeatedly calls calcBounds() and changeBounds() for all its subviews.

calcBounds() must calculate the new bounds of the view given that its owner's size has changed by `delta', and return the new bounds in `bounds'.

calcBounds() calculates the new bounds using the flags specified in growMode data member.

void TView::changeBounds ( const TRect & bounds ) [virtual]
 

changeBounds() must change the view's bounds (origin and size data members) to the rectangle given by the `bounds' parameter. Having changed the bounds, changeBounds() must then redraw the view.

changeBounds() is called by various TView member functions, but should never be called directly.

changeBounds() first calls setBounds(bounds) and then calls drawView().

Reimplemented in TEditor, THelpViewer, TScroller, TListViewer, and TGroup.

void TView::clearEvent ( TEvent & event )
 

Standard member function used in handleEvent() to signal that the view has successfully handled the event.

Sets `event.what' to evNothing and `event.message.infoPtr' to this.

Boolean TView::commandEnabled ( ushort command ) [static]
 

Returns True if the given command is currently enabled; otherwise it returns False.

Note that when you change a modal state, you can then disable and enable commands as you wish; when you return to the previous modal state, however, the original command set will be restored.

Boolean TView::containsMouse ( TEvent & event )
 

Returns True if a mouse event occurs inside the calling view, otherwise returns False. Returns True if the view is visible and the mouse coordinates (defined in `event.mouse.where') are within this view.

The coordinate is defined in the global coordinate system.

See also:
TView::makeGlobal , TView::makeLocal

ushort TView::dataSize ( ) [virtual]
 

dataSize() must be used to return the size of the data read from and written to data records by setData() and getData(). The data record mechanism is typically used only in views that implement controls for dialog boxes.

TView::dataSize() returns zero to indicate that no data was transferred.

Reimplemented in TColorDialog, TInputLine, TCluster, TMultiCheckBoxes, TListBox, TMemo, TFileList, TChDirDialog, and TGroup.

void TView::disableCommand ( ushort command ) [static]
 

Disables the given command. If the command set is changed by the call, commandSetChanged is set True.

void TView::disableCommands ( TCommandSet & commands ) [static]
 

Disables the commands specified in the `commands' argument. If the command set is changed by this call, commandSetChanged is set True.

void TView::dragView ( TEvent & event,
uchar mode,
TRect & limits,
TPoint minSize,
TPoint maxSize ) [virtual]
 

Drags the view in the ways specified by the `mode' argument, that is interpreted like the growMode data member.

`limits' specifies the rectangle (in the owner's coordinate system) within which the view can be moved, and `min' and `max' specify the minimum and maximum sizes the view can shrink or grow to.

The event leading to the dragging operation is needed in `event' to distinguish mouse dragging from use of the cursor keys.

void TView::draw ( ) [virtual]
 

Draws the view on the screen.

Called whenever the view must draw (display) itself. draw() must cover the entire area of the view.

This member function must be overridden appropriately for each derived class. draw() is seldom called directly, since it is more efficient to use drawView(), which draws only views that are exposed; that is, some or all of the view is visible on the screen.

If required, draw can call getClipRect() to obtain the rectangle that needs redrawing, and then only draw that area. For complicated views, this can improve performance noticeably.

To perform its task, draw() usually uses a TDrawBuffer object.

Reimplemented in TBackground, TColorSelector, TMonoSelector, TColorDisplay, TInputLine, TButton, TRadioButtons, TCheckBoxes, TMultiCheckBoxes, TStaticText, TLabel, THistory, TIndicator, TEditor, THelpViewer, TMenuBar, TMenuBox, TStatusLine, TOutlineViewer, TFileInfoPane, TTerminal, TFrame, TScrollBar, TListViewer, and TGroup.

void TView::drawCursor ( )
 

If the view is sfFocused, the cursor is reset with a call to resetCursor().

See also:
TView::state

void TView::drawHide ( TView * lastView )
 

Calls drawCursor() followed by drawUnderView(). The latter redraws all subviews (with shadows if required) until the given `lastView' is reached.

void TView::drawShow ( TView * lastView )
 

Calls drawView(), then if state data member has the sfShadow bit set, drawUnderView() is called to draw the shadow.

void TView::drawUnderRect ( TRect & r,
TView * lastView )
 

Calls owner->clip.intersect(r) to set the area that needs drawing. Then, all the subviews from the next view to the given `lastView' are drawn using drawSubViews(). Finally, owner->clip is reset to owner->getExtent().

See also:
TGroup::clip , TRect::intersect , TView::getExtent

void TView::drawUnderView ( Boolean doShadow,
TView * lastView )
 

Calls drawUnderRect(r, lastView), where `r' is the calling view's current bounds. If `doShadow' is True, the view's bounds are first increased by shadowSize (see `TView.cc' for more).

See also:
drawUnderRect

void TView::drawView ( )
 

Draws the view on the screen.

Calls draw() if exposed() returns True, indicating that the view is exposed (see sfExposed). If exposed() returns False, drawView() does nothing.

You should call drawView() (not draw()) whenever you need to redraw a view after making a change that affects its visual appearance.

void TView::enableCommand ( ushort command ) [static]
 

Enables the given command. If the command set is changed by this call, commandSetChanged is set True.

void TView::enableCommands ( TCommandSet & commands ) [static]
 

Enables all the commands in the `commands' argument. If the command set is changed by this call, commandSetChanged is set True.

void TView::endModal ( ushort command ) [virtual]
 

Calls TopView() to seek the top most modal view. If there is none such (that is, if TopView() returns 0) no further action is taken. If there is a modal view, that view calls endModal(), and so on.

The net result is that endModal() terminates the current modal state. The `command' argument is passed to the TGroup::execView() that created the modal state in the first place.

Reimplemented in TGroup.

Boolean TView::eventAvail ( )
 

Calls getEvent() and returns True if an event is available. Calls putEvent() to set the event as pending.

See also:
TProgram::pending

ushort TView::execute ( ) [virtual]
 

Is called from TGroup::execView() whenever a view becomes modal. If a view is to allow modal execution, it must override execute() to provide an event loop. The value returned by execute() will be the value returned by TGroup::execView().

The default TView::execute() simply returns cmCancel.

Reimplemented in TMenuView, and TGroup.

Boolean TView::exposed ( )
 

Checks if the view is exposed.

Returns True if any part of the view is visible on the screen. The view is exposed if:

  1. it has the sfExposed bit set in state data member
  2. it has the sfVisible bit set in state data member
  3. its coordinates make it fully or partially visible on the screen.

Boolean TView::focus ( )
 

Tries to grab the focus.

The view can grab the focus if:

  1. the view is not selected (bit sfSelected cleared in state)
  2. the view is not modal (bit sfModal cleared in state)
  3. the owner exists and it is focused
If all the above conditions are True, the focus() method calls select() to get the focus.

TRect TView::getBounds ( )
 

Returns the current value of size, the bounding rectangle of the view in its owner's coordinate system.

  1. `a' is set to origin
  2. `b' is set to origin + size

TRect TView::getClipRect ( )
 

Returns the clipping rectangle: the smallest rectangle which needs to be redrawn in a draw() call.

For complicated views, draw() can use getClipRect() to improve performance noticeably.

ushort TView::getColor ( ushort color )
 

Maps the palette indices in the low and high bytes of `color' into physical character attributes by tracing through the palette of the view and the palettes of all its owners.

void TView::getCommands ( TCommandSet & commands ) [static]
 

Returns, in the `commands' argument, the current command set.

void TView::getData ( void * rec ) [virtual]
 

getData() must copy dataSize() bytes from the view to the data record given by the `rec' pointer. The data record mechanism is typically used only in views that implement controls for dialog boxes.

See also:
TView::setData

The default TView::getData() does nothing.

Reimplemented in TColorDialog, TInputLine, TCluster, TMultiCheckBoxes, TListBox, TMemo, TFileList, TFileDialog, TChDirDialog, and TGroup.

void TView::getEvent ( TEvent & event ) [virtual]
 

Returns the next available event in the `event' argument. Returns evNothing if no event is available. By default, it calls the view's owner's getEvent().

See also:
TGroup::getEvent , Program::getEvent

Reimplemented in TProgram, and TApplication.

Referenced by TApplication::getEvent().

TRect TView::getExtent ( )
 

Returns the extent rectangle of the view.

  1. `a' is set to (0, 0)
  2. `b' is set to size

ushort TView::getHelpCtx ( ) [virtual]
 

getHelpCtx() returns the view's help context. The default getHelpCtx() returns the value in the helpCtx data member, or returns hcDragging if the view is being dragged (see sfDragging).

Reimplemented in TCluster, TMenuView, and TGroup.

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

getPalette() must return a string representing the view's palette.

This can be 0 (empty string) if the view has no palette. getPalette() is called by writeChar() and writeStr() when converting palette indices to physical character attributes.

The default return value of 0 causes no color translation to be performed by this view. getPalette() is almost always overridden in derived classes.

Reimplemented in TBackground, TProgram, TDialog, TInputLine, TButton, TCluster, TStaticText, TLabel, THistoryViewer, THistoryWindow, THistory, TIndicator, TEditor, TMemo, THelpViewer, THelpWindow, TMenuView, TStatusLine, TOutlineViewer, TFileInfoPane, TFrame, TScrollBar, TScroller, TListViewer, and TWindow.

Boolean TView::getState ( ushort aState )
 

Returns True if the state given in `aState' is set in the data member state.

void TView::growTo ( short x,
short y )
 

Grows or shrinks the view to the given size using a call to locate().

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

handleEvent() is the central member function through which all TVision event handling is implemented. The `what' data member of the `event' parameter contains the event class (evXXXX), and the remaining `event' data members further describe the event.

To indicate that it has handled an event, handleEvent() should call clearEvent(). handleEvent() is almost always overridden in derived classes.

The default TView::handleEvent() handles evMouseDown events as follows:

If the view is:

  1. not selected (see sfSelected in TView::state)
  2. and not disabled (see sfDisabled in TView::state)
  3. and if the view is selectable (see ofSelectable in TView::options)
then the view selects itself by calling select(). No other events are handled by TView::handleEvent().

Reimplemented in TDeskTop, TProgram, TColorSelector, TMonoSelector, TColorDisplay, TColorGroupList, TColorItemList, TColorDialog, TDialog, TInputLine, TButton, TCluster, TLabel, THistoryViewer, THistory, TEditor, TMemo, TFileEditor, TEditWindow, THelpViewer, TMenuView, TStatusLine, TOutlineViewer, TFileInputLine, TSortedListBox, TFileInfoPane, TFileDialog, TChDirDialog, TFrame, TScrollBar, TScroller, TListViewer, TGroup, and TWindow.

void TView::hide ( )
 

Hides the view by calling setState() to clear the sfVisible flag in the state data member.

void TView::hideCursor ( )
 

Hides the cursor by calling setState() to clear the sfCursorVis flag in the state data member.

void TView::keyEvent ( TEvent & event )
 

Returns, in the `event' variable, the next evKeyDown event. It waits, ignoring all other events, until a keyboard event becomes available.

void TView::locate ( TRect & bounds )
 

Changes the bounds of the view to those of the `bounds' argument. The view is redrawn in its new location.

locate() calls sizeLimits() to verify that the given bounds are valid, and then calls changeBounds() to change the bounds and redraw the view.

void TView::makeFirst ( )
 

Moves the view to the top of its owner's subview list. A call to makeFirst() corresponds to putInFrontOf(owner->first()).

See also:
TGroup::first , TView::putInFrontOf

TPoint TView::makeGlobal ( TPoint source )
 

Converts the `source' point coordinates from local (view) to global (screen) and returns the result.

TPoint TView::makeLocal ( TPoint source )
 

Converts the `source' point coordinates from global (screen) to local (view) and returns the result.

Useful for converting the event.where data member of an evMouse event from global coordinates to local coordinates.

For example:

 mouseLoc = makeLocal(eventWhere);
 

uchar TView::mapColor ( uchar )
 

Maps the given color to an offset into the current palette. mapColor() works by calling getPalette() for each owning group in the chain.

It succesively maps the offset in each palette until the ultimate owning palette is reached.

If `color' is invalid (for example, out of range) for any of the palettes encountered in the chain, mapColor() returns errorAttr.

Boolean TView::mouseEvent ( TEvent & event,
ushort mask )
 

Sets the next mouse event in the `event' argument. Returns True if this event is in the `mask' argument. Also returns False if an evMouseUp event occurs.

This member function lets you track a mouse while its button is down; for example, in drag block-marking operations for text editors.

Here's an extract of a handleEvent() routine that tracks the mouse with the view's cursor:

 void TMyView::handleEvent(TEvent& event)
 {
     TView::handleEvent(event);
     switch (event.what)
     {
     case evMouseDown:
         do
         {
             makeLocal(event.where, mouse);
             setCursor(mouse.x, mouse.y);
         }
         while (mouseEvent(event, evmouseMove));
         clearEvent(event);
     ...
     }
     ...
 }
 
See also:
TView::clearEvent , TView::makeLocal , TView::setCursor

Boolean TView::mouseInView ( TPoint mouse )
 

Returns True if the `mouse' argument (given in global coordinates) is within the calling view. Call makeGlobal and makeLocal to convert one point between different coordinate systems.

void TView::moveTo ( short x,
short y )
 

Moves the origin to the point (x,y) relative to the owner's view. The view's size is unchanged.

TView * TView::nextView ( )
 

Returns a pointer to the next subview in the owner's subview list. A 0 is returned if the calling view is the last one in its owner's list.

void TView::normalCursor ( )
 

Clears the sfCursorIns bit in state data member, thereby making the cursor into an underline. If sfCursorVis is set, the new cursor will be displayed.

TView * TView::prev ( )
 

Returns a pointer to the previous subview in the owner's subview list. If the calling view is the first one in its owner's list, prev() returns the last view in the list.

Note that prev() treats the list as circular, whereas prevView() treats the list linearly.

TView * TView::prevView ( )
 

Returns a pointer to the previous subview in the owner's subview list. A 0 is returned if the calling view is the first one in its owner's list.

Note that prev() treats the list as circular, whereas prevView() treats the list linearly.

void TView::putEvent ( TEvent & event ) [virtual]
 

Puts the event given by `event' into the event queue, causing it to be the next event returned by getEvent(). Only one event can be pushed onto the event queue in this fashion.

Often used by views to generate command events; for example,

 event.what = evCommand;
 event.command = cmSaveAll;
 event.infoPtr = 0;
 putEvent(event);
 

The default TView::putEvent() calls the view's owner's putEvent().

See also:
TGroup::putEvent , TProgram::pending , TProgram::putEvent

Reimplemented in TProgram.

void TView::putInFrontOf ( TView * Target )
 

Moves the calling view in front of the `Target' view in the owner's subview list. The call

 MyView.putInFrontOf(owner->first);
 

is equivalent to MyView.makeFirst(). This member function works by changing pointers in the subview list.

See also:
TView::makeFirst

Depending on the position of the other views and their visibility states, putInFrontOf() may obscure (clip) underlying views.

If the view is selectable (see ofSelectable) and is put in front of all other subviews, then the view becomes selected.

See also:
TView::options

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

Reads from the input stream `is'.

Reimplemented from TStreamable.

Reimplemented in TBackground, TColorSelector, TColorDisplay, TColorGroupList, TColorDialog, TInputLine, TButton, TCluster, TMultiCheckBoxes, TListBox, TStaticText, TParamText, TLabel, THistory, TEditor, TMemo, TFileEditor, TEditWindow, TMenuView, TStatusLine, TOutlineViewer, TOutline, TSortedListBox, TFileDialog, TChDirDialog, TScrollBar, TScroller, TListViewer, TGroup, and TWindow.

void TView::resetCursor ( ) [virtual]
 

Resets the cursor.

Reimplemented in TGroup.

void TView::select ( )
 

Selects the view (see sfSelected). If the view's owner is focused, then the view also becomes focused (see sfFocused).

See also:
TView::state

If the view has the ofTopSelect flag set in its options data member, then the view is moved to the top of its owner's subview list (using a call to makeFirst()).

void TView::setBounds ( const TRect & bounds )
 

Sets the bounding rectangle of the view to the value given by the `bounds' parameter. The origin data member is set to `bounds.a', and the size data member is set to the difference between `bounds.b' and `bounds.a'.

The setBounds() member function is intended to be called only from within an overridden changeBounds() member function. You should never call setBounds() directly.

Reimplemented in TMenuView.

void TView::setCmdState ( TCommandSet & commands,
Boolean enable ) [static]
 

Undocumented.

void TView::setCommands ( TCommandSet & commands ) [static]
 

Changes the current command set to the given `commands' argument.

void TView::setCursor ( int x,
int y )
 

Moves the hardware cursor to the point (x, y) using view-relative (local) coordinates. (0, 0) is the top-left corner.

void TView::setData ( void * rec ) [virtual]
 

setData() must copy dataSize() bytes from the data record given by `rec' to the view. The data record mechanism is typically used only in views that implement controls for dialog boxes.

See also:
TView::getData

The default TView::setData() does nothing.

Reimplemented in TColorDialog, TInputLine, TCluster, TRadioButtons, TMultiCheckBoxes, TListBox, TMemo, TFileList, TFileDialog, TChDirDialog, and TGroup.

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

Sets or clears a state flag in the state data member. The `aState' parameter specifies the state flag to modify, and the `enable' parameter specifies whether to turn the flag off (False) or on (True).

setState() then carries out any appropriate action to reflect the new state, such as redrawing views that become exposed when the view is hidden (sfVisible), or reprogramming the hardware when the cursor shape is changed (sfCursorVis and sfCursorIns).

setState() is sometimes overridden to trigger additional actions that are based on state flags. Another common reason to override setState() is to enable or disable commands that are handled by a particular view.

Reimplemented in TInputLine, TButton, TCluster, TIndicator, TEditor, TOutlineViewer, TDirListBox, TFrame, TScroller, TListViewer, TGroup, and TWindow.

void TView::show ( )
 

If the view is sfVisible, nothing happens. Otherwise, show() displays the view by calling setState() to set the sfVisible flag in state data member.

void TView::showCursor ( )
 

Turns on the hardware cursor by setting the sfCursorVis bit in state data member. Note that the cursor is invisible by default.

void TView::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 TObject.

Reimplemented in TDeskTop, TProgram, TLabel, THistory, TEditor, TFileEditor, TFileDialog, TChDirDialog, TScroller, TListViewer, TGroup, and TWindow.

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

Sets, in the `min' and `max' arguments, the minimum and maximum values that size data member may assume.

The default TView::sizeLimits returns (0, 0) in `min' and owner->size in `max'. If owner data member is 0, `max.x' and `max.y' are both set to INT_MAX.

Reimplemented in TEditWindow, and TWindow.

Boolean TView::valid ( ushort command ) [virtual]
 

Use this member function to check the validity of a view after it has been constructed or at the point in time when a modal state ends (due to a call to endModal()).

A `command' argument of cmValid (zero) indicates that the view should check the result of its constructor: valid(cmValid) should return True if the view was successfully constructed and is now ready to be used, False otherwise.

Any other (nonzero) `command' argument indicates that the current modal state (such as a modal dialog box) is about to end with a resulting value of `command'. In this case, valid() should check the validity of the view.

It is the responsibility of valid() to alert the user in case the view is invalid. The default TView::valid() simply returns True.

Reimplemented in TDialog, TInputLine, TEditor, TFileEditor, TFileDialog, TChDirDialog, and TGroup.

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

Writes to the output stream `os'.

Reimplemented from TStreamable.

Reimplemented in TBackground, TColorSelector, TColorDisplay, TColorGroupList, TColorDialog, TInputLine, TButton, TCluster, TMultiCheckBoxes, TListBox, TStaticText, TParamText, TLabel, THistory, TEditor, TMemo, TFileEditor, TEditWindow, TMenuView, TStatusLine, TOutlineViewer, TOutline, TFileDialog, TChDirDialog, TScrollBar, TScroller, TListViewer, TGroup, and TWindow.

void TView::writeBuf ( short x,
short y,
short w,
short h,
const TDrawBuffer & b ) [inline]
 

Writes the given buffer to the screen starting at the coordinates (x, y), and filling the region of width `w' and height `h'. Should only be used in draw() member functions.

See also:
TDrawBuffer

Definition at line 1913 of file views.h.

void TView::writeBuf ( short x,
short y,
short w,
short h,
const void * b )
 

Writes the given buffer to the screen starting at the coordinates (x, y), and filling the region of width `w' and height `h'. Should only be used in draw() member functions.

See also:
TDrawBuffer

Referenced by writeBuf().

void TView::writeChar ( short x,
short y,
char c,
uchar color,
short count )
 

Beginning at the point (x, y), writes `count' copies of the character `c' in the color determined by the color'th entry in the current view's palette. Should only be used in draw() functions.

void TView::writeLine ( short x,
short y,
short w,
short h,
const void * b )
 

Writes the line contained in the buffer `b' to the screen, beginning at the point (x, y) within the rectangle defined by the width `w' and the height `h'. If `h' is greater than 1, the line will be repeated `h' times. Should only be used in draw() member functions.

See also:
TDrawBuffer

void TView::writeLine ( short x,
short y,
short w,
short h,
const TDrawBuffer & b ) [inline]
 

Writes the line contained in the buffer `b' to the screen, beginning at the point (x, y) within the rectangle defined by the width `w' and the height `h'. If `h' is greater than 1, the line will be repeated `h' times. Should only be used in draw() member functions.

See also:
TDrawBuffer

Definition at line 1919 of file views.h.

void TView::writeStr ( short x,
short y,
const char * str,
uchar color )
 

Writes the string `str' with the color attributes of the color'th entry in the view's palette, beginning at the point (x, y). Should only be used in draw() member functions.


Member Data Documentation

Boolean TView::commandSetChanged [static]
 

Set to True whenever the view's command set is changed via an enable or disable command call.

See also:
TView::disableCommand , TView::disableCommands , TView::enableCommand , TView::enableCommands , TView::setCommands

Definition at line 1774 of file views.h.

TCommandSet TView::curCommandSet [static]
 

Holds the set of commands currently enabled for this view. Initially, the following commands are disabled: cmZoom, cmClose, cmResize, cmNext, cmPrev.

This data member is constantly monitored by handleEvent() to determine which of the received command events needs to be serviced.

curCommandSet should not be altered directly: use the appropriate set, enable, or disable calls.

See also:
TView::disableCommand , TView::disableCommands , TView::enableCommand , TView::enableCommands , TView::setCommands

Definition at line 1792 of file views.h.

TPoint TView::cursor
 

The location of the hardware cursor within the view. The cursor is visible only if the view is focused (sfFocused) and the cursor turned on (sfCursorVis).

See also:
TView::state

The shape of the cursor is either an underline or block (determined by sfCursorIns).

Definition at line 1680 of file views.h.

uchar TView::dragMode
 

Determines how the view should behave when mouse-dragged. The dragMode bits are defined as follows:

 Constant   Value Meaning

 dmDragMove 0x01  Allow the view to move
 dmDragGrow 0x02  Allow the view to change size
 dmLimitLoX 0x10  The view's left-hand side cannot move outside limits
 dmLimitLoY 0x20  The view's top side cannot move outside limits
 dmLimitHiX 0x40  The view's right-hand side cannot move outside limits
 dmLimitHiY 0x80  The view's bottom side cannot move outside limits
 dmLimitAll 0xF0  No part of the view can move outside limits
 

By default, the TView constructor sets the dragMode data member to dmLimitLoY. Currently, these constants and dragMode are only used to compose the `mode' argument of TView::dragView() calls when a view is moved or resized.

Definition at line 1740 of file views.h.

uchar TView::errorAttr [static]
 

Attribute used to signal an invalid palette selection. For example, mapColor() returns errorAttr if it is called with an invalid color argument.

By default, errorAttr is set to 0xCF, which shows as flashing red on white.

Definition at line 1815 of file views.h.

ushort TView::eventMask
 

eventMask is a bit mask that determines which event classes will be recognized by the view.

The default eventMask enables evMouseDown, evKeyDown, and evCommand. Assigning 0xFFFF to eventMask causes the view to react to all event classes; conversely, a value of zero causes the view to not react to any events.

Definition at line 1589 of file views.h.

uchar TView::growMode
 

Determines how the view will grow when its owner view is resized. To growMode is assigned one or more of the following growMode masks:

 Constant  Value Meaning

 gfGrowLoX 0x01  If set, the left-hand side of the view will maintain a
                 constant distance from its owner's right-hand side. If
                 not set, the movement indicated won't occur.

 gfGrowLoY 0x02  If set, the top of the view will maintain a constant
                 distance from the bottom of its owner.

 gfGrowHiX 0x04  If set, the right-hand side of the view will maintain a
                  constant distance from its owner's right side.

 gfGrowHiY 0x08  If set, the bottom of the view will maintain a
                 constant distance from the bottom of its owner's.

 gfGrowRel 0x10  For use with TWindow objects that are in the
                 desktop. The view will change size relative to the
                 owner's size, maintaining that relative size with
                 respect to the owner even when screen is resized.

 gfGrowAll 0x0F  If set, the view will move with the lower-right corner
                 of its owner.
 

Note that LoX = left side; LoY = top side; HiX = right side and HiY = bottom side.

Example:

 growMode = gfGrowLoX | gfGrowLoY;
 

Definition at line 1718 of file views.h.

ushort TView::helpCtx
 

The help context of the view. When the view is focused, this data member will represent the help context of the application, unless the context number is hcNoContext, in which case there is no help context for the view.

The following default help context constants are defined:

 Constant    Value Meaning

 hcNoContext 0     No context specified
 hcDragging  1     Object is being dragged
 

The default value of helpCtx is hcNoContext. getHelpCtx() returns hcDragging whenever the view is being dragged (as indicated by the sfDragging state flag).

TVision reserves help context values 0 through 999 for its own use. Programmers may define their own constants in the range 1,000 to 65,535.

Definition at line 1764 of file views.h.

const char *const TView::name [static]
 

Undocumented.

Reimplemented in TBackground, TDeskTop, TColorSelector, TMonoSelector, TColorDisplay, TColorGroupList, TColorItemList, TColorDialog, TDialog, TInputLine, TButton, TCluster, TRadioButtons, TCheckBoxes, TMultiCheckBoxes, TListBox, TStaticText, TParamText, TLabel, THistory, TIndicator, TEditor, TMemo, TFileEditor, TEditWindow, TMenuView, TMenuBar, TMenuBox, TMenuPopup, TStatusLine, TOutlineViewer, TOutline, TFileInputLine, TSortedListBox, TFileList, TFileInfoPane, TFileDialog, TDirListBox, TChDirDialog, TFrame, TScrollBar, TScroller, TListViewer, TGroup, and TWindow.

Definition at line 1875 of file views.h.

TView * TView::next
 

Pointer to next peer view in Z-order. If this is the last subview, next points to owner's first subview.

Definition at line 1426 of file views.h.

ushort TView::options
 

The options word flags determine various behaviors of the view. The following mnemonics are used to refer to the bit positions of the options data member. Setting a bit position to 1 indicates that the view has that particular attribute; clearing the bit position means that the attribute is off or disabled.

 Constant      Value  Meaning

 ofSelectable  0x0001 Set if the view should select itself automatically
                      (see sfSelected); for example, by a mouse
                      click in the view, or a Tab in a dialog box.

 ofTopSelect   0x0002 Set if the view should move in front of all other
                      peer views when selected. When the
                      ofTopSelect bit is set, a call to
                      select() corresponds to a call to
                      makeFirst(). TWindow and descendants by
                      default have the ofTopSelect bit set, which
                      causes them to move in front of all other windows
                      on the desktop when selected.

 ofFirstClick  0x0004 If clear, a mouse click that selects a view will
                      have no further effect. If set, such a mouse click
                      is processed as a normal mouse click after
                      selecting the view. Has no effect unless
                      ofSelectable is also set. See also
                      handleEvent(), sfSelected and
                      ofSelectable.

 ofFramed      0x0008 Set if the view should have a frame drawn around
                      it. A TWindow and any class derived from
                      TWindow, has a TFrame as its last
                      subview. When drawing itself, the TFrame
                      will also draw a frame around any other subviews
                      that have the ofFramed bit set.

 ofPreProcess  0x0010 Set if the view should receive focused events
                      before they are sent to the focused view.
                      Otherwise clear. See also sfFocused,
                      ofPostProcess, and TGroup::phase.

 ofPostProcess 0x0020 Set if the view should receive focused events
                      whenever the focused view fails to handle them.
                      Otherwise clear. See also sfFocused,
                      ofPreProcess and TGroup::phase.

 ofBuffered    0x0040 Used for TGroup objects and classes derived
                      from TGroup only. Set if a cache buffer
                      should be allocated if sufficient memory is
                      available. The group buffer holds a screen image
                      of the whole group so that group redraws can be
                      speeded up. In the absence of a buffer,
                      TGroup::draw() calls on each subview's
                      drawView() method. If subsequent memory
                      allocation calls fail, group buffers will be
                      deallocated to make memory available.

 ofTileable    0x0080 Set if the desktop can tile (or cascade) this
                      view. Usually used only with TWindow objects.

 ofCenterX     0x0100 Set if the view should be centered on the x-axis
                      of its owner when inserted in a group using
                      TGroup::insert().

 ofCenterY     0x0200 Set if the view should be centered on the y-axis
                      of its owner when inserted in a group using
                      TGroup::insert().

 ofCentered    0x0300 Set if the view should be centered on both axes of
                      its owner when inserted in a group using
                      TGroup::insert().
 

Definition at line 1579 of file views.h.

TPoint TView::origin
 

The (x, y) coordinates, relative to the owner's origin, of the top-left corner of the view.

Definition at line 1670 of file views.h.

TGroup * TView::owner
 

Points to the TGroup object that owns this view. If 0, the view has no owner. The view is displayed within its owner's view and will be clipped by the owner's bounding rectangle.

Definition at line 1799 of file views.h.

Boolean TView::showMarkers [static]
 

Used to indicate whether indicators should be placed around focused controls. TProgram::initScreen() sets showMarkers to True if the video mode is monochrome; otherwise it is False. The value may, however, be set on in color and black and white modes if desired.

Definition at line 1806 of file views.h.

TPoint TView::size
 

The size of the view.

Definition at line 1503 of file views.h.

ushort TView::state
 

The state of the view is represented by bits set or clear in the state data member. The bits are represented mnemonically by constants as follows.

 Constant    Value Meaning

 sfVisible   0x001 Set if the view is visible on its owner. Views are by
                   default sfVisible. Use show() and
                   hide() to modify sfVisible. An
                   sfVisible view is not necessarily visible on the
                   screen, since its owner might not be visible. To test
                   for visibility on the screen, examine the
                   sfExposed bit or call exposed().

 sfCursorVis 0x002 Set if a view's cursor is visible. Clear is the
                   default. You can use showCursor() and
                   hideCursor() to modify sfCursorVis.

 sfCursorIns 0x004 Set if the view's cursor is a solid block; clear if
                   the view's cursor is an underline (the default). Use
                   blockCursor() and normalCursor() to modify
                   this bit.

 sfShadow    0x008 Set if the view has a shadow.

 sfActive    0x010 Set if the view is the active window or a subview in
                   the active window.

 sfSelected  0x020 Set if the view is the currently selected subview
                   within its owner. Each TGroup object has a
                   TGroup::current data member that points to the
                   currently selected subview (or is 0 if no subview is
                   selected). There can be only one currently selected
                   subview in a TGroup.

 sfFocused   0x040 Set if the view is focused. A view is focused if it
                   is selected and all owners above it are also
                   selected. The last view on the focused chain is the
                   final target of all focused events.

 sfDragging  0x080 Set if the view is being dragged.

 sfDisabled  0x100 Set if the view is disabled. A disabled view will
                   ignore all events sent to it.

 sfModal     0x200 Set if the view is modal. There is always exactly one
                   modal view in a running TVision application, usually
                   a TApplication or TDialog object. When a
                   view starts executing (through an
                   TGroup::execView() call), that view becomes
                   modal. The modal view represents the apex (root) of
                   the active event tree, getting and handling events
                   until its endModal() method is called. During
                   this "local" event loop, events are passed down to
                   lower subviews in the view tree. Events from these
                   lower views pass back up the tree, but go no further
                   than the modal view. See also setState(),
                   handleEvent() and TGroup::execView().

 sfDefault   0x400 This is a spare flag, available to specify some
                   user-defined default state.

 sfExposed   0x800 Set if the view is owned directly or indirectly by
                   the application object, and therefore possibly
                   visible on the. exposed() uses this flag in
                   combination with further clipping calculations to
                   determine whether any part of the view is actually
                   visible on the screen.
 

Many TView member functions test and/or alter the state data member by calling getState() and/or setState().

Definition at line 1665 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