]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/winundef.h
fixed default button handling: don't keep BS_DEFPUSHBUTTON style when the app loses...
[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 176
4ccf704a
VZ
177
178/*
179 When this file is included, sometimes the wxCHECK_W32API_VERSION macro
180 is undefined. With for example CodeWarrior this gives problems with
181 the following code:
182 #if 0 && wxCHECK_W32API_VERSION( 0, 5 )
183 Because CodeWarrior does macro expansion before test evaluation.
184 We define wxCHECK_W32API_VERSION here if it's undefined.
185*/
186#if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION)
187 #define wxCHECK_W32API_VERSION(maj, min) (0)
188#endif
189
6bbd3344
BM
190// StartDoc
191
98216d40 192#ifdef StartDoc
379a3b04 193 #undef StartDoc
d8c72298 194 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
0c589ad0
BM
195 #define DOCINFOW DOCINFO
196 #define DOCINFOA DOCINFO
197 #endif
379a3b04
BM
198 #ifdef _UNICODE
199 inline int StartDoc(HDC h, CONST DOCINFOW* info)
200 {
d8c72298 201 return StartDocW(h, (DOCINFOW*) info);
379a3b04
BM
202 }
203 #else
204 inline int StartDoc(HDC h, CONST DOCINFOA* info)
205 {
d8c72298 206 return StartDocA(h, (DOCINFOA*) info);
379a3b04
BM
207 }
208 #endif
98216d40
VZ
209#endif
210
379a3b04
BM
211// GetObject
212
213#ifdef GetObject
214 #undef GetObject
215 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
216 {
217 #ifdef _UNICODE
218 return GetObjectW(h, i, buffer);
219 #else
220 return GetObjectA(h, i, buffer);
6ec9d18f
RD
221 #endif
222 }
223#endif
224
7cc98b3e 225// GetMessage
6ec9d18f
RD
226
227#ifdef GetMessage
228 #undef GetMessage
229 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
230 {
231 #ifdef _UNICODE
232 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
233 #else
234 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
235 #endif
379a3b04 236 }
e90babdf 237#endif
98216d40 238
7cc98b3e
VZ
239// LoadLibrary
240
241#ifdef LoadLibrary
242 #undef LoadLibrary
7cc98b3e 243 #ifdef _UNICODE
f6bcfd97
BP
244 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
245 {
7cc98b3e 246 return LoadLibraryW(lpLibFileName);
f6bcfd97 247 }
7cc98b3e 248 #else
f6bcfd97
BP
249 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
250 {
7cc98b3e 251 return LoadLibraryA(lpLibFileName);
7cc98b3e 252 }
f6bcfd97 253 #endif
7cc98b3e
VZ
254#endif
255
b568d04f
VZ
256// FindResource
257#ifdef FindResource
258 #undef FindResource
b568d04f 259 #ifdef _UNICODE
f6bcfd97
BP
260 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
261 {
b568d04f 262 return FindResourceW(hModule, lpName, lpType);
f6bcfd97 263 }
b568d04f 264 #else
f6bcfd97
BP
265 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
266 {
b568d04f 267 return FindResourceA(hModule, lpName, lpType);
b568d04f 268 }
f6bcfd97 269 #endif
b568d04f
VZ
270#endif
271
3372145d
PA
272// IsMaximized
273
274#ifdef IsMaximized
275 #undef IsMaximized
276 inline BOOL IsMaximized(HWND hwnd)
277 {
278 return IsZoomed(hwnd);
279 }
280#endif
281
2ba3d4f0
PA
282// GetFirstChild
283
284#ifdef GetFirstChild
285 #undef GetFirstChild
286 inline HWND GetFirstChild(HWND hwnd)
287 {
288 return GetTopWindow(hwnd);
289 }
290#endif
291
79bc2382
PA
292// GetPrevSibling
293
294#ifdef GetPrevSibling
295 #undef GetPrevSibling
296 inline HWND GetPrevSibling(HWND hwnd)
297 {
298 return GetWindow(hwnd,GW_HWNDPREV);
299 }
300#endif
301
302// GetNextSibling
303
304#ifdef GetNextSibling
305 #undef GetNextSibling
306 inline HWND GetNextSibling(HWND hwnd)
307 {
308 return GetWindow(hwnd,GW_HWNDNEXT);
309 }
310#endif
311
c455ab93
RR
312// For WINE
313
314#if defined(GetWindowStyle) || defined(__WXWINE__)
315 #undef GetWindowStyle
316#endif
98216d40 317
379a3b04 318// For ming and cygwin
6bbd3344 319
379a3b04
BM
320// GetFirstChild
321#ifdef GetFirstChild
322 #undef GetFirstChild
323 inline HWND GetFirstChild(HWND h)
324 {
325 return GetTopWindow(h);
326 }
327#endif
6bbd3344 328
98216d40 329
379a3b04
BM
330// GetNextSibling
331#ifdef GetNextSibling
0c589ad0
BM
332 #undef GetNextSibling
333 inline HWND GetNextSibling(HWND h)
334 {
335 return GetWindow(h, GW_HWNDNEXT);
336 }
98216d40
VZ
337#endif
338
73c13bb9
RD
339
340#ifdef Yield
341 #undef Yield
342#endif
343
379a3b04
BM
344// GetWindowProc
345//ifdef GetWindowProc
346// #undef GetWindowProc
347//endif
348//ifdef GetNextChild
349// #undef GetNextChild
350//endif
6bbd3344 351
25889d3c
JS
352// #endif // _WX_WINUNDEF_H_
353