]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/winundef.h
OS/2 bug fix updates.
[wxWidgets.git] / include / wx / msw / winundef.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: winundef.h
3 // Purpose: undefine the common symbols #define'd by <windows.h>
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 16.05.99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
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
14 * a 2nd time -- JACS
15 #ifndef _WX_WINUNDEF_H_
16 #define _WX_WINUNDEF_H_
17 */
18
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.
23 //
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 // ----------------------------------------------------------------------------
27
28 // CreateDialog
29
30 #ifdef CreateDialog
31 #undef CreateDialog
32
33 inline HWND CreateDialog(HINSTANCE hInstance,
34 LPCTSTR pTemplate,
35 HWND hwndParent,
36 DLGPROC pDlgProc)
37 {
38 #ifdef _UNICODE
39 return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
40 #else
41 return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc);
42 #endif
43 }
44 #endif
45
46 // GetCharWidth
47
48 #ifdef GetCharWidth
49 #undef GetCharWidth
50 inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer)
51 {
52 #ifdef _UNICODE
53 return GetCharWidthW(dc, first, last, buffer);
54 #else
55 return GetCharWidthA(dc, first, last, buffer);
56 #endif
57 }
58 #endif
59
60 // FindWindow
61
62 #ifdef FindWindow
63 #undef FindWindow
64 #ifdef _UNICODE
65 inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
66 {
67 return FindWindowW(classname, windowname);
68 }
69 #else
70 inline HWND FindWindow(LPCSTR classname, LPCSTR windowname)
71 {
72 return FindWindowA(classname, windowname);
73 }
74 #endif
75 #endif
76
77 // PlaySound
78
79 #ifdef PlaySound
80 #undef PlaySound
81 #ifdef _UNICODE
82 inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound)
83 {
84 return PlaySoundW(pszSound, hMod, fdwSound);
85 }
86 #else
87 inline BOOL PlaySound(LPCSTR pszSound, HMODULE hMod, DWORD fdwSound)
88 {
89 return PlaySoundA(pszSound, hMod, fdwSound);
90 }
91 #endif
92 #endif
93
94 // GetClassName
95
96 #ifdef GetClassName
97 #undef GetClassName
98 #ifdef _UNICODE
99 inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
100 {
101 return GetClassNameW(h, classname, maxcount);
102 }
103 #else
104 inline int GetClassName(HWND h, LPSTR classname, int maxcount)
105 {
106 return GetClassNameA(h, classname, maxcount);
107 }
108 #endif
109 #endif
110
111 // GetClassInfo
112
113 #ifdef GetClassInfo
114 #undef GetClassInfo
115 #ifdef _UNICODE
116 inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
117 {
118 return GetClassInfoW(h, name, winclass);
119 }
120 #else
121 inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass)
122 {
123 return GetClassInfoA(h, name, winclass);
124 }
125 #endif
126 #endif
127
128 // LoadAccelerators
129
130 #ifdef LoadAccelerators
131 #undef LoadAccelerators
132 #ifdef _UNICODE
133 inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
134 {
135 return LoadAcceleratorsW(h, name);
136 }
137 #else
138 inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name)
139 {
140 return LoadAcceleratorsA(h, name);
141 }
142 #endif
143 #endif
144
145 // DrawText
146
147 #ifdef DrawText
148 #undef DrawText
149 #ifdef _UNICODE
150 inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
151 {
152 return DrawTextW(h, str, count, rect, format);
153 }
154 #else
155 inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format)
156 {
157 return DrawTextA(h, str, count, rect, format);
158 }
159 #endif
160 #endif
161
162 // StartDoc
163
164 #ifdef StartDoc
165 #undef StartDoc
166 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
167 #define DOCINFOW DOCINFO
168 #define DOCINFOA DOCINFO
169 #endif
170 #ifdef _UNICODE
171 inline int StartDoc(HDC h, CONST DOCINFOW* info)
172 {
173 return StartDocW(h, (DOCINFOW*) info);
174 }
175 #else
176 inline int StartDoc(HDC h, CONST DOCINFOA* info)
177 {
178 return StartDocA(h, (DOCINFOA*) info);
179 }
180 #endif
181 #endif
182
183 // GetObject
184
185 #ifdef GetObject
186 #undef GetObject
187 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
188 {
189 #ifdef _UNICODE
190 return GetObjectW(h, i, buffer);
191 #else
192 return GetObjectA(h, i, buffer);
193 #endif
194 }
195 #endif
196
197 // GetMessage
198
199 #ifdef GetMessage
200 #undef GetMessage
201 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
202 {
203 #ifdef _UNICODE
204 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
205 #else
206 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
207 #endif
208 }
209 #endif
210
211 // LoadLibrary
212
213 #ifdef LoadLibrary
214 #undef LoadLibrary
215 #ifdef _UNICODE
216 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
217 {
218 return LoadLibraryW(lpLibFileName);
219 }
220 #else
221 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
222 {
223 return LoadLibraryA(lpLibFileName);
224 }
225 #endif
226 #endif
227
228 // FindResource
229 #ifdef FindResource
230 #undef FindResource
231 #ifdef _UNICODE
232 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
233 {
234 return FindResourceW(hModule, lpName, lpType);
235 }
236 #else
237 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
238 {
239 return FindResourceA(hModule, lpName, lpType);
240 }
241 #endif
242 #endif
243
244 // IsMaximized
245
246 #ifdef IsMaximized
247 #undef IsMaximized
248 inline BOOL IsMaximized(HWND hwnd)
249 {
250 return IsZoomed(hwnd);
251 }
252 #endif
253
254 // GetFirstChild
255
256 #ifdef GetFirstChild
257 #undef GetFirstChild
258 inline HWND GetFirstChild(HWND hwnd)
259 {
260 return GetTopWindow(hwnd);
261 }
262 #endif
263
264 // GetPrevSibling
265
266 #ifdef GetPrevSibling
267 #undef GetPrevSibling
268 inline HWND GetPrevSibling(HWND hwnd)
269 {
270 return GetWindow(hwnd,GW_HWNDPREV);
271 }
272 #endif
273
274 // GetNextSibling
275
276 #ifdef GetNextSibling
277 #undef GetNextSibling
278 inline HWND GetNextSibling(HWND hwnd)
279 {
280 return GetWindow(hwnd,GW_HWNDNEXT);
281 }
282 #endif
283
284 // For WINE
285
286 #if defined(GetWindowStyle) || defined(__WXWINE__)
287 #undef GetWindowStyle
288 #endif
289
290 // For ming and cygwin
291
292 // GetFirstChild
293 #ifdef GetFirstChild
294 #undef GetFirstChild
295 inline HWND GetFirstChild(HWND h)
296 {
297 return GetTopWindow(h);
298 }
299 #endif
300
301
302 // GetNextSibling
303 #ifdef GetNextSibling
304 #undef GetNextSibling
305 inline HWND GetNextSibling(HWND h)
306 {
307 return GetWindow(h, GW_HWNDNEXT);
308 }
309 #endif
310
311
312 #ifdef Yield
313 #undef Yield
314 #endif
315
316 // GetWindowProc
317 //ifdef GetWindowProc
318 // #undef GetWindowProc
319 //endif
320 //ifdef GetNextChild
321 // #undef GetNextChild
322 //endif
323
324 // #endif // _WX_WINUNDEF_H_
325