Filter Library | Camera | Interface Physics |
#include <ProgressDlg.h>
Class CProgressDlg is used as follows.
The user may cancel the computation prematurely by pressing the Cancel-button on the progress dialog or by pressing the Esc-key. In this case the progress dialog's OnCancel() handler is called and the following happens.
Note 1: handling of the Esc-key press was not implemented in the original version.
Note 2: waiting for the worker thread was not implemented in the original version.
Class CProgressDlg uses a critical section (CCriticalSection) to guard access to the dialog text, and progress bar range and position from different threads.
For more information, see the implementation of class CScanFilterCrossCorrelate.
Definition at line 74 of file ProgressDlg.h.
Public Member Functions | |
Predicates | |
BOOL | IsResumed () |
the thread has informed us that it has been resumed. | |
BOOL | IsCanceling () |
Cancel-button or Escape-key pressed (window close message). | |
BOOL | StopRequested () |
Cancel-button or Esc-key pressed; alias for IsCanceling(). | |
Mutators | |
void | SetResumed () |
set resumed flag. | |
void | SetRange (int nLower, int nUpper) |
set progress bar range; Note just store, OnTimer updates dialog. | |
void | SetPos (int nPos) |
set progress bar position; Note just store, OnTimer updates dialog. | |
void | SetText (LPCTSTR lpcsText) |
set progress dialog message text; Note just store, OnTimer updates dialog. | |
void | Terminate () |
close the progress dialog window. | |
virtual int | DoModal (CWinThread *pTread=NULL) |
display dialog as a modal window. | |
Protected Member Functions | |
virtual void | DoDataExchange (CDataExchange *pDX) |
Dialog Data Exchange (DDX) / Dialog Data Validation (DDV) support. | |
virtual BOOL | OnInitDialog () |
initialize the dialog | |
afx_msg void | OnCancel () |
handle cancel message (button) | |
afx_msg void | OnClose () |
handle close message (button, Esc) | |
afx_msg void | OnTimer (UINT nIDEvent) |
handle timer event | |
BOOL | ResumeComputationThread (CWinThread *pThread) |
resume the given thread. | |
Protected Attributes | |
CWinThread * | m_pThread |
the computation thread | |
SECProgressCtrl | m_wndProgress |
advanced progress bar from Rogue Wave Objective Toolkit | |
volatile BOOL | m_bInitialized |
dialog is initialized flag | |
volatile BOOL | m_bCancel |
Cancel-button or Esc-key pressed flag. | |
volatile BOOL | m_bResumed |
computation thread has been resumed flag | |
CString | m_csMessage |
progress dialog message text | |
volatile int | m_nLowerPosition |
progress bar lower position | |
volatile int | m_nUpperPosition |
progress bar upper position | |
volatile int | m_nCurrentPosition |
progress bar current position | |
Private Types | |
enum | { IDD = IDD_PROGRESSDLG } |
Private Attributes | |
CCriticalSection | m_criticalSection |
critical section guard. | |
Static Private Attributes | |
static const int | c_nTimerIDEvent |
our timer event. |
void CProgressDlg::Terminate | ( | ) |
Definition at line 148 of file ProgressDlg.cpp.
References IsCanceling(), and m_bInitialized.
Referenced by CScanFilterLowPass::ComputationThreadFunction(), CScanFilterHighPass::ComputationThreadFunction(), CScanFilterFFTInverse::ComputationThreadFunction(), CScanFilterFFT::ComputationThreadFunction(), CScanFilterCrossCorrelateF::ComputationThreadFunction(), CScanFilterAutoCorrelate::ComputationThreadFunction(), CScanFilterCrossCorrelate2::SpawnComputationThread(), and CScanFilterCrossCorrelate::SpawnComputationThread().