Merge branch 'master' of git.ucc.asn.au:/matches/honours
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / include / treeview.h
1 // Win32++   Version 7.3\r
2 // Released: 30th November 2011\r
3 //\r
4 //      David Nash\r
5 //      email: [email protected]\r
6 //      url: https://sourceforge.net/projects/win32-framework\r
7 //\r
8 //\r
9 // Copyright (c) 2005-2011  David Nash\r
10 //\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
20 //\r
21 // The above copyright notice and this permission notice\r
22 // shall be included in all copies or substantial portions\r
23 // of the Software.\r
24 //\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
34 //\r
35 ////////////////////////////////////////////////////////\r
36 \r
37 \r
38 \r
39 \r
40 #ifndef _WIN32XX_TREEVIEW_H_\r
41 #define _WIN32XX_TREEVIEW_H_\r
42 \r
43 #include "wincore.h"\r
44 #include "commctrl.h"\r
45 \r
46 // Disable macros from Windowsx.h\r
47 #undef GetNextSibling\r
48 #undef GetPrevSibling\r
49 \r
50 namespace Win32xx\r
51 {\r
52 \r
53         class CTreeView : public CWnd\r
54         {\r
55         public:\r
56                 CTreeView() {}\r
57                 virtual ~CTreeView() {}\r
58                 virtual void PreRegisterClass(WNDCLASS &wc);\r
59 \r
60 // Attributes\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
104 \r
105 // Operations\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
121 \r
122         private:\r
123                 CTreeView(const CTreeView&);                            // Disable copy construction\r
124                 CTreeView& operator = (const CTreeView&); // Disable assignment operator\r
125 \r
126         };\r
127         \r
128 }\r
129 \r
130 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
131 \r
132 namespace Win32xx\r
133 {\r
134 \r
135         inline void CTreeView::PreRegisterClass(WNDCLASS &wc)\r
136         {\r
137                 // Set the Window Class\r
138                 wc.lpszClassName =  WC_TREEVIEW;\r
139         }\r
140 \r
141 // Attributes\r
142         inline COLORREF CTreeView::GetBkColor() const\r
143         // Retrieves the current background color of the control.\r
144         {\r
145                 assert(::IsWindow(m_hWnd));\r
146                 return TreeView_GetBkColor( m_hWnd );\r
147         }\r
148 \r
149         inline HTREEITEM CTreeView::GetChild(HTREEITEM hItem) const\r
150         // Retrieves the first child item of the specified tree-view item.\r
151         {\r
152                 assert(::IsWindow(m_hWnd));\r
153                 return TreeView_GetChild(m_hWnd, hItem);\r
154         }\r
155 \r
156         inline UINT CTreeView::GetCount() const\r
157         // Retrieves a count of the items in a tree-view control.\r
158         {\r
159                 assert(::IsWindow(m_hWnd));\r
160                 return TreeView_GetCount( m_hWnd );\r
161         }\r
162 \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
165         {\r
166                 assert(::IsWindow(m_hWnd));\r
167                 return TreeView_GetDropHilight(m_hWnd);\r
168         }\r
169 \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
172         {\r
173                 assert(::IsWindow(m_hWnd));\r
174                 return (CEdit*)FromHandle(TreeView_GetEditControl(m_hWnd));\r
175         }\r
176 \r
177         inline HTREEITEM CTreeView::GetFirstVisible() const\r
178         // Retrieves the first visible item in a tree-view control window.\r
179         {\r
180                 assert(::IsWindow(m_hWnd));\r
181                 return TreeView_GetFirstVisible(m_hWnd);\r
182         }\r
183 \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
186         {\r
187                 assert(::IsWindow(m_hWnd));\r
188                 return TreeView_GetImageList( m_hWnd, iImageType );\r
189         }\r
190 \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
193         {\r
194                 assert(::IsWindow(m_hWnd));\r
195                 return TreeView_GetIndent( m_hWnd );\r
196         }\r
197 \r
198         inline COLORREF CTreeView::GetInsertMarkColor() const\r
199         // Retrieves the color used to draw the insertion mark for the tree view.\r
200         {\r
201                 assert(::IsWindow(m_hWnd));\r
202                 return TreeView_GetInsertMarkColor( m_hWnd );\r
203         }\r
204 \r
205         inline BOOL CTreeView::GetItem(TVITEM& Item) const\r
206         // Retrieves some or all of a tree-view item's attributes.\r
207         {\r
208                 assert(::IsWindow(m_hWnd));\r
209                 return TreeView_GetItem( m_hWnd, &Item );\r
210         }\r
211 \r
212         inline DWORD_PTR CTreeView::GetItemData(HTREEITEM hItem) const\r
213         // Retrieves a tree-view item's application data.\r
214         {\r
215                 assert(::IsWindow(m_hWnd));\r
216 \r
217                 TVITEM tvi = {0};\r
218                 tvi.mask = TVIF_PARAM;\r
219                 tvi.hItem = hItem;\r
220                 TreeView_GetItem( m_hWnd, &tvi );\r
221                 return tvi.lParam;\r
222         }\r
223 \r
224         inline int  CTreeView::GetItemHeight() const\r
225         // Retrieves the current height of the tree-view item.\r
226         {\r
227                 assert(::IsWindow(m_hWnd));\r
228                 return TreeView_GetItemHeight( m_hWnd );\r
229         }\r
230 \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
233         {\r
234                 assert(::IsWindow(m_hWnd));\r
235 \r
236                 TVITEM tvi = {0};\r
237                 tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;\r
238                 tvi.hItem = hItem;\r
239                 BOOL bResult = TreeView_GetItem( m_hWnd, &tvi );\r
240                 nImage = tvi.iImage;\r
241                 nSelectedImage = tvi.iSelectedImage;\r
242                 return bResult;\r
243         }\r
244 \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
247         {\r
248                 assert(::IsWindow(m_hWnd));\r
249                 return TreeView_GetItemRect( m_hWnd, hItem, &rc, bTextOnly );\r
250         }\r
251 \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
256         {\r
257                 assert(::IsWindow(m_hWnd));\r
258 \r
259                 CString t;\r
260                 if (nTextMax > 0)\r
261                 {\r
262                         TVITEM tvi = {0};\r
263                         tvi.hItem = hItem;\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
270                         t = tvi.pszText;\r
271                 }\r
272                 return t;\r
273         }\r
274 \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
278         {\r
279                 assert(::IsWindow(m_hWnd));\r
280                 return TreeView_GetLastVisible(m_hWnd);\r
281         }\r
282 \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
285         {\r
286                 assert(::IsWindow(m_hWnd));\r
287                 return TreeView_GetNextItem( m_hWnd, hItem, nCode);\r
288         }\r
289 \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
292         {\r
293                 assert(::IsWindow(m_hWnd));\r
294                 return TreeView_GetNextSibling(m_hWnd, hItem);\r
295         }\r
296 \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
299         {\r
300                 assert(::IsWindow(m_hWnd));\r
301                 return TreeView_GetNextVisible(m_hWnd, hItem);\r
302         }\r
303 \r
304         inline HTREEITEM CTreeView::GetParentItem(HTREEITEM hItem) const\r
305         // Retrieves the parent item of the specified tree-view item.\r
306         {\r
307                 assert(::IsWindow(m_hWnd));\r
308                 return TreeView_GetParent(m_hWnd, hItem);\r
309         }\r
310 \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
313         {\r
314                 assert(::IsWindow(m_hWnd));\r
315                 return TreeView_GetPrevSibling(m_hWnd, hItem);\r
316         }\r
317 \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
320         {\r
321                 assert(::IsWindow(m_hWnd));\r
322                 return TreeView_GetPrevVisible(m_hWnd, hItem);\r
323         }\r
324 \r
325         inline HTREEITEM CTreeView::GetRootItem() const\r
326         // Retrieves the topmost or very first item of the tree-view control.\r
327         {\r
328                 assert(::IsWindow(m_hWnd));\r
329                 return TreeView_GetRoot(m_hWnd);\r
330         }\r
331 \r
332         inline int CTreeView::GetScrollTime() const\r
333         // Retrieves the maximum scroll time for the tree-view control.\r
334         {\r
335                 assert(::IsWindow(m_hWnd));\r
336                 return TreeView_GetScrollTime( m_hWnd );\r
337         }\r
338 \r
339         inline HTREEITEM CTreeView::GetSelection() const\r
340         // Retrieves the currently selected item in a tree-view control.\r
341         {\r
342                 assert(::IsWindow(m_hWnd));\r
343                 return TreeView_GetSelection(m_hWnd);\r
344         }\r
345 \r
346         inline COLORREF CTreeView::GetTextColor() const\r
347         // Retrieves the current text color of the control.\r
348         {\r
349                 assert(::IsWindow(m_hWnd));\r
350                 return TreeView_GetTextColor( m_hWnd );\r
351         }\r
352 \r
353         inline CToolTip* CTreeView::GetToolTips() const\r
354         // Retrieves the handle to the child ToolTip control used by a tree-view control.\r
355         {\r
356                 assert(::IsWindow(m_hWnd));\r
357                 return (CToolTip*) FromHandle( TreeView_GetToolTips( m_hWnd ) );\r
358         }\r
359 \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
362         {\r
363                 assert(::IsWindow(m_hWnd));\r
364                 return TreeView_GetVisibleCount( m_hWnd );\r
365         }\r
366 \r
367         inline BOOL CTreeView::ItemHasChildren(HTREEITEM hItem) const\r
368         // Returns true of the tree-view item has one or more children\r
369         {\r
370                 assert(::IsWindow(m_hWnd));\r
371 \r
372                 if (TreeView_GetChild( m_hWnd, hItem ))\r
373                         return TRUE;\r
374 \r
375                 return FALSE;\r
376         }\r
377 \r
378         inline COLORREF CTreeView::SetBkColor(COLORREF clrBk) const\r
379         // Sets the background color of the control.\r
380         {\r
381                 assert(::IsWindow(m_hWnd));\r
382                 return TreeView_SetBkColor( m_hWnd, clrBk );\r
383         }\r
384 \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
388         {\r
389                 assert(::IsWindow(m_hWnd));\r
390                 return TreeView_SetImageList( m_hWnd, himl, nType );\r
391         }\r
392 \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
396         {\r
397                 assert(::IsWindow(m_hWnd));\r
398                 TreeView_SetIndent( m_hWnd, indent );\r
399         }\r
400 \r
401         inline BOOL CTreeView::SetInsertMark(HTREEITEM hItem, BOOL fAfter/* = TRUE*/) const\r
402         // Sets the insertion mark in a tree-view control.\r
403         {\r
404                 assert(::IsWindow(m_hWnd));\r
405                 return TreeView_SetInsertMark( m_hWnd, hItem, fAfter );\r
406         }\r
407 \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
410         {\r
411                 assert(::IsWindow(m_hWnd));\r
412                 return TreeView_SetInsertMarkColor( m_hWnd, clrInsertMark );\r
413         }\r
414 \r
415         inline BOOL CTreeView::SetItem(TVITEM& Item) const\r
416         // Sets some or all of a tree-view item's attributes.\r
417         {\r
418                 assert(::IsWindow(m_hWnd));\r
419                 return TreeView_SetItem( m_hWnd, &Item );\r
420         }\r
421 \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
424         {\r
425                 assert(::IsWindow(m_hWnd));\r
426 \r
427                 TVITEM tvi = {0};\r
428                 tvi.hItem = hItem;\r
429                 tvi.mask  = nMask;\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
437         }\r
438 \r
439         inline BOOL CTreeView::SetItemData(HTREEITEM hItem, DWORD_PTR dwData) const\r
440         // Sets the tree-view item's application data.\r
441         {\r
442                 assert(::IsWindow(m_hWnd));\r
443 \r
444                 TVITEM tvi = {0};\r
445                 tvi.hItem = hItem;\r
446                 tvi.mask = TVIF_PARAM;\r
447                 tvi.lParam = dwData;\r
448                 return TreeView_SetItem( m_hWnd, &tvi );\r
449         }\r
450 \r
451         inline int  CTreeView::SetItemHeight(SHORT cyItem) const\r
452         // Sets the height of the tree-view items.\r
453         {\r
454                 assert(::IsWindow(m_hWnd));\r
455                 return TreeView_SetItemHeight( m_hWnd, cyItem );\r
456         }\r
457 \r
458         inline BOOL CTreeView::SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) const\r
459         // Sets the tree-view item's application image.\r
460         {\r
461                 assert(::IsWindow(m_hWnd));\r
462 \r
463                 TVITEM tvi = {0};\r
464                 tvi.hItem = hItem;\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
469         }\r
470 \r
471         inline BOOL CTreeView::SetItemText(HTREEITEM hItem, LPCTSTR szText) const\r
472         // Sets the tree-view item's application text.\r
473         {\r
474                 assert(::IsWindow(m_hWnd));\r
475 \r
476                 TVITEM tvi = {0};\r
477                 tvi.hItem = hItem;\r
478                 tvi.pszText = (LPTSTR)szText;\r
479                 tvi.mask = TVIF_TEXT;\r
480                 return TreeView_SetItem(m_hWnd, &tvi );\r
481         }\r
482 \r
483         inline UINT CTreeView::SetScrollTime(UINT uScrollTime) const\r
484         // Sets the maximum scroll time for the tree-view control.\r
485         {\r
486                 assert(::IsWindow(m_hWnd));\r
487                 return TreeView_SetScrollTime( m_hWnd, uScrollTime );\r
488         }\r
489 \r
490         inline COLORREF CTreeView::SetTextColor(COLORREF clrText) const\r
491         // Sets the text color of the control.\r
492         {\r
493                 assert(::IsWindow(m_hWnd));\r
494                 return TreeView_SetTextColor( m_hWnd, clrText );\r
495         }\r
496 \r
497         inline CToolTip* CTreeView::SetToolTips(CToolTip* pToolTip) const\r
498         // Sets a tree-view control's child ToolTip control.\r
499         {\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
503         }\r
504 \r
505         // Operations\r
506 \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
511         {\r
512                 assert(::IsWindow(m_hWnd));\r
513                 return TreeView_CreateDragImage( m_hWnd, hItem );\r
514         }\r
515 \r
516         inline BOOL CTreeView::DeleteAllItems() const\r
517         // Deletes all items from a tree-view control.\r
518         {\r
519                 assert(::IsWindow(m_hWnd));\r
520                 return TreeView_DeleteAllItems( m_hWnd );\r
521         }\r
522 \r
523         inline BOOL CTreeView::DeleteItem(HTREEITEM hItem) const\r
524         // Removes an item and all its children from a tree-view control.\r
525         {\r
526                 assert(::IsWindow(m_hWnd));\r
527                 return TreeView_DeleteItem( m_hWnd, hItem );\r
528         }\r
529 \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
534         {\r
535                 assert(::IsWindow(m_hWnd));\r
536                 return TreeView_EditLabel( m_hWnd, hItem );\r
537         }\r
538 \r
539         inline BOOL CTreeView::EndEditLabelNow(BOOL fCancel) const\r
540         // Ends the editing of a tree-view item's label.\r
541         {\r
542                 assert(::IsWindow(m_hWnd));\r
543                 return TreeView_EndEditLabelNow(m_hWnd, fCancel);\r
544         }\r
545 \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
549         {\r
550                 assert(::IsWindow(m_hWnd));\r
551                 return TreeView_EnsureVisible( m_hWnd, hItem );\r
552         }\r
553 \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
557         {\r
558                 assert(::IsWindow(m_hWnd));\r
559                 return TreeView_Expand( m_hWnd, hItem, nCode );\r
560         }\r
561 \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
564         {\r
565                 assert(::IsWindow(m_hWnd));\r
566                 return TreeView_HitTest( m_hWnd, &ht );\r
567         }\r
568 \r
569         inline HTREEITEM CTreeView::InsertItem(TVINSERTSTRUCT& tvIS) const\r
570         // Inserts a new item in a tree-view control.\r
571         {\r
572                 assert(::IsWindow(m_hWnd));\r
573                 return TreeView_InsertItem( m_hWnd, &tvIS );\r
574         }\r
575 \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
579         {\r
580                 assert(::IsWindow(m_hWnd));\r
581                 return TreeView_Select(m_hWnd, hitem, flag );\r
582         }\r
583 \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
587         {\r
588                 assert(::IsWindow(m_hWnd));\r
589                 return TreeView_SelectDropTarget(m_hWnd, hItem);\r
590         }\r
591 \r
592         inline BOOL CTreeView::SelectItem(HTREEITEM hItem) const\r
593         // Selects the specified tree-view item.\r
594         {\r
595                 assert(::IsWindow(m_hWnd));\r
596                 return TreeView_SelectItem(m_hWnd, hItem);\r
597         }\r
598 \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
602         {\r
603                 assert(::IsWindow(m_hWnd));\r
604                 return TreeView_SelectSetFirstVisible(m_hWnd, hItem);\r
605         }\r
606 \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
609         {\r
610                 assert(::IsWindow(m_hWnd));\r
611                 return TreeView_SortChildren( m_hWnd, hItem, fRecurse );\r
612         }\r
613 \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
616         {\r
617                 assert(::IsWindow(m_hWnd));\r
618                 return TreeView_SortChildrenCB( m_hWnd, &sort, fRecurse );\r
619         }\r
620 \r
621 \r
622 } // namespace Win32xx\r
623 \r
624 #endif // #ifndef _WIN32XX_TREEVIEW_H_\r
625 \r

UCC git Repository :: git.ucc.asn.au