#include "wx/textcompleter.h"
#include "wx/dynlib.h"
+#include <initguid.h>
+
#include "wx/msw/private.h"
#if wxUSE_UXTHEME
#if defined(__MINGW32__) || defined (__WATCOMC__) || defined(__CYGWIN__)
// needed for IID_IAutoComplete, IID_IAutoComplete2 and ACO_AUTOSUGGEST
#include <shlguid.h>
+
+ #ifndef ACO_AUTOAPPEND
+ #define ACO_AUTOAPPEND 0x02
+ #endif
#endif
#ifndef ACO_UPDOWNKEYDROPSLIST
#define SHACF_FILESYS_ONLY 0x00000010
#endif
+#ifndef SHACF_FILESYS_DIRS
+ #define SHACF_FILESYS_DIRS 0x00000020
+#endif
+
namespace
{
#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;
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);
// 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)