PathDialog.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. //////////////////////////////////////////////////////////////////////////
  14. //PathDialog.h file
  15. //
  16. //Written by Nguyen Tan Hung <[email protected]>
  17. //////////////////////////////////////////////////////////////////////////
  18. #if !defined(AFX_PATHDIALOG_H__0F70BC86_11DB_11D4_B012_0000E8DD8DAA__INCLUDED_)
  19. #define AFX_PATHDIALOG_H__0F70BC86_11DB_11D4_B012_0000E8DD8DAA__INCLUDED_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif // _MSC_VER > 1000
  23. // PathDialog.h : header file
  24. //
  25. #include "shlobj.h"
  26. class CPathDialog;
  27. // CPathDialogSub - intercepts messages from child controls
  28. class CPathDialogSub : public CWnd
  29. {
  30. friend CPathDialog;
  31. public:
  32. CPathDialog* m_pPathDialog;
  33. protected:
  34. afx_msg void OnOK(); // OK button clicked
  35. afx_msg void OnChangeEditPath();
  36. DECLARE_MESSAGE_MAP()
  37. private:
  38. };
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CPathDialog dialog
  41. class CPathDialog
  42. {
  43. friend CPathDialogSub;
  44. // Construction
  45. public:
  46. CPathDialog(LPCTSTR lpszCaption=NULL,
  47. LPCTSTR lpszTitle=NULL,
  48. LPCTSTR lpszInitialPath=NULL,
  49. CWnd* pParent = NULL);
  50. CString GetPathName();
  51. virtual int DoModal();
  52. static int Touch(LPCTSTR lpPath, BOOL bValidate=TRUE);
  53. static int MakeSurePathExists(LPCTSTR lpPath);
  54. static BOOL IsFileNameValid(LPCTSTR lpFileName);
  55. static int ConcatPath(LPTSTR lpRoot, LPCTSTR lpMorePath);
  56. private:
  57. static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lParam, LPARAM pData);
  58. LPCTSTR m_lpszCaption;
  59. LPCTSTR m_lpszInitialPath;
  60. TCHAR m_szPathName[MAX_PATH];
  61. BROWSEINFO m_bi;
  62. HWND m_hWnd;
  63. CWnd* m_pParentWnd;
  64. BOOL m_bParentDisabled;
  65. BOOL m_bGetSuccess;
  66. CPathDialogSub m_PathDialogSub;
  67. };
  68. //{{AFX_INSERT_LOCATION}}
  69. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  70. #endif // !defined(AFX_PATHDIALOG_H__0F70BC86_11DB_11D4_B012_0000E8DD8DAA__INCLUDED_)