OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Use this class to navigate the TTreeViewCtrl. More...
#include <owl/treeviewctrl.h>
Public Types | |
enum | THowToInsert { First = reinterpret_cast<INT_PTR>(TVI_FIRST) , Last = reinterpret_cast<INT_PTR>(TVI_LAST) , Sort = reinterpret_cast<INT_PTR>(TVI_SORT) } |
Specifies how to insert a new item into a Tree-View control. More... | |
enum | TExpandCode { Collapse = TVE_COLLAPSE , Expand = TVE_EXPAND , Toggle = TVE_TOGGLE , CollapseReset = TVE_COLLAPSERESET } |
How to expand the item. More... | |
enum | TNextCode { Root = TVGN_ROOT , Next = TVGN_NEXT , Previous = TVGN_PREVIOUS , Parent = TVGN_PARENT , Child = TVGN_CHILD , FirstVisible = TVGN_FIRSTVISIBLE , NextVisible = TVGN_NEXTVISIBLE , PreviousVisible = TVGN_PREVIOUSVISIBLE , DropHilite = TVGN_DROPHILITE , Caret = TVGN_CARET } |
How to retrieve the next node. More... | |
Public Member Functions | |
TTreeNode (TTreeViewCtrl &tree, LPCTSTR text) | |
Construct a new node given the node's text. | |
TTreeNode (TTreeViewCtrl &tree, LPCTSTR text, int index, int selIndex) | |
Construct a new node given the node's text and image info. | |
TTreeNode (TTreeViewCtrl &tree, TVITEM item) | |
Construct based on an item. | |
TTreeNode (TTreeViewCtrl &tree, HTREEITEM hItem=TVI_ROOT) | |
Parameters: | |
TTreeNode (const TTreeNode &node, uint32 flag) | |
Construct the node neighboring a given node. | |
TTreeNode (const TTreeNode &) | |
Copy constructor: create a new node by copying another node Called implicitly by functions that return a TTreeNode by value; otherwise, shouldn't be needed. | |
TTreeNode & | operator= (const TTreeNode &other) |
TTreeViewCtrl & | GetTreeView () const |
Returns a reference to the associated tree view. | |
TTreeNode | GetParent () const |
Return the parent of the current node. | |
TTreeNode | GetChild () const |
Get the first child of the current node. | |
TTreeNode | GetNextSibling () const |
Return the next sibling. | |
TTreeNode | GetPrevSibling () const |
Return the previous sibling. | |
TTreeNode | GetNextVisible () const |
Return the next visible item. | |
TTreeNode | GetPrevVisible () const |
Return the next previous item. | |
TTreeNode | GetNextItem (uint32 flag) const |
Return the next item. | |
TTreeNode | AddChild (const TTreeNode &node) const |
Inserts a new child item into the Tree-View (TreeView) control. | |
TTreeNode | AddSibling (const TTreeNode &node) const |
TTreeNode | InsertChild (const TTreeNode &node, THowToInsert how) const |
TTreeNode | InsertItem (const TTreeNode &node) const |
bool | Delete (void) |
TTreeNode | AddChild (const TTvItem &) const |
TTreeNode | AddSibling (const TTvItem &) const |
Inserts a new sibling item into the Tree-View (TreeView) control. (Adds the item above this item.) | |
TTreeNode | InsertChild (const TTvItem &, THowToInsert) const |
TTreeNode | InsertItem (const TTvItem &) const |
void | SetMask (uint mask) |
uint | GetMask (void) const |
void | SetStateMask (uint mask) |
uint | GetStateMask (void) const |
void | SetHTreeItem (HTREEITEM hItem) |
Set and Get the node's item handle. | |
HTREEITEM | GetHTreeItem () const |
bool | SetHasChildren (int hasChildren, bool sendNow=true) |
bool | GetHasChildren (int &hasChildren, bool getNew=true) |
bool | SetState (uint state, bool sendNow=true) |
bool | GetState (uint &state, bool getNew=true) |
bool | SetImageIndex (int index, bool sendNow=true) |
bool | SetSelectedImageIndex (int index, bool sendNow=true) |
bool | SetItemData (LPARAM data, bool sendNow=true) |
bool | GetItemData (LPARAM &data, bool getNew=true) |
bool | GetItemRect (TRect &rect, bool textOnly=true) const |
void | Check (bool state=true) |
Sets the node's checked state. | |
bool | IsChecked () const |
Retrieves the node's checked state. | |
bool | SetText (LPCTSTR text, bool sendNow=true) |
bool | SetText (const tstring &text, bool sendNow=true) |
bool | GetText (TCHAR *text, uint length, bool getNew=false) |
LPCTSTR | GetText (bool getNew=false) |
void | SetCacheSize (uint size) |
void | FlushCache (void) |
bool | GetItem (void) |
Update the item information in the node. | |
bool | SetItem (void) |
bool | GetItem (TTvItem *item) |
Return the item associated with the node. | |
bool | SetItem (TTvItem *item) |
Set the item associated with this node. | |
HIMAGELIST | CreateDragImage () |
Return the image list used for a dragging purposes. | |
HWND | EditLabel () |
Return the HWND of the edit control to change the text. | |
bool | EnsureVisible () |
Makes sure the item is visible. | |
bool | ExpandItem (uint32 flag) |
Expand or contract a parent node. | |
bool | SelectItem (uint32 flag) |
Make the next item selected. | |
bool | SortChildren (bool recurse=false) |
Sort the children of this node. | |
bool | SortChildren (const TTvComparator &Comparator, bool recurse=false, LPARAM extraParam=0) |
operator HTREEITEM () const | |
Return the magic cookie used by the control associated with the item. | |
Protected Attributes | |
TTvItem | ItemStruct |
contains a TVITEM with HTREEITEM | |
TTreeViewCtrl * | TreeView |
wrapper for item of this tree | |
Use this class to navigate the TTreeViewCtrl.
Each node conceptually contains a pointer to a TTvItem.
Definition at line 106 of file treeviewctrl.h.
How to expand the item.
Enumerator | |
---|---|
Collapse | Always collapse. |
Expand | Always expand. |
Toggle | Toggle between collapse and expand. |
CollapseReset | Collapse this node and all children. |
Definition at line 294 of file treeviewctrl.h.
Specifies how to insert a new item into a Tree-View control.
In 32-bit applications, the THowToInsert values correspond to Tree-View Insert constants.
Enumerator | |
---|---|
First | First child. |
Last | Last child. |
Sort | Sort order. |
Definition at line 112 of file treeviewctrl.h.
How to retrieve the next node.
Definition at line 303 of file treeviewctrl.h.
owl::TTreeNode::TTreeNode | ( | TTreeViewCtrl & | tree, |
LPCTSTR | text ) |
Construct a new node given the node's text.
Parameters:
tree A
TTreeViewCtrl object to associate with the node. text A
text label for the node.Remarks:
Definition at line 49 of file treeviewctrl.cpp.
References SetText().
owl::TTreeNode::TTreeNode | ( | TTreeViewCtrl & | tree, |
LPCTSTR | text, | ||
int | index, | ||
int | selIndex ) |
Construct a new node given the node's text and image info.
Parameters:
tree A
TTreeViewCtrl object to associate with the node. text A
text label for the node. index The
index of the image in the TTreeViewCtrl image list that corresponds to the node's unselected state. Remarks:
Definition at line 76 of file treeviewctrl.cpp.
References SetImageIndex(), SetSelectedImageIndex(), and SetText().
owl::TTreeNode::TTreeNode | ( | TTreeViewCtrl & | tree, |
TVITEM | item ) |
Construct based on an item.
Parameters:
tree A
TTreeViewCtrl object to associate with the node. item A
TVITEM object representing the item.Remarks:
Definition at line 99 of file treeviewctrl.cpp.
References SetText().
owl::TTreeNode::TTreeNode | ( | TTreeViewCtrl & | tw, |
HTREEITEM | hItem = TVI_ROOT ) |
Parameters:
tree A
TTreeViewCtrl object to associate with the node. hItem A
handle to a TVITEM object representing the item, a Tree-View Insert constant (32-bit applications), or a THowToInsert value.Remarks:
Definition at line 121 of file treeviewctrl.cpp.
References ItemStruct, and WARNX.
Construct the node neighboring a given node.
The flag indicates whether to create the next, previous, parent, or first child node.
Parameters:
Remarks:
Definition at line 190 of file treeviewctrl.cpp.
References owl::TTreeViewCtrl::GetNextItem(), and TreeView.
owl::TTreeNode::TTreeNode | ( | const TTreeNode & | other | ) |
Copy constructor: create a new node by copying another node Called implicitly by functions that return a TTreeNode by value; otherwise, shouldn't be needed.
Parameters
other A
TTreeNode object to copy. Definition at line 138 of file treeviewctrl.cpp.
Inserts a new child item into the Tree-View (TreeView) control.
Parameters
node A
TTreeNode object encapsulating an item that will be the parent of the new item.Returns a TTreeNode object encapsulating the new item. Returns NULL upon failure. (In 32-bit applications, you can check for a NULL handle using the HTREEITEM() operator.)
Definition at line 572 of file treeviewctrl.h.
References InsertChild(), and Last.
Definition at line 578 of file treeviewctrl.h.
References InsertChild(), and Last.
Definition at line 218 of file treeviewctrl.cpp.
References InsertItem().
Inserts a new sibling item into the Tree-View (TreeView) control. (Adds the item above this item.)
Parameters
node A
TTreeNode object encapsulating an item that will be a sibling of the new item.Return Value Returns a TTreeNode object encapsulating the new item. Returns NULL upon failure. (In 32-bit applications, you can check for a NULL handle using the HTREEITEM() operator.)
Definition at line 211 of file treeviewctrl.cpp.
References InsertItem().
Sets the node's checked state.
Assumes that the tree has the TVS_CHECKBOXES style, or has state images manually implemented in a similar manner to represent checked state.
Definition at line 570 of file treeviewctrl.cpp.
References owl::TWindow::GetHandle(), GetHTreeItem(), owl::TTreeViewCtrl::HasStyle(), ItemStruct, PRECONDITION, TreeView, and WARNX.
|
inline |
Return the image list used for a dragging purposes.
Definition at line 507 of file treeviewctrl.h.
References owl::TTreeViewCtrl::CreateDragImage(), and TreeView.
Definition at line 609 of file treeviewctrl.cpp.
References owl::TTreeViewCtrl::Delete(), ItemStruct, PRECONDITION, and TreeView.
|
inline |
Return the HWND of the edit control to change the text.
Definition at line 498 of file treeviewctrl.h.
References owl::TTreeViewCtrl::EditLabel(), and TreeView.
|
inline |
Makes sure the item is visible.
Scroll the items if necessary.
Definition at line 517 of file treeviewctrl.h.
References owl::TTreeViewCtrl::EnsureVisible(), and TreeView.
Expand or contract a parent node.
Similar to the user clicking on the '-' or '+' area of the control.
Definition at line 527 of file treeviewctrl.h.
References owl::TTreeViewCtrl::ExpandItem(), and TreeView.
Definition at line 600 of file treeviewctrl.cpp.
|
inline |
Get the first child of the current node.
Definition at line 596 of file treeviewctrl.h.
References Child, and GetNextItem().
Definition at line 483 of file treeviewctrl.cpp.
References GetItem(), ItemStruct, PRECONDITION, and TreeView.
|
inline |
Definition at line 681 of file treeviewctrl.h.
References owl::TTvItem::GetHTreeitem(), and ItemStruct.
Return the item associated with the node.
Definition at line 710 of file treeviewctrl.h.
References ItemStruct, PRECONDITION, owl::TWindow::SendMessage(), owl::TTvItem::SetHTreeItem(), and TreeView.
Update the item information in the node.
What's set in the mask determines what will be retrieved. Unless the user has explicitly called SetMask, the call should retrieve everything.
Definition at line 725 of file treeviewctrl.h.
References ItemStruct, PRECONDITION, owl::TWindow::SendMessage(), and TreeView.
Definition at line 457 of file treeviewctrl.cpp.
References GetItem(), ItemStruct, PRECONDITION, and TreeView.
Definition at line 547 of file treeviewctrl.cpp.
References ItemStruct, PRECONDITION, REINTERPRET_CAST, owl::TWindow::SendMessage(), and TreeView.
Definition at line 653 of file treeviewctrl.h.
References ItemStruct.
Return the next item.
Definition at line 545 of file treeviewctrl.h.
References owl::TTreeViewCtrl::GetNextItem(), and TreeView.
|
inline |
Return the next sibling.
Definition at line 605 of file treeviewctrl.h.
References GetNextItem(), and Next.
|
inline |
Return the next visible item.
Definition at line 623 of file treeviewctrl.h.
References GetNextItem(), and NextVisible.
|
inline |
Return the parent of the current node.
Definition at line 587 of file treeviewctrl.h.
References GetNextItem(), and Parent.
|
inline |
Return the previous sibling.
Definition at line 614 of file treeviewctrl.h.
References GetNextItem(), and Previous.
|
inline |
Return the next previous item.
Definition at line 632 of file treeviewctrl.h.
References GetNextItem(), and PreviousVisible.
Definition at line 300 of file treeviewctrl.cpp.
References GetItem(), ItemStruct, PRECONDITION, and TreeView.
Definition at line 665 of file treeviewctrl.h.
References ItemStruct.
Definition at line 394 of file treeviewctrl.cpp.
References FlushCache(), GetItem(), ItemStruct, PRECONDITION, and TreeView.
Definition at line 377 of file treeviewctrl.cpp.
|
inline |
Returns a reference to the associated tree view.
Definition at line 164 of file treeviewctrl.h.
|
inline |
Definition at line 551 of file treeviewctrl.h.
References InsertChild().
TTreeNode owl::TTreeNode::InsertChild | ( | const TTvItem & | item, |
THowToInsert | how ) const |
Definition at line 239 of file treeviewctrl.cpp.
References owl::TTreeViewCtrl::InsertItem(), and TreeView.
Definition at line 557 of file treeviewctrl.h.
References InsertItem().
Definition at line 253 of file treeviewctrl.cpp.
References GetParent(), owl::TTreeViewCtrl::InsertItem(), and TreeView.
bool owl::TTreeNode::IsChecked | ( | ) | const |
Retrieves the node's checked state.
Assumes that the tree has the TVS_CHECKBOXES style, or has state images manually implemented in a similar manner to represent checked state.
Definition at line 585 of file treeviewctrl.cpp.
References owl::TWindow::GetHandle(), GetHTreeItem(), owl::TTreeViewCtrl::HasStyle(), ItemStruct, PRECONDITION, TreeView, and WARNX.
|
inline |
Return the magic cookie used by the control associated with the item.
Definition at line 489 of file treeviewctrl.h.
Definition at line 146 of file treeviewctrl.cpp.
Make the next item selected.
Definition at line 536 of file treeviewctrl.h.
References owl::TTreeViewCtrl::SelectItem(), and TreeView.
Definition at line 508 of file treeviewctrl.cpp.
References ItemStruct, PRECONDITION, SetItem(), and TreeView.
Set and Get the node's item handle.
Definition at line 675 of file treeviewctrl.h.
References ItemStruct, and owl::TTvItem::SetHTreeItem().
Definition at line 420 of file treeviewctrl.cpp.
References ItemStruct, PRECONDITION, SetItem(), and TreeView.
Set the item associated with this node.
Definition at line 690 of file treeviewctrl.h.
References PRECONDITION, owl::TWindow::SendMessage(), owl::TTvItem::SetHTreeItem(), and TreeView.
Definition at line 699 of file treeviewctrl.h.
References ItemStruct, PRECONDITION, owl::TWindow::SendMessage(), and TreeView.
Definition at line 445 of file treeviewctrl.cpp.
References ItemStruct, PRECONDITION, SetItem(), and TreeView.
Definition at line 647 of file treeviewctrl.h.
References ItemStruct.
Definition at line 432 of file treeviewctrl.cpp.
References ItemStruct, PRECONDITION, SetItem(), and TreeView.
Definition at line 325 of file treeviewctrl.cpp.
References ItemStruct, PRECONDITION, SetItem(), and TreeView.
Definition at line 659 of file treeviewctrl.h.
References ItemStruct.
Definition at line 223 of file treeviewctrl.h.
References SetText().
Definition at line 347 of file treeviewctrl.cpp.
References _tcslen, _tcsncpy, FlushCache(), ItemStruct, PRECONDITION, SetItem(), and TreeView.
Sort the children of this node.
Definition at line 641 of file treeviewctrl.h.
References owl::TTreeViewCtrl::SortChildren(), and TreeView.
bool owl::TTreeNode::SortChildren | ( | const TTvComparator & | Comparator, |
bool | recurse = false, | ||
LPARAM | extraParam = 0 ) |
Definition at line 288 of file treeviewctrl.cpp.
References owl::OwlTreeWindCompare(), owl::TTreeViewCtrl::SortChildren(), and TreeView.
|
protected |
contains a TVITEM with HTREEITEM
Definition at line 317 of file treeviewctrl.h.
|
protected |
wrapper for item of this tree
Definition at line 318 of file treeviewctrl.h.