Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[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
77ffb593 7// Copyright: (c) wxWidgets team
65571936 8// Licence: wxWindows licence
98216d40
VZ
9/////////////////////////////////////////////////////////////////////////////
10
25889d3c
JS
11/* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h,
12 * then again _AFTER_ you've included windows.h, in which case it won't work
13 * a 2nd time -- JACS
98216d40
VZ
14#ifndef _WX_WINUNDEF_H_
15#define _WX_WINUNDEF_H_
25889d3c 16 */
98216d40 17
7cc98b3e
VZ
18// ----------------------------------------------------------------------------
19// windows.h #defines the following identifiers which are also used in wxWin so
20// we replace these symbols with the corresponding inline functions and
21// undefine the macro.
22//
23// This looks quite ugly here but allows us to write clear (and correct!) code
24// elsewhere because the functions, unlike the macros, respect the scope.
25// ----------------------------------------------------------------------------
6bbd3344 26
b225f659
VZ
27// CreateDialog
28
fb86251b 29#if defined(CreateDialog)
b225f659
VZ
30 #undef CreateDialog
31
32 inline HWND CreateDialog(HINSTANCE hInstance,
33 LPCTSTR pTemplate,
34 HWND hwndParent,
35 DLGPROC pDlgProc)
36 {
37 #ifdef _UNICODE
38 return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
39 #else
40 return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc);
41 #endif
42 }
43#endif
44
136b3b19
VZ
45// CreateFont
46
47#ifdef CreateFont
48 #undef CreateFont
49
50 inline HFONT CreateFont(int height,
51 int width,
52 int escapement,
53 int orientation,
54 int weight,
55 DWORD italic,
56 DWORD underline,
57 DWORD strikeout,
58 DWORD charset,
59 DWORD outprecision,
60 DWORD clipprecision,
61 DWORD quality,
62 DWORD family,
63 LPCTSTR facename)
64 {
65 #ifdef _UNICODE
66 return CreateFontW(height, width, escapement, orientation,
67 weight, italic, underline, strikeout, charset,
68 outprecision, clipprecision, quality,
69 family, facename);
70 #else
71 return CreateFontA(height, width, escapement, orientation,
72 weight, italic, underline, strikeout, charset,
73 outprecision, clipprecision, quality,
74 family, facename);
75 #endif
76 }
77#endif // CreateFont
78
7344726a
VZ
79// CreateWindow
80
81#if defined(CreateWindow)
82 #undef CreateWindow
83
84 inline HWND CreateWindow(LPCTSTR lpClassName,
85 LPCTSTR lpWndClass,
86 DWORD dwStyle,
87 int x, int y, int w, int h,
88 HWND hWndParent,
89 HMENU hMenu,
90 HINSTANCE hInstance,
91 LPVOID lpParam)
92 {
93 #ifdef _UNICODE
94 return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h,
95 hWndParent, hMenu, hInstance, lpParam);
96 #else
97 return CreateWindowA(lpClassName, lpWndClass, dwStyle, x, y, w, h,
98 hWndParent, hMenu, hInstance, lpParam);
99 #endif
100 }
101#endif
102
731db709
VZ
103// LoadMenu
104
105#ifdef LoadMenu
106 #undef LoadMenu
107
108 inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name)
109 {
110 #ifdef _UNICODE
111 return LoadMenuW(instance, name);
112 #else
113 return LoadMenuA(instance, name);
114 #endif
115 }
116#endif
117
2b5f62a0
VZ
118// FindText
119
120#ifdef FindText
121 #undef FindText
122
123 inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace)
124 {
5d779223 125 #ifdef _UNICODE
2b5f62a0
VZ
126 return FindTextW(lpfindreplace);
127 #else
128 return FindTextA(lpfindreplace);
5d779223 129 #endif
2b5f62a0
VZ
130 }
131#endif
132
6bbd3344
BM
133// GetCharWidth
134
98216d40 135#ifdef GetCharWidth
379a3b04
BM
136 #undef GetCharWidth
137 inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer)
138 {
139 #ifdef _UNICODE
140 return GetCharWidthW(dc, first, last, buffer);
141 #else
142 return GetCharWidthA(dc, first, last, buffer);
143 #endif
144 }
e90babdf 145#endif
6bbd3344
BM
146
147// FindWindow
148
98216d40 149#ifdef FindWindow
379a3b04
BM
150 #undef FindWindow
151 #ifdef _UNICODE
152 inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
153 {
154 return FindWindowW(classname, windowname);
155 }
156 #else
157 inline HWND FindWindow(LPCSTR classname, LPCSTR windowname)
158 {
159 return FindWindowA(classname, windowname);
160 }
161 #endif
e90babdf 162#endif
6bbd3344 163
13ff9344
JS
164// PlaySound
165
166#ifdef PlaySound
167 #undef PlaySound
168 #ifdef _UNICODE
169 inline BOOL PlaySound(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound)
170 {
171 return PlaySoundW(pszSound, hMod, fdwSound);
172 }
173 #else
174 inline BOOL PlaySound(LPCSTR pszSound, HMODULE hMod, DWORD fdwSound)
175 {
176 return PlaySoundA(pszSound, hMod, fdwSound);
177 }
178 #endif
179#endif
180
6bbd3344
BM
181// GetClassName
182
98216d40 183#ifdef GetClassName
379a3b04
BM
184 #undef GetClassName
185 #ifdef _UNICODE
186 inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
187 {
188 return GetClassNameW(h, classname, maxcount);
189 }
190 #else
191 inline int GetClassName(HWND h, LPSTR classname, int maxcount)
192 {
193 return GetClassNameA(h, classname, maxcount);
194 }
195 #endif
e90babdf 196#endif
6bbd3344
BM
197
198// GetClassInfo
199
98216d40 200#ifdef GetClassInfo
379a3b04
BM
201 #undef GetClassInfo
202 #ifdef _UNICODE
203 inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
204 {
205 return GetClassInfoW(h, name, winclass);
206 }
207 #else
208 inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass)
209 {
210 return GetClassInfoA(h, name, winclass);
211 }
212 #endif
e90babdf 213#endif
6bbd3344
BM
214
215// LoadAccelerators
216
98216d40 217#ifdef LoadAccelerators
379a3b04
BM
218 #undef LoadAccelerators
219 #ifdef _UNICODE
220 inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
221 {
222 return LoadAcceleratorsW(h, name);
223 }
224 #else
225 inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name)
226 {
227 return LoadAcceleratorsA(h, name);
228 }
229 #endif
98216d40 230#endif
6bbd3344
BM
231
232// DrawText
233
98216d40 234#ifdef DrawText
379a3b04
BM
235 #undef DrawText
236 #ifdef _UNICODE
237 inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
238 {
239 return DrawTextW(h, str, count, rect, format);
240 }
241 #else
242 inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format)
243 {
244 return DrawTextA(h, str, count, rect, format);
245 }
246 #endif
e90babdf 247#endif
6bbd3344 248
4ccf704a 249
6bbd3344
BM
250// StartDoc
251
98216d40 252#ifdef StartDoc
379a3b04 253 #undef StartDoc
364f3b07
VZ
254
255 // Work around a bug in very old MinGW headers that didn't define DOCINFOW
256 // and DOCINFOA but only DOCINFO in both ANSI and Unicode.
257 #if defined( __GNUG__ )
258 #if !wxCHECK_W32API_VERSION( 0, 5 )
259 #define DOCINFOW DOCINFO
260 #define DOCINFOA DOCINFO
261 #endif
0c589ad0 262 #endif
364f3b07 263
379a3b04
BM
264 #ifdef _UNICODE
265 inline int StartDoc(HDC h, CONST DOCINFOW* info)
266 {
d8c72298 267 return StartDocW(h, (DOCINFOW*) info);
379a3b04
BM
268 }
269 #else
270 inline int StartDoc(HDC h, CONST DOCINFOA* info)
271 {
d8c72298 272 return StartDocA(h, (DOCINFOA*) info);
379a3b04
BM
273 }
274 #endif
98216d40
VZ
275#endif
276
379a3b04
BM
277// GetObject
278
279#ifdef GetObject
280 #undef GetObject
281 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
282 {
283 #ifdef _UNICODE
284 return GetObjectW(h, i, buffer);
285 #else
286 return GetObjectA(h, i, buffer);
6ec9d18f
RD
287 #endif
288 }
289#endif
290
7cc98b3e 291// GetMessage
6ec9d18f
RD
292
293#ifdef GetMessage
294 #undef GetMessage
295 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
296 {
297 #ifdef _UNICODE
298 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
299 #else
300 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
301 #endif
379a3b04 302 }
e90babdf 303#endif
98216d40 304
8b39c006
VZ
305// LoadIcon
306#ifdef LoadIcon
307 #undef LoadIcon
5e2411ab 308 inline HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
8b39c006
VZ
309 {
310 #ifdef _UNICODE
311 return LoadIconW(hInstance, lpIconName);
312 #else // ANSI
313 return LoadIconA(hInstance, lpIconName);
314 #endif // Unicode/ANSI
315 }
316#endif // LoadIcon
317
381adb74
VZ
318// LoadBitmap
319#ifdef LoadBitmap
320 #undef LoadBitmap
321 inline HBITMAP LoadBitmap(HINSTANCE hInstance, LPCTSTR lpBitmapName)
322 {
323 #ifdef _UNICODE
324 return LoadBitmapW(hInstance, lpBitmapName);
325 #else // ANSI
326 return LoadBitmapA(hInstance, lpBitmapName);
327 #endif // Unicode/ANSI
328 }
329#endif // LoadBitmap
8b39c006 330
7cc98b3e
VZ
331// LoadLibrary
332
333#ifdef LoadLibrary
334 #undef LoadLibrary
7cc98b3e 335 #ifdef _UNICODE
f6bcfd97
BP
336 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
337 {
7cc98b3e 338 return LoadLibraryW(lpLibFileName);
f6bcfd97 339 }
7cc98b3e 340 #else
f6bcfd97
BP
341 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
342 {
7cc98b3e 343 return LoadLibraryA(lpLibFileName);
7cc98b3e 344 }
f6bcfd97 345 #endif
7cc98b3e
VZ
346#endif
347
b568d04f
VZ
348// FindResource
349#ifdef FindResource
350 #undef FindResource
b568d04f 351 #ifdef _UNICODE
f6bcfd97
BP
352 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
353 {
b568d04f 354 return FindResourceW(hModule, lpName, lpType);
f6bcfd97 355 }
b568d04f 356 #else
f6bcfd97
BP
357 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
358 {
b568d04f 359 return FindResourceA(hModule, lpName, lpType);
b568d04f 360 }
f6bcfd97 361 #endif
b568d04f
VZ
362#endif
363
3372145d
PA
364// IsMaximized
365
366#ifdef IsMaximized
367 #undef IsMaximized
0c0d1521 368 inline BOOL IsMaximized(HWND WXUNUSED_IN_WINCE(hwnd))
3372145d 369 {
42d11c8e
JS
370#ifdef __WXWINCE__
371 return FALSE;
372#else
3372145d 373 return IsZoomed(hwnd);
42d11c8e 374#endif
3372145d
PA
375 }
376#endif
377
2ba3d4f0
PA
378// GetFirstChild
379
380#ifdef GetFirstChild
381 #undef GetFirstChild
0c0d1521 382 inline HWND GetFirstChild(HWND WXUNUSED_IN_WINCE(hwnd))
2ba3d4f0 383 {
42d11c8e
JS
384#ifdef __WXWINCE__
385 return 0;
386#else
2ba3d4f0 387 return GetTopWindow(hwnd);
42d11c8e 388#endif
2ba3d4f0
PA
389 }
390#endif
391
dec531b2
VS
392// GetFirstSibling
393
394#ifdef GetFirstSibling
395 #undef GetFirstSibling
396 inline HWND GetFirstSibling(HWND hwnd)
397 {
398 return GetWindow(hwnd,GW_HWNDFIRST);
399 }
400#endif
401
402// GetLastSibling
403
404#ifdef GetLastSibling
405 #undef GetLastSibling
406 inline HWND GetLastSibling(HWND hwnd)
407 {
408 return GetWindow(hwnd,GW_HWNDLAST);
409 }
410#endif
411
79bc2382
PA
412// GetPrevSibling
413
414#ifdef GetPrevSibling
415 #undef GetPrevSibling
416 inline HWND GetPrevSibling(HWND hwnd)
417 {
418 return GetWindow(hwnd,GW_HWNDPREV);
419 }
420#endif
421
422// GetNextSibling
423
424#ifdef GetNextSibling
425 #undef GetNextSibling
426 inline HWND GetNextSibling(HWND hwnd)
427 {
428 return GetWindow(hwnd,GW_HWNDNEXT);
429 }
430#endif
431
c455ab93
RR
432// For WINE
433
b4da152e 434#if defined(GetWindowStyle)
c455ab93
RR
435 #undef GetWindowStyle
436#endif
98216d40 437
379a3b04 438// For ming and cygwin
6bbd3344 439
379a3b04
BM
440// GetFirstChild
441#ifdef GetFirstChild
442 #undef GetFirstChild
443 inline HWND GetFirstChild(HWND h)
444 {
445 return GetTopWindow(h);
446 }
447#endif
6bbd3344 448
98216d40 449
379a3b04
BM
450// GetNextSibling
451#ifdef GetNextSibling
0c589ad0
BM
452 #undef GetNextSibling
453 inline HWND GetNextSibling(HWND h)
454 {
455 return GetWindow(h, GW_HWNDNEXT);
456 }
98216d40
VZ
457#endif
458
73c13bb9
RD
459
460#ifdef Yield
461 #undef Yield
462#endif
463
368c9c6d
JS
464
465#if defined(__WXWINCE__) && defined(DrawIcon) //#ifdef DrawIcon
466 #undef DrawIcon
27d2dbbc 467 inline BOOL DrawIcon(HDC hdc, int x, int y, HICON hicon)
368c9c6d
JS
468 {
469 return DrawIconEx(hdc,x,y,hicon,0,0,0,NULL, DI_NORMAL) ;
470 }
471#endif
472
473
379a3b04
BM
474// GetWindowProc
475//ifdef GetWindowProc
476// #undef GetWindowProc
477//endif
478//ifdef GetNextChild
479// #undef GetNextChild
480//endif
6bbd3344 481
25889d3c
JS
482// #endif // _WX_WINUNDEF_H_
483