#ifndef _COMMON_CUSTOMOPENDIALOG_HPP_
#define _COMMON_CUSTOMOPENDIALOG_HPP_
#ifndef _COMMON_DWINDOW_HPP_
#include <common/dwindow.hpp>
#endif
#ifndef _COMMON_OPENDIALOG_HPP_
#include <common/opendlg.hpp>
#endif

template <class T>
class Array;
class NotifyMessageHeader;

class CustomOpenDialog : public DWindow
{
public:
  CustomOpenDialog(void);
	virtual ~CustomOpenDialog();
	const String &openFileName(void);
	void setFilterPattern(const String &strFilterPattern);
	void setTitle(const String &strTitle);
	void setFileTitle(const String &strFileTitle);
	BOOL perform(GUIWindow &parentWindow,const String &strTemplateName);
protected:
  virtual BOOL handleCommand(CallbackData &someCallbackData);
	virtual BOOL handleInit(CallbackData &someCallbackData);
	virtual BOOL handleFileOk(const NotifyMessageHeader &notifyMessageHeader);
	virtual BOOL handleFolderChange(const NotifyMessageHeader &notifyMessageHeader);
	virtual BOOL handleHelp(const NotifyMessageHeader &notifyMessageHeader);
	virtual BOOL handleInitDone(const NotifyMessageHeader &notifyMesageHeader);
	virtual BOOL handleSelChange(const NotifyMessageHeader &notifyMessageHeader);
	virtual BOOL handleShareViolation(const NotifyMessageHeader &notifyMessageHeader);
	virtual BOOL handleTypeChange(const NotifyMessageHeader &notifyMessageHeader);
  BOOL setControlText(UINT controlID,const String &strControlText)const;
  BOOL setDefaultExtension(const String &strDefExt)const;
  BOOL getFolderIDList(Array<BYTE> &arrayList)const;
  BOOL getFolderPath(String &strFolderPath)const;
  BOOL getFilePath(String &strFilePath)const;
  BOOL getSpec(String &strFileSpec)const;
  BOOL hideControl(UINT controlID)const;
private:
  CustomOpenDialog(const CustomOpenDialog &someCustomOpenDialog);
	CustomOpenDialog &operator=(const CustomOpenDialog &someCustomOpenDialog);
	CallbackData::ReturnType initHandler(CallbackData &someCallbackData);
	CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
	CallbackData::ReturnType notifyHandler(CallbackData &someCallbackData);

	Callback<CustomOpenDialog> mInitHandler;
	Callback<CustomOpenDialog> mCommandHandler;
	Callback<CustomOpenDialog> mNotifyHandler;
  OpenDialog mOpenDialog;
	String mFilterPatternString;
	String mTitleString;
	String mFileTitleString;
	String mOpenFileNameString;
};
#endif
