blob: 82e7536776f7c054635c3ec74c60d228a08f9386 [file] [log] [blame]
Dennis Syrovatsky139d7832005-11-02 05:36:05 +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// -=- FTDialog.h
23
24#ifndef __RFB_WIN32_FTDIALOG_H__
25#define __RFB_WIN32_FTDIALOG_H__
26
27#include <windows.h>
28#include <commctrl.h>
29
30#include <rfb/FileInfo.h>
Dennis Syrovatsky4ab41852005-11-07 09:52:36 +000031#include <vncviewer/FileTransfer.h>
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000032#include <vncviewer/FTListView.h>
33#include <vncviewer/FTProgress.h>
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000034#include <vncviewer/resource.h>
35
36namespace rfb {
37 namespace win32 {
Dennis Syrovatsky4ab41852005-11-07 09:52:36 +000038 class FileTransfer;
39
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000040 class FTDialog
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000041 {
42 public:
43 FTDialog(HINSTANCE hInst, FileTransfer *pFT);
44 ~FTDialog();
45
Dennis Syrovatsky4905c8f2005-11-21 15:52:46 +000046 bool createFTDialog(HWND hwndParent);
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +000047 bool closeFTDialog();
48 void destroyFTDialog();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000049
50 static BOOL CALLBACK FTDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
51
Dennis Syrovatskyd6febeb2005-11-10 04:27:49 +000052 void addRemoteLVItems(FileInfo *pFI);
Dennis Syrovatsky8b194ee2005-11-10 08:56:34 +000053 void reqFolderUnavailable();
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000054
Dennis Syrovatskyc4ed9b72005-11-28 07:10:27 +000055 void setStatusText(LPCSTR format,...);
56
57 HWND getWndHandle() { return m_hwndFTDialog; }
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000058
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +000059 void postCheckTransferQueueMsg();
60 void postUploadFilePortionMsg();
61 void postDownloadFilePortionMsg();
62
Dennis Syrovatsky6806fec2005-11-28 06:12:44 +000063 FTProgress *m_pProgress;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000064
65 private:
66 FileTransfer *m_pFileTransfer;
67
68 HWND m_hwndFTDialog;
Dennis Syrovatskyb595e032005-11-09 06:24:25 +000069 HWND m_hwndLocalPath;
70 HWND m_hwndRemotePath;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000071 HINSTANCE m_hInstance;
72
Dennis Syrovatsky8b194ee2005-11-10 08:56:34 +000073 void showLocalLVItems();
74 void showRemoteLVItems();
75
Dennis Syrovatsky139d7832005-11-02 05:36:05 +000076 void onLocalItemActivate(LPNMITEMACTIVATE lpnmia);
77 void onRemoteItemActivate(LPNMITEMACTIVATE lpnmia);
78
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +000079 void onLocalReload();
80 void onRemoteReload();
81
Dennis Syrovatsky3f079e72005-11-23 05:23:50 +000082 void onLocalRButton();
83 void onRemoteRButton();
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +000084 void showFTMenu(bool copyBtnState, bool createFldBtnState,
85 bool renameBtnState, bool deleteBtnState,
86 bool cancelBtnState);
87 void onFTMenuCommand(int command);
Dennis Syrovatsky3f079e72005-11-23 05:23:50 +000088
Dennis Syrovatskyabc2cc52005-11-23 03:52:07 +000089 void onUpload();
90 void onDownload();
91
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +000092 void onLocalRename();
93 void onRemoteRename();
94
95 void onLocalDelete();
96 void onRemoteDelete();
97
98 void onFTCancel();
99
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +0000100 void setIcon(int dest, int idIcon);
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000101 bool initFTDialog();
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000102 bool initFTWndMsgs();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000103
Dennis Syrovatskyb595e032005-11-09 06:24:25 +0000104 void onLocalOneUpFolder();
105 void onRemoteOneUpFolder();
Dennis Syrovatsky0b765cc2005-11-10 04:52:10 +0000106 int makeOneUpFolder(char *pPath);
Dennis Syrovatskyabc2cc52005-11-23 03:52:07 +0000107
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000108 void refreshBtnState();
109 void setButtonsState();
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000110
111 bool m_bDlgShown;
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +0000112
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000113 UINT m_msgCheckTransferQueue;
114 UINT m_msgUploadFilePortion;
115 UINT m_msgDownloadFilePortion;
116
Dennis Syrovatsky6c6786d2005-11-07 09:17:38 +0000117 FTListView *m_pLocalLV;
118 FTListView *m_pRemoteLV;
119
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000120 int m_FTMenuSource;
121
Dennis Syrovatskyd6febeb2005-11-10 04:27:49 +0000122 char m_szLocalPath[FT_FILENAME_SIZE];
123 char m_szRemotePath[FT_FILENAME_SIZE];
124 char m_szLocalPathTmp[FT_FILENAME_SIZE];
125 char m_szRemotePathTmp[FT_FILENAME_SIZE];
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000126
Dennis Syrovatsky13b4d4c2005-11-28 08:14:18 +0000127 static const char szCheckTransferQueueText[];
128 static const char szUploadFilePortionText[];
129 static const char szDownloadFilePortionText[];
130
Dennis Syrovatskybe4956b2005-11-23 09:15:12 +0000131 typedef struct tagFTBUTTONSSTATE
132 {
133 bool uploadBtn;
134 bool downloadBtn;
135 bool createLocalFldBtn;
136 bool createRemoteFldBtn;
137 bool renameLocalBtn;
138 bool renameRemoteBtn;
139 bool deleteLocalBtn;
140 bool deleteRemoteBtn;
141 bool cancelBtn;
142 } FTBUTTONSSTATE;
143
144 FTBUTTONSSTATE m_BtnState;
Dennis Syrovatsky139d7832005-11-02 05:36:05 +0000145 };
146 }
147}
148
149#endif // __RFB_WIN32_FTDIALOG_H__