- Sync with trunk up to r46941.
[reactos.git] / base / applications / rapps / treeview.c
1 /*
2 * PROJECT: ReactOS Applications Manager
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/rapps/treeview.c
5 * PURPOSE: TreeView functions
6 * PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
7 */
8
9 #include "rapps.h"
10
11 HWND hTreeView;
12
13
14 HTREEITEM
15 TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam)
16 {
17 TV_INSERTSTRUCTW Insert;
18
19 ZeroMemory(&Insert, sizeof(TV_INSERTSTRUCT));
20
21 Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
22 Insert.hInsertAfter = TVI_LAST;
23 Insert.hParent = hParent;
24 Insert.item.iSelectedImage = SelectedImage;
25 Insert.item.iImage = Image;
26 Insert.item.lParam = lParam;
27 Insert.item.pszText = lpText;
28
29 return TreeView_InsertItem(hTreeView, &Insert);
30 }
31
32 BOOL
33 CreateTreeView(HWND hwnd)
34 {
35 hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
36 WC_TREEVIEWW,
37 L"",
38 WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_SHOWSELALWAYS,
39 0, 28, 200, 350,
40 hwnd,
41 NULL,
42 hInst,
43 NULL);
44
45 if (!hListView)
46 {
47 /* TODO: Show error message */
48 return FALSE;
49 }
50
51 SetFocus(hTreeView);
52
53 return TRUE;
54 }