added wxTextEntry::AutoCompleteFileNames() and implemented it for wxMSW

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-04 23:08:26 +00:00
parent ecaed0bcda
commit 59396417d3
5 changed files with 86 additions and 2 deletions

View File

@@ -30,9 +30,14 @@
#if wxUSE_TEXTCTRL || wxUSE_COMBOBOX
#include "wx/textentry.h"
#include "wx/dynlib.h"
#include "wx/msw/private.h"
#ifndef SHACF_FILESYS_ONLY
#define SHACF_FILESYS_ONLY 0x00000010
#endif
#define GetEditHwnd() ((HWND)(GetEditHWND()))
// ============================================================================
@@ -135,6 +140,39 @@ void wxTextEntry::GetSelection(long *from, long *to) const
*to = dwEnd;
}
bool wxTextEntry::AutoCompleteFileNames()
{
typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1;
static wxDynamicLibrary s_dllShlwapi;
if ( s_pfnSHAutoComplete == (SHAutoComplete_t)-1 )
{
wxLogNull noLog;
if ( !s_dllShlwapi.Load(_T("shlwapi.dll"), wxDL_VERBATIM) )
{
s_pfnSHAutoComplete = NULL;
}
else
{
wxDL_INIT_FUNC(s_pfn, SHAutoComplete, s_dllShlwapi);
}
}
if ( !s_pfnSHAutoComplete )
return false;
HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), SHACF_FILESYS_ONLY);
if ( FAILED(hr) )
{
wxLogApiError(_T("SHAutoComplete()"), hr);
return false;
}
return true;
}
bool wxTextEntry::IsEditable() const
{
return !(::GetWindowLong(GetEditHwnd(), GWL_STYLE) & ES_READONLY);