]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/winundef.h
Add a Get and Set for an OS/2 PS
[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
BM
27
28// GetCharWidth
29
98216d40 30#ifdef GetCharWidth
379a3b04
BM
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 }
e90babdf 40#endif
6bbd3344
BM
41
42// FindWindow
43
98216d40 44#ifdef FindWindow
379a3b04
BM
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
e90babdf 57#endif
6bbd3344
BM
58
59// GetClassName
60
98216d40 61#ifdef GetClassName
379a3b04
BM
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
e90babdf 74#endif
6bbd3344
BM
75
76// GetClassInfo
77
98216d40 78#ifdef GetClassInfo
379a3b04
BM
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
e90babdf 91#endif
6bbd3344
BM
92
93// LoadAccelerators
94
98216d40 95#ifdef LoadAccelerators
379a3b04
BM
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
98216d40 108#endif
6bbd3344
BM
109
110// DrawText
111
98216d40 112#ifdef DrawText
379a3b04
BM
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
e90babdf 125#endif
6bbd3344
BM
126
127// StartDoc
128
98216d40 129#ifdef StartDoc
379a3b04 130 #undef StartDoc
0470b1e6 131 #ifdef __GNUG__
0c589ad0
BM
132 #define DOCINFOW DOCINFO
133 #define DOCINFOA DOCINFO
134 #endif
379a3b04
BM
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
98216d40
VZ
146#endif
147
379a3b04
BM
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);
6ec9d18f
RD
158 #endif
159 }
160#endif
161
7cc98b3e 162// GetMessage
6ec9d18f
RD
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
379a3b04 173 }
e90babdf 174#endif
98216d40 175
7cc98b3e
VZ
176// LoadLibrary
177
178#ifdef LoadLibrary
179 #undef LoadLibrary
7cc98b3e 180 #ifdef _UNICODE
f6bcfd97
BP
181 inline HINSTANCE LoadLibrary(LPCWSTR lpLibFileName)
182 {
7cc98b3e 183 return LoadLibraryW(lpLibFileName);
f6bcfd97 184 }
7cc98b3e 185 #else
f6bcfd97
BP
186 inline HINSTANCE LoadLibrary(LPCSTR lpLibFileName)
187 {
7cc98b3e 188 return LoadLibraryA(lpLibFileName);
7cc98b3e 189 }
f6bcfd97 190 #endif
7cc98b3e
VZ
191#endif
192
b568d04f
VZ
193// FindResource
194#ifdef FindResource
195 #undef FindResource
b568d04f 196 #ifdef _UNICODE
f6bcfd97
BP
197 inline HRSRC FindResource(HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType)
198 {
b568d04f 199 return FindResourceW(hModule, lpName, lpType);
f6bcfd97 200 }
b568d04f 201 #else
f6bcfd97
BP
202 inline HRSRC FindResource(HMODULE hModule, LPCSTR lpName, LPCSTR lpType)
203 {
b568d04f 204 return FindResourceA(hModule, lpName, lpType);
b568d04f 205 }
f6bcfd97 206 #endif
b568d04f
VZ
207#endif
208
3372145d
PA
209// IsMaximized
210
211#ifdef IsMaximized
212 #undef IsMaximized
213 inline BOOL IsMaximized(HWND hwnd)
214 {
215 return IsZoomed(hwnd);
216 }
217#endif
218
2ba3d4f0
PA
219// GetFirstChild
220
221#ifdef GetFirstChild
222 #undef GetFirstChild
223 inline HWND GetFirstChild(HWND hwnd)
224 {
225 return GetTopWindow(hwnd);
226 }
227#endif
228
79bc2382
PA
229// GetPrevSibling
230
231#ifdef GetPrevSibling
232 #undef GetPrevSibling
233 inline HWND GetPrevSibling(HWND hwnd)
234 {
235 return GetWindow(hwnd,GW_HWNDPREV);
236 }
237#endif
238
239// GetNextSibling
240
241#ifdef GetNextSibling
242 #undef GetNextSibling
243 inline HWND GetNextSibling(HWND hwnd)
244 {
245 return GetWindow(hwnd,GW_HWNDNEXT);
246 }
247#endif
248
c455ab93
RR
249// For WINE
250
251#if defined(GetWindowStyle) || defined(__WXWINE__)
252 #undef GetWindowStyle
253#endif
98216d40 254
379a3b04 255// For ming and cygwin
6bbd3344 256
379a3b04
BM
257// GetFirstChild
258#ifdef GetFirstChild
259 #undef GetFirstChild
260 inline HWND GetFirstChild(HWND h)
261 {
262 return GetTopWindow(h);
263 }
264#endif
6bbd3344 265
98216d40 266
379a3b04
BM
267// GetNextSibling
268#ifdef GetNextSibling
0c589ad0
BM
269 #undef GetNextSibling
270 inline HWND GetNextSibling(HWND h)
271 {
272 return GetWindow(h, GW_HWNDNEXT);
273 }
98216d40
VZ
274#endif
275
379a3b04
BM
276// GetWindowProc
277//ifdef GetWindowProc
278// #undef GetWindowProc
279//endif
280//ifdef GetNextChild
281// #undef GetNextChild
282//endif
6bbd3344 283
25889d3c
JS
284// #endif // _WX_WINUNDEF_H_
285