]>
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
);
180 inline HINSTANCE
LoadLibrary(LPCTSTR lpLibFileName
)
183 return LoadLibraryW(lpLibFileName
);
185 return LoadLibraryA(lpLibFileName
);
193 inline HRSRC
FindResource(HMODULE hModule
, LPCTSTR lpName
, LPCTSTR lpType
)
196 return FindResourceW(hModule
, lpName
, lpType
);
198 return FindResourceA(hModule
, lpName
, lpType
);
207 inline BOOL
IsMaximized(HWND hwnd
)
209 return IsZoomed(hwnd
);
217 inline HWND
GetFirstChild(HWND hwnd
)
219 return GetTopWindow(hwnd
);
225 #ifdef GetPrevSibling
226 #undef GetPrevSibling
227 inline HWND
GetPrevSibling(HWND hwnd
)
229 return GetWindow(hwnd
,GW_HWNDPREV
);
235 #ifdef GetNextSibling
236 #undef GetNextSibling
237 inline HWND
GetNextSibling(HWND hwnd
)
239 return GetWindow(hwnd
,GW_HWNDNEXT
);
245 #if defined(GetWindowStyle) || defined(__WXWINE__)
246 #undef GetWindowStyle
249 // For ming and cygwin
254 inline HWND
GetFirstChild(HWND h
)
256 return GetTopWindow(h
);
262 #ifdef GetNextSibling
263 #undef GetNextSibling
264 inline HWND
GetNextSibling(HWND h
)
266 return GetWindow(h
, GW_HWNDNEXT
);
271 //ifdef GetWindowProc
272 // #undef GetWindowProc
275 // #undef GetNextChild
278 // #endif // _WX_WINUNDEF_H_