soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
STreeCtrl Class Reference

A tree control for displaying hierarchical data. More...

#include <STreeCtrl.h>

Inheritance diagram for STreeCtrl:
CSTree< LPTVITEM >

Classes

class  IListener
 Listener interface for tree view events. More...
 

Public Member Functions

 STreeCtrl ()
 Constructor for STreeCtrl.
 
virtual ~STreeCtrl ()
 Destructor for STreeCtrl.
 
HSTREEITEM InsertItem (LPCTSTR lpszItem, int nImage, int nSelectedImage, LPARAM lParam, HSTREEITEM hParent=STVI_ROOT, HSTREEITEM hInsertAfter=STVI_LAST) OVERRIDE
 Inserts a new item into the tree.
 
HSTREEITEM InsertItemA (LPCSTR lpszItem, int nImage, int nSelectedImage, LPARAM lParam, HSTREEITEM hParent=STVI_ROOT, HSTREEITEM hInsertAfter=STVI_LAST) OVERRIDE
 Inserts a new item into the tree (ANSI version).
 
BOOL RemoveItem (HSTREEITEM hItem) OVERRIDE
 Removes an item from the tree.
 
void RemoveAllItems () OVERRIDE
 Removes all items from the tree.
 
HSTREEITEM GetRootItem () SCONST OVERRIDE
 Gets the root item of the tree.
 
HSTREEITEM GetNextSiblingItem (HSTREEITEM hItem) SCONST OVERRIDE
 Gets the next sibling item.
 
HSTREEITEM GetPrevSiblingItem (HSTREEITEM hItem) SCONST OVERRIDE
 Gets the previous sibling item.
 
HSTREEITEM GetChildItem (HSTREEITEM hItem, BOOL bFirst=TRUE) SCONST OVERRIDE
 Gets a child item.
 
HSTREEITEM GetParentItem (HSTREEITEM hItem) SCONST OVERRIDE
 Gets the parent item.
 
HSTREEITEM GetSelectedItem () SCONST OVERRIDE
 Gets the selected item.
 
HSTREEITEM GetNextItem (HSTREEITEM hItem) SCONST OVERRIDE
 Gets the next item.
 
void SortChildren (HSTREEITEM hItem, FunTreeSortCallback sortFunc, void *pCtx) OVERRIDE
 Sorts the children of an item.
 
BOOL SelectItem (HSTREEITEM hItem, BOOL bEnsureVisible=TRUE) OVERRIDE
 Selects an item.
 
BOOL GetItemText (HSTREEITEM hItem, IStringT *strText) SCONST OVERRIDE
 Gets the text of an item.
 
BOOL GetItemTextA (HSTREEITEM hItem, IStringA *strText) SCONST OVERRIDE
 Gets the text of an item (ANSI version).
 
BOOL SetItemText (HSTREEITEM hItem, LPCTSTR lpszItem) OVERRIDE
 Sets the text of an item.
 
BOOL SetItemTextA (HSTREEITEM hItem, LPCSTR lpszItem) OVERRIDE
 Sets the text of an item (ANSI version).
 
BOOL GetItemImage (HSTREEITEM hItem, int *nImage, int *nSelectedImage) SCONST OVERRIDE
 Gets the images of an item.
 
BOOL SetItemImage (HSTREEITEM hItem, int nImage, int nSelectedImage) OVERRIDE
 Sets the images of an item.
 
LPARAM GetItemData (HSTREEITEM hItem) SCONST OVERRIDE
 Gets the application-defined data of an item.
 
BOOL SetItemData (HSTREEITEM hItem, LPARAM lParam) OVERRIDE
 Sets the application-defined data of an item.
 
BOOL ItemHasChildren (HSTREEITEM hItem) SCONST OVERRIDE
 Checks if an item has children.
 
int GetCheckState (HSTREEITEM hItem) SCONST OVERRIDE
 Gets the check state of an item.
 
BOOL SetCheckState (HSTREEITEM hItem, BOOL bCheck) OVERRIDE
 Sets the check state of an item.
 
BOOL Expand (HSTREEITEM hItem, UINT nCode=TVE_EXPAND) OVERRIDE
 Expands or collapses an item.
 
BOOL EnsureVisible (HSTREEITEM hItem) OVERRIDE
 Ensures an item is visible.
 
void SetListener (IListener *pListener)
 Sets the listener for tree view events.
 
HSTREEITEM InsertItem (LPCTSTR lpszItem, HSTREEITEM hParent=STVI_ROOT, HSTREEITEM hInsertAfter=STVI_LAST)
 Inserts a new item into the tree.
 
HSTREEITEM InsertItem (LPCTSTR lpszItem, int nImage, int nSelectedImage, HSTREEITEM hParent=STVI_ROOT, HSTREEITEM hInsertAfter=STVI_LAST)
 Inserts a new item into the tree.
 
HSTREEITEM HitTest (CPoint &pt)
 Performs a hit test on the tree view.
 
BOOL GetItemText (HSTREEITEM hItem, SStringT &strText) const
 Gets the text of an item.
 

Protected Member Functions

void PageUp ()
 Handles the page up action.
 
void PageDown ()
 Handles the page down action.
 
void UpdateScrollBar ()
 Updates the scroll bars.
 
virtual BOOL CreateChildren (SXmlNode xmlNode)
 Creates child windows from an XML node.
 
virtual void LoadBranch (HSTREEITEM hParent, SXmlNode xmlNode)
 Loads a branch of items from an XML node.
 
virtual void LoadItemAttribute (SXmlNode xmlNode, LPTVITEM pItem)
 Loads attributes for an item from an XML node.
 
HSTREEITEM InsertItem (LPTVITEM pItemObj, HSTREEITEM hParent, HSTREEITEM hInsertAfter)
 Inserts a new item into the tree.
 
HSTREEITEM InsertItem (SXmlNode xmlNode, HSTREEITEM hParent=STVI_ROOT, HSTREEITEM hInsertAfter=STVI_LAST)
 Inserts a new item into the tree from an XML node.
 
BOOL IsAncestor (HSTREEITEM hItem1, HSTREEITEM hItem2)
 Checks if one item is an ancestor of another.
 
BOOL VerifyItem (HSTREEITEM hItem) const
 Verifies if an item is valid.
 
void SetChildrenVisible (HSTREEITEM hItem, BOOL bVisible)
 Sets the visibility of an item's children.
 
void SetChildrenState (HSTREEITEM hItem, int nCheckValue)
 Sets the check state of an item's children.
 
BOOL CheckChildrenState (HSTREEITEM hItem, BOOL bCheck)
 Checks the state of an item's children.
 
void CheckState (HSTREEITEM hItem)
 Updates the check state of an item.
 
virtual void ItemLayout ()
 Performs layout calculations for items.
 
virtual void CalcItemContentWidth (LPTVITEM pItem)
 Calculates the content width of an item.
 
virtual int CalcItemWidth (const LPTVITEM pItem)
 Calculates the width of an item.
 
virtual int CalcMaxItemWidth (HSTREEITEM hItem)
 Calculates the maximum width of an item and its children.
 
virtual void UpdateContentWidth ()
 Updates the content width of the tree.
 
int GetItemShowIndex (HSTREEITEM hItemObj)
 Gets the index of an item in the visible list.
 
BOOL GetItemRect (LPTVITEM pItem, CRect &rcItem)
 Gets the rectangle of an item.
 
void RedrawItem (HSTREEITEM hItem)
 Redraws an item.
 
virtual void DrawItem (IRenderTarget *pRT, const CRect &rc, HSTREEITEM hItem)
 Draws an item.
 
virtual void DrawLines (IRenderTarget *pRT, const CRect &rc, HSTREEITEM hItem)
 Draws lines for an item.
 
int ItemHitTest (HSTREEITEM hItem, CPoint &pt) const
 Performs a hit test on an item.
 
void ModifyToggleState (HSTREEITEM hItem, DWORD dwStateAdd, DWORD dwStateRemove)
 Modifies the toggle state of an item.
 
void ModifyChekcBoxState (HSTREEITEM hItem, DWORD dwStateAdd, DWORD dwStateRemove)
 Modifies the checkbox state of an item.
 
void ItemLButtonDown (HSTREEITEM hItem, UINT nFlags, CPoint pt)
 Handles the left mouse button down event for an item.
 
void ItemLButtonUp (HSTREEITEM hItem, UINT nFlags, CPoint pt)
 Handles the left mouse button up event for an item.
 
void ItemLButtonDbClick (HSTREEITEM hItem, UINT nFlags, CPoint pt)
 Handles the left mouse button double-click event for an item.
 
void ItemMouseMove (HSTREEITEM hItem, UINT nFlags, CPoint pt)
 Handles the mouse move event for an item.
 
void ItemMouseLeave (HSTREEITEM hItem)
 Handles the mouse leave event for an item.
 
virtual void OnNodeFree (LPTVITEM &pItemData)
 Frees the memory associated with an item.
 
virtual void OnInsertItem (LPTVITEM &pItemData)
 Handles the insertion of an item.
 
virtual HRESULT SetAttribute (const SNS::SStringW &amp;amp;amp;amp;strAttribName, const SNS::SStringW &amp;amp;amp;amp;strValue, BOOL bLoading=FALSE)
 
void OnDestroy ()
 Handles the destruction of the tree control.
 
void OnPaint (IRenderTarget *pRT)
 Handles the paint event.
 
void OnLButtonDown (UINT nFlags, CPoint pt)
 Handles the left mouse button down event.
 
void OnLButtonUp (UINT nFlags, CPoint pt)
 Handles the left mouse button up event.
 
void OnLButtonDbClick (UINT nFlags, CPoint pt)
 Handles the left mouse button double-click event.
 
void OnRButtonDown (UINT nFlags, CPoint pt)
 Handles the right mouse button down event.
 
void OnMouseMove (UINT nFlags, CPoint pt)
 Handles the mouse move event.
 
void OnMouseLeave ()
 Handles the mouse leave event.
 
void OnSize (UINT nType, CSize size)
 Handles the size event.
 
 MSG_WM_RBUTTONDOWN (OnRButtonDown)
 
- Protected Member Functions inherited from CSTree< LPTVITEM >
virtual void OnNodeFree (LPTVITEM &data)
 Virtual function to handle the freeing of node data.
 
 CSTree ()
 Constructor.
 
virtual ~CSTree ()
 Destructor.
 
void DeleteAllItems ()
 Delete all items in the tree.
 
HSTREEITEM GetRootItem (BOOL bFirst=TRUE)
 Get the root item.
 
HSTREEITEM GetChildItem (HSTREEITEM hItem, BOOL bFirst=TRUE) const
 Get the child item.
 
int GetChildrenCount (HSTREEITEM hItem) const
 Get the number of children.
 
virtual void DeleteItem (HSTREEITEM hItem)
 Delete an item.
 
BOOL DeleteItemEx (HSTREEITEM hItem)
 Delete an item and its branch.
 
HSTREEITEM InsertItem (const LPTVITEM &data, HSTREEITEM hParent=((HSTREEITEM) 0xFFFF0000), HSTREEITEM hInsertAfter=((HSTREEITEM) 0xFFFF0002))
 Insert a new item.
 
HSTREEITEM TraversingRecursion (HSTREEITEM hItem, CBTRAVERSING funTraversing, LPARAM lParam)
 Traverse the tree recursively.
 
HSTREEITEM TraversingSequence (HSTREEITEM hItem, CBTRAVERSING funTraversing, LPARAM lParam)
 Traverse the tree in sequence.
 
int GetDesendants (HSTREEITEM hItem)
 Get the number of descendants of a node.
 
HSTREEITEM GetNextItem (HSTREEITEM hItem) const
 Get the next item in the tree.
 
HSTREEITEM GetNextItem (HSTREEITEM hItem, int &nLevel) const
 Get the next item in the tree with level relationship.
 
void SortChildren (HSTREEITEM hItem, int(__cdecl *funSort)(void *, const void *, const void *), void *pCtx)
 Sort the children of a node.
 
void SetDataFreer (IDataFreer *cbFree)
 Set the data freer callback.
 

Protected Attributes

HSTREEITEM m_hSelItem
 Handle to the selected item.
 
HSTREEITEM m_hHoverItem
 Handle to the item under the hover state.
 
HSTREEITEM m_hCaptureItem
 Handle to the item that has capture.
 
int m_nVisibleItems
 Number of visible items.
 
int m_nContentWidth
 Total content width of the tree.
 
UINT m_uItemMask
 Mask for item attributes.
 
int m_nItemOffset
 Offset for item positioning.
 
CRect m_rcToggle
 Rectangle for the toggle button.
 
CRect m_rcCheckBox
 Rectangle for the checkbox.
 
CRect m_rcIcon
 Rectangle for the icon.
 
int m_nItemHoverBtn
 Button currently hovered.
 
int m_nItemPushDownBtn
 Button currently pushed down.
 
int m_nItemHei
 Height of each item.
 
int m_nIndent
 Indentation between levels.
 
int m_nItemMargin
 Margin around each item.
 
BOOL m_bCheckBox
 Flag indicating if checkboxes are enabled.
 
BOOL m_bRightClickSel
 Flag indicating if right-click selection is enabled.
 
IListenerm_pListener
 Listener for tree view events.
 
SAutoRefPtr< ISkinObjm_pItemBgSkin
 Skin for the background of items.
 
SAutoRefPtr< ISkinObjm_pItemSelSkin
 Skin for the selected background of items.
 
SAutoRefPtr< ISkinObjm_pIconSkin
 Skin for the icons.
 
SAutoRefPtr< ISkinObjm_pToggleSkin
 Skin for the toggle buttons.
 
SAutoRefPtr< ISkinObjm_pCheckSkin
 Skin for the checkboxes.
 
SAutoRefPtr< ISkinObjm_pLineSkin
 Skin for the lines.
 
COLORREF m_crItemBg
 Background color of items.
 
COLORREF m_crItemSelBg
 Background color of selected items.
 
COLORREF m_crItemText
 Text color of items.
 
COLORREF m_crItemSelText
 Text color of selected items.
 
BOOL m_bHasLines
 Flag indicating if lines are drawn between items.
 
- Protected Attributes inherited from CSTree< LPTVITEM >
IDataFreer * m_dataFreer
 
HSTREENODE m_hRootFirst
 
HSTREENODE m_hRootLast
 

Additional Inherited Members

- Static Protected Member Functions inherited from CSTree< LPTVITEM >
static HSTREEITEM GetNextSiblingItem (HSTREEITEM hItem)
 Get the next sibling item.
 
static HSTREEITEM GetPrevSiblingItem (HSTREEITEM hItem)
 Get the previous sibling item.
 
static HSTREEITEM GetParentItem (HSTREEITEM hItem)
 Get the parent item.
 
static int GetItemLevel (HSTREEITEM hItem)
 Get the level of the item.
 
static HSTREEITEM GetRootItem (HSTREEITEM hItem)
 Get the root item of the specified node.
 
static LPTVITEM GetItem (HSTREEITEM hItem)
 Get the item data.
 
static LPTVITEM & GetItemRef (HSTREEITEM hItem)
 Get the item data reference.
 
static LPTVITEM * GetItemPt (HSTREEITEM hItem)
 Get the item data pointer.
 

Detailed Description

A tree control for displaying hierarchical data.

This class represents a tree control that can display hierarchical data with various customization options.

Definition at line 102 of file STreeCtrl.h.

Constructor & Destructor Documentation

◆ STreeCtrl()

SNSBEGIN STreeCtrl::STreeCtrl ( )

Constructor for STreeCtrl.

Definition at line 12 of file STreeCtrl.cpp.

◆ ~STreeCtrl()

STreeCtrl::~STreeCtrl ( )
virtual

Destructor for STreeCtrl.

Definition at line 49 of file STreeCtrl.cpp.

Member Function Documentation

◆ CalcItemContentWidth()

void STreeCtrl::CalcItemContentWidth ( LPTVITEM pItem)
protectedvirtual

Calculates the content width of an item.

Parameters
pItemPointer to the item data.

Definition at line 621 of file STreeCtrl.cpp.

◆ CalcItemWidth()

int STreeCtrl::CalcItemWidth ( const LPTVITEM pItem)
protectedvirtual

Calculates the width of an item.

Parameters
pItemPointer to the item data.
Returns
Calculated width of the item.

Definition at line 1295 of file STreeCtrl.cpp.

◆ CalcMaxItemWidth()

int STreeCtrl::CalcMaxItemWidth ( HSTREEITEM hItem)
protectedvirtual

Calculates the maximum width of an item and its children.

Parameters
hItemHandle to the item.
Returns
Maximum width of the item and its children.

Definition at line 635 of file STreeCtrl.cpp.

◆ CheckChildrenState()

BOOL STreeCtrl::CheckChildrenState ( HSTREEITEM hItem,
BOOL bCheck )
protected

Checks the state of an item's children.

Parameters
hItemHandle to the item.
bCheckTRUE to check the children, FALSE to uncheck them.
Returns
TRUE if the state was successfully updated, otherwise FALSE.

Definition at line 517 of file STreeCtrl.cpp.

◆ CheckState()

void STreeCtrl::CheckState ( HSTREEITEM hItem)
protected

Updates the check state of an item.

Parameters
hItemHandle to the item.

Definition at line 538 of file STreeCtrl.cpp.

◆ CreateChildren()

BOOL STreeCtrl::CreateChildren ( SXmlNode xmlNode)
protectedvirtual

Creates child windows from an XML node.

Parameters
xmlNodeXML node containing the child window definitions.
Returns
TRUE if successful, otherwise FALSE.

Reimplemented from SWindow.

Definition at line 378 of file STreeCtrl.cpp.

◆ DrawItem()

void STreeCtrl::DrawItem ( IRenderTarget * pRT,
const CRect & rc,
HSTREEITEM hItem )
protectedvirtual

Draws an item.

Parameters
pRTPointer to the rendering target.
rcRectangle to draw the item.
hItemHandle to the item.

Definition at line 794 of file STreeCtrl.cpp.

◆ DrawLines()

void STreeCtrl::DrawLines ( IRenderTarget * pRT,
const CRect & rc,
HSTREEITEM hItem )
protectedvirtual

Draws lines for an item.

Parameters
pRTPointer to the rendering target.
rcRectangle to draw the lines.
hItemHandle to the item.

Definition at line 866 of file STreeCtrl.cpp.

◆ EnsureVisible()

BOOL STreeCtrl::EnsureVisible ( HSTREEITEM hItem)

Ensures an item is visible.

Parameters
hItemHandle to the item.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 336 of file STreeCtrl.cpp.

◆ Expand()

BOOL STreeCtrl::Expand ( HSTREEITEM hItem,
UINT nCode = TVE_EXPAND )

Expands or collapses an item.

Parameters
hItemHandle to the item.
nCodeCode specifying the action (e.g., TVE_EXPAND).
Returns
TRUE if successful, otherwise FALSE.

Definition at line 303 of file STreeCtrl.cpp.

◆ GetCheckState()

int STreeCtrl::GetCheckState ( HSTREEITEM hItem)

Gets the check state of an item.

Parameters
hItemHandle to the item.
Returns
Check state of the item.

Definition at line 269 of file STreeCtrl.cpp.

◆ GetChildItem()

HSTREEITEM STreeCtrl::GetChildItem ( HSTREEITEM hItem,
BOOL bFirst = TRUE )

Gets a child item.

Parameters
hItemHandle to the item.
bFirstTRUE to get the first child, FALSE to get the next child.
Returns
Handle to the child item.

Definition at line 160 of file STreeCtrl.cpp.

◆ GetItemData()

LPARAM STreeCtrl::GetItemData ( HSTREEITEM hItem)

Gets the application-defined data of an item.

Parameters
hItemHandle to the item.
Returns
Application-defined data.

Definition at line 236 of file STreeCtrl.cpp.

◆ GetItemImage()

BOOL STreeCtrl::GetItemImage ( HSTREEITEM hItem,
int * nImage,
int * nSelectedImage )

Gets the images of an item.

Parameters
hItemHandle to the item.
nImagePointer to receive the index of the normal image.
nSelectedImagePointer to receive the index of the selected image.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 204 of file STreeCtrl.cpp.

◆ GetItemRect()

BOOL STreeCtrl::GetItemRect ( LPTVITEM pItem,
CRect & rcItem )
protected

Gets the rectangle of an item.

Parameters
pItemPointer to the item data.
rcItemRectangle to receive the item position.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 692 of file STreeCtrl.cpp.

◆ GetItemShowIndex()

int STreeCtrl::GetItemShowIndex ( HSTREEITEM hItemObj)
protected

Gets the index of an item in the visible list.

Parameters
hItemObjHandle to the item.
Returns
Index of the item in the visible list.

Definition at line 665 of file STreeCtrl.cpp.

◆ GetItemText() [1/2]

BOOL STreeCtrl::GetItemText ( HSTREEITEM hItem,
IStringT * strText )

Gets the text of an item.

Parameters
hItemHandle to the item.
strTextString to receive the item text.
Returns
TRUE if successful, otherwise FALSE.

◆ GetItemText() [2/2]

BOOL STreeCtrl::GetItemText ( HSTREEITEM hItem,
SStringT & strText ) const
inline

Gets the text of an item.

Parameters
hItemHandle to the item.
strTextString to receive the item text.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 403 of file STreeCtrl.h.

◆ GetItemTextA()

BOOL STreeCtrl::GetItemTextA ( HSTREEITEM hItem,
IStringA * strText )
inline

Gets the text of an item (ANSI version).

Parameters
hItemHandle to the item.
strTextString to receive the item text.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 263 of file STreeCtrl.h.

◆ GetNextItem()

HSTREEITEM STreeCtrl::GetNextItem ( HSTREEITEM hItem)

Gets the next item.

Parameters
hItemHandle to the item.
Returns
Handle to the next item.

Definition at line 1431 of file STreeCtrl.cpp.

◆ GetNextSiblingItem()

HSTREEITEM STreeCtrl::GetNextSiblingItem ( HSTREEITEM hItem)

Gets the next sibling item.

Parameters
hItemHandle to the item.
Returns
Handle to the next sibling item.

Definition at line 150 of file STreeCtrl.cpp.

◆ GetParentItem()

HSTREEITEM STreeCtrl::GetParentItem ( HSTREEITEM hItem)

Gets the parent item.

Parameters
hItemHandle to the item.
Returns
Handle to the parent item.

Definition at line 165 of file STreeCtrl.cpp.

◆ GetPrevSiblingItem()

HSTREEITEM STreeCtrl::GetPrevSiblingItem ( HSTREEITEM hItem)

Gets the previous sibling item.

Parameters
hItemHandle to the item.
Returns
Handle to the previous sibling item.

Definition at line 155 of file STreeCtrl.cpp.

◆ GetRootItem()

HSTREEITEM STreeCtrl::GetRootItem ( )

Gets the root item of the tree.

Returns
Handle to the root item.

Definition at line 145 of file STreeCtrl.cpp.

◆ GetSelectedItem()

HSTREEITEM STreeCtrl::GetSelectedItem ( )

Gets the selected item.

Returns
Handle to the selected item.

Definition at line 170 of file STreeCtrl.cpp.

◆ HitTest()

HSTREEITEM STreeCtrl::HitTest ( CPoint & pt)

Performs a hit test on the tree view.

Parameters
ptMouse position.
Returns
Handle to the item at the specified position.

Definition at line 733 of file STreeCtrl.cpp.

◆ InsertItem() [1/5]

HSTREEITEM STreeCtrl::InsertItem ( LPCTSTR lpszItem,
HSTREEITEM hParent = STVI_ROOT,
HSTREEITEM hInsertAfter = STVI_LAST )

Inserts a new item into the tree.

Parameters
lpszItemText of the item.
hParentHandle to the parent item.
hInsertAfterHandle to the item after which to insert.
Returns
Handle to the inserted item.

Definition at line 55 of file STreeCtrl.cpp.

◆ InsertItem() [2/5]

HSTREEITEM STreeCtrl::InsertItem ( LPCTSTR lpszItem,
int nImage,
int nSelectedImage,
HSTREEITEM hParent = STVI_ROOT,
HSTREEITEM hInsertAfter = STVI_LAST )

Inserts a new item into the tree.

Parameters
lpszItemText of the item.
nImageIndex of the normal image.
nSelectedImageIndex of the selected image.
hParentHandle to the parent item.
hInsertAfterHandle to the item after which to insert.
Returns
Handle to the inserted item.

Definition at line 60 of file STreeCtrl.cpp.

◆ InsertItem() [3/5]

HSTREEITEM STreeCtrl::InsertItem ( LPCTSTR lpszItem,
int nImage,
int nSelectedImage,
LPARAM lParam,
HSTREEITEM hParent = STVI_ROOT,
HSTREEITEM hInsertAfter = STVI_LAST )

Inserts a new item into the tree.

Parameters
lpszItemText of the item.
nImageIndex of the normal image.
nSelectedImageIndex of the selected image.
lParamApplication-defined data.
hParentHandle to the parent item.
hInsertAfterHandle to the item after which to insert.
Returns
Handle to the inserted item.

Definition at line 65 of file STreeCtrl.cpp.

◆ InsertItem() [4/5]

HSTREEITEM STreeCtrl::InsertItem ( LPTVITEM pItemObj,
HSTREEITEM hParent,
HSTREEITEM hInsertAfter )
protected

Inserts a new item into the tree.

Parameters
pItemObjPointer to the item data.
hParentHandle to the parent item.
hInsertAfterHandle to the item after which to insert.
Returns
Handle to the inserted item.

Definition at line 425 of file STreeCtrl.cpp.

◆ InsertItem() [5/5]

HSTREEITEM STreeCtrl::InsertItem ( SXmlNode xmlNode,
HSTREEITEM hParent = STVI_ROOT,
HSTREEITEM hInsertAfter = STVI_LAST )
protected

Inserts a new item into the tree from an XML node.

Parameters
xmlNodeXML node containing the item definition.
hParentHandle to the parent item.
hInsertAfterHandle to the item after which to insert.
Returns
Handle to the inserted item.

Definition at line 471 of file STreeCtrl.cpp.

◆ InsertItemA()

HSTREEITEM STreeCtrl::InsertItemA ( LPCSTR lpszItem,
int nImage,
int nSelectedImage,
LPARAM lParam,
HSTREEITEM hParent = STVI_ROOT,
HSTREEITEM hInsertAfter = STVI_LAST )
inline

Inserts a new item into the tree (ANSI version).

Parameters
lpszItemText of the item.
nImageIndex of the normal image.
nSelectedImageIndex of the selected image.
lParamApplication-defined data.
hParentHandle to the parent item.
hInsertAfterHandle to the item after which to insert.
Returns
Handle to the inserted item.

Definition at line 164 of file STreeCtrl.h.

◆ IsAncestor()

BOOL STreeCtrl::IsAncestor ( HSTREEITEM hItem1,
HSTREEITEM hItem2 )
protected

Checks if one item is an ancestor of another.

Parameters
hItem1Handle to the potential ancestor item.
hItem2Handle to the potential descendant item.
Returns
TRUE if hItem1 is an ancestor of hItem2, otherwise FALSE.

Definition at line 479 of file STreeCtrl.cpp.

◆ ItemHasChildren()

BOOL STreeCtrl::ItemHasChildren ( HSTREEITEM hItem)

Checks if an item has children.

Parameters
hItemHandle to the item.
Returns
TRUE if the item has children, otherwise FALSE.

Definition at line 261 of file STreeCtrl.cpp.

◆ ItemHitTest()

int STreeCtrl::ItemHitTest ( HSTREEITEM hItem,
CPoint & pt ) const
protected

Performs a hit test on an item.

Parameters
hItemHandle to the item.
ptMouse position.
Returns
Index of the hit test result.

Definition at line 946 of file STreeCtrl.cpp.

◆ ItemLayout()

void STreeCtrl::ItemLayout ( )
protectedvirtual

Performs layout calculations for items.

Definition at line 575 of file STreeCtrl.cpp.

◆ ItemLButtonDbClick()

void STreeCtrl::ItemLButtonDbClick ( HSTREEITEM hItem,
UINT nFlags,
CPoint pt )
protected

Handles the left mouse button double-click event for an item.

Parameters
hItemHandle to the item.
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1052 of file STreeCtrl.cpp.

◆ ItemLButtonDown()

void STreeCtrl::ItemLButtonDown ( HSTREEITEM hItem,
UINT nFlags,
CPoint pt )
protected

Handles the left mouse button down event for an item.

Parameters
hItemHandle to the item.
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 989 of file STreeCtrl.cpp.

◆ ItemLButtonUp()

void STreeCtrl::ItemLButtonUp ( HSTREEITEM hItem,
UINT nFlags,
CPoint pt )
protected

Handles the left mouse button up event for an item.

Parameters
hItemHandle to the item.
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1028 of file STreeCtrl.cpp.

◆ ItemMouseLeave()

void STreeCtrl::ItemMouseLeave ( HSTREEITEM hItem)
protected

Handles the mouse leave event for an item.

Parameters
hItemHandle to the item.

Definition at line 1107 of file STreeCtrl.cpp.

◆ ItemMouseMove()

void STreeCtrl::ItemMouseMove ( HSTREEITEM hItem,
UINT nFlags,
CPoint pt )
protected

Handles the mouse move event for an item.

Parameters
hItemHandle to the item.
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1072 of file STreeCtrl.cpp.

◆ LoadBranch()

void STreeCtrl::LoadBranch ( HSTREEITEM hParent,
SXmlNode xmlNode )
protectedvirtual

Loads a branch of items from an XML node.

Parameters
hParentHandle to the parent item.
xmlNodeXML node containing the branch definitions.

Definition at line 394 of file STreeCtrl.cpp.

◆ LoadItemAttribute()

void STreeCtrl::LoadItemAttribute ( SXmlNode xmlNode,
LPTVITEM pItem )
protectedvirtual

Loads attributes for an item from an XML node.

Parameters
xmlNodeXML node containing the item attributes.
pItemPointer to the item.

Definition at line 410 of file STreeCtrl.cpp.

◆ ModifyChekcBoxState()

void STreeCtrl::ModifyChekcBoxState ( HSTREEITEM hItem,
DWORD dwStateAdd,
DWORD dwStateRemove )
protected

Modifies the checkbox state of an item.

Parameters
hItemHandle to the item.
dwStateAddState to add.
dwStateRemoveState to remove.

Definition at line 974 of file STreeCtrl.cpp.

◆ ModifyToggleState()

void STreeCtrl::ModifyToggleState ( HSTREEITEM hItem,
DWORD dwStateAdd,
DWORD dwStateRemove )
protected

Modifies the toggle state of an item.

Parameters
hItemHandle to the item.
dwStateAddState to add.
dwStateRemoveState to remove.

Definition at line 959 of file STreeCtrl.cpp.

◆ OnDestroy()

void STreeCtrl::OnDestroy ( )
protected

Handles the destruction of the tree control.

Definition at line 1129 of file STreeCtrl.cpp.

◆ OnInsertItem()

void STreeCtrl::OnInsertItem ( LPTVITEM & pItemData)
protectedvirtual

Handles the insertion of an item.

Parameters
pItemDataPointer to the item data.

Definition at line 1331 of file STreeCtrl.cpp.

◆ OnLButtonDbClick()

void STreeCtrl::OnLButtonDbClick ( UINT nFlags,
CPoint pt )
protected

Handles the left mouse button double-click event.

Parameters
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1227 of file STreeCtrl.cpp.

◆ OnLButtonDown()

void STreeCtrl::OnLButtonDown ( UINT nFlags,
CPoint pt )
protected

Handles the left mouse button down event.

Parameters
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1178 of file STreeCtrl.cpp.

◆ OnLButtonUp()

void STreeCtrl::OnLButtonUp ( UINT nFlags,
CPoint pt )
protected

Handles the left mouse button up event.

Parameters
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1210 of file STreeCtrl.cpp.

◆ OnMouseLeave()

void STreeCtrl::OnMouseLeave ( )
protected

Handles the mouse leave event.

Definition at line 1248 of file STreeCtrl.cpp.

◆ OnMouseMove()

void STreeCtrl::OnMouseMove ( UINT nFlags,
CPoint pt )
protected

Handles the mouse move event.

Parameters
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1233 of file STreeCtrl.cpp.

◆ OnNodeFree()

void STreeCtrl::OnNodeFree ( LPTVITEM & pItemData)
protectedvirtual

Frees the memory associated with an item.

Parameters
pItemDataPointer to the item data.

Definition at line 1322 of file STreeCtrl.cpp.

◆ OnPaint()

void STreeCtrl::OnPaint ( IRenderTarget * pRT)
protected

Handles the paint event.

Parameters
pRTPointer to the rendering target.

Definition at line 1135 of file STreeCtrl.cpp.

◆ OnRButtonDown()

void STreeCtrl::OnRButtonDown ( UINT nFlags,
CPoint pt )
protected

Handles the right mouse button down event.

Parameters
nFlagsFlags associated with the mouse event.
ptMouse position.

Definition at line 1193 of file STreeCtrl.cpp.

◆ OnSize()

void STreeCtrl::OnSize ( UINT nType,
CSize size )
protected

Handles the size event.

Parameters
nTypeType of size change.
sizeNew size.

Definition at line 1425 of file STreeCtrl.cpp.

◆ PageDown()

void STreeCtrl::PageDown ( )
protected

Handles the page down action.

Definition at line 371 of file STreeCtrl.cpp.

◆ PageUp()

void STreeCtrl::PageUp ( )
protected

Handles the page up action.

Definition at line 366 of file STreeCtrl.cpp.

◆ RedrawItem()

void STreeCtrl::RedrawItem ( HSTREEITEM hItem)
protected

Redraws an item.

Parameters
hItemHandle to the item.

Definition at line 774 of file STreeCtrl.cpp.

◆ RemoveAllItems()

void STreeCtrl::RemoveAllItems ( )

Removes all items from the tree.

Definition at line 134 of file STreeCtrl.cpp.

◆ RemoveItem()

BOOL STreeCtrl::RemoveItem ( HSTREEITEM hItem)

Removes an item from the tree.

Parameters
hItemHandle to the item to remove.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 77 of file STreeCtrl.cpp.

◆ SelectItem()

BOOL STreeCtrl::SelectItem ( HSTREEITEM hItem,
BOOL bEnsureVisible = TRUE )

Selects an item.

Parameters
hItemHandle to the item to select.
bEnsureVisibleTRUE to ensure the item is visible.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 1257 of file STreeCtrl.cpp.

◆ SetAttribute()

virtual HRESULT STreeCtrl::SetAttribute ( const SNS::SStringW &amp;amp;amp;amp; strAttribName,
const SNS::SStringW &amp;amp;amp;amp; strValue,
BOOL bLoading = FALSE )
inlineprotectedvirtual

Reimplemented from SPanel.

Definition at line 794 of file STreeCtrl.h.

◆ SetCheckState()

BOOL STreeCtrl::SetCheckState ( HSTREEITEM hItem,
BOOL bCheck )

Sets the check state of an item.

Parameters
hItemHandle to the item.
bCheckTRUE to check the item, FALSE to uncheck.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 278 of file STreeCtrl.cpp.

◆ SetChildrenState()

void STreeCtrl::SetChildrenState ( HSTREEITEM hItem,
int nCheckValue )
protected

Sets the check state of an item's children.

Parameters
hItemHandle to the item.
nCheckValueNew check state value.

Definition at line 504 of file STreeCtrl.cpp.

◆ SetChildrenVisible()

void STreeCtrl::SetChildrenVisible ( HSTREEITEM hItem,
BOOL bVisible )
protected

Sets the visibility of an item's children.

Parameters
hItemHandle to the item.
bVisibleTRUE to make the children visible, FALSE to hide them.

Definition at line 490 of file STreeCtrl.cpp.

◆ SetItemData()

BOOL STreeCtrl::SetItemData ( HSTREEITEM hItem,
LPARAM lParam )

Sets the application-defined data of an item.

Parameters
hItemHandle to the item.
lParamApplication-defined data.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 247 of file STreeCtrl.cpp.

◆ SetItemImage()

BOOL STreeCtrl::SetItemImage ( HSTREEITEM hItem,
int nImage,
int nSelectedImage )

Sets the images of an item.

Parameters
hItemHandle to the item.
nImageIndex of the normal image.
nSelectedImageIndex of the selected image.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 221 of file STreeCtrl.cpp.

◆ SetItemText()

BOOL STreeCtrl::SetItemText ( HSTREEITEM hItem,
LPCTSTR lpszItem )

Sets the text of an item.

Parameters
hItemHandle to the item.
lpszItemNew text for the item.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 189 of file STreeCtrl.cpp.

◆ SetItemTextA()

BOOL STreeCtrl::SetItemTextA ( HSTREEITEM hItem,
LPCSTR lpszItem )
inline

Sets the text of an item (ANSI version).

Parameters
hItemHandle to the item.
lpszItemNew text for the item.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 286 of file STreeCtrl.h.

◆ SetListener()

void STreeCtrl::SetListener ( IListener * pListener)

Sets the listener for tree view events.

Parameters
pListenerPointer to the listener.

Definition at line 1339 of file STreeCtrl.cpp.

◆ SortChildren()

void STreeCtrl::SortChildren ( HSTREEITEM hItem,
FunTreeSortCallback sortFunc,
void * pCtx )

Sorts the children of an item.

Parameters
hItemHandle to the item.
sortFuncSorting callback function.
pCtxContext for the sorting function.

Definition at line 1300 of file STreeCtrl.cpp.

◆ UpdateContentWidth()

void STreeCtrl::UpdateContentWidth ( )
protectedvirtual

Updates the content width of the tree.

Definition at line 660 of file STreeCtrl.cpp.

◆ UpdateScrollBar()

void STreeCtrl::UpdateScrollBar ( )
protected

Updates the scroll bars.

Definition at line 1344 of file STreeCtrl.cpp.

◆ VerifyItem()

BOOL STreeCtrl::VerifyItem ( HSTREEITEM hItem) const
protected

Verifies if an item is valid.

Parameters
hItemHandle to the item to verify.
Returns
TRUE if the item is valid, otherwise FALSE.

Definition at line 1307 of file STreeCtrl.cpp.

Member Data Documentation

◆ m_bCheckBox

BOOL STreeCtrl::m_bCheckBox
protected

Flag indicating if checkboxes are enabled.

Definition at line 727 of file STreeCtrl.h.

◆ m_bHasLines

BOOL STreeCtrl::m_bHasLines
protected

Flag indicating if lines are drawn between items.

has lines

Definition at line 792 of file STreeCtrl.h.

◆ m_bRightClickSel

BOOL STreeCtrl::m_bRightClickSel
protected

Flag indicating if right-click selection is enabled.

Definition at line 732 of file STreeCtrl.h.

◆ m_crItemBg

COLORREF STreeCtrl::m_crItemBg
protected

Background color of items.

Definition at line 772 of file STreeCtrl.h.

◆ m_crItemSelBg

COLORREF STreeCtrl::m_crItemSelBg
protected

Background color of selected items.

Definition at line 777 of file STreeCtrl.h.

◆ m_crItemSelText

COLORREF STreeCtrl::m_crItemSelText
protected

Text color of selected items.

Definition at line 787 of file STreeCtrl.h.

◆ m_crItemText

COLORREF STreeCtrl::m_crItemText
protected

Text color of items.

Definition at line 782 of file STreeCtrl.h.

◆ m_hCaptureItem

HSTREEITEM STreeCtrl::m_hCaptureItem
protected

Handle to the item that has capture.

Definition at line 662 of file STreeCtrl.h.

◆ m_hHoverItem

HSTREEITEM STreeCtrl::m_hHoverItem
protected

Handle to the item under the hover state.

Definition at line 657 of file STreeCtrl.h.

◆ m_hSelItem

HSTREEITEM STreeCtrl::m_hSelItem
protected

Handle to the selected item.

Definition at line 652 of file STreeCtrl.h.

◆ m_nContentWidth

int STreeCtrl::m_nContentWidth
protected

Total content width of the tree.

Definition at line 672 of file STreeCtrl.h.

◆ m_nIndent

int STreeCtrl::m_nIndent
protected

Indentation between levels.

Definition at line 717 of file STreeCtrl.h.

◆ m_nItemHei

int STreeCtrl::m_nItemHei
protected

Height of each item.

Definition at line 712 of file STreeCtrl.h.

◆ m_nItemHoverBtn

int STreeCtrl::m_nItemHoverBtn
protected

Button currently hovered.

Definition at line 702 of file STreeCtrl.h.

◆ m_nItemMargin

int STreeCtrl::m_nItemMargin
protected

Margin around each item.

Definition at line 722 of file STreeCtrl.h.

◆ m_nItemOffset

int STreeCtrl::m_nItemOffset
protected

Offset for item positioning.

Definition at line 682 of file STreeCtrl.h.

◆ m_nItemPushDownBtn

int STreeCtrl::m_nItemPushDownBtn
protected

Button currently pushed down.

Definition at line 707 of file STreeCtrl.h.

◆ m_nVisibleItems

int STreeCtrl::m_nVisibleItems
protected

Number of visible items.

Definition at line 667 of file STreeCtrl.h.

◆ m_pCheckSkin

SAutoRefPtr<ISkinObj> STreeCtrl::m_pCheckSkin
protected

Skin for the checkboxes.

Definition at line 762 of file STreeCtrl.h.

◆ m_pIconSkin

SAutoRefPtr<ISkinObj> STreeCtrl::m_pIconSkin
protected

Skin for the icons.

Definition at line 752 of file STreeCtrl.h.

◆ m_pItemBgSkin

SAutoRefPtr<ISkinObj> STreeCtrl::m_pItemBgSkin
protected

Skin for the background of items.

Definition at line 742 of file STreeCtrl.h.

◆ m_pItemSelSkin

SAutoRefPtr<ISkinObj> STreeCtrl::m_pItemSelSkin
protected

Skin for the selected background of items.

Definition at line 747 of file STreeCtrl.h.

◆ m_pLineSkin

SAutoRefPtr<ISkinObj> STreeCtrl::m_pLineSkin
protected

Skin for the lines.

Definition at line 767 of file STreeCtrl.h.

◆ m_pListener

IListener* STreeCtrl::m_pListener
protected

Listener for tree view events.

Definition at line 737 of file STreeCtrl.h.

◆ m_pToggleSkin

SAutoRefPtr<ISkinObj> STreeCtrl::m_pToggleSkin
protected

Skin for the toggle buttons.

Definition at line 757 of file STreeCtrl.h.

◆ m_rcCheckBox

CRect STreeCtrl::m_rcCheckBox
protected

Rectangle for the checkbox.

Definition at line 692 of file STreeCtrl.h.

◆ m_rcIcon

CRect STreeCtrl::m_rcIcon
protected

Rectangle for the icon.

Definition at line 697 of file STreeCtrl.h.

◆ m_rcToggle

CRect STreeCtrl::m_rcToggle
protected

Rectangle for the toggle button.

Definition at line 687 of file STreeCtrl.h.

◆ m_uItemMask

UINT STreeCtrl::m_uItemMask
protected

Mask for item attributes.

Definition at line 677 of file STreeCtrl.h.


The documentation for this class was generated from the following files: