]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/winundef.h
fixed outdated filenames
[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 // LoadMenu
47
48 #ifdef LoadMenu
49 #undef LoadMenu
50
51 inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name)
52 {
53 #ifdef _UNICODE
54 return LoadMenuW(instance, name);
55 #else
56 return LoadMenuA(instance, name);
57 #endif
58 }
59 #endif
60
61 // GetCharWidth
62
63 #ifdef GetCharWidth
64 #undef GetCharWidth
65 inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer)
66 {
67 #ifdef _UNICODE
68 return GetCharWidthW(dc, first, last, buffer);
69 #else
70 return GetCharWidthA(dc, first, last, buffer);
71 #endif
72 }
73 #endif
74
75 // FindWindow
76
77 #ifdef FindWindow
78 #undef FindWindow
79 #ifdef _UNICODE
80 inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
81 {
82 return FindWindowW(classname, windowname);
83 }
84 #else
85 inline HWND FindWindow(LPCSTR classname, LPCSTR windowname)
86 {
87 return FindWindowA(classname, windowname);
88 }
89 #endif
90 #endif
91
92 // PlaySound
93
94 #ifdef PlaySound
95 #undef PlaySound
96 #ifdef _UNICODE
97 inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound)
98 {
99 return PlaySoundW(pszSound, hMod, fdwSound);
100 }
101 #else
102 inline BOOL PlaySound(LPCSTR pszSound, HMODULE hMod, DWORD fdwSound)
103 {
104 return PlaySoundA(pszSound, hMod, fdwSound);
105 }
106 #endif
107 #endif
108
109 // GetClassName
110
111 #ifdef GetClassName
112 #undef GetClassName
113 #ifdef _UNICODE
114 inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
115 {
116 return GetClassNameW(h, classname, maxcount);
117 }
118 #else
119 inline int GetClassName(HWND h, LPSTR classname, int maxcount)
120 {
121 return GetClassNameA(h, classname, maxcount);
122 }
123 #endif
124 #endif
125
126 // GetClassInfo
127
128 #ifdef GetClassInfo
129 #undef GetClassInfo
130 #ifdef _UNICODE
131 inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
132 {
133 return GetClassInfoW(h, name, winclass);
134 }
135 #else
136 inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass)
137 {
138 return GetClassInfoA(h, name, winclass);
139 }
140 #endif
141 #endif
142
143 // LoadAccelerators
144
145 #ifdef LoadAccelerators
146 #undef LoadAccelerators
147 #ifdef _UNICODE
148 inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
149 {
150 return LoadAcceleratorsW(h, name);
151 }
152 #else
153 inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name)
154 {
155 return LoadAcceleratorsA(h, name);
156 }
157 #endif
158 #endif
159
160 // DrawText
161
162 #ifdef DrawText
163 #undef DrawText
164 #ifdef _UNICODE
165 inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
166 {
167 return DrawTextW(h, str, count, rect, format);
168 }
169 #else
170 inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format)
171 {
172 return DrawTextA(h, str, count, rect, format);
173 }
174 #endif
175 #endif
176
177
178 /*
179 When this file is included, sometimes the wxCHECK_W32API_VERSION macro
180 is undefined. With for example CodeWarrior this gives problems with
181 the following code:
182 #if 0 && wxCHECK_W32API_VERSION( 0, 5 )
183 Because CodeWarrior does macro expansion before test evaluation.
184 We define wxCHECK_W32API_VERSION here if it's undefined.
185 */
186 #if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION)
187 #define wxCHECK_W32API_VERSION(maj, min) (0)
188 #endif
189
190 // StartDoc
191
192 #ifdef StartDoc
193 #undef StartDoc
194 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
195 #define DOCINFOW DOCINFO
196 #define DOCINFOA DOCINFO
197 #endif
198 #ifdef _UNICODE
199 inline int StartDoc(HDC h, CONST DOCINFOW* info)
200 {
201 return StartDocW(h, (DOCINFOW*) info);
202 }
203 #else
204 inline int StartDoc(HDC h, CONST DOCINFOA* info)
205 {
206 return StartDocA(h, (DOCINFOA*) info);
207 }
208 #endif
209 #endif
210
211 // GetObject
212
213 #ifdef GetObject
214 #undef GetObject
215 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
216 {
217 #ifdef _UNICODE
218 return GetObjectW(h, i, buffer);
219 #else
220 return GetObjectA(h, i, buffer);
221 #endif
222 }
223 #endif
224
225 // GetMessage
226
227 #ifdef GetMessage
228 #undef GetMessage
229 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
230 {
231 #ifdef _UNICODE
232 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
233 #else
234 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
235 #endif
236 }
237 #endif
238
239 // LoadLibrary
240
241 #ifdef LoadLibrary
242 #undef LoadLibrary
243 #ifdef _UNICODE
244 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
245 {
246 return LoadLibraryW(lpLibFileName);
247 }
248 #else
249 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
250 {
251 return LoadLibraryA(lpLibFileName);
252 }
253 #endif
254 #endif
255
256 // FindResource
257 #ifdef FindResource
258 #undef FindResource
259 #ifdef _UNICODE
260 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
261 {
262 return FindResourceW(hModule, lpName, lpType);
263 }
264 #else
265 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
266 {
267 return FindResourceA(hModule, lpName, lpType);
268 }
269 #endif
270 #endif
271
272 // IsMaximized
273
274 #ifdef IsMaximized
275 #undef IsMaximized
276 inline BOOL IsMaximized(HWND hwnd)
277 {
278 return IsZoomed(hwnd);
279 }
280 #endif
281
282 // GetFirstChild
283
284 #ifdef GetFirstChild
285 #undef GetFirstChild
286 inline HWND GetFirstChild(HWND hwnd)
287 {
288 return GetTopWindow(hwnd);
289 }
290 #endif
291
292 // GetPrevSibling
293
294 #ifdef GetPrevSibling
295 #undef GetPrevSibling
296 inline HWND GetPrevSibling(HWND hwnd)
297 {
298 return GetWindow(hwnd,GW_HWNDPREV);
299 }
300 #endif
301
302 // GetNextSibling
303
304 #ifdef GetNextSibling
305 #undef GetNextSibling
306 inline HWND GetNextSibling(HWND hwnd)
307 {
308 return GetWindow(hwnd,GW_HWNDNEXT);
309 }
310 #endif
311
312 // For WINE
313
314 #if defined(GetWindowStyle) || defined(__WXWINE__)
315 #undef GetWindowStyle
316 #endif
317
318 // For ming and cygwin
319
320 // GetFirstChild
321 #ifdef GetFirstChild
322 #undef GetFirstChild
323 inline HWND GetFirstChild(HWND h)
324 {
325 return GetTopWindow(h);
326 }
327 #endif
328
329
330 // GetNextSibling
331 #ifdef GetNextSibling
332 #undef GetNextSibling
333 inline HWND GetNextSibling(HWND h)
334 {
335 return GetWindow(h, GW_HWNDNEXT);
336 }
337 #endif
338
339
340 #ifdef Yield
341 #undef Yield
342 #endif
343
344 // GetWindowProc
345 //ifdef GetWindowProc
346 // #undef GetWindowProc
347 //endif
348 //ifdef GetNextChild
349 // #undef GetNextChild
350 //endif
351
352 // #endif // _WX_WINUNDEF_H_
353