Allow predefining wxUSE_UNICODE_WINDOWS_H in wxMSW builds
This can be used in order to use normal Unicode build of wxWidgets with an application that needs to use ANSI versions of Win32 functions, e.g. because it doesn't compile with UNICODE defined.
This commit is contained in:
@@ -15,6 +15,14 @@
|
|||||||
#define _WX_WINUNDEF_H_
|
#define _WX_WINUNDEF_H_
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef wxUSE_UNICODE_WINDOWS_H
|
||||||
|
#ifdef _UNICODE
|
||||||
|
#define wxUSE_UNICODE_WINDOWS_H 1
|
||||||
|
#else
|
||||||
|
#define wxUSE_UNICODE_WINDOWS_H 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// windows.h #defines the following identifiers which are also used in wxWin so
|
// windows.h #defines the following identifiers which are also used in wxWin so
|
||||||
// we replace these symbols with the corresponding inline functions and
|
// we replace these symbols with the corresponding inline functions and
|
||||||
@@ -34,7 +42,7 @@
|
|||||||
HWND hwndParent,
|
HWND hwndParent,
|
||||||
DLGPROC pDlgProc)
|
DLGPROC pDlgProc)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
|
return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
|
||||||
#else
|
#else
|
||||||
return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc);
|
return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc);
|
||||||
@@ -62,7 +70,7 @@
|
|||||||
DWORD family,
|
DWORD family,
|
||||||
LPCTSTR facename)
|
LPCTSTR facename)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return CreateFontW(height, width, escapement, orientation,
|
return CreateFontW(height, width, escapement, orientation,
|
||||||
weight, italic, underline, strikeout, charset,
|
weight, italic, underline, strikeout, charset,
|
||||||
outprecision, clipprecision, quality,
|
outprecision, clipprecision, quality,
|
||||||
@@ -90,7 +98,7 @@
|
|||||||
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
||||||
LPVOID lpParam)
|
LPVOID lpParam)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h,
|
return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h,
|
||||||
hWndParent, hMenu, hInstance, lpParam);
|
hWndParent, hMenu, hInstance, lpParam);
|
||||||
#else
|
#else
|
||||||
@@ -107,7 +115,7 @@
|
|||||||
|
|
||||||
inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name)
|
inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return LoadMenuW(instance, name);
|
return LoadMenuW(instance, name);
|
||||||
#else
|
#else
|
||||||
return LoadMenuA(instance, name);
|
return LoadMenuA(instance, name);
|
||||||
@@ -122,7 +130,7 @@
|
|||||||
|
|
||||||
inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace)
|
inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return FindTextW(lpfindreplace);
|
return FindTextW(lpfindreplace);
|
||||||
#else
|
#else
|
||||||
return FindTextA(lpfindreplace);
|
return FindTextA(lpfindreplace);
|
||||||
@@ -136,7 +144,7 @@
|
|||||||
#undef GetCharWidth
|
#undef GetCharWidth
|
||||||
inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer)
|
inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return GetCharWidthW(dc, first, last, buffer);
|
return GetCharWidthW(dc, first, last, buffer);
|
||||||
#else
|
#else
|
||||||
return GetCharWidthA(dc, first, last, buffer);
|
return GetCharWidthA(dc, first, last, buffer);
|
||||||
@@ -148,7 +156,7 @@
|
|||||||
|
|
||||||
#ifdef FindWindow
|
#ifdef FindWindow
|
||||||
#undef FindWindow
|
#undef FindWindow
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
|
inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
|
||||||
{
|
{
|
||||||
return FindWindowW(classname, windowname);
|
return FindWindowW(classname, windowname);
|
||||||
@@ -165,7 +173,7 @@
|
|||||||
|
|
||||||
#ifdef PlaySound
|
#ifdef PlaySound
|
||||||
#undef PlaySound
|
#undef PlaySound
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound)
|
inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound)
|
||||||
{
|
{
|
||||||
return PlaySoundW(pszSound, hMod, fdwSound);
|
return PlaySoundW(pszSound, hMod, fdwSound);
|
||||||
@@ -182,7 +190,7 @@
|
|||||||
|
|
||||||
#ifdef GetClassName
|
#ifdef GetClassName
|
||||||
#undef GetClassName
|
#undef GetClassName
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
|
inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
|
||||||
{
|
{
|
||||||
return GetClassNameW(h, classname, maxcount);
|
return GetClassNameW(h, classname, maxcount);
|
||||||
@@ -199,7 +207,7 @@
|
|||||||
|
|
||||||
#ifdef GetClassInfo
|
#ifdef GetClassInfo
|
||||||
#undef GetClassInfo
|
#undef GetClassInfo
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
|
inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
|
||||||
{
|
{
|
||||||
return GetClassInfoW(h, name, winclass);
|
return GetClassInfoW(h, name, winclass);
|
||||||
@@ -216,7 +224,7 @@
|
|||||||
|
|
||||||
#ifdef LoadAccelerators
|
#ifdef LoadAccelerators
|
||||||
#undef LoadAccelerators
|
#undef LoadAccelerators
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
|
inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
|
||||||
{
|
{
|
||||||
return LoadAcceleratorsW(h, name);
|
return LoadAcceleratorsW(h, name);
|
||||||
@@ -233,7 +241,7 @@
|
|||||||
|
|
||||||
#ifdef DrawText
|
#ifdef DrawText
|
||||||
#undef DrawText
|
#undef DrawText
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
|
inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
|
||||||
{
|
{
|
||||||
return DrawTextW(h, str, count, rect, format);
|
return DrawTextW(h, str, count, rect, format);
|
||||||
@@ -252,7 +260,7 @@
|
|||||||
#ifdef StartDoc
|
#ifdef StartDoc
|
||||||
#undef StartDoc
|
#undef StartDoc
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline int StartDoc(HDC h, CONST DOCINFOW* info)
|
inline int StartDoc(HDC h, CONST DOCINFOW* info)
|
||||||
{
|
{
|
||||||
return StartDocW(h, (DOCINFOW*) info);
|
return StartDocW(h, (DOCINFOW*) info);
|
||||||
@@ -271,7 +279,7 @@
|
|||||||
#undef GetObject
|
#undef GetObject
|
||||||
inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
|
inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return GetObjectW(h, i, buffer);
|
return GetObjectW(h, i, buffer);
|
||||||
#else
|
#else
|
||||||
return GetObjectA(h, i, buffer);
|
return GetObjectA(h, i, buffer);
|
||||||
@@ -285,7 +293,7 @@
|
|||||||
#undef GetMessage
|
#undef GetMessage
|
||||||
inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
|
inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
||||||
#else
|
#else
|
||||||
return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
||||||
@@ -298,7 +306,7 @@
|
|||||||
#undef LoadIcon
|
#undef LoadIcon
|
||||||
inline HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
|
inline HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return LoadIconW(hInstance, lpIconName);
|
return LoadIconW(hInstance, lpIconName);
|
||||||
#else // ANSI
|
#else // ANSI
|
||||||
return LoadIconA(hInstance, lpIconName);
|
return LoadIconA(hInstance, lpIconName);
|
||||||
@@ -311,7 +319,7 @@
|
|||||||
#undef LoadBitmap
|
#undef LoadBitmap
|
||||||
inline HBITMAP LoadBitmap(HINSTANCE hInstance, LPCTSTR lpBitmapName)
|
inline HBITMAP LoadBitmap(HINSTANCE hInstance, LPCTSTR lpBitmapName)
|
||||||
{
|
{
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
return LoadBitmapW(hInstance, lpBitmapName);
|
return LoadBitmapW(hInstance, lpBitmapName);
|
||||||
#else // ANSI
|
#else // ANSI
|
||||||
return LoadBitmapA(hInstance, lpBitmapName);
|
return LoadBitmapA(hInstance, lpBitmapName);
|
||||||
@@ -323,7 +331,7 @@
|
|||||||
|
|
||||||
#ifdef LoadLibrary
|
#ifdef LoadLibrary
|
||||||
#undef LoadLibrary
|
#undef LoadLibrary
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
|
inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
|
||||||
{
|
{
|
||||||
return LoadLibraryW(lpLibFileName);
|
return LoadLibraryW(lpLibFileName);
|
||||||
@@ -339,7 +347,7 @@
|
|||||||
// FindResource
|
// FindResource
|
||||||
#ifdef FindResource
|
#ifdef FindResource
|
||||||
#undef FindResource
|
#undef FindResource
|
||||||
#ifdef _UNICODE
|
#if wxUSE_UNICODE_WINDOWS_H
|
||||||
inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
|
inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
|
||||||
{
|
{
|
||||||
return FindResourceW(hModule, lpName, lpType);
|
return FindResourceW(hModule, lpName, lpType);
|
||||||
|
Reference in New Issue
Block a user