blob: 81cd882ede22bb84c198c25142fac895ecb62463 [file] [log] [blame]
Dennis Syrovatsky32ed3322005-12-15 09:37:38 +00001/* Copyright (C) 2005 TightVNC Team. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 *
18 * TightVNC distribution homepage on the Web: http://www.tightvnc.com/
19 *
20 */
21
22// -=- FTBrpwseDlg.cxx
23
24#include <vncviewer/FTBrowseDlg.h>
25
26using namespace rfb;
27using namespace rfb::win32;
28
29FTBrowseDlg::FTBrowseDlg(FTDialog *pFTDlg)
30{
Dennis Syrovatsky04e05c32005-12-15 09:51:03 +000031 m_pFTDlg = pFTDlg;
32 m_hwndDlg = NULL;
Dennis Syrovatsky32ed3322005-12-15 09:37:38 +000033}
34
35FTBrowseDlg::~FTBrowseDlg()
36{
Dennis Syrovatsky04e05c32005-12-15 09:51:03 +000037 destroy();
38}
Dennis Syrovatsky32ed3322005-12-15 09:37:38 +000039
Dennis Syrovatsky04e05c32005-12-15 09:51:03 +000040bool
41FTBrowseDlg::create()
42{
43 m_hwndDlg = CreateDialogParam(GetModuleHandle(0), MAKEINTRESOURCE(IDD_FTBROWSE),
44 m_pFTDlg->getWndHandle(), (DLGPROC) FTBrowseDlgProc,
45 (LONG) this);
46
47 if (m_hwndDlg == NULL) return false;
48
49 ShowWindow(m_hwndDlg, SW_SHOW);
50 UpdateWindow(m_hwndDlg);
51
52 return true;
53}
54
55void
56FTBrowseDlg::destroy()
57{
58 EndDialog(m_hwndDlg, 0);
Dennis Syrovatsky32ed3322005-12-15 09:37:38 +000059}
Dennis Syrovatsky2eee1c72005-12-15 09:43:34 +000060
Dennis Syrovatskyb0b72472005-12-15 10:02:16 +000061void
62FTBrowseDlg::addItems(FileInfo *pFI)
63{
64 TVITEM tvi;
65 TVINSERTSTRUCT tvins;
66
67 for (unsigned int i = 0; i < pFI->getNumEntries(); i++)
68 {
69 tvi.mask = TVIF_TEXT;
70 tvi.pszText = pFI->getNameAt(i);;
71 tvins.hParent = NULL;
72 tvins.item = tvi;
73 tvins.hParent = TreeView_InsertItem(GetDlgItem(m_hwndDlg, IDC_FTBROWSETREE), &tvins);
74 TreeView_InsertItem(GetDlgItem(m_hwndDlg, IDC_FTBROWSETREE), &tvins);
75 }
76}
77
Dennis Syrovatsky2eee1c72005-12-15 09:43:34 +000078BOOL CALLBACK
79FTBrowseDlg::FTBrowseDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
80{
81 FTBrowseDlg *_this = (FTBrowseDlg *) GetWindowLong(hwnd, GWL_USERDATA);
82 switch (uMsg)
83 {
84 case WM_INITDIALOG:
85 {
86 SetWindowLong(hwnd, GWL_USERDATA, lParam);
87 return FALSE;
88 }
89 break;
90 case WM_COMMAND:
91 {
92 switch (LOWORD(wParam))
93 {
94 case IDOK:
95 return FALSE;
96 case IDCANCEL:
97 return FALSE;
98 }
99 }
100 break;
101 case WM_NOTIFY:
102 switch (LOWORD(wParam))
103 {
104 case IDC_FTBROWSETREE:
105 switch (((LPNMHDR) lParam)->code)
106 {
107 case TVN_SELCHANGED:
108 return FALSE;
109 case TVN_ITEMEXPANDING:
110 return FALSE;
111 }
112 break;
113 }
114 break;
115 case WM_CLOSE:
116 case WM_DESTROY:
117 return FALSE;
118 }
119 return 0;
120}