]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/winundef.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: undefine the common symbols #define'd by <windows.h>
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
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
15 #ifndef _WX_WINUNDEF_H_
16 #define _WX_WINUNDEF_H_
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.
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 // ----------------------------------------------------------------------------
32 inline BOOL
GetCharWidth(HDC dc
, UINT first
, UINT last
, LPINT buffer
)
35 return GetCharWidthW(dc
, first
, last
, buffer
);
37 return GetCharWidthA(dc
, first
, last
, buffer
);
47 inline HWND
FindWindow(LPCWSTR classname
, LPCWSTR windowname
)
49 return FindWindowW(classname
, windowname
);
52 inline HWND
FindWindow(LPCSTR classname
, LPCSTR windowname
)
54 return FindWindowA(classname
, windowname
);
64 inline int GetClassName(HWND h
, LPWSTR classname
, int maxcount
)
66 return GetClassNameW(h
, classname
, maxcount
);
69 inline int GetClassName(HWND h
, LPSTR classname
, int maxcount
)
71 return GetClassNameA(h
, classname
, maxcount
);
81 inline BOOL
GetClassInfo(HINSTANCE h
, LPCWSTR name
, LPWNDCLASSW winclass
)
83 return GetClassInfoW(h
, name
, winclass
);
86 inline BOOL
GetClassInfo(HINSTANCE h
, LPCSTR name
, LPWNDCLASSA winclass
)
88 return GetClassInfoA(h
, name
, winclass
);
95 #ifdef LoadAccelerators
96 #undef LoadAccelerators
98 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCWSTR name
)
100 return LoadAcceleratorsW(h
, name
);
103 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCSTR name
)
105 return LoadAcceleratorsA(h
, name
);
115 inline int DrawText(HDC h
, LPCWSTR str
, int count
, LPRECT rect
, UINT format
)
117 return DrawTextW(h
, str
, count
, rect
, format
);
120 inline int DrawText(HDC h
, LPCSTR str
, int count
, LPRECT rect
, UINT format
)
122 return DrawTextA(h
, str
, count
, rect
, format
);
132 #define DOCINFOW DOCINFO
133 #define DOCINFOA DOCINFO
136 inline int StartDoc(HDC h
, CONST DOCINFOW
* info
)
138 return StartDocW(h
, info
);
141 inline int StartDoc(HDC h
, CONST DOCINFOA
* info
)
143 return StartDocA(h
, info
);
152 inline int GetObject(HGDIOBJ h
, int i
, LPVOID buffer
)
155 return GetObjectW(h
, i
, buffer
);
157 return GetObjectA(h
, i
, buffer
);
166 inline int GetMessage(LPMSG lpMsg
, HWND hWnd
, UINT wMsgFilterMin
, UINT wMsgFilterMax
)
169 return GetMessageW(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
171 return GetMessageA(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
180 inline HINSTANCE
LoadLibrary(LPCTSTR lpLibFileName
)
183 return LoadLibraryW(lpLibFileName
);
185 return LoadLibraryA(lpLibFileName
);
194 inline BOOL
IsMaximized(HWND hwnd
)
196 return IsZoomed(hwnd
);
204 inline HWND
GetFirstChild(HWND hwnd
)
206 return GetTopWindow(hwnd
);
212 #ifdef GetPrevSibling
213 #undef GetPrevSibling
214 inline HWND
GetPrevSibling(HWND hwnd
)
216 return GetWindow(hwnd
,GW_HWNDPREV
);
222 #ifdef GetNextSibling
223 #undef GetNextSibling
224 inline HWND
GetNextSibling(HWND hwnd
)
226 return GetWindow(hwnd
,GW_HWNDNEXT
);
232 #if defined(GetWindowStyle) || defined(__WXWINE__)
233 #undef GetWindowStyle
236 // For ming and cygwin
241 inline HWND
GetFirstChild(HWND h
)
243 return GetTopWindow(h
);
249 #ifdef GetNextSibling
250 #undef GetNextSibling
251 inline HWND
GetNextSibling(HWND h
)
253 return GetWindow(h
, GW_HWNDNEXT
);
258 //ifdef GetWindowProc
259 // #undef GetWindowProc
262 // #undef GetNextChild
265 // #endif // _WX_WINUNDEF_H_