]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/winundef.h
wxTipWindow is now a wxPopupTransientWindow instead of a wxFrame.
[wxWidgets.git] / include / wx / msw / winundef.h
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 // GetCharWidth
47
48 #ifdef GetCharWidth
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 }
58 #endif
59
60 // FindWindow
61
62 #ifdef FindWindow
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
75 #endif
76
77 // GetClassName
78
79 #ifdef GetClassName
80 #undef GetClassName
81 #ifdef _UNICODE
82 inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
83 {
84 return GetClassNameW(h, classname, maxcount);
85 }
86 #else
87 inline int GetClassName(HWND h, LPSTR classname, int maxcount)
88 {
89 return GetClassNameA(h, classname, maxcount);
90 }
91 #endif
92 #endif
93
94 // GetClassInfo
95
96 #ifdef GetClassInfo
97 #undef GetClassInfo
98 #ifdef _UNICODE
99 inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
100 {
101 return GetClassInfoW(h, name, winclass);
102 }
103 #else
104 inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass)
105 {
106 return GetClassInfoA(h, name, winclass);
107 }
108 #endif
109 #endif
110
111 // LoadAccelerators
112
113 #ifdef LoadAccelerators
114 #undef LoadAccelerators
115 #ifdef _UNICODE
116 inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
117 {
118 return LoadAcceleratorsW(h, name);
119 }
120 #else
121 inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name)
122 {
123 return LoadAcceleratorsA(h, name);
124 }
125 #endif
126 #endif
127
128 // DrawText
129
130 #ifdef DrawText
131 #undef DrawText
132 #ifdef _UNICODE
133 inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
134 {
135 return DrawTextW(h, str, count, rect, format);
136 }
137 #else
138 inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format)
139 {
140 return DrawTextA(h, str, count, rect, format);
141 }
142 #endif
143 #endif
144
145 // StartDoc
146
147 #ifdef StartDoc
148 #undef StartDoc
149 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
150 #define DOCINFOW DOCINFO
151 #define DOCINFOA DOCINFO
152 #endif
153 #ifdef _UNICODE
154 inline int StartDoc(HDC h, CONST DOCINFOW* info)
155 {
156 return StartDocW(h, (DOCINFOW*) info);
157 }
158 #else
159 inline int StartDoc(HDC h, CONST DOCINFOA* info)
160 {
161 return StartDocA(h, (DOCINFOA*) info);
162 }
163 #endif
164 #endif
165
166 // GetObject
167
168 #ifdef GetObject
169 #undef GetObject
170 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
171 {
172 #ifdef _UNICODE
173 return GetObjectW(h, i, buffer);
174 #else
175 return GetObjectA(h, i, buffer);
176 #endif
177 }
178 #endif
179
180 // GetMessage
181
182 #ifdef GetMessage
183 #undef GetMessage
184 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
185 {
186 #ifdef _UNICODE
187 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
188 #else
189 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
190 #endif
191 }
192 #endif
193
194 // LoadLibrary
195
196 #ifdef LoadLibrary
197 #undef LoadLibrary
198 #ifdef _UNICODE
199 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
200 {
201 return LoadLibraryW(lpLibFileName);
202 }
203 #else
204 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
205 {
206 return LoadLibraryA(lpLibFileName);
207 }
208 #endif
209 #endif
210
211 // FindResource
212 #ifdef FindResource
213 #undef FindResource
214 #ifdef _UNICODE
215 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
216 {
217 return FindResourceW(hModule, lpName, lpType);
218 }
219 #else
220 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
221 {
222 return FindResourceA(hModule, lpName, lpType);
223 }
224 #endif
225 #endif
226
227 // IsMaximized
228
229 #ifdef IsMaximized
230 #undef IsMaximized
231 inline BOOL IsMaximized(HWND hwnd)
232 {
233 return IsZoomed(hwnd);
234 }
235 #endif
236
237 // GetFirstChild
238
239 #ifdef GetFirstChild
240 #undef GetFirstChild
241 inline HWND GetFirstChild(HWND hwnd)
242 {
243 return GetTopWindow(hwnd);
244 }
245 #endif
246
247 // GetPrevSibling
248
249 #ifdef GetPrevSibling
250 #undef GetPrevSibling
251 inline HWND GetPrevSibling(HWND hwnd)
252 {
253 return GetWindow(hwnd,GW_HWNDPREV);
254 }
255 #endif
256
257 // GetNextSibling
258
259 #ifdef GetNextSibling
260 #undef GetNextSibling
261 inline HWND GetNextSibling(HWND hwnd)
262 {
263 return GetWindow(hwnd,GW_HWNDNEXT);
264 }
265 #endif
266
267 // For WINE
268
269 #if defined(GetWindowStyle) || defined(__WXWINE__)
270 #undef GetWindowStyle
271 #endif
272
273 // For ming and cygwin
274
275 // GetFirstChild
276 #ifdef GetFirstChild
277 #undef GetFirstChild
278 inline HWND GetFirstChild(HWND h)
279 {
280 return GetTopWindow(h);
281 }
282 #endif
283
284
285 // GetNextSibling
286 #ifdef GetNextSibling
287 #undef GetNextSibling
288 inline HWND GetNextSibling(HWND h)
289 {
290 return GetWindow(h, GW_HWNDNEXT);
291 }
292 #endif
293
294
295 #ifdef Yield
296 #undef Yield
297 #endif
298
299 // GetWindowProc
300 //ifdef GetWindowProc
301 // #undef GetWindowProc
302 //endif
303 //ifdef GetNextChild
304 // #undef GetNextChild
305 //endif
306
307 // #endif // _WX_WINUNDEF_H_
308