]>
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
);
192 #if defined(GetWindowStyle) || defined(__WXWINE__)
193 #undef GetWindowStyle
196 // For ming and cygwin
201 inline HWND
GetFirstChild(HWND h
)
203 return GetTopWindow(h
);
209 #ifdef GetNextSibling
210 #undef GetNextSibling
211 inline HWND
GetNextSibling(HWND h
)
213 return GetWindow(h
, GW_HWNDNEXT
);
218 //ifdef GetWindowProc
219 // #undef GetWindowProc
222 // #undef GetNextChild
225 // #endif // _WX_WINUNDEF_H_