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

TScroller Class Reference

Provides a scrolling virtual window onto a larger view. More...

#include <views.h>

Inheritance diagram for TScroller::

TView TObject TStreamable THelpViewer TOutlineViewer TTextDevice TOutline TTerminal List of all members.

Public Methods

 TScroller (const TRect &bounds, TScrollBar *aHScrollBar, TScrollBar *aVScrollBar)
virtual void changeBounds (const TRect &bounds)
virtual TPalettegetPalette () const
virtual void handleEvent (TEvent &event)
virtual void scrollDraw ()
void scrollTo (int x, int y)
void setLimit (int x, int y)
virtual void setState (ushort aState, Boolean enable)
void checkDraw ()
virtual void shutDown ()

Static Public Methods

TStreamablebuild ()

Public Attributes

TPoint delta

Static Public Attributes

const char* const name

Protected Methods

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

Protected Attributes

uchar drawLock
Boolean drawFlag
TScrollBarhScrollBar
TScrollBarvScrollBar
TPoint limit

Detailed Description

TScroller provides a scrolling virtual window onto a larger view. That is, a scrolling view lets the user scroll a large view within a clipped boundary.

The scroller provides an offset from which the TView::draw() method fills the visible region. All methods needed to provide both scroll bar and keyboard scrolling are built into TScroller.

The basic scrolling view provides a useful starting point for scrolling views such as text views.

Definition at line 2379 of file views.h.


Constructor & Destructor Documentation

TScroller::TScroller ( const TRect & bounds,
TScrollBar * aHScrollBar,
TScrollBar * aVScrollBar )
 

Creates and initializes a TScroller object with the given size and scroll bars. Calls TView constructor to set the view's size.

`aHScrollBar' should be 0 if you do not want a horizontal scroll bar; `aVScrollBar' should be 0 if you do not want a vertical scroll bar.

TScroller::TScroller ( 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 * TScroller::build ( ) [static]
 

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

Reimplemented from TView.

Reimplemented in TOutlineViewer, and TOutline.

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

Changes the scroller's size by calling TView::setbounds(). If necessary, the scroller and scroll bars are then redrawn by calling setLimit() and drawView().

Reimplemented from TView.

Reimplemented in THelpViewer.

void TScroller::checkDraw ( )
 

If drawLock is zero and drawFlag is True, drawFlag is set False and drawView() is called. If drawLock is non-zero or drawFlag is False, checkDraw() does nothing.

Methods scrollTo() and setLimit() each call checkDraw() so that drawView() is only called if needed.

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

Returns the default scroller palette string.

Reimplemented from TView.

Reimplemented in THelpViewer, and TOutlineViewer.

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

Handles most events by calling TView::handleEvent().

Broadcast events such as cmScrollBarChanged from either hScrollBar or vScrollBar result in a call to scrollDraw().

Reimplemented from TView.

Reimplemented in THelpViewer, and TOutlineViewer.

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

Reads from the input stream `is'.

Reimplemented from TView.

Reimplemented in TOutlineViewer, and TOutline.

void TScroller::scrollDraw ( ) [virtual]
 

Checks to see if delta matches the current positions of the scroll bars. If not, delta is set to the correct value and drawView() is called to redraw the scroller.

void TScroller::scrollTo ( int x,
int y )
 

Sets the scroll bars to (x,y) by calling hScrollBar->setValue(x) and vScrollBar->setValue(y) and redraws the view by calling drawView().

See also:
TScrollBar::hScrollBar , TScrollBar::vScrollBar , TScrollBar::setValue

void TScroller::setLimit ( int x,
int y )
 

Sets the limit data member and redraws the scrollbars and scroller if necessary.

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

This member function is called whenever the scroller's state changes. Calls TView::setState() to set or clear the state flags in `aState'. If the new state is sfSelected and sfActive, setState() displays the scroll bars; otherwise, they are hidden.

Reimplemented from TView.

Reimplemented in TOutlineViewer.

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

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

Writes to the output stream `os'.

Reimplemented from TView.

Reimplemented in TOutlineViewer, and TOutline.


Member Data Documentation

TPoint TScroller::delta
 

Holds the x (horizontal) and y (vertical) components of the scroller's position relative to the virtual view being scrolled.

Automatic scrolling is achieved by changing either or both of these components in response to scroll bar events that change the value data member(s).

Manual scrolling changes delta, triggers changes in the scroll bar TScrollBar::value data members, and leads to updating of the scroll bar indicators.

Definition at line 2466 of file views.h.

Boolean TScroller::drawFlag [protected]
 

Set True if the scroller has to be redrawn.

Definition at line 2475 of file views.h.

uchar TScroller::drawLock [protected]
 

A semaphore used to control the redrawing of scrollers.

Definition at line 2471 of file views.h.

TScrollBar * TScroller::hScrollBar [protected]
 

Points to the horizontal scroll bar object associated with the scroller. If there is no such scroll bar, hScrollBar is 0.

Definition at line 2480 of file views.h.

TPoint TScroller::limit [protected]
 

Data members limit.x and limit.y are the maximum allowed values for delta.x and delta.y data members.

See also:
TScroller::delta

Definition at line 2491 of file views.h.

const char *const TScroller::name [static]
 

Undocumented.

Reimplemented from TView.

Reimplemented in TOutlineViewer, and TOutline.

Definition at line 2522 of file views.h.

TScrollBar * TScroller::vScrollBar [protected]
 

Points to the vertical scroll bar object associated with the scroller. If there is no such scroll bar, vScrollBar is 0.

Definition at line 2485 of file views.h.


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