]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/winundef.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: undefine the common symbols #define'd by <windows.h>
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 /* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h,
13 * then again _AFTER_ you've included windows.h, in which case it won't work
15 #ifndef _WX_WINUNDEF_H_
16 #define _WX_WINUNDEF_H_
19 // ----------------------------------------------------------------------------
20 // windows.h #defines the following identifiers which are also used in wxWin so
21 // we replace these symbols with the corresponding inline functions and
22 // undefine the macro.
24 // This looks quite ugly here but allows us to write clear (and correct!) code
25 // elsewhere because the functions, unlike the macros, respect the scope.
26 // ----------------------------------------------------------------------------
33 inline HWND
CreateDialog(HINSTANCE hInstance
,
39 return CreateDialogW(hInstance
, pTemplate
, hwndParent
, pDlgProc
);
41 return CreateDialogA(hInstance
, pTemplate
, hwndParent
, pDlgProc
);
50 inline BOOL
GetCharWidth(HDC dc
, UINT first
, UINT last
, LPINT buffer
)
53 return GetCharWidthW(dc
, first
, last
, buffer
);
55 return GetCharWidthA(dc
, first
, last
, buffer
);
65 inline HWND
FindWindow(LPCWSTR classname
, LPCWSTR windowname
)
67 return FindWindowW(classname
, windowname
);
70 inline HWND
FindWindow(LPCSTR classname
, LPCSTR windowname
)
72 return FindWindowA(classname
, windowname
);
82 inline int GetClassName(HWND h
, LPWSTR classname
, int maxcount
)
84 return GetClassNameW(h
, classname
, maxcount
);
87 inline int GetClassName(HWND h
, LPSTR classname
, int maxcount
)
89 return GetClassNameA(h
, classname
, maxcount
);
99 inline BOOL
GetClassInfo(HINSTANCE h
, LPCWSTR name
, LPWNDCLASSW winclass
)
101 return GetClassInfoW(h
, name
, winclass
);
104 inline BOOL
GetClassInfo(HINSTANCE h
, LPCSTR name
, LPWNDCLASSA winclass
)
106 return GetClassInfoA(h
, name
, winclass
);
113 #ifdef LoadAccelerators
114 #undef LoadAccelerators
116 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCWSTR name
)
118 return LoadAcceleratorsW(h
, name
);
121 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCSTR name
)
123 return LoadAcceleratorsA(h
, name
);
133 inline int DrawText(HDC h
, LPCWSTR str
, int count
, LPRECT rect
, UINT format
)
135 return DrawTextW(h
, str
, count
, rect
, format
);
138 inline int DrawText(HDC h
, LPCSTR str
, int count
, LPRECT rect
, UINT format
)
140 return DrawTextA(h
, str
, count
, rect
, format
);
149 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
150 #define DOCINFOW DOCINFO
151 #define DOCINFOA DOCINFO
154 inline int StartDoc(HDC h
, CONST DOCINFOW
* info
)
156 return StartDocW(h
, (DOCINFOW
*) info
);
159 inline int StartDoc(HDC h
, CONST DOCINFOA
* info
)
161 return StartDocA(h
, (DOCINFOA
*) info
);
170 inline int GetObject(HGDIOBJ h
, int i
, LPVOID buffer
)
173 return GetObjectW(h
, i
, buffer
);
175 return GetObjectA(h
, i
, buffer
);
184 inline int GetMessage(LPMSG lpMsg
, HWND hWnd
, UINT wMsgFilterMin
, UINT wMsgFilterMax
)
187 return GetMessageW(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
189 return GetMessageA(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
199 inline HINSTANCE
LoadLibrary(LPCWSTR lpLibFileName
)
201 return LoadLibraryW(lpLibFileName
);
204 inline HINSTANCE
LoadLibrary(LPCSTR lpLibFileName
)
206 return LoadLibraryA(lpLibFileName
);
215 inline HRSRC
FindResource(HMODULE hModule
, LPCWSTR lpName
, LPCWSTR lpType
)
217 return FindResourceW(hModule
, lpName
, lpType
);
220 inline HRSRC
FindResource(HMODULE hModule
, LPCSTR lpName
, LPCSTR lpType
)
222 return FindResourceA(hModule
, lpName
, lpType
);
231 inline BOOL
IsMaximized(HWND hwnd
)
233 return IsZoomed(hwnd
);
241 inline HWND
GetFirstChild(HWND hwnd
)
243 return GetTopWindow(hwnd
);
249 #ifdef GetPrevSibling
250 #undef GetPrevSibling
251 inline HWND
GetPrevSibling(HWND hwnd
)
253 return GetWindow(hwnd
,GW_HWNDPREV
);
259 #ifdef GetNextSibling
260 #undef GetNextSibling
261 inline HWND
GetNextSibling(HWND hwnd
)
263 return GetWindow(hwnd
,GW_HWNDNEXT
);
269 #if defined(GetWindowStyle) || defined(__WXWINE__)
270 #undef GetWindowStyle
273 // For ming and cygwin
278 inline HWND
GetFirstChild(HWND h
)
280 return GetTopWindow(h
);
286 #ifdef GetNextSibling
287 #undef GetNextSibling
288 inline HWND
GetNextSibling(HWND h
)
290 return GetWindow(h
, GW_HWNDNEXT
);
300 //ifdef GetWindowProc
301 // #undef GetWindowProc
304 // #undef GetNextChild
307 // #endif // _WX_WINUNDEF_H_