/**************************************************************************************/
/* CXSBrowseFolder                                                                    */
/**************************************************************************************/
/* This is a simple class to wrap the SHBrowseForFolder function.                     */
/**************************************************************************************/
/* Written by Dana Holt, Xenos Software                                             */
/* http://www.xenossoftware.com                                                       */
/* This class is provided as-is, and carries no warranty or guarantee of any kind.    */
/* Use at your own risk.                                                              */
/**************************************************************************************/

#pragma once

#include "Shlobj.h"
#include <string>

using namespace std;

class CXSBrowseFolder
{
public:

	enum retCode {

		RET_CANCEL = 0,
		RET_NOPATH,
		RET_OK

	};

public:
	CXSBrowseFolder(void);
	~CXSBrowseFolder(void);
protected:
	// Holds the current style
	DWORD m_style;
public:
	// Modifies the current style
	DWORD ModifyStyle(DWORD add, DWORD remove = 0);
	// Returns the current style
	DWORD GetStyle(void);
	// Displays the dialog
	CXSBrowseFolder::retCode Show(HWND parent, wchar_t* pathBuffer);
	// Set the title of the dialog
	void SetTitle(const wstring& title);

	static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData);

protected:
	// Buffer to receieve the display name of the selected object
	wchar_t m_displayName[MAX_PATH];
	// Root item to start browsing at
	LPITEMIDLIST m_root;
	// Text to display above the tree view control
	wchar_t m_title[MAX_PATH];
		
};
