/*
 * Copyright (c) 2001, 2002, 2003 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_PROPSHEET_H
#define SETUP_PROPSHEET_H

// This is the header for the PropSheet class.  This class encapsulates
// a Windows property sheet / wizard and interfaces with the PropertyPage class.
// It's named PropSheet instead of PropertySheet because the latter conflicts with
// the Windows function of the same name.


#include <vector>

#include "win32.h"
#include <prsht.h>
#undef PropertySheet
#ifdef UNICODE
#define DoPropertySheet PropertySheetW
#else
#define DoPropertySheet PropertySheetA
#endif

#include "Window.h"

namespace Setup
{

class PropertyPage;

class PropertySheet : public Window
{
	typedef std::vector<PropertyPage*> PageContainer;
	PageContainer m_propertyPages;

	HPROPSHEETPAGE* m_pageHandles;
	HPROPSHEETPAGE* createPages();

public:
	PropertySheet();
	virtual ~PropertySheet();

private:
	void setHWNDFromPage(HWND h);
	void adjustPageSize(HWND page);

	friend class PropertyPage;

public:
	virtual bool create(const Window * Parent = NULL,
			    DWORD Style = WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN);

	void addPage(PropertyPage * p);

	bool setActivePage(int i);
	bool setActivePageByID(int resource_id);
	void setButtons(DWORD flags);
	void setFinish();
	void pressButton(int button);
};

};

#endif /* SETUP_PROPSHEET_H */
