Declare various WXH* handles compatibly with SDK.

It is no longer necessary to cast between e.g. HINSTANCE and
WXHINSTANCE, they are now declared as the same type (without including
Windows SDK header).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2010-04-25 12:07:30 +00:00
parent 6a57bd93ad
commit fe42ab1d7b
4 changed files with 28 additions and 29 deletions

View File

@@ -2904,29 +2904,34 @@ typedef void * WXRECTANGLEPTR;
/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
#if defined(__WIN32__) #if defined(__WIN32__)
/* the keywords needed for WinMain() declaration */ /* Stand-ins for Windows types to avoid #including all of windows.h */
#ifndef WXFAR
# define WXFAR #ifndef NO_STRICT
#define WX_MSW_DECLARE_HANDLE(type) typedef struct type##__ * WX##type
#else
#define WX_MSW_DECLARE_HANDLE(type) typedef void * WX##type
#endif #endif
/* Stand-ins for Windows types to avoid #including all of windows.h */ typedef void* WXHANDLE;
typedef void * WXHWND; WX_MSW_DECLARE_HANDLE(HWND);
typedef void * WXHANDLE; WX_MSW_DECLARE_HANDLE(HICON);
typedef void * WXHICON; WX_MSW_DECLARE_HANDLE(HFONT);
typedef void * WXHFONT; WX_MSW_DECLARE_HANDLE(HMENU);
typedef void * WXHMENU; WX_MSW_DECLARE_HANDLE(HPEN);
typedef void * WXHPEN; WX_MSW_DECLARE_HANDLE(HBRUSH);
typedef void * WXHBRUSH; WX_MSW_DECLARE_HANDLE(HPALETTE);
typedef void * WXHPALETTE; WX_MSW_DECLARE_HANDLE(HCURSOR);
typedef void * WXHCURSOR; WX_MSW_DECLARE_HANDLE(HRGN);
typedef void * WXHRGN; WX_MSW_DECLARE_HANDLE(RECTPTR);
typedef void * WXRECTPTR; WX_MSW_DECLARE_HANDLE(HACCEL);
typedef void * WXHACCEL; WX_MSW_DECLARE_HANDLE(HINSTANCE);
typedef void WXFAR * WXHINSTANCE; WX_MSW_DECLARE_HANDLE(HBITMAP);
typedef void * WXHBITMAP; WX_MSW_DECLARE_HANDLE(HIMAGELIST);
typedef void * WXHIMAGELIST; WX_MSW_DECLARE_HANDLE(HGLOBAL);
typedef void * WXHGLOBAL; WX_MSW_DECLARE_HANDLE(HDC);
typedef void * WXHDC;
#undef WX_MSW_DECLARE_HANDLE
typedef unsigned int WXUINT; typedef unsigned int WXUINT;
typedef unsigned long WXDWORD; typedef unsigned long WXDWORD;
typedef unsigned short WXWORD; typedef unsigned short WXWORD;

View File

@@ -973,12 +973,6 @@ inline long wxSetWindowExStyle(const wxWindowMSW *win, long style)
// and returns either that window if it does or NULL otherwise // and returns either that window if it does or NULL otherwise
extern WXDLLIMPEXP_CORE wxWindow* wxFindWinFromHandle(HWND hwnd); extern WXDLLIMPEXP_CORE wxWindow* wxFindWinFromHandle(HWND hwnd);
// without STRICT WXHWND is the same as HWND anyhow
inline wxWindow* wxFindWinFromHandle(WXHWND hWnd)
{
return wxFindWinFromHandle(static_cast<HWND>(hWnd));
}
// find the window for HWND which is part of some wxWindow, i.e. unlike // find the window for HWND which is part of some wxWindow, i.e. unlike
// wxFindWinFromHandle() above it will also work for "sub controls" of a // wxFindWinFromHandle() above it will also work for "sub controls" of a
// wxWindow. // wxWindow.

View File

@@ -296,7 +296,7 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded()
} }
/* static */ /* static */
HMODULE wxDynamicLibrary::MSWGetModuleHandle(const char *name, void *addr) WXHINSTANCE wxDynamicLibrary::MSWGetModuleHandle(const char *name, void *addr)
{ {
// we want to use GetModuleHandleEx() instead of usual GetModuleHandle() // we want to use GetModuleHandleEx() instead of usual GetModuleHandle()
// because the former works correctly for comctl32.dll while the latter // because the former works correctly for comctl32.dll while the latter

View File

@@ -1807,7 +1807,7 @@ WXHBRUSH wxToolBar::MSWGetToolbarBgBrush()
wxBrush * const wxBrush * const
brush = wxTheBrushList->FindOrCreateBrush(colBg); brush = wxTheBrushList->FindOrCreateBrush(colBg);
return brush ? brush->GetResourceHandle() : 0; return brush ? static_cast<WXHBRUSH>(brush->GetResourceHandle()) : 0;
} }
WXHBRUSH wxToolBar::MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child) WXHBRUSH wxToolBar::MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child)