2#include "control/STreeView.h"
5class STreeViewDataSetObserver :
public TObjRefImpl<ITvDataSetObserver> {
7 STreeViewDataSetObserver(STreeView *pView)
12 STDMETHOD_(
void, onBranchChanged)(THIS_ HSTREEITEM hBranch) OVERRIDE
14 m_pOwner->onBranchChanged(hBranch);
17 STDMETHOD_(
void, onBranchInvalidated)
18 (THIS_ HSTREEITEM hBranch, BOOL bInvalidParents, BOOL bInvalidChildren) OVERRIDE
20 m_pOwner->onBranchInvalidated(hBranch, bInvalidParents, bInvalidChildren);
23 STDMETHOD_(
void, onBranchExpandedChanged)
24 (THIS_ HSTREEITEM hBranch, BOOL bExpandedOld, BOOL bExpandedNew) OVERRIDE
26 m_pOwner->onBranchExpandedChanged(hBranch, bExpandedOld, bExpandedNew);
29 STDMETHOD_(
void, notifyItemBeforeRemove)(THIS_ HSTREEITEM hItem) OVERRIDE
31 m_pOwner->onItemBeforeRemove(hItem);
57 if (hItem != ITEM_ROOT)
69 HSTREEITEM hChild =
m_adapter->GetFirstChildItem(hItem);
70 int nBranchHeight = 0;
71 while (hChild != ITEM_NULL)
77 hChild =
m_adapter->GetNextSiblingItem(hChild);
101 int nPos = nParentPosition + nItemHeight;
110 if (position - nPos < nParentBranchHeight / 2)
112 HSTREEITEM hItem =
m_adapter->GetFirstChildItem(hParent);
116 if (nPos + nBranchHeight > position)
120 nPos += nBranchHeight;
121 hItem =
m_adapter->GetNextSiblingItem(hItem);
126 nPos += nParentBranchHeight;
128 HSTREEITEM hItem =
m_adapter->GetLastChildItem(hParent);
132 nPos -= nBranchHeight;
133 if (nPos <= position)
137 hItem =
m_adapter->GetPrevSiblingItem(hItem);
148 if (
m_adapter->IsItemExpanded(hItem) &&
m_adapter->GetFirstChildItem(hItem) != ITEM_NULL)
165 m_adapter->SetItemDataByIndex(hItem, DATA_INDEX_ITEM_HEIGHT, nHeight);
170 m_adapter->SetItemDataByIndex(hItem, DATA_INDEX_ITEM_OFFSET, nOffset);
175 return (
int)
m_adapter->GetItemDataByIndex(hItem, DATA_INDEX_ITEM_OFFSET);
183 HSTREEITEM hSib =
m_adapter->GetNextSiblingItem(hItem);
184 while (hSib != ITEM_NULL)
188 hSib =
m_adapter->GetNextSiblingItem(hSib);
191 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
192 if (hParent != ITEM_NULL && hParent != ITEM_ROOT &&
IsItemExpanded(hParent))
200 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
201 while (hParent != ITEM_NULL)
205 hParent =
m_adapter->GetParentItem(hParent);
211 m_adapter->SetItemDataByIndex(hItem, DATA_INDEX_BRANCH_HEIGHT, nHeight);
216 return (
int)
m_adapter->GetItemDataByIndex(hItem, DATA_INDEX_BRANCH_HEIGHT);
221 m_adapter->SetItemDataByIndex(hItem, DATA_INDEX_ITEM_WIDTH, nWidth);
226 m_adapter->SetItemDataByIndex(hBranch, DATA_INDEX_BRANCH_WIDTH, nWidth);
231 return (
int)
m_adapter->GetItemDataByIndex(hBranch, DATA_INDEX_BRANCH_WIDTH);
236 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
237 if (hParent == ITEM_NULL)
241 int nIndent = hParent == ITEM_ROOT ? 0 :
m_nIndent;
242 if (nCurBranchWidth != nOldWidth + nIndent)
244 if (nCurBranchWidth < nNewWidth + nIndent)
254 if (nNewWidth > nOldWidth)
256 nNewBranchWidth = nNewWidth + nIndent;
260 HSTREEITEM hSib =
m_adapter->GetFirstChildItem(hParent);
262 while (hSib != ITEM_NULL)
265 hSib =
m_adapter->GetNextSiblingItem(hSib);
267 nNewBranchWidth += nIndent;
277 return (BOOL)
m_adapter->IsItemExpanded(hItem);
286 if (hItem == ITEM_ROOT)
305 return (
int)
m_adapter->GetItemDataByIndex(hItem, DATA_INDEX_ITEM_HEIGHT);
310 return (
int)
m_adapter->GetItemDataByIndex(hItem, DATA_INDEX_ITEM_WIDTH);
317 if (nOldHeight != nHeight)
327 if (nOldWidth == nWidth)
332 if (nOldBranchWidth == nNewBranchWidth)
352 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
353 if (hParent != ITEM_NULL && hParent != ITEM_ROOT)
372 return (
int)
m_adapter->GetItemDataByIndex(ITEM_ROOT, DATA_INDEX_BRANCH_WIDTH);
377 return (
int)
m_adapter->GetItemDataByIndex(ITEM_ROOT, DATA_INDEX_BRANCH_HEIGHT);
382 if (bExpandedNew == bExpandedOld)
386 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
387 while (hParent != ITEM_NULL)
392 hParent =
m_adapter->GetParentItem(hParent);
406 int nDiff = nVisibleHeightNew - nVisibleHeightOld;
407 if (nDiff == 0 || hItem == ITEM_ROOT)
410 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
411 while (hParent != ITEM_NULL)
414 hParent =
m_adapter->GetParentItem(hParent);
432 m_evtSet.addEvent(EVENTID(EventTVSelChanging));
433 m_evtSet.addEvent(EVENTID(EventTVSelChanged));
434 m_observer.Attach(
new STreeViewDataSetObserver(
this));
451 SSLOGW() <<
"the new adapter is same to previous set adapter, same as onBranchChanged";
468 SPOSITION pos = lstItemPanels->GetHeadPosition();
471 SItemPanel *pItemPanel = lstItemPanels->GetNext(pos);
474 delete lstItemPanels;
499 for (
int i = 0; i <
m_adapter->getViewTypeCount(); i++)
542 HSTREEITEM hItem = (HSTREEITEM)ii.pItem->GetItemIndex();
547 pt.x = -m_siHoz.nPos;
552 CRect rcItem(pt, CSize(rcClient.Width(), szItem.cy));
553 rcItem.OffsetRect(rcClient.TopLeft());
559 CRect rcItem(pt, szItem);
560 rcItem.OffsetRect(rcClient.TopLeft());
562 rcItem.OffsetRect(nIndent, 0);
563 if (SItemPanel::IsItemInClip(mtx, rcClip, rgnClip, rcItem))
565 ii.pItem->Draw(pRT, rcItem);
577 __baseCls::OnSize(nType, size);
604 SPOSITION pos = pLstTypeItems->GetHeadPosition();
607 SItemPanel *pItem = pLstTypeItems->GetNext(pos);
610 delete pLstTypeItems;
614 __baseCls::OnDestroy();
620 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
621 while (hParent != ITEM_ROOT)
623 m_adapter->ExpandItem(hParent, TVC_EXPAND);
624 hParent =
m_adapter->GetParentItem(hParent);
629 if (nPos + nHeight <= m_siVer.nPos)
631 OnScroll(TRUE, SB_THUMBPOSITION, nPos);
633 else if (nPos > m_siVer.nPos + (
int)m_siVer.nPage)
635 OnScroll(TRUE, SB_THUMBPOSITION, nPos + nHeight - m_siVer.nPage);
642 if (nIndent + nWidth <= m_siHoz.nPos)
644 OnScroll(FALSE, SB_THUMBPOSITION, nIndent);
646 else if (nIndent < m_siHoz.nPos + (
int)m_siHoz.nPage)
648 OnScroll(FALSE, SB_THUMBPOSITION, nIndent + nWidth - m_siHoz.nPage);
659 EventTVSelChanging evt(
this);
690 EventTVSelChanged evt(
this);
710 pItem->DoFrameEvent(WM_KEYDOWN, nChar, MAKELONG(nFlags, nRepCnt));
717 if (pOwner && (nChar == VK_ESCAPE || nChar == VK_RETURN))
719 pOwner->
SSendMessage(WM_KEYDOWN, nChar, MAKELONG(nFlags, nRepCnt));
723 HSTREEITEM nNewSelItem = ITEM_NULL;
766 if (nNewSelItem != ITEM_NULL)
769 SetSel(nNewSelItem, TRUE);
783 lRet = pItem->DoFrameEvent(uMsg, wParam, lParam);
803 CSize size = rcClient.Size();
805 m_wBarVisible = SSB_NULL;
807 if (size.cy < szView.cy || (size.cy < szView.cy +
GetSbWidth() && size.cx < szView.cx))
810 m_wBarVisible |= SSB_VERT;
812 m_siVer.nMax = szView.cy - 1;
813 m_siVer.nPage = rcClient.Height();
818 m_wBarVisible |= SSB_HORZ;
822 m_siHoz.nMax = szView.cx - 1;
828 m_siHoz.nPage = size.cx;
830 m_siHoz.nMax = m_siHoz.nPage - 1;
837 m_siVer.nPage = size.cy;
839 m_siVer.nMax = size.cy - 1;
842 if (size.cx < szView.cx && !
m_adapter->isViewWidthMatchParent())
845 m_wBarVisible |= SSB_HORZ;
847 m_siHoz.nMax = szView.cx - 1;
848 m_siHoz.nPage = size.cx;
853 m_siHoz.nPage = size.cx;
855 m_siHoz.nMax = m_siHoz.nPage - 1;
861 if (HasScrollBar(FALSE) && m_siHoz.nPos + (
int)m_siHoz.nPage > szView.cx)
863 m_siHoz.nPos = szView.cx - m_siHoz.nPage;
866 if (HasScrollBar(TRUE) && m_siVer.nPos + (
int)m_siVer.nPage > szView.cy)
868 m_siVer.nPos = szView.cy - m_siVer.nPage;
871 SetScrollPos(TRUE, m_siVer.nPos, TRUE);
872 SetScrollPos(FALSE, m_siHoz.nPos, TRUE);
886 if (hItem == ITEM_NULL)
901 if ((HSTREEITEM)ii.pItem->GetItemIndex() ==
m_hSelected)
929 while (hItem != ITEM_NULL)
931 VISIBLEITEMSMAP::CPair *pFind = pMapOld->Lookup(hItem);
933 ii.nType =
m_adapter->getViewType(hItem);
934 BOOL bNewItem = FALSE;
935 if (pFind && pFind->m_value.nType == ii.nType)
938 pMapOld->RemoveKey(hItem);
942 SList<SItemPanel *> *lstRecycle =
m_itemRecycle.GetAt(ii.nType);
943 if (lstRecycle->IsEmpty())
946 ii.pItem = SItemPanel::Create(
this,
SXmlNode(),
this);
951 ii.pItem = lstRecycle->RemoveHead();
953 ii.pItem->SetItemIndex(hItem);
970 m_adapter->getView(hItem, ii.pItem, &xmlNode);
981 m_adapter->getViewDesiredSize(&szItem, hItem, ii.pItem, -1, -1);
984 szItem.cx = rcItem.Width();
985 ii.pItem->
Move(CRect(0, 0, szItem.cx, szItem.cy));
990 nOffset += szItem.cy;
991 if (nOffset >= rcClient.Height())
993 hItem =
m_adapter->GetNextVisibleItem(hItem);
996 SPOSITION pos = pMapOld->GetStartPosition();
999 ItemInfo ii = pMapOld->GetNextValue(pos);
1008 if ((HSTREEITEM)ii.pItem->GetItemIndex() ==
m_hSelected)
1026 if (szOldView != szNewView)
1053 HSTREEITEM hItem = (HSTREEITEM)pItem->GetItemIndex();
1059 rcItem.top += nOffset;
1094 if (bInvalidParents)
1096 HSTREEITEM hParent =
m_adapter->GetParentItem(hBranch);
1103 m_adapter->getView(hParent, pItem, &xmlNode);
1106 hParent =
m_adapter->GetParentItem(hParent);
1109 if (!bInvalidChildren)
1115 m_adapter->getView(hBranch, pItem, &xmlNode);
1125 bool bInvalid =
false;
1126 HSTREEITEM hItem = (HSTREEITEM)ii.pItem->GetItemIndex();
1129 if (hItem == hBranch)
1134 hItem =
m_adapter->GetParentItem(hItem);
1139 m_adapter->getView(hBranch, ii.pItem, &xmlNode);
1153 m_tvItemLocator->OnBranchExpandedChanged(hBranch, bExpandedOld, bExpandedNew);
1172 if (hHover == hItem ||
m_adapter->IsDecendentItem(hItem, hHover))
1181 if (hCapture == hItem ||
m_adapter->IsDecendentItem(hItem, hCapture))
1197 CPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
1202 pt.Offset(-rcItem.TopLeft());
1203 lRet =
m_itemCapture->DoFrameEvent(uMsg, wParam, MAKELPARAM(pt.x, pt.y));
1207 if (uMsg == WM_LBUTTONDOWN || uMsg == WM_RBUTTONDOWN || uMsg == WM_MBUTTONDOWN)
1210 SItemPanel *pPanel =
HitTest(pt2);
1215 pSelItem->DoFrameEvent(WM_KILLFOCUS, 0, 0);
1219 __baseCls::ProcessSwndMessage(uMsg, wParam, lParam, lRet);
1222 SOsrPanel *pHover =
HitTest(pt);
1229 oldHover->DoFrameEvent(WM_MOUSELEAVE, 0, 0);
1241 m_pHoverItem->DoFrameEvent(uMsg, wParam, MAKELPARAM(pt.x, pt.y));
1245 if (uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONUP || uMsg == WM_MBUTTONUP)
1247 __baseCls::ProcessSwndMessage(uMsg, wParam, lParam, lRet);
1260 __baseCls::OnMouseLeave();
1274 CRect rcItem = pSelItem->GetItemRect();
1275 CPoint pt2 = pt - rcItem.TopLeft();
1276 if (pSelItem->DoFrameEvent(WM_MOUSEWHEEL, MAKEWPARAM(nFlags, zDelta), MAKELPARAM(pt2.x, pt2.y)))
1279 return __baseCls::OnMouseWheel(nFlags, zDelta, pt);
1284 __baseCls::OnKillFocus(wndFocus);
1292 __baseCls::OnSetFocus(wndOld);
1301 int nOldPos = m_siVer.nPos;
1302 __baseCls::OnScroll(bVertical, uCode, nPos);
1303 int nNewPos = m_siVer.nPos;
1304 if (nOldPos != nNewPos)
1309 if (uCode == SB_THUMBTRACK)
1324 VISIBLEITEMSMAP::CPair *pNode =
m_pVisibleMap->Lookup(hItem);
1327 return pNode->m_value.pItem;
1345 CRect rcItem = ii.pItem->GetItemRect();
1346 if (rcItem.PtInRect(pt))
1348 pt -= rcItem.TopLeft();
1357 SItemPanel *pItemPanel = sobj_cast<SItemPanel>(pEvt->Sender());
1358 HSTREEITEM hItem = (HSTREEITEM)pItemPanel->GetItemIndex();
1368 SItemPanel *pItemPanel = sobj_cast<SItemPanel>(pEvt->Sender());
1369 HSTREEITEM hItem = (HSTREEITEM)pItemPanel->GetItemIndex();
1372 m_adapter->ExpandItem(hItem, TVC_TOGGLE);
1380 return SC_WANTALLKEYS;
1382 return SC_WANTARROWS | SC_WANTSYSKEY;
1391 bRet =
m_itemCapture->DoFrameEvent(WM_SETCURSOR, 0, MAKELPARAM(pt.x - rcItem.left, pt.y - rcItem.top)) != 0;
1396 bRet =
m_pHoverItem->DoFrameEvent(WM_SETCURSOR, 0, MAKELPARAM(pt.x - rcItem.left, pt.y - rcItem.top)) != 0;
1400 bRet = __baseCls::OnSetCursor(pt);
1408 return __baseCls::UpdateToolTip(pt, tipInfo);
1423 __baseCls::OnColorize(cr);
1429 __baseCls::OnScaleChanged(nScale);
1438 HRESULT hret = __baseCls::OnLanguageChanged();
1454 SPOSITION pos = pLstTypeItems->GetHeadPosition();
1457 SItemPanel *pItem = pLstTypeItems->GetNext(pos);
1465 __baseCls::OnRebuildFont();
1495 SList<HSTREEITEM> lstParent;
1496 HSTREEITEM hParent =
m_adapter->GetParentItem(hItem);
1499 lstParent.AddHead(hParent);
1500 hParent =
m_adapter->GetParentItem(hParent);
1517 rcLine.right = rcLine.left + nIndent;
1518 SPOSITION pos = lstParent.GetHeadPosition();
1521 HSTREEITEM hParent = lstParent.GetNext(pos);
1522 HSTREEITEM hNextSibling =
m_adapter->GetNextSiblingItem(hParent);
1527 rcLine.OffsetRect(nIndent, 0);
1529 BOOL hasNextSibling =
m_adapter->GetNextSiblingItem(hItem) != 0;
1530 BOOL hasPervSibling =
m_adapter->GetPrevSiblingItem(hItem) != 0;
1531 BOOL hasChild =
m_adapter->HasChildren(hItem);
1538 if (!hasParent && !hasPervSibling)
1540 else if (hasNextSibling)
1543 iLine = plus_bottom;
1547 if (!hasParent && !hasPervSibling)
1549 else if (hasNextSibling)
1552 iLine = minus_bottom;
1559 if (!hasParent && !hasPervSibling)
1565 iLine = line_bottom;
1577 SItemPanel *pHoverItem =
HitTest(pt);
1580 CRect rcItem = pHoverItem->GetItemRect();
1581 CRect rcLine(CPoint(rcItem.left - nIndent, rcItem.top + (rcItem.Height() - nIndent) / 2), CSize(nIndent, nIndent));
1582 if (rcLine.PtInRect(pt2))
1584 HSTREEITEM hItem = (HSTREEITEM)pHoverItem->GetItemIndex();
1586 m_adapter->ExpandItem(hItem, TVC_TOGGLE);
A helper class to enable or disable private UI definitions for the host container.
Smart pointer class for managing COM-style reference-counted objects.
BOOL subscribeEvent(DWORD dwEventID, const IEvtSlot &subscriber)
订阅事件
void setMutedState(BOOL setting)
设置事件集的静音状态
void RestoreFocusedView()
Restores the focused view.
void ClearFocus()
Clears the focused window.
void StoreFocusedView()
Stores the focused view.
The SMatrix class holds a 3x3 matrix for transforming coordinates. SMatrix does not have a constructo...
Helper class for painting.
virtual CRect GetClientRect() const
Gets the client rectangle.
int GetSbWidth() const
Gets the width of the scrollbar.
void ScrollUpdate()
Updates the scrollbar.
A class representing an ASCII string.
virtual BOOL OnItemGetRect(const SOsrPanel *pItem, CRect &rcItem) const
Gets the rectangle of an item.
virtual void OnItemSetCapture(SOsrPanel *pItem, BOOL bCapture)
Sets or releases mouse capture for an item.
SItemPanel * GetItemPanel(HSTREEITEM hItem)
Gets the item panel for a given item handle.
void OnDestroy()
Handles the destruction event.
void SetSel(HSTREEITEM hItem, BOOL bNotify=FALSE) OVERRIDE
Sets the selected item.
virtual void OnColorize(COLORREF cr)
Applies colorization to the tree view.
ITreeViewItemLocator * GetItemLocator() SCONST OVERRIDE
Gets the item locator for the tree view.
void onBranchChanged(HSTREEITEM hBranch)
Notifies the tree view that a branch has changed.
VISIBLEITEMSMAP * m_pVisibleMap
void onBranchExpandedChanged(HSTREEITEM hBranch, BOOL bExpandedOld, BOOL bExpandedNew)
Notifies the tree view that the expanded state of a branch has changed.
virtual BOOL UpdateToolTip(CPoint pt, SwndToolTipInfo &tipInfo)
Updates the tooltip information.
BOOL SetAdapter(ITvAdapter *adapter) OVERRIDE
Sets the adapter for the tree view.
BOOL OnItemClick(IEvtArgs *pEvt)
Handles the item click event.
SAutoRefPtr< ITvDataSetObserver > m_observer
void OnSetFocus(SWND wndOld)
Handles the set focus event.
void OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags)
Handles the key down event.
SAutoRefPtr< ISkinObj > m_pLineSkin
void UpdateScrollBar()
Updates the scroll bar.
virtual BOOL IsItemRedrawDelay() const
Indicates if item redraw is delayed.
HSTREEITEM GetSel() SCONST OVERRIDE
Gets the selected item.
LRESULT OnKeyEvent(UINT uMsg, WPARAM wParam, LPARAM lParam)
Handles key events.
SArray< SList< SItemPanel * > * > m_itemRecycle
virtual void OnScaleChanged(int nScale)
Handles scale changes.
SAutoRefPtr< ITreeViewItemLocator > m_tvItemLocator
virtual HRESULT OnLanguageChanged()
Handles language change events.
virtual BOOL OnSetCursor(const CPoint &pt)
Sets the cursor for the tree view.
virtual int GetScrollLineSize(BOOL bVertical)
Gets the scroll line size.
void OnKillFocus(SWND wndFocus)
Handles the kill focus event.
virtual BOOL OnScroll(BOOL bVertical, UINT uCode, int nPos)
Handles scroll events.
BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
Handles the mouse wheel event.
void EnsureVisible(HSTREEITEM hItem) OVERRIDE
Ensures an item is visible.
void RedrawItem(SItemPanel *pItem)
Redraws an item.
SAutoRefPtr< ITvAdapter > m_adapter
void SetItemLocator(ITreeViewItemLocator *pItemLocator) OVERRIDE
Sets the item locator for the tree view.
void UpdateVisibleItems()
Updates the visible items.
ITvAdapter * GetAdapter() SCONST OVERRIDE
Gets the adapter for the tree view.
void OnMouseLeave()
Handles the mouse leave event.
STreeView()
Constructor for STreeView.
virtual void OnRebuildFont()
Rebuilds the font settings.
HRESULT OnAttrIndent(const SStringW &strValue, BOOL bLoading)
Handles the indentation attribute.
IItemPanel * HitTest(const POINT *pt) SCONST OVERRIDE
Performs a hit test on the tree view.
void OnLButtonDown(UINT nFlags, CPoint pt)
Handles the left mouse button down event.
virtual BOOL CreateChildren(SXmlNode xmlNode)
Creates child elements from XML node.
SOsrPanel * m_itemCapture
void onBranchInvalidated(HSTREEITEM hBranch, BOOL bInvalidParents, BOOL bInvalidChildren)
Notifies the tree view that a branch has been invalidated.
void OnSize(UINT nType, CSize size)
Handles the size event.
void onItemBeforeRemove(HSTREEITEM hItem)
Notifies the tree view that an item is about to be removed.
virtual UINT WINAPI OnGetDlgCode() const
Gets the dialog code for the tree view.
void OnPaint(IRenderTarget *pRT)
Handles the paint event.
~STreeView()
Destructor for STreeView.
BOOL OnItemDblClick(IEvtArgs *pEvt)
Handles the item double-click event.
SList< ItemInfo > m_visible_items
void DispatchMessage2Items(UINT uMsg, WPARAM wParam, LPARAM lParam)
Dispatches a message to items.
LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam)
Handles mouse events.
virtual void DrawLines(IRenderTarget *pRT, const CRect &rc, HSTREEITEM hItem)
Draws lines for an item.
Class responsible for locating and managing tree view items.
int _GetItemOffset(HSTREEITEM hItem) const
Gets the offset of an item.
int GetItemIndent(HSTREEITEM hItem) SCONST OVERRIDE
Gets the indentation of an item.
void _SetItemOffset(HSTREEITEM hItem, int nOffset)
Sets the offset of an item.
~STreeViewItemLocator()
Destructor for STreeViewItemLocator.
void SetIndent(int nIndent) OVERRIDE
Sets the indentation between levels.
int GetScrollLineSize() SCONST OVERRIDE
Gets the scroll line size.
BOOL IsItemExpanded(HSTREEITEM hItem) const
Checks if an item is expanded.
HSTREEITEM _Position2Item(int position, HSTREEITEM hParent, int nParentPosition) const
Converts a position to an item handle.
int GetItemWidth(HSTREEITEM hItem) SCONST OVERRIDE
Gets the width of an item.
int _GetBranchWidth(HSTREEITEM hBranch) const
Gets the width of a branch.
void _UpdateSiblingsOffset(HSTREEITEM hItem)
Updates the offset of sibling items.
void OnBranchExpandedChanged(HSTREEITEM hItem, BOOL bExpandedOld, BOOL bExpandedNew) OVERRIDE
Notifies the locator that the expanded state of a branch has changed.
BOOL _IsItemVisible(HSTREEITEM hItem) const
Checks if an item is visible.
void _UpdateBranchHeight(HSTREEITEM hItem, int nDiff)
Updates the height of a branch.
int _GetItemVisibleWidth(HSTREEITEM hItem) const
Gets the visible width of an item.
void _SetBranchWidth(HSTREEITEM hBranch, int nWidth)
Sets the width of a branch.
int GetTotalWidth() SCONST OVERRIDE
Gets the total width of the tree view.
SAutoRefPtr< ITvAdapter > m_adapter
void SetAdapter(ITvAdapter *pAdapter) OVERRIDE
Sets the adapter for the tree view items.
HSTREEITEM Position2Item(int position) SCONST OVERRIDE
Converts a position to an item handle.
int GetTotalHeight() SCONST OVERRIDE
Gets the total height of the tree view.
void _SetItemHeight(HSTREEITEM hItem, int nHeight)
Sets the height of an item.
void SetItemHeight(HSTREEITEM hItem, int nHeight) OVERRIDE
Sets the height of an item.
void _InitBranch(HSTREEITEM hItem)
Initializes a branch.
int _GetBranchHeight(HSTREEITEM hItem) const
Gets the height of a branch.
int _GetItemVisibleHeight(HSTREEITEM hItem) const
Gets the visible height of an item.
void _SetItemWidth(HSTREEITEM hItem, int nWidth)
Sets the width of an item.
int GetIndent() SCONST OVERRIDE
Gets the indentation between levels.
int GetItemHeight(HSTREEITEM hItem) SCONST OVERRIDE
Gets the height of an item.
void SetItemWidth(HSTREEITEM hItem, int nWidth) OVERRIDE
Sets the width of an item.
int Item2Position(HSTREEITEM hItem) SCONST OVERRIDE
Converts an item handle to its position.
STreeViewItemLocator(int nIndent=16)
Constructor for STreeViewItemLocator.
void _SetBranchHeight(HSTREEITEM hItem, int nHeight)
Sets the height of a branch.
void _UpdateBranchWidth(HSTREEITEM hItem, int nOldWidth, int nNewWidth)
Updates the branch width data in the parent window.
void OnBranchChanged(HSTREEITEM hItem) OVERRIDE
Notifies the locator that a branch has changed.
Base class for SOUI DUI windows.
BOOL FireEvent(IEvtArgs *evt) OVERRIDE
Fires an event.
void SetVisible(BOOL bVisible, BOOL bUpdate=FALSE) OVERRIDE
Sets the visibility of the window.
void UnlockUpdate() OVERRIDE
Unlocks updates to the window.
SWindow * GetOwner() const
Retrieves the current owner of the window.
BOOL Destroy() OVERRIDE
Destroys the window.
void SDispatchMessage(UINT uMsg, WPARAM wParam=0, LPARAM lParam=0) OVERRIDE
Dispatches a message to the window.
int GetScale() SCONST OVERRIDE
Retrieves the scale factor of the window.
BOOL IsMsgHandled() const
Checks if the message is handled.
COLORREF GetColorizeColor() SCONST OVERRIDE
Retrieves the colorization color of the window.
ISwndContainer * GetContainer() OVERRIDE
Retrieves the container associated with this window.
void DoColorize(COLORREF cr) OVERRIDE
Applies colorization to the window.
virtual CRect GetClientRect() const
Retrieves the client rectangle of the window.
LRESULT SSendMessage(UINT uMsg, WPARAM wParam=0, LPARAM lParam=0, BOOL *pbMsgHandled=NULL) OVERRIDE
Sends a message to the window.
virtual void BeforePaint(IRenderTarget *pRT, SPainter &painter)
Prepare rendering environment.
void InvalidateRect(LPCRECT lprect) OVERRIDE
Invalidates a specific rectangle area of the window.
virtual void AfterPaint(IRenderTarget *pRT, SPainter &painter)
Restore rendering environment.
SEventSet * GetEventSet()
Retrieves the event set associated with the window.
void SetMsgHandled(BOOL bHandled)
Sets the message handled flag.
void GetScaleSkin(SAutoRefPtr< ISkinObj > &pSkin, int nScale)
Retrieves a scaled skin object based on the current scale factor.
void LockUpdate() OVERRIDE
Locks updates to the window.
SWND m_swnd
Member variables representing various properties of the window.
void Move(LPCRECT prect) OVERRIDE
Moves the window to a new position and size.
Class representing an XML node.
SXmlNode child(const wchar_t *name, bool bCaseSensitive=false) const
Gets the child node, attribute, or next/previous sibling with the specified name.
SFocusManager * GetFocusManager()
Retrieves the focus manager.
Template class implementing the IObjRef interface.
Interface for rendering target objects.
HRESULT GetTransform(float matrix[9]) SCONST PURE
Retrieves the current coordinate transformation matrix.
HRESULT PushClipRect(LPCRECT pRect, UINT mode=RGN_AND) PURE
Push a rectangular clip region.
HRESULT PopClip() PURE
Pop the last clip region from the stack.
HRESULT GetClipBox(LPRECT prc) PURE
Get the bounding box of the current clip region.
HRESULT GetClipRegion(IRegionS **ppRegion) PURE
Get the current clip region.
BOOL OnReleaseSwndCapture() PURE
Releases the mouse capture from the Swnd object.
SWND OnSetSwndCapture(SWND swnd) PURE
Sets the Swnd object to capture the mouse.