#include <TreeNode.h>
It has a text label, an image, a selected image asociated, and a state (collapsed/expanded). A node can be parent of sub-TreeNodes.
Public Types | |
typedef std::vector< TreeNode * > | Container |
Public Member Functions | |
TreeNode (const String &text="", int imageIndex=-1, int selectedImageIndex=-1) | |
virtual | ~TreeNode () |
void | addNode (TreeNode *node) |
Adds a new sub-node (child) to this one. | |
void | removeNode (TreeNode *node) |
Removes a child node. | |
TreeNode * | getParent () |
Container | getChildren () |
Returns the collection of children. | |
TreeView * | getTreeView () |
virtual bool | hasChildren () |
Returns true if this node should have the plus sign to be expanded. | |
virtual String | getText () |
Returns the label's text for the node. | |
virtual int | getImage () |
Returns the index of the image that uses this node from the ImageList. | |
virtual int | getSelectedImage () |
Returns the index of the image in selected-state that uses this node from the ImageList. | |
void | setText (const String &text) |
Sets the node's text. | |
void | setImage (int imageIndex) |
Sets the node's image. | |
void | setSelectedImage (int selectedImageIndex) |
Sets the node's image in selected-state. | |
bool | isExpanded () |
void | setExpanded (bool state) |
void | ensureVisibility () |
HTREEITEM | getHandle () |
Static Public Member Functions | |
static TreeNode * | fromHandle (HWND hwnd, HTREEITEM htreeitem) |
Protected Member Functions | |
virtual void | onBeforeExpand (TreeViewEvent &ev) |
virtual void | onBeforeCollapse (TreeViewEvent &ev) |
virtual void | onBeforeSelect (TreeViewEvent &ev) |
virtual void | onBeforeLabelEdit (TreeViewEvent &ev) |
virtual void | onAfterExpand (TreeViewEvent &ev) |
virtual void | onAfterCollapse (TreeViewEvent &ev) |
virtual void | onAfterSelect (TreeViewEvent &ev) |
virtual void | onAfterLabelEdit (TreeViewEvent &ev) |
The default implementation changes the m_text field to be returned in getText() only if ev wasn't canceled. | |
Private Member Functions | |
void | addToTreeView (TreeView *treeView) |
Connects the node and its children to the Win32 TreeView. | |
void | removeFromTreeView () |
Disconnects the node (and its children) from the Win32 TreeView. | |
Private Attributes | |
String | m_text |
int | m_image |
int | m_selectedImage |
TreeNode * | m_parent |
Container | m_children |
HTREEITEM | m_HTREEITEM |
TreeView * | m_owner |
bool | m_deleted |
Friends | |
class | TreeView |
class | TreeViewIterator |
typedef std::vector<TreeNode*> Vaca::TreeNode::Container |
TreeNode::TreeNode | ( | const String & | text = "" , |
|
int | imageIndex = -1 , |
|||
int | selectedImageIndex = -1 | |||
) |
TreeNode::~TreeNode | ( | ) | [virtual] |
void TreeNode::addNode | ( | TreeNode * | node | ) |
Adds a new sub-node (child) to this one.
After calling this method node'll have this node as parent.
void TreeNode::removeNode | ( | TreeNode * | node | ) |
Removes a child node.
node | must be a child of the object this. |
TreeNode * TreeNode::getParent | ( | ) |
TreeNode::Container TreeNode::getChildren | ( | ) |
Returns the collection of children.
TreeView * TreeNode::getTreeView | ( | ) |
bool TreeNode::hasChildren | ( | ) | [virtual] |
Returns true if this node should have the plus sign to be expanded.
The default implementation returns true if the m_children member has elements. If you override this method isn't necessary to call the base implementation.
class MyTreeNode : public TreeNode { protected: bool hasChildren() { return ...; } };
String TreeNode::getText | ( | ) | [virtual] |
int TreeNode::getImage | ( | ) | [virtual] |
int TreeNode::getSelectedImage | ( | ) | [virtual] |
Returns the index of the image in selected-state that uses this node from the ImageList.
If you override this method isn't necessary to call the base implementation.
void TreeNode::setText | ( | const String & | text | ) |
Sets the node's text.
It's useful only if you are using the default implementation of getText().
void TreeNode::setImage | ( | int | imageIndex | ) |
Sets the node's image.
It's useful only if you are using the default implementation of getImage().
void TreeNode::setSelectedImage | ( | int | selectedImageIndex | ) |
Sets the node's image in selected-state.
It's useful only if you are using the default implementation of getSelectedImage().
bool TreeNode::isExpanded | ( | ) |
void TreeNode::setExpanded | ( | bool | state | ) |
void TreeNode::ensureVisibility | ( | ) |
HTREEITEM TreeNode::getHandle | ( | ) |
TreeNode * TreeNode::fromHandle | ( | HWND | hwnd, | |
HTREEITEM | htreeitem | |||
) | [static] |
void TreeNode::onBeforeExpand | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
void TreeNode::onBeforeCollapse | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
void TreeNode::onBeforeSelect | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
void TreeNode::onBeforeLabelEdit | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
void TreeNode::onAfterExpand | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
void TreeNode::onAfterCollapse | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
void TreeNode::onAfterSelect | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
void TreeNode::onAfterLabelEdit | ( | TreeViewEvent & | ev | ) | [protected, virtual] |
The default implementation changes the m_text field to be returned in getText() only if ev wasn't canceled.
void TreeNode::addToTreeView | ( | TreeView * | treeView | ) | [private] |
Connects the node and its children to the Win32 TreeView.
void TreeNode::removeFromTreeView | ( | ) | [private] |
Disconnects the node (and its children) from the Win32 TreeView.
friend class TreeView [friend] |
friend class TreeViewIterator [friend] |
String Vaca::TreeNode::m_text [private] |
int Vaca::TreeNode::m_image [private] |
int Vaca::TreeNode::m_selectedImage [private] |
TreeNode* Vaca::TreeNode::m_parent [private] |
Container Vaca::TreeNode::m_children [private] |
HTREEITEM Vaca::TreeNode::m_HTREEITEM [private] |
TreeView* Vaca::TreeNode::m_owner [private] |
bool Vaca::TreeNode::m_deleted [private] |