GME  13
DirDialog.h
Go to the documentation of this file.
00001 #if !defined(DIRDIALOG_INCLUDED_)
00002 #define DIRDIALOG_INCLUDED_
00003 
00004 #if _MSC_VER >= 1000
00005 #pragma once
00006 #endif // _MSC_VER >= 1000
00007 // DirDialog.h - header for CDirDialog class
00008 #include "afxdlgs.h" //zolmol
00009 // CDlgWnd - intercepts messages from child controls
00010 class CDlgWnd : public CWnd
00011 {
00012 public:
00013     void CheckDir(const CString &ss);   // Display directory contents
00014 
00015 protected:
00016     afx_msg void OnOpen();              // Open button clicked
00017 
00018     DECLARE_MESSAGE_MAP()
00019 };
00020 
00021 // CDirEdit - edit control class
00022 class CDirEdit : public CEdit
00023 {
00024 protected:
00025     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00026     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00027     afx_msg UINT OnGetDlgCode();
00028 
00029     DECLARE_MESSAGE_MAP()
00030 };
00031 
00032 // CDirDialog - directory selection dialog
00033 class CDirDialog : public CFileDialog
00034 {
00035 public:
00036     CDirDialog(LPCTSTR initial = NULL,
00037                LPCTSTR filter = NULL, CWnd* pParentWnd = NULL);
00038 
00039     CString GetPath() { return m_strPath; }
00040 
00041     // Overriden members of CFileDialog
00042     virtual void OnInitDone();
00043     virtual void OnFolderChange();
00044 
00045     // Disallow selection of files (since we're only selecting directories)
00046     virtual BOOL OnFileNameOK() { return TRUE; }
00047 
00048 private:
00049     CString m_strPath;                  // Current directory
00050     CString m_strFilter;                // The current file filters string (used for string storage
00051                                         // for internal use of File Open dialog)
00052 
00053     CDlgWnd m_DlgWnd;                   // Subclassed dialog window (parent of CDirDialog window)
00054     CDirEdit m_Edit;                    // Edit control where you can type in a dir. name
00055     CButton m_Open;                     // "Open" button (replaces OK button)
00056 };
00057 
00058 #endif // DIRDIALOG_INCLUDED_