Tree Control Data Structures
The SECTreeCtrl and SECTreeView classes utilize the same data structures used by the CTreeCtrl class. The use of these data structures does not promote object-oriented programming. However, they are compatible with CTreeCtrl.
TV_ITEM
The TV_ITEM structure retrieves or specifies the attributes of a tree view item. It is defined as follows:
typedef struct _TV_ITEM { tvi
UINT mask; // what is valid in this structure
HTREEITEM hItem; // handle of this item
UINT state; // selected, expanded, drop
// highlighted,
// also state and overlay
// image indexes
// via obscure macros
// like INDEXTO…
// that map to bit fields
UINT stateMask; // what is valid in the “state”
// member
LPSTR pszText; // text or LPSTR_TEXTCALLBACK
int cchTextMax; // only used when modifying text
int iImage; // normal image index
// or I_IMAGECALLBACK
int iSelectedImage; // selected image #
// or I_IMAGECALLBACK
int cChildren; // # of children
// or I_CHILDRENCALLBACK
LPARAM lParam; // 32-bit user defined data
} TV_ITEM;
For a complete description of the members of this structure, refer to the MSDN documentation for TV_ITEM or TVITEM, which is identical to TV_ITEM, but follows current naming conventions.
NM_TREEVIEW
The NM_TREEVIEW structure is used within the tree control message notification mechanism. It contains information about a specific tree view notification message. A pointer to this data structure is included as a parameter accompanying the WM_NOTIFY message. It is defined as follows:
typedef struct tagNMTREEVIEW {
NMHDR hdr;
UINT action;
TVITEM itemOld;
TVITEM itemNew;
POINT ptDrag;
} NMTREEVIEW, FAR *LPNMTREEVIEW;
For a complete description of the members of this structure, refer to the MSDN documentation for NM_TREEVIEW or NMTREEVIEW, which is identical to NM_TREEVIEW, but follows current naming conventions.
TV_HITTESTINFO
This structure contains information for determining the location of a point relative to a tree view control. It is defined as follows:
typedef struct _TVHITTESTINFO {
POINT pt; // client coordinates of point to test
UINT flags; // info about the results of hit test
HTREEITEM hItem; // handle of item that occupies point
} TV_HITTESTINFO, FAR *LPTV_HITTESTINFO;
This structure is used as an optional parameter of the HitTest() method. For more information about the members of this structure, refer to the MSDN documentation for TV_HITTESTINFO or TVHITTESTINFO, which is identical to TV_HITTESTINFO, but follows current naming conventions. Refer to the documentation for SEC_TREECLASS::HitTest() in the Objective Toolkit Class Reference.