]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/winundef.h
Refactored & cleaned up wxChoice & wxComboBox code, fixed client data
[wxWidgets.git] / include / wx / msw / winundef.h
... / ...
CommitLineData
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// 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
76// GetCharWidth
77
78#ifdef GetCharWidth
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 }
88#endif
89
90// FindWindow
91
92#ifdef FindWindow
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
105#endif
106
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
124// GetClassName
125
126#ifdef GetClassName
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
139#endif
140
141// GetClassInfo
142
143#ifdef GetClassInfo
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
156#endif
157
158// LoadAccelerators
159
160#ifdef LoadAccelerators
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
173#endif
174
175// DrawText
176
177#ifdef DrawText
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
190#endif
191
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
205// StartDoc
206
207#ifdef StartDoc
208 #undef StartDoc
209 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
210 #define DOCINFOW DOCINFO
211 #define DOCINFOA DOCINFO
212 #endif
213 #ifdef _UNICODE
214 inline int StartDoc(HDC h, CONST DOCINFOW* info)
215 {
216 return StartDocW(h, (DOCINFOW*) info);
217 }
218 #else
219 inline int StartDoc(HDC h, CONST DOCINFOA* info)
220 {
221 return StartDocA(h, (DOCINFOA*) info);
222 }
223 #endif
224#endif
225
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);
236 #endif
237 }
238#endif
239
240// GetMessage
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
251 }
252#endif
253
254// LoadLibrary
255
256#ifdef LoadLibrary
257 #undef LoadLibrary
258 #ifdef _UNICODE
259 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
260 {
261 return LoadLibraryW(lpLibFileName);
262 }
263 #else
264 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
265 {
266 return LoadLibraryA(lpLibFileName);
267 }
268 #endif
269#endif
270
271// FindResource
272#ifdef FindResource
273 #undef FindResource
274 #ifdef _UNICODE
275 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
276 {
277 return FindResourceW(hModule, lpName, lpType);
278 }
279 #else
280 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
281 {
282 return FindResourceA(hModule, lpName, lpType);
283 }
284 #endif
285#endif
286
287// IsMaximized
288
289#ifdef IsMaximized
290 #undef IsMaximized
291 inline BOOL IsMaximized(HWND hwnd)
292 {
293 return IsZoomed(hwnd);
294 }
295#endif
296
297// GetFirstChild
298
299#ifdef GetFirstChild
300 #undef GetFirstChild
301 inline HWND GetFirstChild(HWND hwnd)
302 {
303 return GetTopWindow(hwnd);
304 }
305#endif
306
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
327// For WINE
328
329#if defined(GetWindowStyle) || defined(__WXWINE__)
330 #undef GetWindowStyle
331#endif
332
333// For ming and cygwin
334
335// GetFirstChild
336#ifdef GetFirstChild
337 #undef GetFirstChild
338 inline HWND GetFirstChild(HWND h)
339 {
340 return GetTopWindow(h);
341 }
342#endif
343
344
345// GetNextSibling
346#ifdef GetNextSibling
347 #undef GetNextSibling
348 inline HWND GetNextSibling(HWND h)
349 {
350 return GetWindow(h, GW_HWNDNEXT);
351 }
352#endif
353
354
355#ifdef Yield
356 #undef Yield
357#endif
358
359// GetWindowProc
360//ifdef GetWindowProc
361// #undef GetWindowProc
362//endif
363//ifdef GetNextChild
364// #undef GetNextChild
365//endif
366
367// #endif // _WX_WINUNDEF_H_
368