]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/winundef.h
Fixes from Mumit Khan to allow DLL compilation; most fixes related to
[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 // GetCharWidth
29
30 #ifdef GetCharWidth
31 #undef GetCharWidth
32 inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer)
33 {
34 #ifdef _UNICODE
35 return GetCharWidthW(dc, first, last, buffer);
36 #else
37 return GetCharWidthA(dc, first, last, buffer);
38 #endif
39 }
40 #endif
41
42 // FindWindow
43
44 #ifdef FindWindow
45 #undef FindWindow
46 #ifdef _UNICODE
47 inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
48 {
49 return FindWindowW(classname, windowname);
50 }
51 #else
52 inline HWND FindWindow(LPCSTR classname, LPCSTR windowname)
53 {
54 return FindWindowA(classname, windowname);
55 }
56 #endif
57 #endif
58
59 // GetClassName
60
61 #ifdef GetClassName
62 #undef GetClassName
63 #ifdef _UNICODE
64 inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
65 {
66 return GetClassNameW(h, classname, maxcount);
67 }
68 #else
69 inline int GetClassName(HWND h, LPSTR classname, int maxcount)
70 {
71 return GetClassNameA(h, classname, maxcount);
72 }
73 #endif
74 #endif
75
76 // GetClassInfo
77
78 #ifdef GetClassInfo
79 #undef GetClassInfo
80 #ifdef _UNICODE
81 inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
82 {
83 return GetClassInfoW(h, name, winclass);
84 }
85 #else
86 inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass)
87 {
88 return GetClassInfoA(h, name, winclass);
89 }
90 #endif
91 #endif
92
93 // LoadAccelerators
94
95 #ifdef LoadAccelerators
96 #undef LoadAccelerators
97 #ifdef _UNICODE
98 inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
99 {
100 return LoadAcceleratorsW(h, name);
101 }
102 #else
103 inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name)
104 {
105 return LoadAcceleratorsA(h, name);
106 }
107 #endif
108 #endif
109
110 // DrawText
111
112 #ifdef DrawText
113 #undef DrawText
114 #ifdef _UNICODE
115 inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
116 {
117 return DrawTextW(h, str, count, rect, format);
118 }
119 #else
120 inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format)
121 {
122 return DrawTextA(h, str, count, rect, format);
123 }
124 #endif
125 #endif
126
127 // StartDoc
128
129 #ifdef StartDoc
130 #undef StartDoc
131 #ifdef __GNUG__
132 #define DOCINFOW DOCINFO
133 #define DOCINFOA DOCINFO
134 #endif
135 #ifdef _UNICODE
136 inline int StartDoc(HDC h, CONST DOCINFOW* info)
137 {
138 return StartDocW(h, info);
139 }
140 #else
141 inline int StartDoc(HDC h, CONST DOCINFOA* info)
142 {
143 return StartDocA(h, info);
144 }
145 #endif
146 #endif
147
148 // GetObject
149
150 #ifdef GetObject
151 #undef GetObject
152 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
153 {
154 #ifdef _UNICODE
155 return GetObjectW(h, i, buffer);
156 #else
157 return GetObjectA(h, i, buffer);
158 #endif
159 }
160 #endif
161
162 // GetMessage
163
164 #ifdef GetMessage
165 #undef GetMessage
166 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
167 {
168 #ifdef _UNICODE
169 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
170 #else
171 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
172 #endif
173 }
174 #endif
175
176 // LoadLibrary
177
178 #ifdef LoadLibrary
179 #undef LoadLibrary
180 inline HINSTANCE LoadLibrary(LPCTSTR lpLibFileName)
181 {
182 #ifdef _UNICODE
183 return LoadLibraryW(lpLibFileName);
184 #else
185 return LoadLibraryA(lpLibFileName);
186 #endif
187 }
188 #endif
189
190 // FindResource
191 #ifdef FindResource
192 #undef FindResource
193 inline HRSRC FindResource(HMODULE hModule, LPCTSTR lpName, LPCTSTR lpType)
194 {
195 #ifdef _UNICODE
196 return FindResourceW(hModule, lpName, lpType);
197 #else
198 return FindResourceA(hModule, lpName, lpType);
199 #endif
200 }
201 #endif
202
203 // IsMaximized
204
205 #ifdef IsMaximized
206 #undef IsMaximized
207 inline BOOL IsMaximized(HWND hwnd)
208 {
209 return IsZoomed(hwnd);
210 }
211 #endif
212
213 // GetFirstChild
214
215 #ifdef GetFirstChild
216 #undef GetFirstChild
217 inline HWND GetFirstChild(HWND hwnd)
218 {
219 return GetTopWindow(hwnd);
220 }
221 #endif
222
223 // GetPrevSibling
224
225 #ifdef GetPrevSibling
226 #undef GetPrevSibling
227 inline HWND GetPrevSibling(HWND hwnd)
228 {
229 return GetWindow(hwnd,GW_HWNDPREV);
230 }
231 #endif
232
233 // GetNextSibling
234
235 #ifdef GetNextSibling
236 #undef GetNextSibling
237 inline HWND GetNextSibling(HWND hwnd)
238 {
239 return GetWindow(hwnd,GW_HWNDNEXT);
240 }
241 #endif
242
243 // For WINE
244
245 #if defined(GetWindowStyle) || defined(__WXWINE__)
246 #undef GetWindowStyle
247 #endif
248
249 // For ming and cygwin
250
251 // GetFirstChild
252 #ifdef GetFirstChild
253 #undef GetFirstChild
254 inline HWND GetFirstChild(HWND h)
255 {
256 return GetTopWindow(h);
257 }
258 #endif
259
260
261 // GetNextSibling
262 #ifdef GetNextSibling
263 #undef GetNextSibling
264 inline HWND GetNextSibling(HWND h)
265 {
266 return GetWindow(h, GW_HWNDNEXT);
267 }
268 #endif
269
270 // GetWindowProc
271 //ifdef GetWindowProc
272 // #undef GetWindowProc
273 //endif
274 //ifdef GetNextChild
275 // #undef GetNextChild
276 //endif
277
278 // #endif // _WX_WINUNDEF_H_
279