]>
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 // ----------------------------------------------------------------------------
32 inline BOOL
GetCharWidth(HDC dc
, UINT first
, UINT last
, LPINT buffer
)
35 return GetCharWidthW(dc
, first
, last
, buffer
);
37 return GetCharWidthA(dc
, first
, last
, buffer
);
47 inline HWND
FindWindow(LPCWSTR classname
, LPCWSTR windowname
)
49 return FindWindowW(classname
, windowname
);
52 inline HWND
FindWindow(LPCSTR classname
, LPCSTR windowname
)
54 return FindWindowA(classname
, windowname
);
64 inline int GetClassName(HWND h
, LPWSTR classname
, int maxcount
)
66 return GetClassNameW(h
, classname
, maxcount
);
69 inline int GetClassName(HWND h
, LPSTR classname
, int maxcount
)
71 return GetClassNameA(h
, classname
, maxcount
);
81 inline BOOL
GetClassInfo(HINSTANCE h
, LPCWSTR name
, LPWNDCLASSW winclass
)
83 return GetClassInfoW(h
, name
, winclass
);
86 inline BOOL
GetClassInfo(HINSTANCE h
, LPCSTR name
, LPWNDCLASSA winclass
)
88 return GetClassInfoA(h
, name
, winclass
);
95 #ifdef LoadAccelerators
96 #undef LoadAccelerators
98 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCWSTR name
)
100 return LoadAcceleratorsW(h
, name
);
103 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCSTR name
)
105 return LoadAcceleratorsA(h
, name
);
115 inline int DrawText(HDC h
, LPCWSTR str
, int count
, LPRECT rect
, UINT format
)
117 return DrawTextW(h
, str
, count
, rect
, format
);
120 inline int DrawText(HDC h
, LPCSTR str
, int count
, LPRECT rect
, UINT format
)
122 return DrawTextA(h
, str
, count
, rect
, format
);
132 #define DOCINFOW DOCINFO
133 #define DOCINFOA DOCINFO
136 inline int StartDoc(HDC h
, CONST DOCINFOW
* info
)
138 return StartDocW(h
, info
);
141 inline int StartDoc(HDC h
, CONST DOCINFOA
* info
)
143 return StartDocA(h
, info
);
152 inline int GetObject(HGDIOBJ h
, int i
, LPVOID buffer
)
155 return GetObjectW(h
, i
, buffer
);
157 return GetObjectA(h
, i
, buffer
);
166 inline int GetMessage(LPMSG lpMsg
, HWND hWnd
, UINT wMsgFilterMin
, UINT wMsgFilterMax
)
169 return GetMessageW(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
171 return GetMessageA(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
181 inline HINSTANCE
LoadLibrary(LPCWSTR lpLibFileName
)
183 return LoadLibraryW(lpLibFileName
);
186 inline HINSTANCE
LoadLibrary(LPCSTR lpLibFileName
)
188 return LoadLibraryA(lpLibFileName
);
197 inline HRSRC
FindResource(HMODULE hModule
, LPCWSTR lpName
, LPCWSTR lpType
)
199 return FindResourceW(hModule
, lpName
, lpType
);
202 inline HRSRC
FindResource(HMODULE hModule
, LPCSTR lpName
, LPCSTR lpType
)
204 return FindResourceA(hModule
, lpName
, lpType
);
213 inline BOOL
IsMaximized(HWND hwnd
)
215 return IsZoomed(hwnd
);
223 inline HWND
GetFirstChild(HWND hwnd
)
225 return GetTopWindow(hwnd
);
231 #ifdef GetPrevSibling
232 #undef GetPrevSibling
233 inline HWND
GetPrevSibling(HWND hwnd
)
235 return GetWindow(hwnd
,GW_HWNDPREV
);
241 #ifdef GetNextSibling
242 #undef GetNextSibling
243 inline HWND
GetNextSibling(HWND hwnd
)
245 return GetWindow(hwnd
,GW_HWNDNEXT
);
251 #if defined(GetWindowStyle) || defined(__WXWINE__)
252 #undef GetWindowStyle
255 // For ming and cygwin
260 inline HWND
GetFirstChild(HWND h
)
262 return GetTopWindow(h
);
268 #ifdef GetNextSibling
269 #undef GetNextSibling
270 inline HWND
GetNextSibling(HWND h
)
272 return GetWindow(h
, GW_HWNDNEXT
);
277 //ifdef GetWindowProc
278 // #undef GetWindowProc
281 // #undef GetNextChild
284 // #endif // _WX_WINUNDEF_H_