#ifndef PROGRESS_H
#define PROGRESS_H

#include "stdafx.h"

// CProgress class header file
// Copyright 1996 CustomSoft (http://www.concentric.net/~cgalbrai)
// Cecil A. Galbraith
// 3217 Linden Parkway
// Harrisburg, Pennsylvania 17110 USA
// cgalbrai@concentric.net

class CProgress:public CWnd
{  
	private:
	
	CString csClassName; // holds the Windows class name returned by AfxRegister....
	
	COLORREF LeftColor; // color of the progressing rectangle - no default
	COLORREF RightColor; // color of the regressing rectangle - no default
	
	CBrush lBrush; // brush for left rectangle
	CBrush rBrush; // brush for right rectangle
	
	CRect Meterrectangle; // rectangle to hold indicator (both left and right rect) Fixed in size
	CRect leftrectangle;  // the progressing side of the meter
	CRect rightrectangle; // the regressing side of the meter
	
	TEXTMETRIC tm; // used to set placement of text in the meter
	
	CPoint point; // upper left corner of meter rectangle - used only to create meter window
		
	long iVarnum; // counter variable used in the Meter class member
	long oldvarnum;
	char format[5];

	unsigned int oldalign; // used to save old alignment of text

	int hposition; // used in placement of text in meter
	int vposition; // used in placement of text in meter
	int percentage; // the counter number that shows in the meter
	int oldpercentage; // used to minimize flickering in the display
	int blockcounter; // counts the number of blocks currently showing
	int iBlockRectWidth;
	int iOffset;
	int iBlockWidth;
	int iInitialOffset;
	int iIsBarType;
	int iBlocks;		
	
	BOOL bInternalTextFlag; // set TRUE to show desire to use percent counter
	BOOL bUseText; // used internally to show percent counter
	BOOL bBorderFlag; // TRUE causes 3D border around meter
	
	BOOL bLeftBrushCreated; // flag to prevent two left brush creations
	BOOL bRightBrushCreated; // flag to prevent two right brush creations
	BOOL bWindowCreated; // flag to prevent two window creations
	
	char szBuffer[20]; // buffer used in displaying the counter number and % sign
	
	int SetForeColor(COLORREF LeftColor);
	int SetBackColor(COLORREF RightColor); 
	
	void SetMeterSize(int width, int height); 
	void SetMeterLocation(int x, int y);
	
	void SetBorderFlag(BOOL flag);
	void SetTextFlag(BOOL flag);	
	
	public: 	 
	
	CProgress(); // only constructor
	~CProgress(); // destructor	
	
	void Meter(long varnumber, long minnumber, long maxnumber);
	void Meter(long varnumber, long maxnumber, int blocks);
	void ClearMeter(void);

	int Create(CWnd * ptr, int x, int y, int cx, int cy,BOOL border,BOOL text, COLORREF fore, COLORREF back);

	void SetFormat(const char *str){strcpy(format, str);};

	protected:
		
// Generated message map functions
//{{AFX_MSG(CProgress)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
	 
	};



#endif