Move wxCmpNatural() MSW definition to MSW-specific code
It is tidier to have MSW-specific stuff, such as shlwapi.h inclusion, in wxMSW rather than common code. No real changes.
This commit is contained in:
@@ -25,23 +25,6 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include "wx/afterstd.h"
|
#include "wx/afterstd.h"
|
||||||
|
|
||||||
#if defined( __WINDOWS__ )
|
|
||||||
#include <shlwapi.h>
|
|
||||||
|
|
||||||
// In some distributions of MinGW32, this function is exported in the library,
|
|
||||||
// but not declared in shlwapi.h. Therefore we declare it here.
|
|
||||||
#if defined( __MINGW32_TOOLCHAIN__ )
|
|
||||||
extern "C" __declspec(dllimport) int WINAPI StrCmpLogicalW(LPCWSTR psz1, LPCWSTR psz2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// For MSVC we can also link the library containing StrCmpLogicalW()
|
|
||||||
// directly from here, for the other compilers this needs to be done at
|
|
||||||
// makefiles level.
|
|
||||||
#ifdef __VISUALC__
|
|
||||||
#pragma comment(lib, "shlwapi")
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// ArrayString
|
// ArrayString
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -912,15 +895,13 @@ int wxCMPFUNC_CONV wxCmpNaturalGeneric(const wxString& s1, const wxString& s2)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxCmpNatural
|
// wxCmpNatural
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
|
||||||
// If a native version of Natural sort is available, then use that, otherwise
|
// If native natural sort function isn't available, use the generic version.
|
||||||
// use the generic version.
|
#if !defined(__WINDOWS__)
|
||||||
|
|
||||||
int wxCMPFUNC_CONV wxCmpNatural(const wxString& s1, const wxString& s2)
|
int wxCMPFUNC_CONV wxCmpNatural(const wxString& s1, const wxString& s2)
|
||||||
{
|
{
|
||||||
#if defined( __WINDOWS__ )
|
|
||||||
return StrCmpLogicalW(s1.wc_str(), s2.wc_str());
|
|
||||||
#else
|
|
||||||
return wxCmpNaturalGeneric(s1, s2);
|
return wxCmpNaturalGeneric(s1, s2);
|
||||||
#endif // #if defined( __WINDOWS__ )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // #if !defined( __WINDOWS__ )
|
||||||
|
@@ -95,6 +95,22 @@
|
|||||||
// For wxKillAllChildren
|
// For wxKillAllChildren
|
||||||
#include <tlhelp32.h>
|
#include <tlhelp32.h>
|
||||||
|
|
||||||
|
// For wxCmpNatural()
|
||||||
|
#include <shlwapi.h>
|
||||||
|
|
||||||
|
// In some distributions of MinGW32, this function is exported in the library,
|
||||||
|
// but not declared in shlwapi.h. Therefore we declare it here.
|
||||||
|
#if defined( __MINGW32_TOOLCHAIN__ )
|
||||||
|
extern "C" __declspec(dllimport) int WINAPI StrCmpLogicalW(LPCWSTR psz1, LPCWSTR psz2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For MSVC we can also link the library containing StrCmpLogicalW()
|
||||||
|
// directly from here, for the other compilers this needs to be done at
|
||||||
|
// makefiles level.
|
||||||
|
#ifdef __VISUALC__
|
||||||
|
#pragma comment(lib, "shlwapi")
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1583,3 +1599,8 @@ wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc)
|
|||||||
|
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxCMPFUNC_CONV wxCmpNatural(const wxString& s1, const wxString& s2)
|
||||||
|
{
|
||||||
|
return StrCmpLogicalW(s1.wc_str(), s2.wc_str());
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user