1 // Win32++ Version 7.3
\r
2 // Released: 30th November 2011
\r
6 // url: https://sourceforge.net/projects/win32-framework
\r
9 // Copyright (c) 2005-2011 David Nash
\r
11 // Permission is hereby granted, free of charge, to
\r
12 // any person obtaining a copy of this software and
\r
13 // associated documentation files (the "Software"),
\r
14 // to deal in the Software without restriction, including
\r
15 // without limitation the rights to use, copy, modify,
\r
16 // merge, publish, distribute, sublicense, and/or sell
\r
17 // copies of the Software, and to permit persons to whom
\r
18 // the Software is furnished to do so, subject to the
\r
19 // following conditions:
\r
21 // The above copyright notice and this permission notice
\r
22 // shall be included in all copies or substantial portions
\r
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
\r
26 // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
\r
27 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
\r
28 // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
\r
29 // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
\r
30 // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
\r
31 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
32 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
\r
33 // OR OTHER DEALINGS IN THE SOFTWARE.
\r
35 ////////////////////////////////////////////////////////
\r
40 #ifndef _WIN32XX_TREEVIEW_H_
\r
41 #define _WIN32XX_TREEVIEW_H_
\r
43 #include "wincore.h"
\r
44 #include "commctrl.h"
\r
46 // Disable macros from Windowsx.h
\r
47 #undef GetNextSibling
\r
48 #undef GetPrevSibling
\r
53 class CTreeView : public CWnd
\r
57 virtual ~CTreeView() {}
\r
58 virtual void PreRegisterClass(WNDCLASS &wc);
\r
61 COLORREF GetBkColor() const;
\r
62 HTREEITEM GetChild(HTREEITEM hItem) const;
\r
63 UINT GetCount() const;
\r
64 HTREEITEM GetDropHiLightItem() const;
\r
65 CEdit* GetEditControl() const;
\r
66 HTREEITEM GetFirstVisible() const;
\r
67 HIMAGELIST GetImageList(int iImageType) const;
\r
68 UINT GetIndent() const;
\r
69 COLORREF GetInsertMarkColor() const;
\r
70 BOOL GetItem(TVITEM& Item) const;
\r
71 DWORD_PTR GetItemData(HTREEITEM hItem) const;
\r
72 int GetItemHeight() const;
\r
73 BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage ) const;
\r
74 BOOL GetItemRect(HTREEITEM hItem, CRect& rc, BOOL bTextOnly) const;
\r
75 CString GetItemText(HTREEITEM hItem, UINT nTextMax /* = 260 */) const;
\r
76 HTREEITEM GetLastVisible() const;
\r
77 HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const;
\r
78 HTREEITEM GetNextSibling(HTREEITEM hItem) const;
\r
79 HTREEITEM GetNextVisible(HTREEITEM hItem) const;
\r
80 HTREEITEM GetParentItem(HTREEITEM hItem) const;
\r
81 HTREEITEM GetPrevSibling(HTREEITEM hItem) const;
\r
82 HTREEITEM GetPrevVisible(HTREEITEM hItem) const;
\r
83 HTREEITEM GetRootItem() const;
\r
84 int GetScrollTime() const;
\r
85 HTREEITEM GetSelection() const;
\r
86 COLORREF GetTextColor() const;
\r
87 CToolTip* GetToolTips() const;
\r
88 UINT GetVisibleCount() const;
\r
89 BOOL ItemHasChildren(HTREEITEM hItem) const;
\r
90 COLORREF SetBkColor(COLORREF clrBk) const;
\r
91 HIMAGELIST SetImageList(HIMAGELIST himl, int nType) const;
\r
92 void SetIndent(int indent) const;
\r
93 BOOL SetInsertMark(HTREEITEM hItem, BOOL fAfter = TRUE) const;
\r
94 COLORREF SetInsertMarkColor(COLORREF clrInsertMark) const;
\r
95 BOOL SetItem(TVITEM& Item) const;
\r
96 BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR szText, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) const;
\r
97 BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData) const;
\r
98 int SetItemHeight(SHORT cyItem) const;
\r
99 BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) const;
\r
100 BOOL SetItemText(HTREEITEM hItem, LPCTSTR szText) const;
\r
101 UINT SetScrollTime(UINT uScrollTime) const;
\r
102 COLORREF SetTextColor(COLORREF clrText) const;
\r
103 CToolTip* SetToolTips(CToolTip* pToolTip) const;
\r
106 HIMAGELIST CreateDragImage(HTREEITEM hItem) const;
\r
107 BOOL DeleteAllItems() const;
\r
108 BOOL DeleteItem(HTREEITEM hItem) const;
\r
109 HWND EditLabel(HTREEITEM hItem) const;
\r
110 BOOL EndEditLabelNow(BOOL fCancel) const;
\r
111 BOOL EnsureVisible(HTREEITEM hItem) const;
\r
112 BOOL Expand(HTREEITEM hItem, UINT nCode) const;
\r
113 HTREEITEM HitTest(TVHITTESTINFO& ht) const;
\r
114 HTREEITEM InsertItem(TVINSERTSTRUCT& tvIS) const;
\r
115 BOOL Select(HTREEITEM hitem, UINT flag) const;
\r
116 BOOL SelectDropTarget(HTREEITEM hItem) const;
\r
117 BOOL SelectItem(HTREEITEM hItem) const;
\r
118 BOOL SelectSetFirstVisible(HTREEITEM hItem) const;
\r
119 BOOL SortChildren(HTREEITEM hItem, BOOL fRecurse) const;
\r
120 BOOL SortChildrenCB(TVSORTCB& sort, BOOL fRecurse) const;
\r
123 CTreeView(const CTreeView&); // Disable copy construction
\r
124 CTreeView& operator = (const CTreeView&); // Disable assignment operator
\r
130 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\r
135 inline void CTreeView::PreRegisterClass(WNDCLASS &wc)
\r
137 // Set the Window Class
\r
138 wc.lpszClassName = WC_TREEVIEW;
\r
142 inline COLORREF CTreeView::GetBkColor() const
\r
143 // Retrieves the current background color of the control.
\r
145 assert(::IsWindow(m_hWnd));
\r
146 return TreeView_GetBkColor( m_hWnd );
\r
149 inline HTREEITEM CTreeView::GetChild(HTREEITEM hItem) const
\r
150 // Retrieves the first child item of the specified tree-view item.
\r
152 assert(::IsWindow(m_hWnd));
\r
153 return TreeView_GetChild(m_hWnd, hItem);
\r
156 inline UINT CTreeView::GetCount() const
\r
157 // Retrieves a count of the items in a tree-view control.
\r
159 assert(::IsWindow(m_hWnd));
\r
160 return TreeView_GetCount( m_hWnd );
\r
163 inline HTREEITEM CTreeView::GetDropHiLightItem() const
\r
164 // Retrieves the tree-view item that is the target of a drag-and-drop operation.
\r
166 assert(::IsWindow(m_hWnd));
\r
167 return TreeView_GetDropHilight(m_hWnd);
\r
170 inline CEdit* CTreeView::GetEditControl() const
\r
171 // Retrieves the handle to the edit control being used to edit a tree-view item's text.
\r
173 assert(::IsWindow(m_hWnd));
\r
174 return (CEdit*)FromHandle(TreeView_GetEditControl(m_hWnd));
\r
177 inline HTREEITEM CTreeView::GetFirstVisible() const
\r
178 // Retrieves the first visible item in a tree-view control window.
\r
180 assert(::IsWindow(m_hWnd));
\r
181 return TreeView_GetFirstVisible(m_hWnd);
\r
184 inline HIMAGELIST CTreeView::GetImageList(int iImageType) const
\r
185 // Retrieves the handle to the normal or state image list associated with a tree-view control.
\r
187 assert(::IsWindow(m_hWnd));
\r
188 return TreeView_GetImageList( m_hWnd, iImageType );
\r
191 inline UINT CTreeView::GetIndent() const
\r
192 // Retrieves the amount, in pixels, that child items are indented relative to their parent items.
\r
194 assert(::IsWindow(m_hWnd));
\r
195 return TreeView_GetIndent( m_hWnd );
\r
198 inline COLORREF CTreeView::GetInsertMarkColor() const
\r
199 // Retrieves the color used to draw the insertion mark for the tree view.
\r
201 assert(::IsWindow(m_hWnd));
\r
202 return TreeView_GetInsertMarkColor( m_hWnd );
\r
205 inline BOOL CTreeView::GetItem(TVITEM& Item) const
\r
206 // Retrieves some or all of a tree-view item's attributes.
\r
208 assert(::IsWindow(m_hWnd));
\r
209 return TreeView_GetItem( m_hWnd, &Item );
\r
212 inline DWORD_PTR CTreeView::GetItemData(HTREEITEM hItem) const
\r
213 // Retrieves a tree-view item's application data.
\r
215 assert(::IsWindow(m_hWnd));
\r
218 tvi.mask = TVIF_PARAM;
\r
220 TreeView_GetItem( m_hWnd, &tvi );
\r
224 inline int CTreeView::GetItemHeight() const
\r
225 // Retrieves the current height of the tree-view item.
\r
227 assert(::IsWindow(m_hWnd));
\r
228 return TreeView_GetItemHeight( m_hWnd );
\r
231 inline BOOL CTreeView::GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage ) const
\r
232 // Retrieves the index of the tree-view item's image and selected image.
\r
234 assert(::IsWindow(m_hWnd));
\r
237 tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
\r
239 BOOL bResult = TreeView_GetItem( m_hWnd, &tvi );
\r
240 nImage = tvi.iImage;
\r
241 nSelectedImage = tvi.iSelectedImage;
\r
245 inline BOOL CTreeView::GetItemRect(HTREEITEM hItem, CRect& rc, BOOL bTextOnly) const
\r
246 // Retrieves the bounding rectangle for a tree-view item and indicates whether the item is visible.
\r
248 assert(::IsWindow(m_hWnd));
\r
249 return TreeView_GetItemRect( m_hWnd, hItem, &rc, bTextOnly );
\r
252 inline CString CTreeView::GetItemText(HTREEITEM hItem, UINT nTextMax /* = 260 */) const
\r
253 // Retrieves the text for a tree-view item.
\r
254 // Note: Although the tree-view control allows any length string to be stored
\r
255 // as item text, only the first 260 characters are displayed.
\r
257 assert(::IsWindow(m_hWnd));
\r
264 tvi.mask = TVIF_TEXT;
\r
265 tvi.cchTextMax = nTextMax;
\r
266 std::vector<TCHAR> vTChar(nTextMax +1, _T('\0'));
\r
267 TCHAR* pTCharArray = &vTChar.front();
\r
268 tvi.pszText = pTCharArray;
\r
269 ::SendMessage(m_hWnd, TVM_GETITEM, 0L, (LPARAM)&tvi);
\r
275 inline HTREEITEM CTreeView::GetLastVisible() const
\r
276 // Retrieves the last expanded item in a tree-view control.
\r
277 // This does not retrieve the last item visible in the tree-view window.
\r
279 assert(::IsWindow(m_hWnd));
\r
280 return TreeView_GetLastVisible(m_hWnd);
\r
283 inline HTREEITEM CTreeView::GetNextItem(HTREEITEM hItem, UINT nCode) const
\r
284 // Retrieves the tree-view item that bears the specified relationship to a specified item.
\r
286 assert(::IsWindow(m_hWnd));
\r
287 return TreeView_GetNextItem( m_hWnd, hItem, nCode);
\r
290 inline HTREEITEM CTreeView::GetNextSibling(HTREEITEM hItem) const
\r
291 // Retrieves the next sibling item of a specified item in a tree-view control.
\r
293 assert(::IsWindow(m_hWnd));
\r
294 return TreeView_GetNextSibling(m_hWnd, hItem);
\r
297 inline HTREEITEM CTreeView::GetNextVisible(HTREEITEM hItem) const
\r
298 // Retrieves the next visible item that follows a specified item in a tree-view control.
\r
300 assert(::IsWindow(m_hWnd));
\r
301 return TreeView_GetNextVisible(m_hWnd, hItem);
\r
304 inline HTREEITEM CTreeView::GetParentItem(HTREEITEM hItem) const
\r
305 // Retrieves the parent item of the specified tree-view item.
\r
307 assert(::IsWindow(m_hWnd));
\r
308 return TreeView_GetParent(m_hWnd, hItem);
\r
311 inline HTREEITEM CTreeView::GetPrevSibling(HTREEITEM hItem) const
\r
312 // Retrieves the previous sibling item of a specified item in a tree-view control.
\r
314 assert(::IsWindow(m_hWnd));
\r
315 return TreeView_GetPrevSibling(m_hWnd, hItem);
\r
318 inline HTREEITEM CTreeView::GetPrevVisible(HTREEITEM hItem) const
\r
319 // Retrieves the first visible item that precedes a specified item in a tree-view control.
\r
321 assert(::IsWindow(m_hWnd));
\r
322 return TreeView_GetPrevVisible(m_hWnd, hItem);
\r
325 inline HTREEITEM CTreeView::GetRootItem() const
\r
326 // Retrieves the topmost or very first item of the tree-view control.
\r
328 assert(::IsWindow(m_hWnd));
\r
329 return TreeView_GetRoot(m_hWnd);
\r
332 inline int CTreeView::GetScrollTime() const
\r
333 // Retrieves the maximum scroll time for the tree-view control.
\r
335 assert(::IsWindow(m_hWnd));
\r
336 return TreeView_GetScrollTime( m_hWnd );
\r
339 inline HTREEITEM CTreeView::GetSelection() const
\r
340 // Retrieves the currently selected item in a tree-view control.
\r
342 assert(::IsWindow(m_hWnd));
\r
343 return TreeView_GetSelection(m_hWnd);
\r
346 inline COLORREF CTreeView::GetTextColor() const
\r
347 // Retrieves the current text color of the control.
\r
349 assert(::IsWindow(m_hWnd));
\r
350 return TreeView_GetTextColor( m_hWnd );
\r
353 inline CToolTip* CTreeView::GetToolTips() const
\r
354 // Retrieves the handle to the child ToolTip control used by a tree-view control.
\r
356 assert(::IsWindow(m_hWnd));
\r
357 return (CToolTip*) FromHandle( TreeView_GetToolTips( m_hWnd ) );
\r
360 inline UINT CTreeView::GetVisibleCount() const
\r
361 // Obtains the number of items that can be fully visible in the client window of a tree-view control.
\r
363 assert(::IsWindow(m_hWnd));
\r
364 return TreeView_GetVisibleCount( m_hWnd );
\r
367 inline BOOL CTreeView::ItemHasChildren(HTREEITEM hItem) const
\r
368 // Returns true of the tree-view item has one or more children
\r
370 assert(::IsWindow(m_hWnd));
\r
372 if (TreeView_GetChild( m_hWnd, hItem ))
\r
378 inline COLORREF CTreeView::SetBkColor(COLORREF clrBk) const
\r
379 // Sets the background color of the control.
\r
381 assert(::IsWindow(m_hWnd));
\r
382 return TreeView_SetBkColor( m_hWnd, clrBk );
\r
385 inline HIMAGELIST CTreeView::SetImageList(HIMAGELIST himl, int nType) const
\r
386 // Sets the normal or state image list for a tree-view control
\r
387 // and redraws the control using the new images.
\r
389 assert(::IsWindow(m_hWnd));
\r
390 return TreeView_SetImageList( m_hWnd, himl, nType );
\r
393 inline void CTreeView::SetIndent(int indent) const
\r
394 // Sets the width of indentation for a tree-view control
\r
395 // and redraws the control to reflect the new width.
\r
397 assert(::IsWindow(m_hWnd));
\r
398 TreeView_SetIndent( m_hWnd, indent );
\r
401 inline BOOL CTreeView::SetInsertMark(HTREEITEM hItem, BOOL fAfter/* = TRUE*/) const
\r
402 // Sets the insertion mark in a tree-view control.
\r
404 assert(::IsWindow(m_hWnd));
\r
405 return TreeView_SetInsertMark( m_hWnd, hItem, fAfter );
\r
408 inline COLORREF CTreeView::SetInsertMarkColor(COLORREF clrInsertMark) const
\r
409 // Sets the color used to draw the insertion mark for the tree view.
\r
411 assert(::IsWindow(m_hWnd));
\r
412 return TreeView_SetInsertMarkColor( m_hWnd, clrInsertMark );
\r
415 inline BOOL CTreeView::SetItem(TVITEM& Item) const
\r
416 // Sets some or all of a tree-view item's attributes.
\r
418 assert(::IsWindow(m_hWnd));
\r
419 return TreeView_SetItem( m_hWnd, &Item );
\r
422 inline BOOL CTreeView::SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR szText, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) const
\r
423 // Sets some or all of a tree-view item's attributes.
\r
425 assert(::IsWindow(m_hWnd));
\r
430 tvi.pszText = (LPTSTR)szText;
\r
431 tvi.iImage = nImage;
\r
432 tvi.iSelectedImage = nSelectedImage;
\r
433 tvi.state = nState;
\r
434 tvi.stateMask = nStateMask;
\r
435 tvi.lParam = lParam;
\r
436 return TreeView_SetItem( m_hWnd, &tvi );
\r
439 inline BOOL CTreeView::SetItemData(HTREEITEM hItem, DWORD_PTR dwData) const
\r
440 // Sets the tree-view item's application data.
\r
442 assert(::IsWindow(m_hWnd));
\r
446 tvi.mask = TVIF_PARAM;
\r
447 tvi.lParam = dwData;
\r
448 return TreeView_SetItem( m_hWnd, &tvi );
\r
451 inline int CTreeView::SetItemHeight(SHORT cyItem) const
\r
452 // Sets the height of the tree-view items.
\r
454 assert(::IsWindow(m_hWnd));
\r
455 return TreeView_SetItemHeight( m_hWnd, cyItem );
\r
458 inline BOOL CTreeView::SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) const
\r
459 // Sets the tree-view item's application image.
\r
461 assert(::IsWindow(m_hWnd));
\r
465 tvi.iImage = nImage;
\r
466 tvi.iSelectedImage = nSelectedImage;
\r
467 tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
\r
468 return TreeView_SetItem(m_hWnd, &tvi );
\r
471 inline BOOL CTreeView::SetItemText(HTREEITEM hItem, LPCTSTR szText) const
\r
472 // Sets the tree-view item's application text.
\r
474 assert(::IsWindow(m_hWnd));
\r
478 tvi.pszText = (LPTSTR)szText;
\r
479 tvi.mask = TVIF_TEXT;
\r
480 return TreeView_SetItem(m_hWnd, &tvi );
\r
483 inline UINT CTreeView::SetScrollTime(UINT uScrollTime) const
\r
484 // Sets the maximum scroll time for the tree-view control.
\r
486 assert(::IsWindow(m_hWnd));
\r
487 return TreeView_SetScrollTime( m_hWnd, uScrollTime );
\r
490 inline COLORREF CTreeView::SetTextColor(COLORREF clrText) const
\r
491 // Sets the text color of the control.
\r
493 assert(::IsWindow(m_hWnd));
\r
494 return TreeView_SetTextColor( m_hWnd, clrText );
\r
497 inline CToolTip* CTreeView::SetToolTips(CToolTip* pToolTip) const
\r
498 // Sets a tree-view control's child ToolTip control.
\r
500 assert(::IsWindow(m_hWnd));
\r
501 HWND hToolTip = pToolTip? pToolTip->GetHwnd() : 0;
\r
502 return (CToolTip*) FromHandle( TreeView_SetToolTips( m_hWnd, hToolTip ) );
\r
507 inline HIMAGELIST CTreeView::CreateDragImage(HTREEITEM hItem) const
\r
508 // Creates a dragging bitmap for the specified item in a tree-view control.
\r
509 // It also creates an image list for the bitmap and adds the bitmap to the image list.
\r
510 // An application can display the image when dragging the item by using the image list functions.
\r
512 assert(::IsWindow(m_hWnd));
\r
513 return TreeView_CreateDragImage( m_hWnd, hItem );
\r
516 inline BOOL CTreeView::DeleteAllItems() const
\r
517 // Deletes all items from a tree-view control.
\r
519 assert(::IsWindow(m_hWnd));
\r
520 return TreeView_DeleteAllItems( m_hWnd );
\r
523 inline BOOL CTreeView::DeleteItem(HTREEITEM hItem) const
\r
524 // Removes an item and all its children from a tree-view control.
\r
526 assert(::IsWindow(m_hWnd));
\r
527 return TreeView_DeleteItem( m_hWnd, hItem );
\r
530 inline HWND CTreeView::EditLabel(HTREEITEM hItem) const
\r
531 // Begins in-place editing of the specified item's text, replacing the text of the item
\r
532 // with a single-line edit control containing the text.
\r
533 // The specified item is implicitly selected and focused.
\r
535 assert(::IsWindow(m_hWnd));
\r
536 return TreeView_EditLabel( m_hWnd, hItem );
\r
539 inline BOOL CTreeView::EndEditLabelNow(BOOL fCancel) const
\r
540 // Ends the editing of a tree-view item's label.
\r
542 assert(::IsWindow(m_hWnd));
\r
543 return TreeView_EndEditLabelNow(m_hWnd, fCancel);
\r
546 inline BOOL CTreeView::EnsureVisible(HTREEITEM hItem) const
\r
547 // Ensures that a tree-view item is visible, expanding the parent item or
\r
548 // scrolling the tree-view control, if necessary.
\r
550 assert(::IsWindow(m_hWnd));
\r
551 return TreeView_EnsureVisible( m_hWnd, hItem );
\r
554 inline BOOL CTreeView::Expand(HTREEITEM hItem, UINT nCode) const
\r
555 // The TreeView_Expand macro expands or collapses the list of child items associated
\r
556 // with the specified parent item, if any.
\r
558 assert(::IsWindow(m_hWnd));
\r
559 return TreeView_Expand( m_hWnd, hItem, nCode );
\r
562 inline HTREEITEM CTreeView::HitTest(TVHITTESTINFO& ht) const
\r
563 // Determines the location of the specified point relative to the client area of a tree-view control.
\r
565 assert(::IsWindow(m_hWnd));
\r
566 return TreeView_HitTest( m_hWnd, &ht );
\r
569 inline HTREEITEM CTreeView::InsertItem(TVINSERTSTRUCT& tvIS) const
\r
570 // Inserts a new item in a tree-view control.
\r
572 assert(::IsWindow(m_hWnd));
\r
573 return TreeView_InsertItem( m_hWnd, &tvIS );
\r
576 inline BOOL CTreeView::Select(HTREEITEM hitem, UINT flag) const
\r
577 // Selects the specified tree-view item, scrolls the item into view, or redraws
\r
578 // the item in the style used to indicate the target of a drag-and-drop operation.
\r
580 assert(::IsWindow(m_hWnd));
\r
581 return TreeView_Select(m_hWnd, hitem, flag );
\r
584 inline BOOL CTreeView::SelectDropTarget(HTREEITEM hItem) const
\r
585 // Redraws a specified tree-view control item in the style used to indicate the
\r
586 // target of a drag-and-drop operation.
\r
588 assert(::IsWindow(m_hWnd));
\r
589 return TreeView_SelectDropTarget(m_hWnd, hItem);
\r
592 inline BOOL CTreeView::SelectItem(HTREEITEM hItem) const
\r
593 // Selects the specified tree-view item.
\r
595 assert(::IsWindow(m_hWnd));
\r
596 return TreeView_SelectItem(m_hWnd, hItem);
\r
599 inline BOOL CTreeView::SelectSetFirstVisible(HTREEITEM hItem) const
\r
600 // Scrolls the tree-view control vertically to ensure that the specified item is visible.
\r
601 // If possible, the specified item becomes the first visible item at the top of the control's window.
\r
603 assert(::IsWindow(m_hWnd));
\r
604 return TreeView_SelectSetFirstVisible(m_hWnd, hItem);
\r
607 inline BOOL CTreeView::SortChildren(HTREEITEM hItem, BOOL fRecurse) const
\r
608 // Sorts the child items of the specified parent item in a tree-view control.
\r
610 assert(::IsWindow(m_hWnd));
\r
611 return TreeView_SortChildren( m_hWnd, hItem, fRecurse );
\r
614 inline BOOL CTreeView::SortChildrenCB(TVSORTCB& sort, BOOL fRecurse) const
\r
615 // Sorts tree-view items using an application-defined callback function that compares the items.
\r
617 assert(::IsWindow(m_hWnd));
\r
618 return TreeView_SortChildrenCB( m_hWnd, &sort, fRecurse );
\r
622 } // namespace Win32xx
\r
624 #endif // #ifndef _WIN32XX_TREEVIEW_H_
\r