#ifndef __DbFileDialog_h
#define __DbFileDialog_h

#ifndef _AFX	// MFC _xZkqqHx_iCpAiOgHiCoNiCmIiCkCiPoKiNiHiBeC_xHqqkZx_
#include <Commdlg.h>			// For FCDbFileDialog::OPENFILENAME.
#endif//_AFX

//----- 06.04.20 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//// OK_xZkqqHx_iDhLiDfOiDjDiCmM_xHqqkZx_ID_xZkqqHx_iBeC_xHqqkZx_
//#define FD_DBFD_OK_BUTTON_ID	2000
//----- 06.04.20 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iDeOiDiJiDfI_xHqqkZx_>	FCDbFileDialog
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDhEiDeAiDeDiDiLiDfPiDeDiDeBiDiNiDePiCmMiDeOiDiJiDfIiBeC_xHqqkZx_MFC_xZkqqHx_iCpAiOgHiCmBiCmEiCkCiCmIiCkCiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.04.11 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
class FCDbFileDialog
{
public:
	FCDbFileDialog (	BOOL bOpenFileDialog,
						const wchar_t* wcpDefExt = NULL,
						const wchar_t* wcpFileName = NULL,
						DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
						const wchar_t* wcpFilter = NULL,
						HWND hwndParent = NULL,
						const wchar_t* wcpTitle = NULL,
						const DWORD* pCtrlIdArray = NULL,
						const wchar_t** pCtrlTextArray = NULL,
						size_t szCtrlTextCount = 0,
						BOOL bIsJustifyWindow = TRUE);
	virtual DWORD	DoModal ();
	virtual WString	GetPathName () const;
	virtual WString	GetFileName () const;
	virtual WString	GetFolderPath () const;
	virtual void	SetFileName (const wchar_t* wcpName);

	virtual long	GetCurrentFilterIndex () const;
	virtual BOOL	GetFilterFileExt (WString& wstrExt, long lFilterIndex) const;
	virtual void	FindFilterFileExt (longSet& stIndex, const wchar_t* wcpExt) const;
// 06.01.21 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual void	SetHelpID (DWORD dwId);
	virtual BOOL	PostMessage (DWORD dwMessageId, WPARAM wParam = 0, LPARAM lParam = 0);
	virtual LRESULT	SendMessage (DWORD dwMessageId, WPARAM wParam = 0, LPARAM lParam = 0);

	virtual void	ScreenToClient (LPPOINT lpPoint) const;
	virtual void	ScreenToClient (LPRECT lpRect) const;
	virtual void	GetClientRect (LPRECT lpRect) const;
	virtual void	GetWindowRect (LPRECT lpRect) const;


protected:
	virtual BOOL	OnInitDialog ();
	virtual void	OnOK ();
	virtual void	OnHelp ();
	virtual void	OnDestroy ();
// 06.01.21 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	virtual HBRUSH	OnCtlColor (CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	virtual HBRUSH	OnCtlColor (HDC hDC, HWND hWnd, UINT nCtlColor);
	virtual void	OnSize (UINT nType, int cx, int cy);
	virtual void	OnFileSelchanged ();
	virtual void	OnFileNameChanged ();
	virtual void	OnFileTypeChanged (long lFilterIndex);
	virtual void	OnFolderChanged ();
//----- 06.01.21 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	virtual CWnd*	GetDlgItem (int nID) const;
//	virtual CWnd*	GetParent () const;
//----- 06.01.21 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

	virtual HWND	TwGetHwnd () const;
	virtual HWND	TwGetDlgItemHwnd (int nId) const;
	virtual BOOL	TwPostMessage (DWORD dwMessageId, WPARAM wParam = 0, LPARAM lParam = 0) const;
	virtual LRESULT	TwSendMessage (DWORD dwMessageId, WPARAM wParam = 0, LPARAM lParam = 0) const;
	virtual void	TwScreenToClient (LPPOINT lpPoint) const;
	virtual void	TwScreenToClient (LPRECT lpRect) const;

// 06.01.21 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual void	DDXControl (DWORD dwControlId, CWnd& wndControl);
	virtual UINT_PTR	OnMessage (DWORD dwMessageId, WPARAM wParam, LPARAM lParam);
	virtual BOOL	OnCommand (WPARAM wParam, LPARAM lParam);

	virtual const MSG*	GetCurrentMessage () const;

	virtual WString	GetControlText (DWORD dwId) const;

	static UINT_PTR CALLBACK OFNHookProc (	HWND hdlg,
											UINT uiMsg,
											WPARAM wParam,
											LPARAM lParam);
	static INT_PTR CALLBACK myDlgParentProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	static FCDbFileDialog* myHWNDToDlgTable (short nCmd, HWND hWnd, FCDbFileDialog* pDlg);

// _xZkqqHx_iDiBiDjDiDgPjFmPjAjEiBeC_xHqqkZx_
public:
	OPENFILENAME	m_ofn;
	const static long	MAX_PATH_STR_LEN;

protected:
	enum
	{
		registerDlg = 0,
		crossOffDlg,
		findDlg
	};

	BOOL		m_bOpenFileDialog;
// 06.01.20 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	CString		m_strDefExt;
	tcstring	m_strDefExt;
	TCHARVector	m_vFileName;
	TCHARVector	m_vFilter;
// 06.01.20 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	CString		m_strTitle;
	tcstring	m_strTitle;
// 06.01.21 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	DWORD		m_dwHelpId;
	long		m_lLastFilterIndex;
	MSG			m_msgLastMessage;
	HWND		m_hWnd;

	map<DWORD, WString>	m_mpIdToText;
	BOOL		m_bIsJustifyWindow;

	DLGPROC		m_parentProc;		// _xZkqqHx_iDfPiDeDiDeBiDiNiDePiDhGiDiNiDfGiDfHiDiDjFnLjBlGjHhAjFmPjAjEiBeC_xHqqkZx_
}; // class FCDbFileDialog.

#endif//__DbFileDialog_h
