]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/winundef.h
Fixed OS/2 compilation problems.
[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
6bbd3344
BM
46// GetCharWidth
47
98216d40 48#ifdef GetCharWidth
379a3b04
BM
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 }
e90babdf 58#endif
6bbd3344
BM
59
60// FindWindow
61
98216d40 62#ifdef FindWindow
379a3b04
BM
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
e90babdf 75#endif
6bbd3344 76
13ff9344
JS
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
6bbd3344
BM
94// GetClassName
95
98216d40 96#ifdef GetClassName
379a3b04
BM
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
e90babdf 109#endif
6bbd3344
BM
110
111// GetClassInfo
112
98216d40 113#ifdef GetClassInfo
379a3b04
BM
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
e90babdf 126#endif
6bbd3344
BM
127
128// LoadAccelerators
129
98216d40 130#ifdef LoadAccelerators
379a3b04
BM
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
98216d40 143#endif
6bbd3344
BM
144
145// DrawText
146
98216d40 147#ifdef DrawText
379a3b04
BM
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
e90babdf 160#endif
6bbd3344
BM
161
162// StartDoc
163
98216d40 164#ifdef StartDoc
379a3b04 165 #undef StartDoc
d8c72298 166 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
0c589ad0
BM
167 #define DOCINFOW DOCINFO
168 #define DOCINFOA DOCINFO
169 #endif
379a3b04
BM
170 #ifdef _UNICODE
171 inline int StartDoc(HDC h, CONST DOCINFOW* info)
172 {
d8c72298 173 return StartDocW(h, (DOCINFOW*) info);
379a3b04
BM
174 }
175 #else
176 inline int StartDoc(HDC h, CONST DOCINFOA* info)
177 {
d8c72298 178 return StartDocA(h, (DOCINFOA*) info);
379a3b04
BM
179 }
180 #endif
98216d40
VZ
181#endif
182
379a3b04
BM
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);
6ec9d18f
RD
193 #endif
194 }
195#endif
196
7cc98b3e 197// GetMessage
6ec9d18f
RD
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
379a3b04 208 }
e90babdf 209#endif
98216d40 210
7cc98b3e
VZ
211// LoadLibrary
212
213#ifdef LoadLibrary
214 #undef LoadLibrary
7cc98b3e 215 #ifdef _UNICODE
f6bcfd97
BP
216 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
217 {
7cc98b3e 218 return LoadLibraryW(lpLibFileName);
f6bcfd97 219 }
7cc98b3e 220 #else
f6bcfd97
BP
221 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
222 {
7cc98b3e 223 return LoadLibraryA(lpLibFileName);
7cc98b3e 224 }
f6bcfd97 225 #endif
7cc98b3e
VZ
226#endif
227
b568d04f
VZ
228// FindResource
229#ifdef FindResource
230 #undef FindResource
b568d04f 231 #ifdef _UNICODE
f6bcfd97
BP
232 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
233 {
b568d04f 234 return FindResourceW(hModule, lpName, lpType);
f6bcfd97 235 }
b568d04f 236 #else
f6bcfd97
BP
237 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
238 {
b568d04f 239 return FindResourceA(hModule, lpName, lpType);
b568d04f 240 }
f6bcfd97 241 #endif
b568d04f
VZ
242#endif
243
3372145d
PA
244// IsMaximized
245
246#ifdef IsMaximized
247 #undef IsMaximized
248 inline BOOL IsMaximized(HWND hwnd)
249 {
250 return IsZoomed(hwnd);
251 }
252#endif
253
2ba3d4f0
PA
254// GetFirstChild
255
256#ifdef GetFirstChild
257 #undef GetFirstChild
258 inline HWND GetFirstChild(HWND hwnd)
259 {
260 return GetTopWindow(hwnd);
261 }
262#endif
263
79bc2382
PA
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
c455ab93
RR
284// For WINE
285
286#if defined(GetWindowStyle) || defined(__WXWINE__)
287 #undef GetWindowStyle
288#endif
98216d40 289
379a3b04 290// For ming and cygwin
6bbd3344 291
379a3b04
BM
292// GetFirstChild
293#ifdef GetFirstChild
294 #undef GetFirstChild
295 inline HWND GetFirstChild(HWND h)
296 {
297 return GetTopWindow(h);
298 }
299#endif
6bbd3344 300
98216d40 301
379a3b04
BM
302// GetNextSibling
303#ifdef GetNextSibling
0c589ad0
BM
304 #undef GetNextSibling
305 inline HWND GetNextSibling(HWND h)
306 {
307 return GetWindow(h, GW_HWNDNEXT);
308 }
98216d40
VZ
309#endif
310
73c13bb9
RD
311
312#ifdef Yield
313 #undef Yield
314#endif
315
379a3b04
BM
316// GetWindowProc
317//ifdef GetWindowProc
318// #undef GetWindowProc
319//endif
320//ifdef GetNextChild
321// #undef GetNextChild
322//endif
6bbd3344 323
25889d3c
JS
324// #endif // _WX_WINUNDEF_H_
325