/*
 * Copyright (c) 2001, Gary R. Van Sickle.
 * Copyright (c) 2005-2006, Tom N Harris.
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     A copy of the GNU General Public License can be found at
 *     http://www.gnu.org/
 *
 * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
 * Written by Tom N Harris <telliamed@whoopdedo.org>
 *
 */

#ifndef SETUP_PROGRESS_H
#define SETUP_PROGRESS_H

// This is the header for the ProgressPage class.  It is a fairly generic
// progress indicator property page.


#include "win32.h"
#include "cString.h"
#include "Thread.h"
#include "PropPage.h"

#define WM_APP_INSTALL_BEGIN        WM_APP+1
#define WM_APP_INSTALL_COMPLETE     WM_APP+2
#define WM_APP_INSTALL_CANCEL       WM_APP+3
#define WM_APP_INSTALL_NOTHING      WM_APP+4

namespace Setup
{

class Installer;

class ProgressPage : public PropertyPage
{
private:
	Installer & m_installer;

	HWND m_action;
	HWND m_destname;
	HWND m_filename;
	HWND m_progress;

	Thread* m_copier;

public:
	ProgressPage(Installer&);
	virtual ~ProgressPage();

	virtual bool onMessageApp(UINT uMsg, WPARAM wParam, LPARAM lParam);
	
	bool create();

	virtual void onInit();
	virtual void onActivate();
	virtual bool onCancel();
	virtual long onUnattended()
	{
		return -1;
	};

	void setAction(DWORD id);
	void setDirectoryName(String const& s);
	void setFileName(String const& s);

	void initProgress(long limit);
	void setProgress(long pos);
	void advanceProgress();
	void advanceProgress(long delta);

};

};

#endif /* SETUP_PROGRESS_H */
