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

TListBox Class Reference

Displays a list of items, in one or more columns, with an optional vertical scroll bar. More...

#include <dialogs.h>

Inheritance diagram for TListBox::

TListViewer TView TObject TStreamable TDirListBox TSortedListBox TFileList List of all members.

Public Methods

 TListBox (const TRect &bounds, ushort aNumCols, TScrollBar *aScrollBar)
 ~TListBox ()
virtual ushort dataSize ()
virtual void getData (void *rec)
virtual void getText (char *dest, short item, short maxLen)
virtual void newList (TCollection *aList)
virtual void setData (void *rec)
TCollectionlist ()

Static Public Methods

TStreamablebuild ()

Static Public Attributes

const char* const name

Protected Methods

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

Protected Attributes

TCollectionitems

Detailed Description

TListBox is derived from TListViewer to help you set up the most commonly used list boxes, namely those displaying collections of strings, such as file names.

TListBox objects represent displayed lists of such items in one or more columns with an optional vertical scroll bar.

Definition at line 1643 of file dialogs.h.


Constructor & Destructor Documentation

TListBox::TListBox ( const TRect & bounds,
ushort aNumCols,
TScrollBar * aScrollBar )
 

Creates a list box control with the given size, number of columns, and a vertical scroll bar referenced by the `aScrollBar' pointer.

This constructor calls TListViewer::TListViewer(bounds, aNumCols, 0, aScrollBar), thereby supressing the horizontal scroll bar.

See also:
TListViewer::TListViewer

The items data member is initially empty collection, and the inherited range data member is set to zero.

Your application must provide a suitable TCollection holding the strings (or other objects) to be listed. The items data member must be set to point to this collection using newList().

TListBox::~TListBox ( )
 

Undocumented.

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

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

Reimplemented from TListViewer.

Reimplemented in TSortedListBox, TFileList, and TDirListBox.

ushort TListBox::dataSize ( ) [virtual]
 

Returns the size of the data read and written to the records passed to getData() and setData(). These three member functions are useful for initializing groups.

By default, dataSize() returns the size of TCollection plus the size of ushort (for items and the selected item). You may need to override this member function for your own applications.

See also:
TListBox::items , TListBoxRec

Reimplemented from TView.

Reimplemented in TFileList.

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

Writes TListBox object data to the target record. By default, getData() writes the current items and focused data members to `rec'. You may need to override this member function for your own applications.

See also:
TListBox::dataSize , TListBox::setData

Reimplemented from TView.

Reimplemented in TFileList.

void TListBox::getText ( char * dest,
short item,
short maxLen ) [virtual]
 

Sets a string in `dest' from the calling TListBox object. By default, the returned string is obtained from the item'th item in the TCollection using (char *) ((list())->at(item)).

See also:
TCollection::at , TListBox::list

If list() returns a collection containing non-string objects, you will need to override this member function. If list() returns 0, getText() sets `dest' to " ".

Reimplemented from TListViewer.

Reimplemented in TFileList, and TDirListBox.

TCollection * TListBox::list ( ) [inline]
 

Returns the private items pointer.

Reimplemented in TSortedListBox, TFileList, and TDirListBox.

Definition at line 1775 of file dialogs.h.

Referenced by TDirListBox::list(), TFileList::list(), and TSortedListBox::list().

void TListBox::newList ( TCollection * aList ) [virtual]
 

Creates a new list by deleting the current one and replacing it with the given `aList'.

Referenced by TFileList::newList().

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

Reads from the input stream `is'.

Reimplemented from TListViewer.

Reimplemented in TSortedListBox.

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

Replaces the current list with items and focused values read from the given `rec' array. setData() calls newList() so that the new list is displayed with the correct focused item. As with getData() and dataSize(), you may need to override this member function for your own applications.

Reimplemented from TView.

Reimplemented in TFileList.

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

Writes to the output stream `os'.

Reimplemented from TListViewer.


Member Data Documentation

TCollection * TListBox::items [protected]
 

Points at the collection of items to scroll through.

Typically, this might be a collection of strings representing the item texts. User can access this private member only by calling the function list().

Definition at line 1726 of file dialogs.h.

const char *const TListBox::name [static]
 

Undocumented.

Reimplemented from TListViewer.

Reimplemented in TSortedListBox, TFileList, and TDirListBox.

Definition at line 1746 of file dialogs.h.


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