1#ifndef __STREEVIEW__H__
2#define __STREEVIEW__H__
6#include <core/SItemPanel.h>
7#include <interface/SAdapter-i.h>
8#include <interface/STreeViewItemLocator-i.h>
9#include <proxy/SPanelProxy.h>
35 STDMETHOD_(
void,
SetAdapter)(THIS_ ITvAdapter *pAdapter) OVERRIDE;
50 (THIS_ HSTREEITEM hItem, BOOL bExpandedOld, BOOL bExpandedNew) OVERRIDE;
69 STDMETHOD_(
int,
Item2Position)(THIS_ HSTREEITEM hItem) SCONST OVERRIDE;
76 STDMETHOD_(HSTREEITEM,
Position2Item)(THIS_
int position) SCONST OVERRIDE;
89 STDMETHOD_(
void,
SetItemWidth)(THIS_ HSTREEITEM hItem,
int nWidth) OVERRIDE;
96 STDMETHOD_(
int,
GetItemWidth)(THIS_ HSTREEITEM hItem) SCONST OVERRIDE;
103 STDMETHOD_(
void,
SetItemHeight)(THIS_ HSTREEITEM hItem,
int nHeight) OVERRIDE;
110 STDMETHOD_(
int,
GetItemHeight)(THIS_ HSTREEITEM hItem) SCONST OVERRIDE;
117 STDMETHOD_(
int,
GetItemIndent)(THIS_ HSTREEITEM hItem) SCONST OVERRIDE;
123 STDMETHOD_(
int,
GetIndent)(CTHIS) SCONST OVERRIDE;
129 STDMETHOD_(
void,
SetIndent)(THIS_
int nIndent) OVERRIDE;
237 HSTREEITEM
_Position2Item(
int position, HSTREEITEM hParent,
int nParentPosition)
const;
263 :
public TPanelProxy<ITreeView>
264 ,
protected SHostProxy
265 ,
protected IItemContainer {
266 DEF_SOBJECT(
SPanel, L
"treeview")
267 friend class STreeViewDataSetObserver;
286 STDMETHOD_(BOOL,
SetAdapter)(THIS_ ITvAdapter *adapter) OVERRIDE;
292 STDMETHOD_(ITvAdapter *,
GetAdapter)(THIS) SCONST OVERRIDE;
298 STDMETHOD_(
void,
SetItemLocator)(THIS_ ITreeViewItemLocator *pItemLocator) OVERRIDE;
304 STDMETHOD_(ITreeViewItemLocator *,
GetItemLocator)(THIS) SCONST OVERRIDE;
311 STDMETHOD_(
void,
SetSel)(THIS_ HSTREEITEM hItem, BOOL bNotify = FALSE) OVERRIDE;
317 STDMETHOD_(HSTREEITEM,
GetSel)(THIS) SCONST OVERRIDE;
323 STDMETHOD_(
void,
EnsureVisible)(THIS_ HSTREEITEM hItem) OVERRIDE;
330 STDMETHOD_(IItemPanel *,
HitTest)(THIS_
const POINT *pt) SCONST OVERRIDE;
338 SItemPanel *
HitTest(CPoint &pt)
const;
395 void OnSize(UINT nType, CSize size);
408 void OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags);
417 LRESULT
OnKeyEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
431 BOOL
OnMouseWheel(UINT nFlags,
short zDelta, CPoint pt);
440 LRESULT
OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
472 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST,
OnMouseEvent)
473 MESSAGE_RANGE_HANDLER_EX(WM_KEYFIRST, WM_KEYLAST,
OnKeyEvent)
474 MESSAGE_RANGE_HANDLER_EX(WM_IME_STARTCOMPOSITION, WM_IME_KEYLAST,
OnKeyEvent)
476 MESSAGE_HANDLER_EX(WM_IME_REQUEST,
OnKeyEvent)
547 virtual BOOL
OnScroll(BOOL bVertical, UINT uCode,
int nPos);
576 virtual BOOL
OnItemGetRect(const SOsrPanel *pItem, CRect &rcItem) const;
637 typedef SMap<HSTREEITEM, ItemInfo> VISIBLEITEMSMAP;
SOUI Panel with Scrollbar Support.
Smart pointer class for managing COM-style reference-counted objects.
SPanel()
Constructor for SPanel.
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.
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.
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.
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.
Implementation of IXmlDoc.
Class representing an XML node.
Interface for rendering target objects.