summaryrefslogtreecommitdiffstats
path: root/Source/MFCDialog/CMakeSetupDialog.cpp
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-06-05 21:26:48 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-06-05 21:26:48 (GMT)
commit9c149dda8124ed87ebcf381abf8723128bc5cfc8 (patch)
tree45eeeeefa5f6158f41c736bead519a6fe7f1e20b /Source/MFCDialog/CMakeSetupDialog.cpp
parent8e281e5d5f1d59fc404f2cd694d4e871c001e3a1 (diff)
downloadCMake-9c149dda8124ed87ebcf381abf8723128bc5cfc8.zip
CMake-9c149dda8124ed87ebcf381abf8723128bc5cfc8.tar.gz
CMake-9c149dda8124ed87ebcf381abf8723128bc5cfc8.tar.bz2
ENH: add better path chooser dialog
Diffstat (limited to 'Source/MFCDialog/CMakeSetupDialog.cpp')
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp55
1 files changed, 9 insertions, 46 deletions
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index d6819eb..0c558dc 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -3,6 +3,7 @@
#include "stdafx.h"
#include "CMakeSetup.h"
+#include "PathDialog.h"
#include "CMakeSetupDialog.h"
#include "../cmCacheManager.h"
#include "../cmake.h"
@@ -205,57 +206,19 @@ HCURSOR CMakeSetupDialog::OnQueryDragIcon()
-// Insane Microsoft way of setting the initial directory
-// for the Shbrowseforfolder function...
-// SetSelProc
-// Callback procedure to set the initial selection of the browser.
-int CALLBACK CMakeSetupDialog_SetSelProc( HWND hWnd, UINT uMsg,
- LPARAM lParam, LPARAM lpData )
-{
- if (uMsg==BFFM_INITIALIZED)
- {
- ::SendMessage(hWnd, BFFM_SETSELECTION, TRUE, lpData );
- }
- return 0;
-}
-
-inline void ILFree(LPITEMIDLIST pidl)
-{
- LPMALLOC pMalloc;
- if (pidl)
- {
- SHGetMalloc(&pMalloc);
- pMalloc->Free( pidl);
- pMalloc->Release();
- }
-}
-
-
// Browse button
bool CMakeSetupDialog::Browse(CString &result, const char *title)
{
-// don't know what to do with initial right now...
- char szPathName[4096];
- BROWSEINFO bi;
-
- bi.hwndOwner = m_hWnd;
- bi.pidlRoot = NULL;
- bi.pszDisplayName = (LPTSTR)szPathName;
- bi.lpszTitle = title;
- bi.ulFlags = BIF_BROWSEINCLUDEFILES;
- // set up initial directory code
- bi.lpfn = CMakeSetupDialog_SetSelProc;
- bi.lParam = (LPARAM)(LPCSTR) result;
- // open the directory chooser
- LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
- // get the result
- bool bSuccess = (SHGetPathFromIDList(pidl, szPathName) ? true : false);
- if(bSuccess)
+ CPathDialog dlg("Select Path", title, result);
+ if(dlg.DoModal()==IDOK)
+ {
+ result = dlg.GetPathName();
+ return true;
+ }
+ else
{
- result = szPathName;
+ return false;
}
- ILFree(pidl);
- return bSuccess;
}