+// Win32++ Version 7.3\r
+// Released: 30th November 2011\r
+//\r
+// David Nash\r
+// url: https://sourceforge.net/projects/win32-framework\r
+//\r
+//\r
+// Copyright (c) 2005-2011 David Nash\r
+//\r
+// Permission is hereby granted, free of charge, to\r
+// any person obtaining a copy of this software and\r
+// associated documentation files (the "Software"),\r
+// to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify,\r
+// merge, publish, distribute, sublicense, and/or sell\r
+// copies of the Software, and to permit persons to whom\r
+// the Software is furnished to do so, subject to the\r
+// following conditions:\r
+//\r
+// The above copyright notice and this permission notice\r
+// shall be included in all copies or substantial portions\r
+// of the Software.\r
+//\r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF\r
+// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\r
+// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\r
+// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\r
+// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR\r
+// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE\r
+// OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+////////////////////////////////////////////////////////\r
+\r
+\r
+\r
+\r
+#ifndef _WIN32XX_TREEVIEW_H_\r
+#define _WIN32XX_TREEVIEW_H_\r
+\r
+#include "wincore.h"\r
+#include "commctrl.h"\r
+\r
+// Disable macros from Windowsx.h\r
+#undef GetNextSibling\r
+#undef GetPrevSibling\r
+\r
+namespace Win32xx\r
+{\r
+\r
+ class CTreeView : public CWnd\r
+ {\r
+ public:\r
+ CTreeView() {}\r
+ virtual ~CTreeView() {}\r
+ virtual void PreRegisterClass(WNDCLASS &wc);\r
+\r
+// Attributes\r
+ COLORREF GetBkColor() const;\r
+ HTREEITEM GetChild(HTREEITEM hItem) const;\r
+ UINT GetCount() const;\r
+ HTREEITEM GetDropHiLightItem() const;\r
+ CEdit* GetEditControl() const;\r
+ HTREEITEM GetFirstVisible() const;\r
+ HIMAGELIST GetImageList(int iImageType) const;\r
+ UINT GetIndent() const;\r
+ COLORREF GetInsertMarkColor() const;\r
+ BOOL GetItem(TVITEM& Item) const;\r
+ DWORD_PTR GetItemData(HTREEITEM hItem) const;\r
+ int GetItemHeight() const;\r
+ BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage ) const;\r
+ BOOL GetItemRect(HTREEITEM hItem, CRect& rc, BOOL bTextOnly) const;\r
+ CString GetItemText(HTREEITEM hItem, UINT nTextMax /* = 260 */) const;\r
+ HTREEITEM GetLastVisible() const;\r
+ HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const;\r
+ HTREEITEM GetNextSibling(HTREEITEM hItem) const;\r
+ HTREEITEM GetNextVisible(HTREEITEM hItem) const;\r
+ HTREEITEM GetParentItem(HTREEITEM hItem) const;\r
+ HTREEITEM GetPrevSibling(HTREEITEM hItem) const;\r
+ HTREEITEM GetPrevVisible(HTREEITEM hItem) const;\r
+ HTREEITEM GetRootItem() const;\r
+ int GetScrollTime() const;\r
+ HTREEITEM GetSelection() const;\r
+ COLORREF GetTextColor() const;\r
+ CToolTip* GetToolTips() const;\r
+ UINT GetVisibleCount() const;\r
+ BOOL ItemHasChildren(HTREEITEM hItem) const;\r
+ COLORREF SetBkColor(COLORREF clrBk) const;\r
+ HIMAGELIST SetImageList(HIMAGELIST himl, int nType) const;\r
+ void SetIndent(int indent) const;\r
+ BOOL SetInsertMark(HTREEITEM hItem, BOOL fAfter = TRUE) const;\r
+ COLORREF SetInsertMarkColor(COLORREF clrInsertMark) const;\r
+ BOOL SetItem(TVITEM& Item) const;\r
+ BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR szText, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) const;\r
+ BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData) const;\r
+ int SetItemHeight(SHORT cyItem) const;\r
+ BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) const;\r
+ BOOL SetItemText(HTREEITEM hItem, LPCTSTR szText) const;\r
+ UINT SetScrollTime(UINT uScrollTime) const;\r
+ COLORREF SetTextColor(COLORREF clrText) const;\r
+ CToolTip* SetToolTips(CToolTip* pToolTip) const;\r
+\r
+// Operations\r
+ HIMAGELIST CreateDragImage(HTREEITEM hItem) const;\r
+ BOOL DeleteAllItems() const;\r
+ BOOL DeleteItem(HTREEITEM hItem) const;\r
+ HWND EditLabel(HTREEITEM hItem) const;\r
+ BOOL EndEditLabelNow(BOOL fCancel) const;\r
+ BOOL EnsureVisible(HTREEITEM hItem) const;\r
+ BOOL Expand(HTREEITEM hItem, UINT nCode) const;\r
+ HTREEITEM HitTest(TVHITTESTINFO& ht) const;\r
+ HTREEITEM InsertItem(TVINSERTSTRUCT& tvIS) const;\r
+ BOOL Select(HTREEITEM hitem, UINT flag) const;\r
+ BOOL SelectDropTarget(HTREEITEM hItem) const;\r
+ BOOL SelectItem(HTREEITEM hItem) const;\r
+ BOOL SelectSetFirstVisible(HTREEITEM hItem) const;\r
+ BOOL SortChildren(HTREEITEM hItem, BOOL fRecurse) const;\r
+ BOOL SortChildrenCB(TVSORTCB& sort, BOOL fRecurse) const;\r
+\r
+ private:\r
+ CTreeView(const CTreeView&); // Disable copy construction\r
+ CTreeView& operator = (const CTreeView&); // Disable assignment operator\r
+\r
+ };\r
+ \r
+}\r
+\r
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+\r
+namespace Win32xx\r
+{\r
+\r
+ inline void CTreeView::PreRegisterClass(WNDCLASS &wc)\r
+ {\r
+ // Set the Window Class\r
+ wc.lpszClassName = WC_TREEVIEW;\r
+ }\r
+\r
+// Attributes\r
+ inline COLORREF CTreeView::GetBkColor() const\r
+ // Retrieves the current background color of the control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetBkColor( m_hWnd );\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetChild(HTREEITEM hItem) const\r
+ // Retrieves the first child item of the specified tree-view item.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetChild(m_hWnd, hItem);\r
+ }\r
+\r
+ inline UINT CTreeView::GetCount() const\r
+ // Retrieves a count of the items in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetCount( m_hWnd );\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetDropHiLightItem() const\r
+ // Retrieves the tree-view item that is the target of a drag-and-drop operation.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetDropHilight(m_hWnd);\r
+ }\r
+\r
+ inline CEdit* CTreeView::GetEditControl() const\r
+ // Retrieves the handle to the edit control being used to edit a tree-view item's text.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return (CEdit*)FromHandle(TreeView_GetEditControl(m_hWnd));\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetFirstVisible() const\r
+ // Retrieves the first visible item in a tree-view control window.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetFirstVisible(m_hWnd);\r
+ }\r
+\r
+ inline HIMAGELIST CTreeView::GetImageList(int iImageType) const\r
+ // Retrieves the handle to the normal or state image list associated with a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetImageList( m_hWnd, iImageType );\r
+ }\r
+\r
+ inline UINT CTreeView::GetIndent() const\r
+ // Retrieves the amount, in pixels, that child items are indented relative to their parent items.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetIndent( m_hWnd );\r
+ }\r
+\r
+ inline COLORREF CTreeView::GetInsertMarkColor() const\r
+ // Retrieves the color used to draw the insertion mark for the tree view.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetInsertMarkColor( m_hWnd );\r
+ }\r
+\r
+ inline BOOL CTreeView::GetItem(TVITEM& Item) const\r
+ // Retrieves some or all of a tree-view item's attributes.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetItem( m_hWnd, &Item );\r
+ }\r
+\r
+ inline DWORD_PTR CTreeView::GetItemData(HTREEITEM hItem) const\r
+ // Retrieves a tree-view item's application data.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ TVITEM tvi = {0};\r
+ tvi.mask = TVIF_PARAM;\r
+ tvi.hItem = hItem;\r
+ TreeView_GetItem( m_hWnd, &tvi );\r
+ return tvi.lParam;\r
+ }\r
+\r
+ inline int CTreeView::GetItemHeight() const\r
+ // Retrieves the current height of the tree-view item.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetItemHeight( m_hWnd );\r
+ }\r
+\r
+ inline BOOL CTreeView::GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage ) const\r
+ // Retrieves the index of the tree-view item's image and selected image.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ TVITEM tvi = {0};\r
+ tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;\r
+ tvi.hItem = hItem;\r
+ BOOL bResult = TreeView_GetItem( m_hWnd, &tvi );\r
+ nImage = tvi.iImage;\r
+ nSelectedImage = tvi.iSelectedImage;\r
+ return bResult;\r
+ }\r
+\r
+ inline BOOL CTreeView::GetItemRect(HTREEITEM hItem, CRect& rc, BOOL bTextOnly) const\r
+ // Retrieves the bounding rectangle for a tree-view item and indicates whether the item is visible.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetItemRect( m_hWnd, hItem, &rc, bTextOnly );\r
+ }\r
+\r
+ inline CString CTreeView::GetItemText(HTREEITEM hItem, UINT nTextMax /* = 260 */) const\r
+ // Retrieves the text for a tree-view item.\r
+ // Note: Although the tree-view control allows any length string to be stored \r
+ // as item text, only the first 260 characters are displayed.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ CString t;\r
+ if (nTextMax > 0)\r
+ {\r
+ TVITEM tvi = {0};\r
+ tvi.hItem = hItem;\r
+ tvi.mask = TVIF_TEXT;\r
+ tvi.cchTextMax = nTextMax;\r
+ std::vector<TCHAR> vTChar(nTextMax +1, _T('\0'));\r
+ TCHAR* pTCharArray = &vTChar.front();\r
+ tvi.pszText = pTCharArray;\r
+ ::SendMessage(m_hWnd, TVM_GETITEM, 0L, (LPARAM)&tvi);\r
+ t = tvi.pszText;\r
+ }\r
+ return t;\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetLastVisible() const\r
+ // Retrieves the last expanded item in a tree-view control.\r
+ // This does not retrieve the last item visible in the tree-view window.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetLastVisible(m_hWnd);\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetNextItem(HTREEITEM hItem, UINT nCode) const\r
+ // Retrieves the tree-view item that bears the specified relationship to a specified item.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetNextItem( m_hWnd, hItem, nCode);\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetNextSibling(HTREEITEM hItem) const\r
+ // Retrieves the next sibling item of a specified item in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetNextSibling(m_hWnd, hItem);\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetNextVisible(HTREEITEM hItem) const\r
+ // Retrieves the next visible item that follows a specified item in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetNextVisible(m_hWnd, hItem);\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetParentItem(HTREEITEM hItem) const\r
+ // Retrieves the parent item of the specified tree-view item.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetParent(m_hWnd, hItem);\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetPrevSibling(HTREEITEM hItem) const\r
+ // Retrieves the previous sibling item of a specified item in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetPrevSibling(m_hWnd, hItem);\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetPrevVisible(HTREEITEM hItem) const\r
+ // Retrieves the first visible item that precedes a specified item in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetPrevVisible(m_hWnd, hItem);\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetRootItem() const\r
+ // Retrieves the topmost or very first item of the tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetRoot(m_hWnd);\r
+ }\r
+\r
+ inline int CTreeView::GetScrollTime() const\r
+ // Retrieves the maximum scroll time for the tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetScrollTime( m_hWnd );\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::GetSelection() const\r
+ // Retrieves the currently selected item in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetSelection(m_hWnd);\r
+ }\r
+\r
+ inline COLORREF CTreeView::GetTextColor() const\r
+ // Retrieves the current text color of the control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetTextColor( m_hWnd );\r
+ }\r
+\r
+ inline CToolTip* CTreeView::GetToolTips() const\r
+ // Retrieves the handle to the child ToolTip control used by a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return (CToolTip*) FromHandle( TreeView_GetToolTips( m_hWnd ) );\r
+ }\r
+\r
+ inline UINT CTreeView::GetVisibleCount() const\r
+ // Obtains the number of items that can be fully visible in the client window of a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_GetVisibleCount( m_hWnd );\r
+ }\r
+\r
+ inline BOOL CTreeView::ItemHasChildren(HTREEITEM hItem) const\r
+ // Returns true of the tree-view item has one or more children\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ if (TreeView_GetChild( m_hWnd, hItem ))\r
+ return TRUE;\r
+\r
+ return FALSE;\r
+ }\r
+\r
+ inline COLORREF CTreeView::SetBkColor(COLORREF clrBk) const\r
+ // Sets the background color of the control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetBkColor( m_hWnd, clrBk );\r
+ }\r
+\r
+ inline HIMAGELIST CTreeView::SetImageList(HIMAGELIST himl, int nType) const\r
+ // Sets the normal or state image list for a tree-view control\r
+ // and redraws the control using the new images.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetImageList( m_hWnd, himl, nType );\r
+ }\r
+\r
+ inline void CTreeView::SetIndent(int indent) const\r
+ // Sets the width of indentation for a tree-view control\r
+ // and redraws the control to reflect the new width.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ TreeView_SetIndent( m_hWnd, indent );\r
+ }\r
+\r
+ inline BOOL CTreeView::SetInsertMark(HTREEITEM hItem, BOOL fAfter/* = TRUE*/) const\r
+ // Sets the insertion mark in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetInsertMark( m_hWnd, hItem, fAfter );\r
+ }\r
+\r
+ inline COLORREF CTreeView::SetInsertMarkColor(COLORREF clrInsertMark) const\r
+ // Sets the color used to draw the insertion mark for the tree view.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetInsertMarkColor( m_hWnd, clrInsertMark );\r
+ }\r
+\r
+ inline BOOL CTreeView::SetItem(TVITEM& Item) const\r
+ // Sets some or all of a tree-view item's attributes.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetItem( m_hWnd, &Item );\r
+ }\r
+\r
+ inline BOOL CTreeView::SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR szText, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) const\r
+ // Sets some or all of a tree-view item's attributes.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ TVITEM tvi = {0};\r
+ tvi.hItem = hItem;\r
+ tvi.mask = nMask;\r
+ tvi.pszText = (LPTSTR)szText;\r
+ tvi.iImage = nImage;\r
+ tvi.iSelectedImage = nSelectedImage;\r
+ tvi.state = nState;\r
+ tvi.stateMask = nStateMask;\r
+ tvi.lParam = lParam;\r
+ return TreeView_SetItem( m_hWnd, &tvi );\r
+ }\r
+\r
+ inline BOOL CTreeView::SetItemData(HTREEITEM hItem, DWORD_PTR dwData) const\r
+ // Sets the tree-view item's application data.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ TVITEM tvi = {0};\r
+ tvi.hItem = hItem;\r
+ tvi.mask = TVIF_PARAM;\r
+ tvi.lParam = dwData;\r
+ return TreeView_SetItem( m_hWnd, &tvi );\r
+ }\r
+\r
+ inline int CTreeView::SetItemHeight(SHORT cyItem) const\r
+ // Sets the height of the tree-view items.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetItemHeight( m_hWnd, cyItem );\r
+ }\r
+\r
+ inline BOOL CTreeView::SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) const\r
+ // Sets the tree-view item's application image.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ TVITEM tvi = {0};\r
+ tvi.hItem = hItem;\r
+ tvi.iImage = nImage;\r
+ tvi.iSelectedImage = nSelectedImage;\r
+ tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;\r
+ return TreeView_SetItem(m_hWnd, &tvi );\r
+ }\r
+\r
+ inline BOOL CTreeView::SetItemText(HTREEITEM hItem, LPCTSTR szText) const\r
+ // Sets the tree-view item's application text.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+\r
+ TVITEM tvi = {0};\r
+ tvi.hItem = hItem;\r
+ tvi.pszText = (LPTSTR)szText;\r
+ tvi.mask = TVIF_TEXT;\r
+ return TreeView_SetItem(m_hWnd, &tvi );\r
+ }\r
+\r
+ inline UINT CTreeView::SetScrollTime(UINT uScrollTime) const\r
+ // Sets the maximum scroll time for the tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetScrollTime( m_hWnd, uScrollTime );\r
+ }\r
+\r
+ inline COLORREF CTreeView::SetTextColor(COLORREF clrText) const\r
+ // Sets the text color of the control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SetTextColor( m_hWnd, clrText );\r
+ }\r
+\r
+ inline CToolTip* CTreeView::SetToolTips(CToolTip* pToolTip) const\r
+ // Sets a tree-view control's child ToolTip control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ HWND hToolTip = pToolTip? pToolTip->GetHwnd() : 0;\r
+ return (CToolTip*) FromHandle( TreeView_SetToolTips( m_hWnd, hToolTip ) );\r
+ }\r
+\r
+ // Operations\r
+\r
+ inline HIMAGELIST CTreeView::CreateDragImage(HTREEITEM hItem) const\r
+ // Creates a dragging bitmap for the specified item in a tree-view control.\r
+ // It also creates an image list for the bitmap and adds the bitmap to the image list.\r
+ // An application can display the image when dragging the item by using the image list functions.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_CreateDragImage( m_hWnd, hItem );\r
+ }\r
+\r
+ inline BOOL CTreeView::DeleteAllItems() const\r
+ // Deletes all items from a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_DeleteAllItems( m_hWnd );\r
+ }\r
+\r
+ inline BOOL CTreeView::DeleteItem(HTREEITEM hItem) const\r
+ // Removes an item and all its children from a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_DeleteItem( m_hWnd, hItem );\r
+ }\r
+\r
+ inline HWND CTreeView::EditLabel(HTREEITEM hItem) const\r
+ // Begins in-place editing of the specified item's text, replacing the text of the item\r
+ // with a single-line edit control containing the text.\r
+ // The specified item is implicitly selected and focused.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_EditLabel( m_hWnd, hItem );\r
+ }\r
+\r
+ inline BOOL CTreeView::EndEditLabelNow(BOOL fCancel) const\r
+ // Ends the editing of a tree-view item's label.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_EndEditLabelNow(m_hWnd, fCancel);\r
+ }\r
+\r
+ inline BOOL CTreeView::EnsureVisible(HTREEITEM hItem) const\r
+ // Ensures that a tree-view item is visible, expanding the parent item or\r
+ // scrolling the tree-view control, if necessary.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_EnsureVisible( m_hWnd, hItem );\r
+ }\r
+\r
+ inline BOOL CTreeView::Expand(HTREEITEM hItem, UINT nCode) const\r
+ // The TreeView_Expand macro expands or collapses the list of child items associated\r
+ // with the specified parent item, if any.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_Expand( m_hWnd, hItem, nCode );\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::HitTest(TVHITTESTINFO& ht) const\r
+ // Determines the location of the specified point relative to the client area of a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_HitTest( m_hWnd, &ht );\r
+ }\r
+\r
+ inline HTREEITEM CTreeView::InsertItem(TVINSERTSTRUCT& tvIS) const\r
+ // Inserts a new item in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_InsertItem( m_hWnd, &tvIS );\r
+ }\r
+\r
+ inline BOOL CTreeView::Select(HTREEITEM hitem, UINT flag) const\r
+ // Selects the specified tree-view item, scrolls the item into view, or redraws\r
+ // the item in the style used to indicate the target of a drag-and-drop operation.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_Select(m_hWnd, hitem, flag );\r
+ }\r
+\r
+ inline BOOL CTreeView::SelectDropTarget(HTREEITEM hItem) const\r
+ // Redraws a specified tree-view control item in the style used to indicate the\r
+ // target of a drag-and-drop operation.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SelectDropTarget(m_hWnd, hItem);\r
+ }\r
+\r
+ inline BOOL CTreeView::SelectItem(HTREEITEM hItem) const\r
+ // Selects the specified tree-view item.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SelectItem(m_hWnd, hItem);\r
+ }\r
+\r
+ inline BOOL CTreeView::SelectSetFirstVisible(HTREEITEM hItem) const\r
+ // Scrolls the tree-view control vertically to ensure that the specified item is visible.\r
+ // If possible, the specified item becomes the first visible item at the top of the control's window.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SelectSetFirstVisible(m_hWnd, hItem);\r
+ }\r
+\r
+ inline BOOL CTreeView::SortChildren(HTREEITEM hItem, BOOL fRecurse) const\r
+ // Sorts the child items of the specified parent item in a tree-view control.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SortChildren( m_hWnd, hItem, fRecurse );\r
+ }\r
+\r
+ inline BOOL CTreeView::SortChildrenCB(TVSORTCB& sort, BOOL fRecurse) const\r
+ // Sorts tree-view items using an application-defined callback function that compares the items.\r
+ {\r
+ assert(::IsWindow(m_hWnd));\r
+ return TreeView_SortChildrenCB( m_hWnd, &sort, fRecurse );\r
+ }\r
+\r
+\r
+} // namespace Win32xx\r
+\r
+#endif // #ifndef _WIN32XX_TREEVIEW_H_\r
+\r