os::TreeView Class Reference
[The Syllable Graphical User Interface API]

Flexible multicolumn tree view. More...

Inheritance diagram for os::TreeView:

os::ListView os::Control os::View os::Invoker os::Handler List of all members.

Public Member Functions

 TreeView (const Rect &cFrame, const String &cTitle, uint32 nModeFlags=F_MULTI_SELECT|F_RENDER_BORDER, uint32 nResizeMask=CF_FOLLOW_LEFT|CF_FOLLOW_TOP, uint32 nFlags=WID_WILL_DRAW|WID_FULL_UPDATE_ON_RESIZE)
 ~TreeView ()
void InsertNode (TreeViewNode *pcNode, bool bUpdate=true)
 Insert a node at the end.
void InsertNode (int nPos, TreeViewNode *pcNode, bool bUpdate=true)
 Insert a node at a certain position.
TreeViewNodeRemoveNode (int nIndex, bool bUpdate=true)
 Remove a node.
ListViewRowRemoveRow (int nIndex, bool bUpdate=true)
 Remove a row.
void Clear ()
 Clear list.
void Expand (TreeViewNode *pcNode)
 Expand a node.
void Collapse (TreeViewNode *pcNode)
 Collapse a node.
bool HasChildren (TreeViewNode *pcRow)
 Find out if a node has sub nodes.
TreeViewNodeGetParent (TreeViewNode *pcNode=NULL)
 Get parent node.
TreeViewNodeGetChild (TreeViewNode *pcNode=NULL)
 Get child node.
TreeViewNodeGetNext (TreeViewNode *pcNode=NULL)
 Get next sibling.
TreeViewNodeGetPrev (TreeViewNode *pcNode=NULL)
 Get previous sibling.
void GetChildren (std::vector< TreeViewNode * > &cvecChildren, TreeViewNode *pcNode=NULL)
 Get subnodes.
void GetSiblings (std::vector< TreeViewNode * > &cvecSiblings, TreeViewNode *pcNode=NULL)
 Get sibling nodes.
void SetExpandedMessage (Message *pcMsg)
 Set expand/collapse message.
MessageGetExpandedMessage () const
 Set expand/collapse message.
void SetExpandedImage (Image *pcImage)
 Set expander image when expanded.
void SetCollapsedImage (Image *pcImage)
 Set expander image when collapsed.
ImageGetExpandedImage () const
 Get expander image when expanded.
ImageGetCollapsedImage () const
 Get expander image when expanded.
bool GetDrawExpanderBox () const
 Draw box around expander image.
void SetDrawExpanderBox (const bool bDraw)
 Draw box around expander image.
uint GetIndentWidth () const
 Get indentation width.
void SetIndentWidth (uint nIndentWidth)
 Set indentation width.
bool GetDrawTrunk () const
 Draw tree trunk.
void SetDrawTrunk (bool bDraw)
 Draw tree trunk.
const RectGetExpanderImageBounds () const
 Get max size of expander image.
virtual void SortRows (std::vector< ListViewRow * > *pcRows, int nColumn)
 Sort rows.
virtual void Paint (const Rect &cUpdateRect)
 Called by the system update "damaged" areas of the view.

Classes

class  Private

Detailed Description

Description:
See also:
Author:
Henrik Isaksson ([email protected])


Constructor & Destructor Documentation

TreeView::TreeView ( const Rect cFrame,
const String cTitle,
uint32  nModeFlags = F_MULTI_SELECT|F_RENDER_BORDER,
uint32  nResizeMask = CF_FOLLOW_LEFT|CF_FOLLOW_TOP,
uint32  nFlags = WID_WILL_DRAW|WID_FULL_UPDATE_ON_RESIZE 
)

TreeView::~TreeView (  ) 


Member Function Documentation

void TreeView::InsertNode ( TreeViewNode pcNode,
bool  bUpdate = true 
)

Description:
Insert a node at the end of the tree.
Parameters:
nPos Zero-based index to insert position.
pcNode Pointer to node to insert.
bUpdate Set to true to refresh TreeView.
Author:
Henrik Isaksson ([email protected])

void TreeView::InsertNode ( int  nPos,
TreeViewNode pcNode,
bool  bUpdate = true 
)

Description:
Insert a node at position nPos.
Parameters:
nPos Zero-based index to insert position.
pcNode Pointer to node to insert.
bUpdate Set to true to refresh TreeView.
Author:
Henrik Isaksson ([email protected])

TreeViewNode * TreeView::RemoveNode ( int  nIndex,
bool  bUpdate = true 
)

Description:
Does exactly the same thing as RemoveRow().
See also:
ListView::RemoveRow()
Author:
Henrik Isaksson ([email protected])

ListViewRow * TreeView::RemoveRow ( int  nIndex,
bool  bUpdate = true 
)

Description:
Removes a row from the ListView. A pointer to the removed row is returned, and the application is responsible for freeing it.
Parameters:
nIndex Row index.
bUpdate Update display. If many operations are performed, often only the last one need to update the display.
Author:
Kurt Skauen

Reimplemented from os::ListView.

void TreeView::Clear (  ) 

Description:
Clears the ListView for all rows.
Author:
Kurt Skauen

Reimplemented from os::ListView.

void TreeView::Expand ( TreeViewNode pcNode  ) 

Description:
Expands a node so that subnodes are made visible.
Parameters:
pcNode Pointer to node to expand.
See also:
Collapse
Author:
Henrik Isaksson ([email protected])

void TreeView::Collapse ( TreeViewNode pcNode  ) 

Description:
Contracts a node so that subnodes are made invisible.
Parameters:
pcNode Pointer to node to collapse.
See also:
Expand
Author:
Henrik Isaksson ([email protected])

bool TreeView::HasChildren ( TreeViewNode pcNode  ) 

Description:
Returns true if a node has at least one child node.
Parameters:
pcNode Pointer to node.
See also:
GetChild
Author:
Henrik Isaksson ([email protected])

TreeViewNode * TreeView::GetParent ( TreeViewNode pcNode = NULL  ) 

Description:
Returns a pointer to the parent node of pcNode, or the parent of the currently selected node, if pcNode is NULL.
Parameters:
pcNode Pointer to node.
See also:
GetChild(), GetNext(), GetPrev(), ListView::GetRow()
Author:
Henrik Isaksson ([email protected])

TreeViewNode * TreeView::GetChild ( TreeViewNode pcNode = NULL  ) 

Description:
Returns a pointer to the child node (sub node) of pcNode, or the child node of the currently selected node, if pcNode is NULL.
Parameters:
pcNode Pointer to node.
See also:
GetParent(), GetNext(), GetPrev(), ListView::GetRow()
Author:
Henrik Isaksson ([email protected])

TreeViewNode * TreeView::GetNext ( TreeViewNode pcNode = NULL  ) 

Description:
Returns a pointer to the next sibling of pcNode, or the sibling of the currently selected node, if pcNode is NULL.
Parameters:
pcNode Pointer to node.
See also:
GetChild(), GetPrev(), GetParent(), ListView::GetRow()
Author:
Henrik Isaksson ([email protected])

TreeViewNode * TreeView::GetPrev ( TreeViewNode pcNode = NULL  ) 

Description:
Returns a pointer to the previous sibling of pcNode, or the sibling of the currently selected node, if pcNode is NULL.
Parameters:
pcNode Pointer to node.
See also:
GetChild(), GetNext(), GetParent(), ListView::GetRow()
Author:
Henrik Isaksson ([email protected])

void TreeView::GetChildren ( std::vector< TreeViewNode * > &  cvecChildren,
TreeViewNode pcNode = NULL 
)

Description:
Fills a std::vector with the sub nodes (children) of a supplied node that is attached to this TreeView, or the currently selected node if pcNode is NULL.
Parameters:
cvecChildren std::vector to be filled with pointers to nodes.
pcNode Pointer to node to examine or NULL for selected node.
See also:
GetSiblings()
Author:
Henrik Isaksson ([email protected])

void TreeView::GetSiblings ( std::vector< TreeViewNode * > &  cvecSiblings,
TreeViewNode pcNode = NULL 
)

Description:
Fills a std::vector with the siblings of a supplied node that is attached to this TreeView, or the currently selected node if pcNode is NULL.
Parameters:
cvecSibling std::vector to be filled with pointers to nodes.
pcNode Pointer to node to examine or NULL for selected node.
See also:
GetChildren()
Author:
Henrik Isaksson ([email protected])

void TreeView::SetExpandedMessage ( Message pcMsg  ) 

Description:
Set a message to be sent when a node is expanded or collapsed. When the message is sent, a boolean named "expanded" is added, containing the new expanded state of the node (true = expanded, false = collapsed). A pointer named "node" points to the node that has been expanded/collapsed.
Parameters:
pcMsg Pointer to message to send.
Author:
Henrik Isaksson ([email protected])

Message * TreeView::GetExpandedMessage (  )  const

Description:
Get expanded/collapsed message.
See also:
SetExpandedMessage()
Author:
Henrik Isaksson ([email protected])

void TreeView::SetExpandedImage ( Image pcImage  ) 

Description:
Used to set the expander image (in expanded state). Normally you should not use this function, but instead use the system default image.
Parameters:
pcImage Pointer to image to use for expander image.
See also:
GetExpandedImage(), SetCollapsedImage()
Author:
Henrik Isaksson ([email protected])

void TreeView::SetCollapsedImage ( Image pcImage  ) 

Description:
Used to set the expander image (in collapsed state). Normally you should not use this function, but instead use the system default image.
Parameters:
pcImage Pointer to image to use for expander image.
See also:
GetCollapsedImage(), SetExpandedImage()
Author:
Henrik Isaksson ([email protected])

Image * TreeView::GetExpandedImage (  )  const

Description:
Returns the image used for expander icons in expanded state.
Author:
Henrik Isaksson ([email protected])

Image * TreeView::GetCollapsedImage (  )  const

Description:
Returns the image used for expander icons in collapsed state.
Author:
Henrik Isaksson ([email protected])

bool TreeView::GetDrawExpanderBox (  )  const

Description:
Returns true if a box is drawn around the expander image.
Author:
Henrik Isaksson ([email protected])

void TreeView::SetDrawExpanderBox ( const bool  bDraw  ) 

Description:
Set to true to have a box drawn around the expander image.
Author:
Henrik Isaksson ([email protected])

uint TreeView::GetIndentWidth (  )  const

Description:
Returns the size of indentations. Default is 10 pixels.
Author:
Henrik Isaksson ([email protected])

void TreeView::SetIndentWidth ( uint  nIndentWidth  ) 

Description:
Set the size of indentations. Default is 10 pixels.
Author:
Henrik Isaksson ([email protected])

bool TreeView::GetDrawTrunk (  )  const

Description:
Returns true if lines are drawn to each node (aka. tree trunk).
Author:
Henrik Isaksson ([email protected])

void TreeView::SetDrawTrunk ( bool  bDraw  ) 

Description:
Set to true to have lines drawn to each node (aka. tree trunk).
Author:
Henrik Isaksson ([email protected])

const Rect & TreeView::GetExpanderImageBounds (  )  const

Description:
Returns a Rect with the maximum dimensions for the expander icon. Normally there is no reason to call this method directly, it is used by the TreeViewNodes to calculate what their sizes will be.
Author:
Henrik Isaksson ([email protected])

void TreeView::SortRows ( std::vector< ListViewRow * > *  pcRows,
int  nColumn 
) [virtual]

Description:
Overridable default sorting routine.
Parameters:
pcRows std::vector of ListViewRows to be sorted.
nColumn The column to sort by.
See also:
Sort()
Author:
Henrik Isaksson ([email protected])

Reimplemented from os::ListView.

void TreeView::Paint ( const Rect cUpdateRect  )  [virtual]

Description:
Note:
Warning:
Parameters:
cUpdateRect A rectangle enclosing all damaged areas. This is just a rough "worst-case", further fine-grained clipping will be performed by the Application Server to avoid updating non-damaged pixels and make the update as fast and flicker-free as possible.
See also:
Invalidate(), Flush()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::ListView.


Generated on Sat May 9 22:51:50 2009 for Syllable higlevel API by  doxygen 1.5.1