]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/winundef.h
Unicode fix.
[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
VZ
18
19// windows.h #defines the following identifiers which are also used in wxWin
6bbd3344
BM
20
21// GetCharWidth
22
98216d40 23#ifdef GetCharWidth
379a3b04
BM
24 #undef GetCharWidth
25 inline BOOL GetCharWidth(HDC dc, UINT first, UINT last, LPINT buffer)
26 {
27 #ifdef _UNICODE
28 return GetCharWidthW(dc, first, last, buffer);
29 #else
30 return GetCharWidthA(dc, first, last, buffer);
31 #endif
32 }
e90babdf 33#endif
6bbd3344
BM
34
35// FindWindow
36
98216d40 37#ifdef FindWindow
379a3b04
BM
38 #undef FindWindow
39 #ifdef _UNICODE
40 inline HWND FindWindow(LPCWSTR classname, LPCWSTR windowname)
41 {
42 return FindWindowW(classname, windowname);
43 }
44 #else
45 inline HWND FindWindow(LPCSTR classname, LPCSTR windowname)
46 {
47 return FindWindowA(classname, windowname);
48 }
49 #endif
e90babdf 50#endif
6bbd3344
BM
51
52// GetClassName
53
98216d40 54#ifdef GetClassName
379a3b04
BM
55 #undef GetClassName
56 #ifdef _UNICODE
57 inline int GetClassName(HWND h, LPWSTR classname, int maxcount)
58 {
59 return GetClassNameW(h, classname, maxcount);
60 }
61 #else
62 inline int GetClassName(HWND h, LPSTR classname, int maxcount)
63 {
64 return GetClassNameA(h, classname, maxcount);
65 }
66 #endif
e90babdf 67#endif
6bbd3344
BM
68
69// GetClassInfo
70
98216d40 71#ifdef GetClassInfo
379a3b04
BM
72 #undef GetClassInfo
73 #ifdef _UNICODE
74 inline BOOL GetClassInfo(HINSTANCE h, LPCWSTR name, LPWNDCLASSW winclass)
75 {
76 return GetClassInfoW(h, name, winclass);
77 }
78 #else
79 inline BOOL GetClassInfo(HINSTANCE h, LPCSTR name, LPWNDCLASSA winclass)
80 {
81 return GetClassInfoA(h, name, winclass);
82 }
83 #endif
e90babdf 84#endif
6bbd3344
BM
85
86// LoadAccelerators
87
98216d40 88#ifdef LoadAccelerators
379a3b04
BM
89 #undef LoadAccelerators
90 #ifdef _UNICODE
91 inline HACCEL LoadAccelerators(HINSTANCE h, LPCWSTR name)
92 {
93 return LoadAcceleratorsW(h, name);
94 }
95 #else
96 inline HACCEL LoadAccelerators(HINSTANCE h, LPCSTR name)
97 {
98 return LoadAcceleratorsA(h, name);
99 }
100 #endif
98216d40 101#endif
6bbd3344
BM
102
103// DrawText
104
98216d40 105#ifdef DrawText
379a3b04
BM
106 #undef DrawText
107 #ifdef _UNICODE
108 inline int DrawText(HDC h, LPCWSTR str, int count, LPRECT rect, UINT format)
109 {
110 return DrawTextW(h, str, count, rect, format);
111 }
112 #else
113 inline int DrawText(HDC h, LPCSTR str, int count, LPRECT rect, UINT format)
114 {
115 return DrawTextA(h, str, count, rect, format);
116 }
117 #endif
e90babdf 118#endif
6bbd3344
BM
119
120// StartDoc
121
98216d40 122#ifdef StartDoc
379a3b04 123 #undef StartDoc
25889d3c 124 #ifdef __GNUWIN32__
0c589ad0
BM
125 #define DOCINFOW DOCINFO
126 #define DOCINFOA DOCINFO
127 #endif
379a3b04
BM
128 #ifdef _UNICODE
129 inline int StartDoc(HDC h, CONST DOCINFOW* info)
130 {
131 return StartDocW(h, info);
132 }
133 #else
134 inline int StartDoc(HDC h, CONST DOCINFOA* info)
135 {
136 return StartDocA(h, info);
137 }
138 #endif
98216d40
VZ
139#endif
140
379a3b04
BM
141// GetObject
142
143#ifdef GetObject
144 #undef GetObject
145 inline int GetObject(HGDIOBJ h, int i, LPVOID buffer)
146 {
147 #ifdef _UNICODE
148 return GetObjectW(h, i, buffer);
149 #else
150 return GetObjectA(h, i, buffer);
6ec9d18f
RD
151 #endif
152 }
153#endif
154
155
156#ifdef GetMessage
157 #undef GetMessage
158 inline int GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
159 {
160 #ifdef _UNICODE
161 return GetMessageW(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
162 #else
163 return GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
164 #endif
379a3b04 165 }
e90babdf 166#endif
98216d40 167
c455ab93
RR
168// For WINE
169
170#if defined(GetWindowStyle) || defined(__WXWINE__)
171 #undef GetWindowStyle
172#endif
98216d40 173
379a3b04 174// For ming and cygwin
6bbd3344 175
379a3b04
BM
176// GetFirstChild
177#ifdef GetFirstChild
178 #undef GetFirstChild
179 inline HWND GetFirstChild(HWND h)
180 {
181 return GetTopWindow(h);
182 }
183#endif
6bbd3344 184
98216d40 185
379a3b04
BM
186// GetNextSibling
187#ifdef GetNextSibling
0c589ad0
BM
188 #undef GetNextSibling
189 inline HWND GetNextSibling(HWND h)
190 {
191 return GetWindow(h, GW_HWNDNEXT);
192 }
98216d40
VZ
193#endif
194
379a3b04
BM
195// GetWindowProc
196//ifdef GetWindowProc
197// #undef GetWindowProc
198//endif
199//ifdef GetNextChild
200// #undef GetNextChild
201//endif
6bbd3344 202
25889d3c
JS
203// #endif // _WX_WINUNDEF_H_
204