moved combobox styles from defs.to to combobox.h; added wxTE/wxCB_FILENAME styles (MSW only for now); show them in the widgets sample and use for file/dir pickers text controls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include "wx/utils.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include "wx/dynlib.h"
|
||||
|
||||
#include "wx/msw/private.h" // includes <windows.h>
|
||||
|
||||
// ============================================================================
|
||||
@@ -452,3 +454,45 @@ void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2)
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Shell API wrappers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
extern bool wxEnableFileNameAutoComplete(HWND hwnd)
|
||||
{
|
||||
typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
|
||||
|
||||
static SHAutoComplete_t s_pfnSHAutoComplete = NULL;
|
||||
static bool s_initialized = false;
|
||||
|
||||
if ( !s_initialized )
|
||||
{
|
||||
s_initialized = true;
|
||||
|
||||
wxLogNull nolog;
|
||||
wxDynamicLibrary dll(_T("shlwapi.dll"));
|
||||
if ( dll.IsLoaded() )
|
||||
{
|
||||
s_pfnSHAutoComplete =
|
||||
(SHAutoComplete_t)dll.GetSymbol(_T("SHAutoComplete"));
|
||||
if ( s_pfnSHAutoComplete )
|
||||
{
|
||||
// won't be unloaded until the process termination, no big deal
|
||||
dll.Detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !s_pfnSHAutoComplete )
|
||||
return false;
|
||||
|
||||
HRESULT hr = s_pfnSHAutoComplete(hwnd, 0x10 /* SHACF_FILESYS_ONLY */);
|
||||
if ( FAILED(hr) )
|
||||
{
|
||||
wxLogApiError(_T("SHAutoComplete"), hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user