diff options
author | Stef Walter <stef@thewalter.net> | 2003-09-20 07:12:49 +0000 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2003-09-20 07:12:49 +0000 |
commit | b49d8ebefe9b10c53a6a09ad564e22111b7b25c6 (patch) | |
tree | 1d5dd4abc38170a7bc106dabbc59b915017222f0 /win32/droplet/progressdlg.h | |
parent | 1cda9ebbd62916c7c2136722597a86c583e1ecf6 (diff) |
Initial Import
Diffstat (limited to 'win32/droplet/progressdlg.h')
-rw-r--r-- | win32/droplet/progressdlg.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/win32/droplet/progressdlg.h b/win32/droplet/progressdlg.h new file mode 100644 index 0000000..1e416a1 --- /dev/null +++ b/win32/droplet/progressdlg.h @@ -0,0 +1,92 @@ +/* + * AUTHOR + * N. Nielsen + * + * LICENSE + * This software is in the public domain. + * + * The software is provided "as is", without warranty of any kind, + * express or implied, including but not limited to the warranties + * of merchantability, fitness for a particular purpose, and + * noninfringement. In no event shall the author(s) be liable for any + * claim, damages, or other liability, whether in an action of + * contract, tort, or otherwise, arising from, out of, or in connection + * with the software or the use or other dealings in the software. + * + * SUPPORT + * Send bug reports to: <nielsen@memberwebs.com> + */ + +#ifndef __PROGRESSDLG_H_ +#define __PROGRESSDLG_H_ + +#include "resource.h" // main symbols +#include <atlhost.h> + +// ProgressDlg: -------------------------------------------------------- +// The status dialog which is run in another thread + +class ProgressDlg : + public CDialogImpl<ProgressDlg> +{ +public: + ProgressDlg(); + ~ProgressDlg(); + + enum { IDD = IDD_PROGRESSDLG }; + +BEGIN_MSG_MAP(ProgressDlg) + MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog) + MESSAGE_HANDLER(WM_CLOSE, onClose) + COMMAND_ID_HANDLER(IDCANCEL, onCancel) +END_MSG_MAP() + +public: + // Start dialog in another thread + HRESULT startDialog(); + + // Stop the dialog thread + int stopDialog(); + + // Called when a replacement is noted + void onReplaced(); + + // Called (by Replace::replaceSingleFile) when starting + // to process new file + void onNewFile(LPCTSTR fileName); + + // Polled (by Replace::matchStatus) to check if user cancelled + bool isCancelled(); + + // Set the dialog title + void setTitle(const string& title); + +protected: + // Update status etc... + void updateControls(); + +// The message handlers +protected: + LRESULT onInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT onClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT onCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + + // Handler prototypes: + // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + +protected: + HANDLE m_hThread; // The dialog thread + string m_title; // The dialog title + + HANDLE m_hEvent; // dialog initialization event + CRITICAL_SECTION m_sec; // Used for syncing access to date below + + bool m_isCancelled; // Set when user clicks cancel + uint m_numFiles; // Number of files processed + uint m_numReplaces; // Number of replaces seen + bool m_flip; // Used for flicker display +}; + +#endif //__PROGRESSDLG_H_ |