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

Class representing a tree view control. More...

#include <STreeView.h>

Public Member Functions

 STreeView ()
 Constructor for STreeView.
 
 ~STreeView ()
 Destructor for STreeView.
 
BOOL SetAdapter (ITvAdapter *adapter) OVERRIDE
 Sets the adapter for the tree view.
 
ITvAdapter * GetAdapter () SCONST OVERRIDE
 Gets the adapter for the tree view.
 
void SetItemLocator (ITreeViewItemLocator *pItemLocator) OVERRIDE
 Sets the item locator for the tree view.
 
ITreeViewItemLocator * GetItemLocator () SCONST OVERRIDE
 Gets the item locator for the tree view.
 
void SetSel (HSTREEITEM hItem, BOOL bNotify=FALSE) OVERRIDE
 Sets the selected item.
 
HSTREEITEM GetSel () SCONST OVERRIDE
 Gets the selected item.
 
void EnsureVisible (HSTREEITEM hItem) OVERRIDE
 Ensures an item is visible.
 
IItemPanel * HitTest (const POINT *pt) SCONST OVERRIDE
 Performs a hit test on the tree view.
 
SItemPanel * HitTest (CPoint &pt) const
 Performs a hit test on the tree view.
 

Protected Types

typedef SMap< HSTREEITEM, ItemInfo > VISIBLEITEMSMAP
 

Protected Member Functions

BOOL OnItemClick (IEvtArgs *pEvt)
 Handles the item click event.
 
BOOL OnItemDblClick (IEvtArgs *pEvt)
 Handles the item double-click event.
 
void onBranchChanged (HSTREEITEM hBranch)
 Notifies the tree view that a branch has changed.
 
void onBranchInvalidated (HSTREEITEM hBranch, BOOL bInvalidParents, BOOL bInvalidChildren)
 Notifies the tree view that a branch has been invalidated.
 
void onBranchExpandedChanged (HSTREEITEM hBranch, BOOL bExpandedOld, BOOL bExpandedNew)
 Notifies the tree view that the expanded state of a branch has changed.
 
void onItemBeforeRemove (HSTREEITEM hItem)
 Notifies the tree view that an item is about to be removed.
 
void OnPaint (IRenderTarget *pRT)
 Handles the paint event.
 
void OnSize (UINT nType, CSize size)
 Handles the size event.
 
void OnDestroy ()
 Handles the destruction event.
 
void OnKeyDown (TCHAR nChar, UINT nRepCnt, UINT nFlags)
 Handles the key down event.
 
LRESULT OnKeyEvent (UINT uMsg, WPARAM wParam, LPARAM lParam)
 Handles key events.
 
void OnMouseLeave ()
 Handles the mouse leave event.
 
BOOL OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
 Handles the mouse wheel event.
 
LRESULT OnMouseEvent (UINT uMsg, WPARAM wParam, LPARAM lParam)
 Handles mouse events.
 
void OnKillFocus (SWND wndFocus)
 Handles the kill focus event.
 
void OnSetFocus (SWND wndOld)
 Handles the set focus event.
 
void OnLButtonDown (UINT nFlags, CPoint pt)
 Handles the left mouse button down event.
 
HRESULT OnAttrIndent (const SStringW &strValue, BOOL bLoading)
 Handles the indentation attribute.
 
virtual HRESULT SetAttribute (const SNS::SStringW &amp;amp;amp;amp;strAttribName, const SNS::SStringW &amp;amp;amp;amp;strValue, BOOL bLoading=FALSE)
 
virtual UINT WINAPI OnGetDlgCode () const
 Gets the dialog code for the tree view.
 
virtual BOOL OnSetCursor (const CPoint &pt)
 Sets the cursor for the tree view.
 
virtual BOOL UpdateToolTip (CPoint pt, SwndToolTipInfo &tipInfo)
 Updates the tooltip information.
 
virtual void OnColorize (COLORREF cr)
 Applies colorization to the tree view.
 
virtual void OnScaleChanged (int nScale)
 Handles scale changes.
 
virtual HRESULT OnLanguageChanged ()
 Handles language change events.
 
virtual void OnRebuildFont ()
 Rebuilds the font settings.
 
virtual BOOL OnScroll (BOOL bVertical, UINT uCode, int nPos)
 Handles scroll events.
 
virtual int GetScrollLineSize (BOOL bVertical)
 Gets the scroll line size.
 
virtual BOOL CreateChildren (SXmlNode xmlNode)
 Creates child elements from XML node.
 
virtual void OnItemSetCapture (SOsrPanel *pItem, BOOL bCapture)
 Sets or releases mouse capture for an item.
 
virtual BOOL OnItemGetRect (const SOsrPanel *pItem, CRect &rcItem) const
 Gets the rectangle of an item.
 
virtual BOOL IsItemRedrawDelay () const
 Indicates if item redraw is delayed.
 
virtual void DrawLines (IRenderTarget *pRT, const CRect &rc, HSTREEITEM hItem)
 Draws lines for an item.
 
void UpdateScrollBar ()
 Updates the scroll bar.
 
void UpdateVisibleItems ()
 Updates the visible items.
 
void RedrawItem (SItemPanel *pItem)
 Redraws an item.
 
SItemPanel * GetItemPanel (HSTREEITEM hItem)
 Gets the item panel for a given item handle.
 
void DispatchMessage2Items (UINT uMsg, WPARAM wParam, LPARAM lParam)
 Dispatches a message to items.
 

Protected Attributes

SAutoRefPtr< ITvAdapter > m_adapter
 
SAutoRefPtr< ITvDataSetObserver > m_observer
 
SAutoRefPtr< ITreeViewItemLocator > m_tvItemLocator
 
SArray< SList< SItemPanel * > * > m_itemRecycle
 
SList< ItemInfo > m_visible_items
 
VISIBLEITEMSMAP * m_pVisibleMap
 
SXmlDoc m_xmlTemplate
 
SOsrPanel * m_itemCapture
 
SOsrPanel * m_pHoverItem
 
HSTREEITEM m_hSelected
 
BOOL m_bWantTab
 
BOOL m_bHasLines
 
SAutoRefPtr< ISkinObjm_pLineSkin
 
SLayoutSize m_indent
 

Friends

class STreeViewDataSetObserver
 

Detailed Description

Class representing a tree view control.

Definition at line 262 of file STreeView.h.

Member Typedef Documentation

◆ VISIBLEITEMSMAP

typedef SMap<HSTREEITEM, ItemInfo> STreeView::VISIBLEITEMSMAP
protected

Definition at line 637 of file STreeView.h.

Constructor & Destructor Documentation

◆ STreeView()

STreeView::STreeView ( )

Constructor for STreeView.

Definition at line 420 of file STreeView.cpp.

◆ ~STreeView()

STreeView::~STreeView ( )

Destructor for STreeView.

Definition at line 438 of file STreeView.cpp.

Member Function Documentation

◆ CreateChildren()

BOOL STreeView::CreateChildren ( SXmlNode xmlNode)
protectedvirtual

Creates child elements from XML node.

Parameters
xmlNodeXML node containing child elements.
Returns
TRUE if successful, otherwise FALSE.

Reimplemented from SWindow.

Definition at line 509 of file STreeView.cpp.

◆ DispatchMessage2Items()

void STreeView::DispatchMessage2Items ( UINT uMsg,
WPARAM wParam,
LPARAM lParam )
protected

Dispatches a message to items.

Parameters
uMsgMessage identifier.
wParamAdditional message information.
lParamAdditional message information.

Definition at line 1443 of file STreeView.cpp.

◆ DrawLines()

void STreeView::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 1490 of file STreeView.cpp.

◆ EnsureVisible()

void STreeView::EnsureVisible ( HSTREEITEM hItem)

Ensures an item is visible.

Parameters
hItemHandle to the item.

Definition at line 617 of file STreeView.cpp.

◆ GetAdapter()

ITvAdapter * STreeView::GetAdapter ( )

Gets the adapter for the tree view.

Returns
Pointer to the adapter.

Definition at line 1470 of file STreeView.cpp.

◆ GetItemLocator()

ITreeViewItemLocator * STreeView::GetItemLocator ( )

Gets the item locator for the tree view.

Returns
Pointer to the item locator.

Definition at line 1480 of file STreeView.cpp.

◆ GetItemPanel()

SItemPanel * STreeView::GetItemPanel ( HSTREEITEM hItem)
protected

Gets the item panel for a given item handle.

Parameters
hItemHandle to the item.
Returns
Pointer to the item panel.

Definition at line 1322 of file STreeView.cpp.

◆ GetScrollLineSize()

int STreeView::GetScrollLineSize ( BOOL bVertical)
protectedvirtual

Gets the scroll line size.

Parameters
bVerticalTRUE if the scroll is vertical, FALSE if horizontal.
Returns
Scroll line size.

Reimplemented from SPanel.

Definition at line 1317 of file STreeView.cpp.

◆ GetSel()

HSTREEITEM STreeView::GetSel ( )

Gets the selected item.

Returns
Handle to the selected item.

Definition at line 1485 of file STreeView.cpp.

◆ HitTest() [1/2]

IItemPanel * STreeView::HitTest ( const POINT * pt)

Performs a hit test on the tree view.

Parameters
ptMouse position.
Returns
Pointer to the item panel at the specified position.

◆ HitTest() [2/2]

SItemPanel * STreeView::HitTest ( CPoint & pt) const

Performs a hit test on the tree view.

Parameters
ptMouse position.
Returns
Pointer to the item panel at the specified position.

Definition at line 1339 of file STreeView.cpp.

◆ IsItemRedrawDelay()

BOOL STreeView::IsItemRedrawDelay ( ) const
protectedvirtual

Indicates if item redraw is delayed.

Returns
TRUE if redraw is delayed, otherwise FALSE.

Definition at line 1070 of file STreeView.cpp.

◆ OnAttrIndent()

HRESULT STreeView::OnAttrIndent ( const SStringW & strValue,
BOOL bLoading )
protected

Handles the indentation attribute.

Parameters
strValueAttribute value.
bLoadingTRUE if loading, FALSE otherwise.
Returns
Result of the attribute handling.

Definition at line 1412 of file STreeView.cpp.

◆ onBranchChanged()

void STreeView::onBranchChanged ( HSTREEITEM hBranch)
protected

Notifies the tree view that a branch has changed.

Parameters
hBranchHandle to the branch item.

Definition at line 1075 of file STreeView.cpp.

◆ onBranchExpandedChanged()

void STreeView::onBranchExpandedChanged ( HSTREEITEM hBranch,
BOOL bExpandedOld,
BOOL bExpandedNew )
protected

Notifies the tree view that the expanded state of a branch has changed.

Parameters
hBranchHandle to the branch item.
bExpandedOldOld expanded state.
bExpandedNewNew expanded state.

Definition at line 1146 of file STreeView.cpp.

◆ onBranchInvalidated()

void STreeView::onBranchInvalidated ( HSTREEITEM hBranch,
BOOL bInvalidParents,
BOOL bInvalidChildren )
protected

Notifies the tree view that a branch has been invalidated.

Parameters
hBranchHandle to the branch item.
bInvalidParentsTRUE to invalidate parent branches, FALSE otherwise.
bInvalidChildrenTRUE to invalidate child branches, FALSE otherwise.

Definition at line 1087 of file STreeView.cpp.

◆ OnColorize()

void STreeView::OnColorize ( COLORREF cr)
protectedvirtual

Applies colorization to the tree view.

Parameters
crColor reference.

Reimplemented from SPanel.

Definition at line 1421 of file STreeView.cpp.

◆ OnDestroy()

void STreeView::OnDestroy ( )
protected

Handles the destruction event.

Definition at line 584 of file STreeView.cpp.

◆ OnGetDlgCode()

UINT STreeView::OnGetDlgCode ( ) const
protectedvirtual

Gets the dialog code for the tree view.

Returns
Dialog code.

Definition at line 1377 of file STreeView.cpp.

◆ onItemBeforeRemove()

void STreeView::onItemBeforeRemove ( HSTREEITEM hItem)
protected

Notifies the tree view that an item is about to be removed.

Parameters
hItemHandle to the item.

Definition at line 1158 of file STreeView.cpp.

◆ OnItemClick()

BOOL STreeView::OnItemClick ( IEvtArgs * pEvt)
protected

Handles the item click event.

Parameters
pEvtEvent arguments.
Returns
TRUE if the event is handled, otherwise FALSE.

Definition at line 1355 of file STreeView.cpp.

◆ OnItemDblClick()

BOOL STreeView::OnItemDblClick ( IEvtArgs * pEvt)
protected

Handles the item double-click event.

Parameters
pEvtEvent arguments.
Returns
TRUE if the event is handled, otherwise FALSE.

Definition at line 1366 of file STreeView.cpp.

◆ OnItemGetRect()

BOOL STreeView::OnItemGetRect ( const SOsrPanel * pItem,
CRect & rcItem ) const
protectedvirtual

Gets the rectangle of an item.

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

Definition at line 1051 of file STreeView.cpp.

◆ OnItemSetCapture()

void STreeView::OnItemSetCapture ( SOsrPanel * pItem,
BOOL bCapture )
protectedvirtual

Sets or releases mouse capture for an item.

Parameters
pItemPointer to the item panel.
bCaptureTRUE to set capture, FALSE to release capture.

Definition at line 1037 of file STreeView.cpp.

◆ OnKeyDown()

void STreeView::OnKeyDown ( TCHAR nChar,
UINT nRepCnt,
UINT nFlags )
protected

Handles the key down event.

Parameters
nCharCharacter code.
nRepCntRepeat count.
nFlagsFlags associated with the key event.

Definition at line 697 of file STreeView.cpp.

◆ OnKeyEvent()

LRESULT STreeView::OnKeyEvent ( UINT uMsg,
WPARAM wParam,
LPARAM lParam )
protected

Handles key events.

Parameters
uMsgMessage identifier.
wParamAdditional message information.
lParamAdditional message information.
Returns
Result of the message processing.

Definition at line 777 of file STreeView.cpp.

◆ OnKillFocus()

void STreeView::OnKillFocus ( SWND wndFocus)
protected

Handles the kill focus event.

Parameters
wndFocusWindow receiving focus.

Definition at line 1282 of file STreeView.cpp.

◆ OnLanguageChanged()

HRESULT STreeView::OnLanguageChanged ( )
protectedvirtual

Handles language change events.

Returns
Result of the language change handling.

Reimplemented from SWindow.

Definition at line 1436 of file STreeView.cpp.

◆ OnLButtonDown()

void STreeView::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 1570 of file STreeView.cpp.

◆ OnMouseEvent()

LRESULT STreeView::OnMouseEvent ( UINT uMsg,
WPARAM wParam,
LPARAM lParam )
protected

Handles mouse events.

Parameters
uMsgMessage identifier.
wParamAdditional message information.
lParamAdditional message information.
Returns
Result of the message processing.

Definition at line 1188 of file STreeView.cpp.

◆ OnMouseLeave()

void STreeView::OnMouseLeave ( )
protected

Handles the mouse leave event.

Definition at line 1258 of file STreeView.cpp.

◆ OnMouseWheel()

BOOL STreeView::OnMouseWheel ( UINT nFlags,
short zDelta,
CPoint pt )
protected

Handles the mouse wheel event.

Parameters
nFlagsFlags associated with the mouse event.
zDeltaWheel delta.
ptMouse position.
Returns
TRUE if the event is handled, otherwise FALSE.

Definition at line 1269 of file STreeView.cpp.

◆ OnPaint()

void STreeView::OnPaint ( IRenderTarget * pRT)
protected

Handles the paint event.

Parameters
pRTPointer to the rendering target.

Definition at line 519 of file STreeView.cpp.

◆ OnRebuildFont()

void STreeView::OnRebuildFont ( )
protectedvirtual

Rebuilds the font settings.

Reimplemented from SWindow.

Definition at line 1463 of file STreeView.cpp.

◆ OnScaleChanged()

void STreeView::OnScaleChanged ( int nScale)
protectedvirtual

Handles scale changes.

Parameters
nScaleNew scale.

Reimplemented from SPanel.

Definition at line 1427 of file STreeView.cpp.

◆ OnScroll()

BOOL STreeView::OnScroll ( BOOL bVertical,
UINT uCode,
int nPos )
protectedvirtual

Handles scroll events.

Parameters
bVerticalTRUE if the scroll is vertical, FALSE if horizontal.
uCodeScroll code.
nPosNew position.
Returns
TRUE if the scroll event is handled, otherwise FALSE.

Reimplemented from SPanel.

Definition at line 1299 of file STreeView.cpp.

◆ OnSetCursor()

BOOL STreeView::OnSetCursor ( const CPoint & pt)
protectedvirtual

Sets the cursor for the tree view.

Parameters
ptMouse position.
Returns
TRUE if the cursor is set, otherwise FALSE.

Reimplemented from SWindow.

Definition at line 1385 of file STreeView.cpp.

◆ OnSetFocus()

void STreeView::OnSetFocus ( SWND wndOld)
protected

Handles the set focus event.

Parameters
wndOldWindow losing focus.

Definition at line 1290 of file STreeView.cpp.

◆ OnSize()

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

Handles the size event.

Parameters
nTypeType of size change.
sizeNew size.

Definition at line 575 of file STreeView.cpp.

◆ RedrawItem()

void STreeView::RedrawItem ( SItemPanel * pItem)
protected

Redraws an item.

Parameters
pItemPointer to the item panel.

Definition at line 1253 of file STreeView.cpp.

◆ SetAdapter()

BOOL STreeView::SetAdapter ( ITvAdapter * adapter)

Sets the adapter for the tree view.

Parameters
adapterPointer to the adapter.
Returns
TRUE if successful, otherwise FALSE.

Definition at line 443 of file STreeView.cpp.

◆ SetAttribute()

virtual HRESULT STreeView::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 488 of file STreeView.h.

◆ SetItemLocator()

void STreeView::SetItemLocator ( ITreeViewItemLocator * pItemLocator)

Sets the item locator for the tree view.

Parameters
pItemLocatorPointer to the item locator.

Definition at line 1475 of file STreeView.cpp.

◆ SetSel()

void STreeView::SetSel ( HSTREEITEM hItem,
BOOL bNotify = FALSE )

Sets the selected item.

Parameters
hItemHandle to the item.
bNotifyTRUE to notify listeners, FALSE otherwise.

Definition at line 652 of file STreeView.cpp.

◆ UpdateScrollBar()

void STreeView::UpdateScrollBar ( )
protected

Updates the scroll bar.

Definition at line 793 of file STreeView.cpp.

◆ UpdateToolTip()

BOOL STreeView::UpdateToolTip ( CPoint pt,
SwndToolTipInfo & tipInfo )
protectedvirtual

Updates the tooltip information.

Parameters
ptMouse position.
tipInfoTooltip information.
Returns
TRUE if the tooltip is updated, otherwise FALSE.

Reimplemented from SWindow.

Definition at line 1405 of file STreeView.cpp.

◆ UpdateVisibleItems()

void STreeView::UpdateVisibleItems ( )
protected

Updates the visible items.

Definition at line 880 of file STreeView.cpp.

Friends And Related Symbol Documentation

◆ STreeViewDataSetObserver

friend class STreeViewDataSetObserver
friend

Definition at line 267 of file STreeView.h.

Member Data Documentation

◆ m_adapter

SAutoRefPtr<ITvAdapter> STreeView::m_adapter
protected

Adapter for the tree view items.

Definition at line 625 of file STreeView.h.

◆ m_bHasLines

BOOL STreeView::m_bHasLines
protected

Flag indicating if lines are drawn between items.

Definition at line 648 of file STreeView.h.

◆ m_bWantTab

BOOL STreeView::m_bWantTab
protected

Flag indicating if tab is wanted.

Definition at line 647 of file STreeView.h.

◆ m_hSelected

HSTREEITEM STreeView::m_hSelected
protected

Current selected item.

Definition at line 645 of file STreeView.h.

◆ m_indent

SLayoutSize STreeView::m_indent
protected

Indentation between levels.

Definition at line 650 of file STreeView.h.

◆ m_itemCapture

SOsrPanel* STreeView::m_itemCapture
protected

Item that has capture.

Definition at line 642 of file STreeView.h.

◆ m_itemRecycle

SArray<SList<SItemPanel *> *> STreeView::m_itemRecycle
protected

Item recycle bin, each style has a list for reuse.

Definition at line 634 of file STreeView.h.

◆ m_observer

SAutoRefPtr<ITvDataSetObserver> STreeView::m_observer
protected

Observer for data set changes.

Definition at line 626 of file STreeView.h.

◆ m_pHoverItem

SOsrPanel* STreeView::m_pHoverItem
protected

Item under hover state.

Definition at line 643 of file STreeView.h.

◆ m_pLineSkin

SAutoRefPtr<ISkinObj> STreeView::m_pLineSkin
protected

Skin for the lines.

Definition at line 649 of file STreeView.h.

◆ m_pVisibleMap

VISIBLEITEMSMAP* STreeView::m_pVisibleMap
protected

Map of visible items.

Definition at line 638 of file STreeView.h.

◆ m_tvItemLocator

SAutoRefPtr<ITreeViewItemLocator> STreeView::m_tvItemLocator
protected

Item locator for the tree view.

Definition at line 627 of file STreeView.h.

◆ m_visible_items

SList<ItemInfo> STreeView::m_visible_items
protected

List of visible items.

Definition at line 635 of file STreeView.h.

◆ m_xmlTemplate

SXmlDoc STreeView::m_xmlTemplate
protected

XML template for items.

Definition at line 640 of file STreeView.h.


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