home *** CD-ROM | disk | FTP | other *** search
- #pragma once
- /*
- File: LProgessIndicator.h
-
- Contains: Abstract base class for the display of progress
- to the user.
-
- Version: 2.1
-
- Author: Chris K. Thomas, ckt@best.com
-
- Copyright: ©1995 Chris K. Thomas. All Rights Reserved.
- */
-
- #include "PP_Types.h"
-
- enum ETaskType
- {
- task_Measured, //we know the end max value for the task for which
- //we are indicating status.
-
- task_Indeterminate //we don't know the max value
- };
-
- class LProgressIndicator
- {
-
- protected:
- ETaskType mTaskType;
- SInt32 mMinValue, mMaxValue; // * start and end value
- SInt32 mCurValue; // * current value
-
- public:
-
- //
- // * instance
- //
- LProgressIndicator();
- LProgressIndicator(ETaskType inTaskType, SInt32 inMin, SInt32 inMax, SInt32 inValue);
- virtual ~LProgressIndicator();
-
- //
- // * incrementing
- //
- void CompletedThisMuchMore(SInt32 inThisMuch);// * relative to current value
- void CompletedThisMuch(SInt32); // * absolute - replaces current value
- virtual void ValueChanged(); // * subclasses override this one;
- // it's called when the curValue changes.
-
- //
- // * accessors
- //
- inline void SetValues(SInt32 inMin, SInt32 inMax, SInt32 inValue);
- inline void SetCurrentValue(SInt32 inCurValue); // equivalent to CompletedThisMuch()
- inline void SetMinValue(SInt32 inMinValue);
- inline void SetMaxValue(SInt32 inMaxValue);
-
- inline SInt32 GetCurrentValue();
- inline SInt32 GetMinValue();
- inline SInt32 GetMaxValue();
-
- inline virtual void SetTaskType(ETaskType inType);
- inline virtual ETaskType GetTaskType();
-
- friend class LProgressIndicatorProxy;
- };
-
-
- inline void
- LProgressIndicator::SetValues(SInt32 inMin, SInt32 inMax, SInt32 inValue)
- {
- mMinValue = inMin;
- mMaxValue = inMax;
- mCurValue = inValue;
-
- //
- // CompletedThisMuch calls ValueChanged, but we also need
- // to call it when only the min and max have changed
- //
-
- if(inValue != mCurValue)
- CompletedThisMuch(inValue);
- else
- ValueChanged();
- }
-
- inline void
- LProgressIndicator::SetCurrentValue(SInt32 inCurValue)
- {
- if(inCurValue != mCurValue)
- CompletedThisMuch(inCurValue);
- }
-
- inline void
- LProgressIndicator::SetMinValue(SInt32 inMinValue)
- {
- if(mMinValue != inMinValue)
- {
- mMinValue = inMinValue;
- ValueChanged();
- }
- }
-
- inline void
- LProgressIndicator::SetMaxValue(SInt32 inMaxValue)
- {
- if(mMaxValue != inMaxValue)
- {
- mMaxValue = inMaxValue;
- ValueChanged();
- }
- }
-
- inline void
- LProgressIndicator::SetTaskType(ETaskType inType)
- {
- mTaskType = inType;
- }
-
- inline SInt32
- LProgressIndicator::GetCurrentValue()
- {
- return mCurValue;
- }
-
- inline SInt32
- LProgressIndicator::GetMinValue()
- {
- return mMinValue;
- }
-
- inline SInt32
- LProgressIndicator::GetMaxValue()
- {
- return mMaxValue;
- }
-
- inline ETaskType
- LProgressIndicator::GetTaskType()
- {
- return mTaskType;
- }
-
-