X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f0c5856e0bb5e892e83527f9967219f33dc71a2..8a31648287be0ef976f133de2786b137f1e98340:/src/msw/textentry.cpp diff --git a/src/msw/textentry.cpp b/src/msw/textentry.cpp index ba18dd0445..e993654d24 100644 --- a/src/msw/textentry.cpp +++ b/src/msw/textentry.cpp @@ -34,6 +34,8 @@ #include "wx/textcompleter.h" #include "wx/dynlib.h" +#include + #include "wx/msw/private.h" #if wxUSE_UXTHEME @@ -73,6 +75,10 @@ #define SHACF_FILESYS_ONLY 0x00000010 #endif +#ifndef SHACF_FILESYS_DIRS + #define SHACF_FILESYS_DIRS 0x00000020 +#endif + namespace { @@ -738,7 +744,7 @@ void wxTextEntry::GetSelection(long *from, long *to) const #ifdef HAS_AUTOCOMPLETE -bool wxTextEntry::DoAutoCompleteFileNames() +bool wxTextEntry::DoAutoCompleteFileNames(int flags) { typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD); static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1; @@ -758,7 +764,18 @@ bool wxTextEntry::DoAutoCompleteFileNames() if ( !s_pfnSHAutoComplete ) return false; - HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), SHACF_FILESYS_ONLY); + DWORD dwFlags = 0; + if ( flags & wxFILE ) + dwFlags |= SHACF_FILESYS_ONLY; + else if ( flags & wxDIR ) + dwFlags |= SHACF_FILESYS_DIRS; + else + { + wxFAIL_MSG(wxS("No flags for file name auto completion?")); + return false; + } + + HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), dwFlags); if ( FAILED(hr) ) { wxLogApiError(wxT("SHAutoComplete()"), hr); @@ -831,9 +848,9 @@ bool wxTextEntry::DoAutoCompleteCustom(wxTextCompleter *completer) // We still need to define stubs as we declared these overrides in the header. -bool wxTextEntry::DoAutoCompleteFileNames() +bool wxTextEntry::DoAutoCompleteFileNames(int flags) { - return wxTextEntryBase::DoAutoCompleteFileNames(); + return wxTextEntryBase::DoAutoCompleteFileNames(flags); } bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)