#include <outline.h>
Inheritance diagram for TOutlineViewer::
Public Methods | |
TOutlineViewer (const TRect &bounds, TScrollBar *aHScrollBar, TScrollBar *aVScrollBar) | |
TOutlineViewer (StreamableInit s) | |
virtual void | adjust (TNode *node, Boolean expand)=0 |
virtual void | draw () |
virtual void | focused (int i) |
virtual TNode* | getChild (TNode *node, int i)=0 |
virtual char* | getGraph (int level, long lines, ushort flags) |
virtual int | getNumChildren (TNode *node)=0 |
virtual TNode* | getNode (int i) |
virtual TPalette& | getPalette () const |
virtual TNode* | getRoot ()=0 |
virtual char* | getText (TNode *node)=0 |
virtual void | handleEvent (TEvent &event) |
virtual Boolean | hasChildren (TNode *node)=0 |
virtual Boolean | isExpanded (TNode *node)=0 |
virtual Boolean | isSelected (int i) |
virtual void | selected (int i) |
virtual void | setState (ushort aState, Boolean enable) |
void | update () |
void | expandAll (TNode *node) |
TNode* | firstThat (Boolean(*test)(TOutlineViewer *ov, TNode *node, int level, int position, long lines, ushort flags)) |
TNode* | forEach (Boolean(*action)(TOutlineViewer *ov, TNode *cur, int level, int position, long lines, ushort flags)) |
char* | createGraph (int level, long lines, ushort flags, int levWidth, int endWidth, const char *chars) |
Static Public Methods | |
TStreamable* | build () |
Public Attributes | |
int | foc |
Static Public Attributes | |
const char* | graphChars |
const char* const | name |
Protected Methods | |
virtual void | write (opstream &os) |
virtual void* | read (ipstream &is) |
Static Protected Methods | |
void | disposeNode (TNode *node) |
TOutlineViewer, however, makes no assumptions about the actual items in the outline. Descendants of TOutlineViewer, such as TOutline, display outlines of specific kinds of items.
Definition at line 112 of file outline.h.
|
Constructs an outline viewer object by first calling the constructor inherited from TScroller, passing `bounds', `aHScrollBar' and `aVScrollBar'. Sets growMode to gfGrowHiX + gfGrowHiY and sets foc data member to zero. |
|
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. |
|
adjust() is an abstract method that descendant outline viewer types must override to show the child nodes of `node' if `expand' is True, or hide them if `expand' is False. Called when the user expands or collapses `node'. If hasChildren() returns False for `node', adjust() will never be called for that node. Reimplemented in TOutline. |
|
Called to create an object in certain stream-reading situations. Reimplemented from TScroller. Reimplemented in TOutline. |
|
Undocumented. |
|
Undocumented. |
|
Called to draw the outline view. Essentially, draw() calls getGraph() to get the graphical part of the outline, then appends the string returned from getText(). The line containing the focused node in the outline displays in a distinct color. Nodes whose child nodes are not displayed are highlighted. Reimplemented from TView. |
|
If `node' has child nodes, expandAll() recursively expands `node' by calling adjust() with the expand parameter True, then expands all its child nodes by calling expandAll() for each of them. |
|
firstThat() iterates over the nodes of the outline, calling the function pointed to by `test' until `test' returns True. `test' must point to a function with the following syntax:
Boolean myIter(TOutlineViewer* ov, TNode* cur, int level, int position, long lines, ushort flags); The parameters are documented in forEach(). |
|
Called whenever a node receives focus. The `i' parameter indicates the position of the newly focused node in the outline. By default, focused() just sets foc data member to `i'. |
|
Iterates over all the nodes. `action' points to a function that forEach() calls for each node in the outline. The syntax for the iterator function is as follows:
Boolean myIter(TOutlineViewer* ov, TNode* cur, int level, int position, long lines, ushort flags); The parameters are as follows:
Name Description cur A pointer to the node being checked. level The level of the node (how many nodes are above it), zero-based. This can be used to a call to either getGraph() or createGraph(). position The display order position of the node in the list. This can be used in a call to focused() or selected(). If in range, position - delta.Y is location the node is displayed on the view. lines Bits indicating the active levels. This can be used in a call to getGraph() or createGraph(). It dicatates which horizontal lines need to be drawn. flags Various flags for drawing. Can be used in a call to getGraph() or createGraph().
|
|
getChild() is an abstract method (pure virtual) that descendant outline viewer types must override to return a pointer to the i-th child of the given `node'. If hasChildren() returns False, indicating that `node' has no child nodes, getChild() will not be called for that node. You can safely assume that when an outline viewer calls getChild(), the given node has at least `i' child nodes. Reimplemented in TOutline. |
|
Returns a string of graphics characters to display to the left of the text returned by getText(). By default, getGraph() calls createGraph() with the default character values. You only need to override getGraph() if you want to change the appearance of the outline. For example, instead of calling createGraph() to show the hierarchy, you might return a string of characters to merely indent the text by a given amount for each level. |
|
Returns a pointer to the i-th node in the outline; that is, the node shown `i' lines from the top of the complete outline. |
|
getNumChildren() is an abstract method (pure virtual) that descendant outline viewer types must override to return the number of child nodes in `node'. If hasChildren() returns False for `node', getNumChildren() will never be called. Reimplemented in TOutline. |
|
Returns a reference to the default outline palette. Reimplemented from TScroller. |
|
getRoot() is an abstract method that descendant outline viewer types must override to return a pointer to the root node of the outline. Reimplemented in TOutline. |
|
getText() is an abstract method (pure virtual) that descendant outline viewer types must override to return the text of `node'. Reimplemented in TOutline. |
|
Handles most events for the outline viewer by calling the handleEvent() method inherited from TScroller, then handles certain mouse and keyboard events.
Reimplemented from TScroller. |
|
hasChildren() is an abstract method (pure virtual) that descendant outline viewers must override to return True if the given `node' has child nodes and False if `node' has no child nodes. If hasChildren() returns False for a particular node, the following functions are never called for that node: adjust(), expandAll(), getChild(), getNumChildren() and isExpanded(). Those methods can assume that if they are called, there are child nodes for them to act on. Reimplemented in TOutline. |
|
isExpanded() is an abstract method (pure virtual) that descendant outline viewer types must override to return True if node's child nodes should be displayed. If hasChildren() returns False for `node', isExpanded() will never be called for that node. Reimplemented in TOutline. |
|
Returns True if node `i' is selected. By default, TOutlineViewer assumes a single-selection outline, so it returns True if that node is focused. You can override isSelected() to handle multiple selections. |
|
Reads from the input stream `is'. Reimplemented from TScroller. Reimplemented in TOutline. |
|
Called whenever a node is selected by the user, either by keyboard control or by the mouse. The `i' parameter indicates the position in the outline of the newly selected node. By default, selected() does nothing; descendant types can override selected() to perform some action in response to selection. |
|
Sets or clears the `aState' state flags for the view by calling the setState() method inherited from TScroller. If the new state includes a focus change, setState() calls drawView() to redraw the outline.
Reimplemented from TScroller. |
|
Updates the limits of the outline viewer. The limit in the vertical direction is number of nodes in the outline. The limit in the horizontal direction is the length of the longest displayed line. Your program should call update() whenever the data in the outline changes. TOutlineViewer assumes that the outline is empty, so if the outline becomes non-empty during initialization, you must explicitly call update(). Also, if during the operation of the outline viewer the data being displayed change, you must call update() and the inherited drawView(). |
|
Writes to the output stream `os'. Reimplemented from TScroller. Reimplemented in TOutline. |
|
Indicates the item number of the focused node in the outline. |
|
Undocumented. |
|
Undocumented. Reimplemented from TScroller. Reimplemented in TOutline. |