No changes, just simplify preprocessor checks in wxMSW wxTextEntry.

Separate !HAS_AUTOCOMPLETE stub versions from the real one as the code was
too difficult to read otherwise and would become even more so after the
addition of the upcoming custom auto-completer support.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67510 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-04-16 17:27:11 +00:00
parent 574479e8db
commit 6b30ffedb1

View File

@ -303,9 +303,11 @@ void wxTextEntry::GetSelection(long *from, long *to) const
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_OLE #if wxUSE_OLE
#ifdef HAS_AUTOCOMPLETE
bool wxTextEntry::DoAutoCompleteFileNames() bool wxTextEntry::DoAutoCompleteFileNames()
{ {
#ifdef HAS_AUTOCOMPLETE
typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD); typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1; static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1;
static wxDynamicLibrary s_dllShlwapi; static wxDynamicLibrary s_dllShlwapi;
@ -332,14 +334,10 @@ bool wxTextEntry::DoAutoCompleteFileNames()
return false; return false;
} }
return true; return true;
#else // !HAS_AUTOCOMPLETE
return false;
#endif // HAS_AUTOCOMPLETE/!HAS_AUTOCOMPLETE
} }
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
{ {
#ifdef HAS_AUTOCOMPLETE
// if we had an old enumerator we must reuse it as IAutoComplete doesn't // if we had an old enumerator we must reuse it as IAutoComplete doesn't
// free it if we call Init() again (see #10968) -- and it's also simpler // free it if we call Init() again (see #10968) -- and it's also simpler
if ( m_enumStrings ) if ( m_enumStrings )
@ -396,12 +394,24 @@ bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
// to the auto completer object // to the auto completer object
pAutoComplete->Release(); pAutoComplete->Release();
return true; return true;
#else // !HAS_AUTOCOMPLETE
wxUnusedVar(choices);
return false;
#endif // HAS_AUTOCOMPLETE/!HAS_AUTOCOMPLETE
} }
#else // !HAS_AUTOCOMPLETE
// We still need to define stubs as we declared these overrides in the header.
bool wxTextEntry::DoAutoCompleteFileNames()
{
return wxTextEntryBase::DoAutoCompleteFileNames();
}
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
{
return wxTextEntryBase::DoAutoCompleteStrings(choices);
}
#endif // HAS_AUTOCOMPLETE/!HAS_AUTOCOMPLETE
#endif // wxUSE_OLE #endif // wxUSE_OLE
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------