Sync with trunk r63192.
[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 HTREEITEM
14 TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam)
15 {
16 TV_INSERTSTRUCTW Insert;
17
18 ZeroMemory(&Insert, sizeof(TV_INSERTSTRUCT));
19
20 Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
21 Insert.hInsertAfter = TVI_LAST;
22 Insert.hParent = hParent;
23 Insert.item.iSelectedImage = SelectedImage;
24 Insert.item.iImage = Image;
25 Insert.item.lParam = lParam;
26 Insert.item.pszText = lpText;
27
28 return TreeView_InsertItem(hTreeView, &Insert);
29 }
30
31 BOOL
32 CreateTreeView(HWND hwnd)
33 {
34 hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
35 WC_TREEVIEWW,
36 L"",
37 WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_SHOWSELALWAYS,
38 0, 28, 200, 350,
39 hwnd,
40 NULL,
41 hInst,
42 NULL);
43
44 if (!hListView)
45 {
46 /* TODO: Show error message */
47 return FALSE;
48 }
49
50 SetFocus(hTreeView);
51
52 return TRUE;
53 }