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