xref: /haiku/src/add-ons/media/plugins/ape_reader/MAClib/MACProgressHelper.h (revision 91054f1d38dd7827c0f0ba9490c213775ec7b471)
1 #ifndef APE_MACPROGRESSHELPER_H
2 #define APE_MACPROGRESSHELPER_H
3 
4 #define KILL_FLAG_CONTINUE          0
5 #define KILL_FLAG_PAUSE             -1
6 #define KILL_FLAG_STOP              1
7 
8 #include "NoWindows.h"
9 #include "MACLib.h"
10 
11 //typedef void ( * APE_PROGRESS_CALLBACK) (int);
12 
13 class CMACProgressHelper
14 {
15 public:
16 
17     CMACProgressHelper(int nTotalSteps, int *pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int *pKillFlag);
18     virtual ~CMACProgressHelper();
19 
20     void UpdateProgress(int nCurrentStep = -1, BOOL bForceUpdate = FALSE);
21     void UpdateProgressComplete() { UpdateProgress(m_nTotalSteps, TRUE); }
22 
23     int ProcessKillFlag(BOOL bSleep = TRUE);
24 
25 private:
26 
27     BOOL                    m_bUseCallback;
28     APE_PROGRESS_CALLBACK    m_CallbackFunction;
29 
30     int                        *m_pPercentageDone;
31 
32     int                        m_nTotalSteps;
33     int                        m_nCurrentStep;
34     int                        m_nLastCallbackFiredPercentageDone;
35 
36     int                        *m_pKillFlag;
37 };
38 
39 #endif // #ifndef APE_MACPROGRESSHELPER_H
40 
41