|
PegTreeNode |
|
|
|
| ||||||||||||
|
|
See Also |
|
| |
| Top of page |
Members |
Constructors:
|
| |
|
|
PegTreeNode(const PEGCHAR *Text,
|
PegBitmap *map = NULL)
| |
This constructor creates a PegTreeNode
object. A node text string must be provided. The bitmap graphic is optional.
Public Functions:
|
| |
|
|
PegTreeNode *Above(void)
|
Returns a pointer
to the node above the current node.
See the example. ![]()
|
| |
|
|
void Add(PegTreeNode *Child)
|
Adds the PegTreeNode object referenced by
Child to the end of the list of siblings of the current node.
If the node referenced by Child is already a sibling
of the current node, the Add() function simply
moves it to the end of the sibling list.
|
| |
|
|
PegTreeNode *Below(void)
|
Returns a pointer
to the node below the current node.
See the example. ![]()
|
| |
|
|
PegTreeNode *Bottom(void)
|
Returns a pointer to the last "visible" node in the list
which is below the current node and in the subtree containing the
current node.
See the example. ![]()
|
| |
|
|
SIGNED BranchHeight(PegTreeView *Parent)
|
Returns the height (in pixels)
of the branch of the tree containing the current node.
The height includes the height of all visible child nodes
if the current branch is open (visible).
Parameter Parent, a pointer to the PegTreeView
object which contains the current node, must be provided so that the
function can access font information needed to derive the height.
|
| |
|
|
SIGNED BranchWidth(PegTreeView *Parent)
|
Returns the width (in pixels)
of the branch of the tree containing the current node.
The width includes the widths of the bitmap (if any)
and the text string of all visible child nodes
if the current branch is open (visible).
Parameter Parent, a pointer to the PegTreeView
object which contains the current node, must be provided so that the
function can access font information needed to derive the width.
|
| |
|
|
void Close(void) {mbOpen = FALSE;}
|
Closes the current node. If the node has children, they will not be drawn the next time the current node is drawn. Only the current node will be visible.
|
| |
|
|
SIGNED Count(void)
|
Returns the number of child objects (nodes) owned by the current node.
|
| |
|
|
PegTreeNode *First(void) {return mpFirst;}
|
Returns a pointer to the first PegTreeNode object
which is a child of the current node. Returns NULL if the
current node has no child nodes.
See the example. ![]()
|
| |
|
|
PegBitmap *GetMap(void) {return mpMap;}
|
Returns a pointer to the bitmap
associated with the current node.
Returns NULL if the current node has no bitmap.
|
| |
|
|
void Insert(PegTreeNode *Sib)
|
Inserts the PegTreeNode object referenced by Sib
after the current node.
|
| |
|
|
BOOL IsOpen(void) {return mbOpen;}
|
Returns TRUE if
the current node is open and has children, else FALSE.
|
| |
|
|
BOOL IsSelected(void) {return mbSelected;}
|
Returns TRUE if
the current node is selected, else FALSE.
|
| |
|
|
void MoveToTop(PegTreeNode *pChild)
|
Moves the PegTreeNode object referenced by pChild
to the head of the current node's list of siblings,
making it the first child of the current node's parent.
This function has no effect if the node referenced by pChild is not
a sibling of the current node.
|
| |
|
|
PegTreeNode *Next(void) {return mpNext;}
|
Returns a pointer to the next PegTreeNode object which
is a sibling of the current node. Returns NULL if the current
node has no siblings below it.
See the example. ![]()
|
| |
|
|
PegTreeNode *NodeAbove(void)
|
This function returns the nearest visible PegTreeNode
above the current node.
|
| |
|
|
PegTreeNode *NodeBelow(void)
|
This function returns the nearest visible PegTreeNode
below the current node.
|
| |
|
|
PegTreeNode *NodeBottom(void)
|
This function returns the bottom-most visible
PegTreeNode on the node's subtree.
|
| |
|
|
SIGNED NodeHeight(PegTreeView *Parent)
|
Returns the height (in pixels) of the current node.
The height does not include the height of any of the current node's children.
Parameter Parent, a pointer to the PegTreeView
object which contains the current node, must be provided so that the
function can access font information needed to derive the node height.
|
| |
|
|
SIGNED NodeWidth(PegTreeView *Parent)
|
Returns the width (in pixels) of the current node.
The width includes the width of the current node's bitmap (if any)
and the width of the text string.
The width does not include the width of any of the current node's children.
Parameter Parent, a pointer to the PegTreeView
object which contains the current node, must be provided so that the
function can access font information needed to derive the node width.
|
| |
|
|
void Open(void) {mbOpen = TRUE;}
|
Opens the current node. If the node has children, they will be drawn the next time the current node is drawn. The current node and its children, if any, will be visible.
|
| |
|
|
PegTreeNode *Parent(void) {return mpParent;}
|
Returns a pointer to the PegTreeNode object (node)
which is the parent of the current node.
Returns NULL if the current node is the topmost
node of the PegTreeView object containing the current node.
|
| |
|
|
void SetFirst(PegTreeNode *pFirst)
|
{mpFirst = pFirst;}
| |
Assigns the PegTreeNode object referenced by pFirst
as the first child of the current node's parent.
This function is only used by the PegTreeView object.
|
| |
|
|
void SetMap(PegBitmap *pMap)
|
{mpMap = pMap;}
| |
Assigns the PegBitmap object referenced by pMap
to the current node. Your application can call this function at any time
to change the bitmap associated with a node, thereby forcing the image
to match the state of the object represented by the node.
The bitmap drawing is updated the next time the current node is drawn
|
| |
|
|
void SetNext(PegTreeNode *pNext)
|
{mpNext = pNext;}
| |
Assigns the PegTreeNode object referenced by pNext
as the next sibling of the current node.
This function is only used by the PegTreeView object.
|
| |
|
|
void SetParent(PegTreeNode *pNode)
|
{mpParent = pNode;}
| |
Assigns the PegTreeNode object referenced by pNode
as the parent node of the current node.
This function is only used by the PegTreeView object.
|
| |
|
|
void SetSelected(BOOL bSelected)
|
{mbSelected = bSelected;}
| |
Forces the current node to be the selected node and to be displayed accordingly the next time the current node is drawn.
Protected Functions:
|
| |
|
|
void Destroy(PegTreeNode *Child)
|
Removes the PegTreeNode object referenced
by Child from the current node. The removed node is then deleted.
|
| |
|
|
PegTreeNode *Remove(PegTreeNode *Child)
|
Removes the PegTreeNode object referenced
by Child from the current node.
|
| |
| Top of page |
Examples |
The following example illustrates a PegTreeView window
populated with PegTreeNode objects.
![]() |
Navigation Terminology:PegStripChart is above PegTextThing.PegList is above PegTreeView.PegWindow is above PegTable.PegTextThing is below PegStripChart.PegTreeView is below PegList.PegTable is below PegWindow.Next after PegThing is PegTextThing.Next after PegTable is PegTextBox.Next after PegDecoratedWindow is NULL.Next after PegChart is NULL.Bottom from PegThing is PegStripChart.Bottom from PegButton is PegButton.Bottom from PegTable is PegTable.First node of PegWindow is PegTable.First node of PegScreen is NULL. |
The description of the
PegTreeView class includes an actual
programming example.
|
Top of page |
|
|
|
|
| Copyright © 2000-2003 |