From 6b30ffedb18b86329fdc41ac1be27bc85bd758ff Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 16 Apr 2011 17:27:11 +0000 Subject: [PATCH] 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 --- src/msw/textentry.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/msw/textentry.cpp b/src/msw/textentry.cpp index 654a82007b..d66b9c6bf3 100644 --- a/src/msw/textentry.cpp +++ b/src/msw/textentry.cpp @@ -303,9 +303,11 @@ void wxTextEntry::GetSelection(long *from, long *to) const // ---------------------------------------------------------------------------- #if wxUSE_OLE + +#ifdef HAS_AUTOCOMPLETE + bool wxTextEntry::DoAutoCompleteFileNames() { -#ifdef HAS_AUTOCOMPLETE typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD); static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1; static wxDynamicLibrary s_dllShlwapi; @@ -332,14 +334,10 @@ bool wxTextEntry::DoAutoCompleteFileNames() return false; } return true; -#else // !HAS_AUTOCOMPLETE - return false; -#endif // HAS_AUTOCOMPLETE/!HAS_AUTOCOMPLETE } bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) { -#ifdef HAS_AUTOCOMPLETE // 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 if ( m_enumStrings ) @@ -396,12 +394,24 @@ bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) // to the auto completer object pAutoComplete->Release(); 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 // ----------------------------------------------------------------------------