added wxCHANGE_HDC_MAP_MODE to avoid #ifdef __WXWINCE__ everywhere
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -519,6 +519,41 @@ private:
|
||||
DECLARE_NO_COPY_CLASS(HDCClipper)
|
||||
};
|
||||
|
||||
// set the given map mode for the life time of this object
|
||||
//
|
||||
// NB: SetMapMode() is not supported by CE so we also define a helper macro
|
||||
// to avoid using it there
|
||||
#ifdef __WXWINCE__
|
||||
#define wxCHANGE_HDC_MAP_MODE(hdc, mm)
|
||||
#else // !__WXWINCE__
|
||||
class HDCMapModeChanger
|
||||
{
|
||||
public:
|
||||
HDCMapModeChanger(HDC hdc, int mm)
|
||||
: m_hdc(hdc)
|
||||
{
|
||||
m_modeOld = ::SetMapMode(hdc, mm);
|
||||
if ( !m_modeOld )
|
||||
wxLogLastError(_T("SelectClipRgn"));
|
||||
}
|
||||
|
||||
~HDCMapModeChanger()
|
||||
{
|
||||
if ( m_modeOld )
|
||||
::SetMapMode(m_hdc, m_modeOld);
|
||||
}
|
||||
|
||||
private:
|
||||
HDC m_hdc;
|
||||
int m_modeOld;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(HDCMapModeChanger)
|
||||
};
|
||||
|
||||
#define wxCHANGE_HDC_MAP_MODE(hdc, mm) \
|
||||
HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm)
|
||||
#endif // __WXWINCE__/!__WXWINCE__
|
||||
|
||||
// smart buffeer using GlobalAlloc/GlobalFree()
|
||||
class GlobalPtr
|
||||
{
|
||||
|
Reference in New Issue
Block a user