#include <views.h>
Inheritance diagram for TListViewer::
Public Methods | |
TListViewer (const TRect &bounds, ushort aNumCols, TScrollBar *aHScrollBar, TScrollBar *aVScrollBar) | |
virtual void | changeBounds (const TRect &bounds) |
virtual void | draw () |
virtual void | focusItem (short item) |
virtual TPalette& | getPalette () const |
virtual void | getText (char *dest, short item, short maxLen) |
virtual Boolean | isSelected (short item) |
virtual void | handleEvent (TEvent &event) |
virtual void | selectItem (short item) |
void | setRange (short aRange) |
virtual void | setState (ushort aState, Boolean enable) |
virtual void | focusItemNum (short item) |
virtual void | shutDown () |
Static Public Methods | |
TStreamable* | build () |
Public Attributes | |
TScrollBar* | hScrollBar |
TScrollBar* | vScrollBar |
short | numCols |
short | topItem |
short | focused |
short | range |
Static Public Attributes | |
char | separatorChar |
const char* const | name |
Protected Methods | |
TListViewer (StreamableInit) | |
virtual void | write (opstream &os) |
virtual void* | read (ipstream &is) |
TListViewer has no list storage mechanism of its own. Use it to display scrollable lists of arrays, linked lists, or similar data structures. You can also use its descendants, such as TListBox, which associates a collection with a list viewer.
Definition at line 2584 of file views.h.
|
Creates and initializes a TListViewer object with the given size by first calling TView::TView(bounds). The numCols data member is set to `aNumCols'. TView::options is set to (ofFirstClick | ofSelectable) so that mouse clicks that select this view will be passed first to handleEvent(). The TView::eventMask is set to evBroadcast. The initial values of range and focused are zero. You can supply pointers to vertical and/or horizontal scroll bars by way of the `aVScrollBar' and `aHScrollBar' arguments. Setting either or both to 0 suppresses one or both scroll bars. These two pointer arguments are assigned to the vScrollBar and hScrollBar data members. |
|
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. |
|
Called to create an object in certain stream-reading situations. Reimplemented from TView. Reimplemented in TColorGroupList, TColorItemList, TListBox, TSortedListBox, TFileList, and TDirListBox. |
|
Changes the size of the TListViewer object by calling TView::changeBounds(bounds). If a horizontal scroll bar has been assigned, TScrollBar::pgStep is updated by way of TScrollBar::setStep().
Reimplemented from TView. |
|
Draws the TListViewer object with the default palette by repeatedly calling getText() for each visible item. Takes into account the focused and selected items and whether the view is sfActive.
Reimplemented from TView. |
|
Makes the given item focused by setting the focused data member to `item'. Also sets the TScrollBar::value data member of the vertical scroll bar (if any) to `item' and adjusts topItem. Reimplemented in TColorGroupList, TColorItemList, and TFileList. |
|
Used internally by focusItem(). Makes the given item focused by setting the focused data member to `item'. |
|
Returns the default TListViewer palette string. Reimplemented from TView. Reimplemented in THistoryViewer. |
|
Derived classes must override it with a function that writes a string not exceeding `maxLen' at address `dest', given an item index referenced by `item'. Note that draw() needs to call getText(). Reimplemented in TColorGroupList, TColorItemList, TListBox, THistoryViewer, TFileList, and TDirListBox. |
|
Handles events by first calling TView::handleEvent(event).
Keyboard events are handled as follows: Spacebar selects the currently focused item; the arrow keys, PgUp, PgDn, Ctrl-PgDn, Ctrl-PgUp, Home, and End keys are tracked to set the focused item. Broadcast events from the scroll bars are handled by changing the focused item and redrawing the view as required. Reimplemented from TView. Reimplemented in TColorGroupList, TColorItemList, THistoryViewer, and TSortedListBox. |
|
Returns True if the given item is selected (focused), that is, if `item' == focused. Reimplemented in TDirListBox. |
|
Reads from the input stream `is'. Reimplemented from TView. Reimplemented in TColorGroupList, TListBox, and TSortedListBox. |
|
Selects the item'th element of the list, then broadcasts this fact to the owning group by calling:
message(owner, evBroadcast, cmListItemSelected, this);
Reimplemented in TFileList, and TDirListBox. |
|
Sets the range data member to `aRange'. If a vertical scroll bar has been assigned, its parameters are adjusted as necessary (and TScrollBar::drawView() is invoked if redrawing is needed). If the currently focused item falls outside the new range, the focused data member is set to zero. |
|
Calls TView::setState(aState, enable) to change the TListViewer object's state. Depending on the `aState' argument, this can result in displaying or hiding the view.
Reimplemented from TView. Reimplemented in TDirListBox. |
|
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. |
|
Writes to the output stream `os'. Reimplemented from TView. Reimplemented in TColorGroupList, and TListBox. |
|
The item number of the focused item. Items are numbered from 0 to range - 1. Initially set to 0, the first item, focused can be changed by mouse click or Spacebar selection. |
|
Pointer to the horizontal scroll bar associated with this view. If 0, the view does not have such a scroll bar. |
|
Undocumented. Reimplemented from TView. Reimplemented in TColorGroupList, TColorItemList, TListBox, TSortedListBox, TFileList, and TDirListBox. |
|
The number of columns in the list control. |
|
The current total number of items in the list. Items are numbered from 0 to range - 1. |
|
Undocumented. |
|
The item number of the top item to be displayed. This value changes during scrolling. Items are numbered from 0 to range - 1. This number depends on the number of columns, the size of the view, and the value of variable range. |
|
Pointer to the vertical scroll bar associated with this view. If 0, the view does not have such a scroll bar. |