SEC_TREECLASS Class

class SEC_TREECLASS

SEC_TREECLASS is the base class for SECTreeCtrl and SECTreeView. All tree functionality is implemented in this class ( include\trcore.inl ), and SEC_LISTCLASS ( include\slstcore.inl ).

Defined in: trcore.h

See Also

SEC_LISTCLASS

Class Members

Construction/Initialization

SEC_TREECLASS()

Construction

Operations

int GetActiveColumn()

retrieve the active Column

virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL)

Create an SECTreeCtrl

virtual BOOL Create(DWORD dwStyle, DWORD dwStyleEx, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL)

Create an SECTreeCtrl

BOOL SubclassTreeCtrlId( UINT idc, CWnd *pWndDlg )

Create a SECTreeCtrl on a dialog template.

BOOL GetItemRect( HTREEITEM hti, LPRECT lpRect, UINT nCode ) const

Retrieves the bounding rectangle for an item and determines whether it is visible or not.

UINT GetIndent() const

Retrieves the amount, in pixels, that child items are indented relative to their parents.

void SetIndent(UINT nIndent)

Sets the width of indentation for a tree view control and redraws the control to reflect the new width.

UINT SetItemHeight(HTREEITEM hti, UINT cyItemHeight) const

Sets the height of a single tree item

HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const

Retrieves the next tree view item.

HTREEITEM GetChildItem(HTREEITEM hItem) const

Retrieves the tree view item that is the child of the item specified.

HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const

Retrieves the next sibling of the item specified.

HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const

Retrieves the previous sibling of the item specified.

HTREEITEM GetParentItem(HTREEITEM hItem) const

Retrieves the parent of the item specified.

HTREEITEM GetFirstVisibleItem() const

Retrieves the first visible item of the tree view control.

HTREEITEM GetLastVisibleItem() const

Retrieves the last visible item of the tree view control.

HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const

Retrieves the next visible item of the item specified.

HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const

Retrieves the previous visible item of the item specified.

HTREEITEM GetFirstSelectedItem() const

Retrieves the first item currently selected in the tree view control.

HTREEITEM GetNextSelectedItem(HTREEITEM hItem) const

Retrieves the next item currently selected in the tree view control.

HTREEITEM GetPrevSelectedItem(HTREEITEM hItem) const

Retrieves the previously selected item in the tree view control.

HTREEITEM GetCaretItem() const

Retrieves the item that currently has the caret (i.e., keyboard focus).

HTREEITEM GetSelectedItem() const

Retrieves a currently selected item of the tree view control.

HTREEITEM GetDropHilightItem() const

Retrieves the item that is the target of a drag-and-drop operation.

HTREEITEM GetRootItem(HTREEITEM hti = NULL) const

Retrieves the root item of the tree view control.

HTREEITEM GetNextItemInDisplayOrder(HTREEITEM hti) const

Gets the next displayed item.

HTREEITEM GetPrevItemInDisplayOrder(HTREEITEM hti) const

Gets the previous displayed item.

virtual BOOL SetItem(const LV_ITEM* pLVI, BOOL bRedraw = TRUE)

Sets the attributes of the specified item.

BOOL SetItem(TV_ITEM* pItem)

Sets the attributes of the specified item.

BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam)

Sets the attributes of the specified item.

virtual BOOL SetItemEx(TV_ITEM* pTVI, TV_ITEM_EX* pTVIX)

Sets the extended attributes of the specified item.

virtual BOOL SetItemEx(LV_ITEM* pLVI, const LV_ITEM_EX* pLVIX)

Sets the extended attributes of the specified item.

BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage)

Sets the index of the item’s image and its selected image within the tree view control’s image list.

BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask)

Sets the state of the item specified.

BOOL SetItemData(HTREEITEM hItem, SEC_DWORD dwData)

Sets the 32-bit application-specific value associated with the item specified.

virtual BOOL GetItem(TV_ITEM* pItem, BOOL bCopyText = TRUE, BOOL bGetDispInfo = FALSE) const

Retrieves the attributes of the specified item.

virtual BOOL GetItem(LV_ITEM* pLVI, BOOL bCopyText = TRUE, BOOL bGetDispInfo = FALSE) const

Retrieves the attributes of the specified item.

virtual BOOL GetItemEx(TV_ITEM* pTVI, TV_ITEM_EX* pTVIX, BOOL bGetDispInfoEx = FALSE) const

Retrieves the extended attributes of the specified item.

virtual BOOL GetItemEx(LV_ITEM* pLVI, LV_ITEM_EX* pLVIX, BOOL bGetDispInfoEx = FALSE) const

Retrieves the extended attributes of the specified item.

BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const

Retrieves the index of the item’s image and its selected image within the tree view control’s image list.

UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const

Returns the state of the item specified.

SEC_DWORD GetItemData(HTREEITEM hItem) const

Gets the 32-bit application-specific value associated with the item specified.

Node* GetNode( HTREEITEM hti ) const

Gets the stored pointer to a Node from an HTREEITEM.

Node* GetNode( Item* pItem ) const

Gets the stored pointer to a node from a list Item pointer.

Node* GetNodeAt( int nIndex ) const

Gets the stored pointer of a node based on an item index.

BOOL SetNodeParent( SECTreeNode *pNode, SECTreeNode *pNodeParent, BOOL bInvalidate=TRUE, HTREEITEM hInsertAfter=TVI_LAST )

Changes the parent of an existing node.

HTREEITEM GetItemAt(int nIndex) const

Gets an HTREEITEM based on a list index.

int ItemIndex(HTREEITEM, int nStartFrom = 0) const

Returns the list index of an HTREEITEM.

int NodeIndex(Node *, int nStartFrom = 0) const

Returns the list index of a Node.

BOOL IsExpanded(HTREEITEM hItem) const

Determines whether a given item is expanded (i.e., displaying the list of child items, if any, associated with it).

virtual BOOL IsCallbackItem(int nIndex) const

Determines whether specified item uses text or image callbacks.

virtual void StoreSubItemText( BOOL bEnable = TRUE )

Enables or disables sub-item text storage for multi-column trees.

virtual BOOL IsStoringSubItemText() const

Returns the state of sub-item text storage.

CString GetItemText(HTREEITEM hItem, int iSubItem = 0) const

Returns the text of the specified item or sub-item.

virtual BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem)

Sets the text of the specified item.

virtual BOOL SetItemText(HTREEITEM hItem, int nSubItem, LPCTSTR lpszItem)

Sets the text of the specified item or sub-item.

BOOL SetItemString(HTREEITEM hti, int nSubItem, const CString& strItem)

Sets the text of the specified item or sub-item.

BOOL GetItemString(HTREEITEM hti, int nSubItem, CString& strItem)

Returns the text of the specified item or sub-item.

BOOL InsertBatch(TV_ITEM** ppItems, HTREEITEM hParent, int cItems, BOOL bInvalidate=TRUE)

Insert a group of items under a common parent

HTREEITEM InsertItem(LPTV_INSERTSTRUCT lpInsertStruct)

Inserts a new item in a tree view control.

HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, HTREEITEM hParent, HTREEITEM hInsertAfter)

Inserts a new item in a tree view control.

HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST)

Inserts a new item in a tree view control.

HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST)

Inserts a new item in a tree view control.

BOOL DeleteItem(HTREEITEM hItem)

Deletes an item from the tree view control.

BOOL DeleteAllItems()

Deletes all items from the tree view control.

virtual BOOL Expand(HTREEITEM hItem, UINT nCode, BOOL bRedraw = TRUE, BOOL bForceExpand = FALSE)

Expands or collapses the list of child items, if any, associated with the given parent item.

void ExpandCompletely(HTREEITEM hItem, BOOL bRedraw = TRUE)

Recursively expands an item and all of its children.

void CollapseCompletely(HTREEITEM hItem, BOOL bRedraw = TRUE)

Recursively collapse an item and all of its children

BOOL Select(HTREEITEM hItem, UINT nCode)

Selects the given tree view item, scrolls the item into view, or redraws the item in the style used to indicate the target of a drag-and-drop operation.

BOOL SelectItem(HTREEITEM hItem)

Selects the given tree view item.

BOOL SelectDropTarget(HTREEITEM hItem, BOOL bAutoScroll=TRUE)

Redraws the item in the style used to indicate the target of a drag-and-drop operation.

BOOL SelectSetFirstVisible(HTREEITEM hItem)

Scrolls the tree view vertically so that the given item is the first visible item and gives it the focus and selection.

BOOL SetFirstVisible(HTREEITEM hti)

Determines whether a given item is set as the first visible item in the tree view control.

HTREEITEM HitTest(CPoint pt, UINT* pFlags = NULL)

Determines the location of the specified point relative to the client area of a tree view control.

HTREEITEM HitTest(TV_HITTESTINFO* pHitTestInfo)

Determines the location of the specified point relative to the client area of a tree view control.

CImageList* CreateDragImage(HTREEITEM hItem)

Creates a dragging bitmap for the given item in a tree view control, creates an image list for the bitmap, and adds the bitmap to the image list. An application uses the image-list functions to display the image when an item is being dragged.

CImageList* CreateDragImageEx(HTREEITEM hItem, CPoint& ptOffset)

Extends CreateDragImage to create multiple selection images

BOOL EnsureVisible(HTREEITEM hItem, BOOL bParentVisible = FALSE)

Ensures that a tree view item is visible. If necessary, expands the parent item or scrolls the tree view control so that the item is visible.

virtual int CompareItem(Node *pNode1, Node *pNode2)

Compares the text of two items.

BOOL SortChildren(HTREEITEM hItem, BOOL bRecursive = TRUE, BOOL bAscending = TRUE)

Sorts the child items of the given parent item in a tree view control.

BOOL SortChildrenCB(LPTV_SORTCB pSort, BOOL bRecursive = TRUE, BOOL bAscending = TRUE)

Sorts tree view items using an application-defined callback function that compares the items.

CEdit* EditLabel(HTREEITEM hItem, int nCol = 0)

Begins in-place editing of the specified item’s text.

UINT GetChildCount(HTREEITEM hti, BOOL bRecursive = TRUE, BOOL bExpandedOnly = FALSE)

Returns the number of children an item has.

BOOL SelectAllVisibleChildren(HTREEITEM hti)

Selects all child nodes visible beneath a parent node.

BOOL SelectItemRange( HTREEITEM htiFirst, HTREEITEM htiLast, BOOL bSelect)

Selects/deselects a range of items.

BOOL IsSelected(HTREEITEM hti) const

Indicates whether an item is selected.

BOOL HideItem( HTREEITEM hti, BOOL bHide )

Hides/Shows an item.

BOOL IsHidden( HTREEITEM hti ) const

Indicates whether or not an item is hidden.

HTREEITEM GetFirstHiddenItem(void) const

Gets first hidden item.

HTREEITEM GetNextHiddenItem(HTREEITEM) const

Gets next hidden item.

BOOL UnHideAllItems(void)

Makes all hidden items visible.

BOOL DisableAllItems( BOOL bDisable )

Disables all items (shown in disabled text color), or enables disabled items.

BOOL DisableItem( HTREEITEM hti, BOOL bDisable )

Disables/enables a particular item.

BOOL IsDisabled( HTREEITEM ) const

Indicates whether or not an item is disabled.

HTREEITEM GetFirstDisabledItem(void) const

Gets first disabled item.

HTREEITEM GetNextDisabledItem(HTREEITEM) const

Gets next disabled item.

void HideDisabledItems(BOOL bHide)

Hides items that are disabled.

BOOL IsHideDisabledItems(void) const

Indicates whether or not disabled items are hidden.

UINT GetCount() const

Retrieves a count of the items in a tree view control.

BOOL ItemHasChildrenOnDemand(HTREEITEM hItem) const

Determines whether the tree item specified has child items on demand.

BOOL ItemHasChildren(HTREEITEM hItem) const

Determines whether the tree item specified has child items.

BOOL ItemExists(HTREEITEM hti) const

Indicates whether or not an item exists in the tree view control.

void EnableScrollOnExpand(BOOL bEnable=TRUE)

Enables/disables scrolling after an item is expanded, to make the last child visible.

virtual CImageList* GetImageList(UINT nImageList) const

Returns a pointer to the requested image list.

virtual CImageList* SetImageList(CImageList* pImageList, int nImageListType)

Sets the normal or state image list.

virtual void EnableHeaderCtrl(BOOL bEnable = TRUE, BOOL bSortHeader = FALSE)

Enables/disables the column header control.

virtual void EnableWordWrap(BOOL bEnable = TRUE)

Enables/disables wrapping of item text.

virtual void EnableToolTips(BOOL bEnable = TRUE)

Enables/disables tooltips.

virtual void EnableMultiSelect(BOOL bEnable = TRUE)

Enables/disables multiple selection.

virtual BOOL GetTreeCtrlStyles(DWORD& dwStyle, DWORD& dwStyleEx) const

Retrieves values for the style and extended style of a tree view control.

virtual BOOL SetTreeCtrlStyles(DWORD dwStyle, DWORD dwStyleEx, BOOL bRedraw = TRUE)

Sets values for the style and extended style of a tree view control.

virtual DWORD GetTreeCtrlStyle() const

Retrieves the style of a tree view control.

virtual DWORD GetTreeCtrlStyleEx() const

Retrieves the extended style of a tree view control.

virtual BOOL SetTreeCtrlStyle(DWORD dwStyle, BOOL bRedraw = TRUE)

Sets value for the style of a tree view control.

virtual BOOL SetTreeCtrlStyleEx(DWORD dwStyleEx, BOOL bRedraw = TRUE)

Sets value for the extended style of a tree view control.

virtual BOOL ModifyTreeCtrlStyle(DWORD dwRemove, DWORD dwAdd, BOOL bRedraw = TRUE)

Modifies a tree view control’s style by removal and addition of specified styles.

virtual BOOL ModifyTreeCtrlStyleEx(DWORD dwRemoveEx, DWORD dwAddEx, BOOL bRedraw = TRUE)

Modifies a tree view control’s extended style by removal and addition of specified extended styles.

virtual BOOL ModifyTreeCtrlStyles(DWORD dwRemove, DWORD dwAdd, DWORD dwRemoveEx, DWORD dwAddEx, BOOL bRedraw = TRUE)

Modifies a tree view control’s style ans extended style by removal and addition of specified styles and extended styles.

void SetFilterLevel(WORD wLevel)

Filters out a complete level of the tree from visibility.

WORD GetFilterLevel(void) const

Retrieves level of the tree isolated by the filter set by SetFilterLevel.

virtual BOOL Update( HTREEITEM hti, BOOL bLabelOnly = FALSE, BOOL bEraseBkgnd = TRUE, BOOL bUpdateBelow = FALSE, BOOL bUpdateNow = FALSE )

Updates the drawing of an item.

inline BOOL InvalidateItem(HTREEITEM hti)

Invalidates an item's rectangle.

void ReMeasureItem( HTREEITEM hti )

Causes the item's width and height to be measured. The item will then be invalidated.

void SetAutoExpandDelay( UINT nDelay )

sets the hover time required to auto expand a drop target. Must have TVXS_AUTOEXPAND.

void SetMaxAnimations( int nMaxAnimations )

sets the maximum numbret of animations when expanding or collapsing, for TVXS_ANIMATE style

virtual BOOL InsertColumn( int nCol, const CString& strHeader, int nFormat=LVCFMT_LEFT, int wWidth=-1, int iSubItem = -1, int iImage = -1, BOOL bUpdate = TRUE )

Inserts a column.

virtual BOOL DeleteColumn( int nCol )

Deletes a column.

virtual BOOL DeleteColumn( const CString& strColumnHeading )

Deletes a column.