+ //
+ // default under PM is that Window and Client DC's are the same
+ //
+ m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(pTheCanvas));
+ m_hPS = ::GpiCreatePS( wxGetInstance()
+ ,m_hDC
+ ,&vSizl
+ ,PU_PELS | GPIF_LONG | GPIA_ASSOC
+ );
+
+ // Set the wxWidgets color table
+ if (!::GpiCreateLogColorTable( m_hPS
+ ,0L
+ ,LCOLF_CONSECRGB
+ ,0L
+ ,(LONG)wxTheColourDatabase->m_nSize
+ ,(PLONG)wxTheColourDatabase->m_palTable
+ ))
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError(_T("Unable to set current color table (4). Error: %s\n"), sError.c_str());
+ }
+ ::GpiCreateLogColorTable( m_hPS
+ ,0L
+ ,LCOLF_RGB
+ ,0L
+ ,0L
+ ,NULL
+ );
+ //
+ // Set the DC/PS rectangle
+ //
+ ::WinQueryWindowRect( GetWinHwnd(m_pCanvas)
+ ,&m_vRclPaint
+ );
+ InitDC();
+} // end of wxClientDC::wxClientDC
+
+void wxClientDC::InitDC()
+{
+ wxWindowDC::InitDC();
+
+ // in wxUniv build we must manually do some DC adjustments usually
+ // performed by Windows for us
+#ifdef __WXUNIVERSAL__
+ wxPoint ptOrigin = m_pCanvas->GetClientAreaOrigin();
+ if ( ptOrigin.x || ptOrigin.y )
+ {
+ // no need to shift DC origin if shift is null
+ SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
+ }
+
+ // clip the DC to avoid overwriting the non client area
+ SetClippingRegion(wxPoint(0, 0), m_pCanvas->GetClientSize());
+#endif // __WXUNIVERSAL__
+} // end of wxClientDC::InitDC