]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/winundef.h
Compilation fixes for Nano-X
[wxWidgets.git] / include / wx / msw / winundef.h
CommitLineData
98216d40
VZ
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
25889d3c
JS
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
98216d40
VZ
15#ifndef _WX_WINUNDEF_H_
16#define _WX_WINUNDEF_H_
25889d3c 17 */
98216d40 18
7cc98b3e
VZ
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// ----------------------------------------------------------------------------
6bbd3344 27
b225f659
VZ
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
731db709
VZ
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
6bbd3344
BM
61// GetCharWidth
62
98216d40 63#ifdef GetCharWidth
379a3b04
BM
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 }
e90babdf 73#endif
6bbd3344
BM
74
75// FindWindow
76
98216d40 77#ifdef FindWindow
379a3b04
BM
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
e90babdf 90#endif
6bbd3344 91
13ff9344
JS
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
6bbd3344
BM
109// GetClassName
110
98216d40 111#ifdef GetClassName
379a3b04
BM
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
e90babdf 124#endif
6bbd3344
BM
125
126// GetClassInfo
127
98216d40 128#ifdef GetClassInfo
379a3b04
BM
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
e90babdf 141#endif
6bbd3344
BM
142
143// LoadAccelerators
144
98216d40 145#ifdef LoadAccelerators
379a3b04
BM
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
98216d40 158#endif
6bbd3344
BM
159
160// DrawText
161
98216d40 162#ifdef DrawText
379a3b04
BM
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
e90babdf 175#endif
6bbd3344
BM
176
177// StartDoc
178
98216d40 179#ifdef StartDoc
379a3b04 180 #undef StartDoc
d8c72298 181 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
0c589ad0
BM
182 #define DOCINFOW DOCINFO
183 #define DOCINFOA DOCINFO
184 #endif
379a3b04
BM
185 #ifdef _UNICODE
186 inline int StartDoc(HDC h, CONST DOCINFOW* info)
187 {
d8c72298 188 return StartDocW(h, (DOCINFOW*) info);
379a3b04
BM
189 }
190 #else
191 inline int StartDoc(HDC h, CONST DOCINFOA* info)
192 {
d8c72298 193 return StartDocA(h, (DOCINFOA*) info);
379a3b04
BM
194 }
195 #endif
98216d40
VZ
196#endif
197
379a3b04
BM
198// GetObject
199
200#ifdef GetObject
201 #undef GetObject
202 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
203 {
204 #ifdef _UNICODE
205 return GetObjectW(h, i, buffer);
206 #else
207 return GetObjectA(h, i, buffer);
6ec9d18f
RD
208 #endif
209 }
210#endif
211
7cc98b3e 212// GetMessage
6ec9d18f
RD
213
214#ifdef GetMessage
215 #undef GetMessage
216 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
217 {
218 #ifdef _UNICODE
219 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
220 #else
221 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
222 #endif
379a3b04 223 }
e90babdf 224#endif
98216d40 225
7cc98b3e
VZ
226// LoadLibrary
227
228#ifdef LoadLibrary
229 #undef LoadLibrary
7cc98b3e 230 #ifdef _UNICODE
f6bcfd97
BP
231 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
232 {
7cc98b3e 233 return LoadLibraryW(lpLibFileName);
f6bcfd97 234 }
7cc98b3e 235 #else
f6bcfd97
BP
236 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
237 {
7cc98b3e 238 return LoadLibraryA(lpLibFileName);
7cc98b3e 239 }
f6bcfd97 240 #endif
7cc98b3e
VZ
241#endif
242
b568d04f
VZ
243// FindResource
244#ifdef FindResource
245 #undef FindResource
b568d04f 246 #ifdef _UNICODE
f6bcfd97
BP
247 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
248 {
b568d04f 249 return FindResourceW(hModule, lpName, lpType);
f6bcfd97 250 }
b568d04f 251 #else
f6bcfd97
BP
252 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
253 {
b568d04f 254 return FindResourceA(hModule, lpName, lpType);
b568d04f 255 }
f6bcfd97 256 #endif
b568d04f
VZ
257#endif
258
3372145d
PA
259// IsMaximized
260
261#ifdef IsMaximized
262 #undef IsMaximized
263 inline BOOL IsMaximized(HWND hwnd)
264 {
265 return IsZoomed(hwnd);
266 }
267#endif
268
2ba3d4f0
PA
269// GetFirstChild
270
271#ifdef GetFirstChild
272 #undef GetFirstChild
273 inline HWND GetFirstChild(HWND hwnd)
274 {
275 return GetTopWindow(hwnd);
276 }
277#endif
278
79bc2382
PA
279// GetPrevSibling
280
281#ifdef GetPrevSibling
282 #undef GetPrevSibling
283 inline HWND GetPrevSibling(HWND hwnd)
284 {
285 return GetWindow(hwnd,GW_HWNDPREV);
286 }
287#endif
288
289// GetNextSibling
290
291#ifdef GetNextSibling
292 #undef GetNextSibling
293 inline HWND GetNextSibling(HWND hwnd)
294 {
295 return GetWindow(hwnd,GW_HWNDNEXT);
296 }
297#endif
298
c455ab93
RR
299// For WINE
300
301#if defined(GetWindowStyle) || defined(__WXWINE__)
302 #undef GetWindowStyle
303#endif
98216d40 304
379a3b04 305// For ming and cygwin
6bbd3344 306
379a3b04
BM
307// GetFirstChild
308#ifdef GetFirstChild
309 #undef GetFirstChild
310 inline HWND GetFirstChild(HWND h)
311 {
312 return GetTopWindow(h);
313 }
314#endif
6bbd3344 315
98216d40 316
379a3b04
BM
317// GetNextSibling
318#ifdef GetNextSibling
0c589ad0
BM
319 #undef GetNextSibling
320 inline HWND GetNextSibling(HWND h)
321 {
322 return GetWindow(h, GW_HWNDNEXT);
323 }
98216d40
VZ
324#endif
325
73c13bb9
RD
326
327#ifdef Yield
328 #undef Yield
329#endif
330
379a3b04
BM
331// GetWindowProc
332//ifdef GetWindowProc
333// #undef GetWindowProc
334//endif
335//ifdef GetNextChild
336// #undef GetNextChild
337//endif
6bbd3344 338
25889d3c
JS
339// #endif // _WX_WINUNDEF_H_
340