/****************************************************************************************************

		ProgressHelper.h
		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Jeremy
		Date:	11/15/2004

****************************************************************************************************/

#ifndef __ProgressHelper__
#define __ProgressHelper__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCountedPtr.h"

class TMCString;

/// \addtogroup Utilities
/// \{
///
/// Helper object to manage a progress bar.  When the object is created, it starts a new 
/// progress bar.  When destroyed, it does an EndProgress on the bar.  Its member functions
/// simply pass on their parameters to the shell utility functions of the same name.
///
/// The advantage to using a TProgressBarHelper instead of directly calling the shell utilities
/// is that with the helper object, you can simply create it on the stack, and be assured 
/// that it will be destroyed and the progress bar finished when needed, without having to 
/// worry about try/catch statements around every place where a user abort might be encountered.
///
class TProgressBarHelper 
{
public:

	// ****************************************************************************
	//								TProgressBarHelper
	// 
	/// Constructor for the TProgressBarHelper.  Starts a new progress bar.
	/// 
	/// \param inPrompt    Title to associate with the progress bar
	/// \param inMaxValue  Maximum value for the progress bar.  When the progress bar reaches this number, it will appear full.
	/// 
	TProgressBarHelper(TMCString& inPrompt, real32 inMaxValue = 100.0f);
	~TProgressBarHelper();
	
	// ****************************************************************************
	//								SetProgressPrompt
	// 
	/// Changes the title of the progress bar.
	/// 
	/// \param inPrompt  New title for progress bar.
	/// 
	void SetProgressPrompt		(TMCString& inPrompt);
	
	// ****************************************************************************
	//								IncrementProgress
	// 
	/// Increments the progress counter by inIncrement.
	/// 
	/// \param inIncrement  Increment to add to the bar's counter
	/// 
	void IncrementProgress		(real32 inIncrement);
	
	// ****************************************************************************
	//								SetProgressValue
	// 
	/// Sets the progress value to a given value (on a scale of 0 to the max value of the progress bar)
	/// 
	/// \param inValue  Value to assign to the bar
	/// 
	void SetProgressValue		(real32 inValue);
	
	// ****************************************************************************
	//								SetProgressValue0to1
	// 
	/// Sets the progress value to a given value (on a scale of 0 to 1.0)
	/// 
	/// \param inValue  Value to assign to the bar
	/// 
	void SetProgressValue0to1	(real32 inValue);

	// ****************************************************************************
	//								SetProgressDelay
	// 
	/// Sets the time that the progress will wait before being displayed
	/// 
	/// \param seconds			The time to wait before displaying the progress bar on the screen.
	/// 
	void SetProgressDelay(const real seconds);

	// ****************************************************************************
	//								GetProgressKey
	// 
	/// returns the progress key.
	/// 
	IMCUnknown* GetProgressKey() const { return fProgressKey; }

protected:
	TMCCountedPtr<IMCUnknown> fProgressKey;
	real32 fMaxValue;
};



/// \}

#endif
