]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dcprint.cpp
Generate key events in generic wxDataViewCtrl implementation.
[wxWidgets.git] / src / msw / dcprint.cpp
index 628e6e81b2217364fed0c46add04d756739c6603..9ca81119cbe74b2853c5ff5b781e776bc201fdd8 100644 (file)
@@ -83,7 +83,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name,
                          const wxString& device_name,
                          const wxString& file,
                          bool interactive,
-                         int orientation)
+                         wxPrintOrientation orientation)
 {
     m_isInteractive = interactive;
 
@@ -228,7 +228,7 @@ void wxPrinterDCImpl::EndPage()
 }
 
 
-wxRect wxPrinterDCImpl::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect() const
 
 {
     if (!IsOk()) return wxRect(0, 0, 0, 0);
@@ -327,16 +327,22 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
     }
 
 
-    HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetDevMode();
+    GlobalPtrLock lockDevMode;
+    const HGLOBAL devMode = data->GetDevMode();
+    if ( devMode )
+        lockDevMode.Init(devMode);
 
-    DEVMODE *lpDevMode = hDevMode ? (DEVMODE *)::GlobalLock(hDevMode) : NULL;
-
-    HDC hDC = ::CreateDC(NULL, deviceName.wx_str(), NULL, lpDevMode);
+    HDC hDC = ::CreateDC
+                (
+                    NULL,               // no driver name as we use device name
+                    deviceName.wx_str(),
+                    NULL,               // unused
+                    static_cast<DEVMODE *>(lockDevMode.Get())
+                );
     if ( !hDC )
-        wxLogLastError(_T("CreateDC(printer)"));
-
-    if ( lpDevMode )
-        ::GlobalUnlock(hDevMode);
+    {
+        wxLogLastError(wxT("CreateDC(printer)"));
+    }
 
     return (WXHDC) hDC;
 #endif // PostScript/Windows printing
@@ -361,7 +367,7 @@ bool DrawBitmapUsingStretchDIBits(HDC hdc,
     DIBSECTION ds;
     if ( !::GetObject(dib.GetHandle(), sizeof(ds), &ds) )
     {
-        wxLogLastError(_T("GetObject(DIBSECTION)"));
+        wxLogLastError(wxT("GetObject(DIBSECTION)"));
 
         return false;
     }
@@ -395,7 +401,7 @@ void wxPrinterDCImpl::DoDrawBitmap(const wxBitmap& bmp,
                                wxCoord x, wxCoord y,
                                bool useMask)
 {
-    wxCHECK_RET( bmp.Ok(), _T("invalid bitmap in wxPrinterDC::DrawBitmap") );
+    wxCHECK_RET( bmp.Ok(), wxT("invalid bitmap in wxPrinterDC::DrawBitmap") );
 
     int width = bmp.GetWidth(),
         height = bmp.GetHeight();
@@ -418,7 +424,7 @@ bool wxPrinterDCImpl::DoBlit(wxCoord xdest, wxCoord ydest,
                          wxCoord width, wxCoord height,
                          wxDC *source,
                          wxCoord WXUNUSED(xsrc), wxCoord WXUNUSED(ysrc),
-                         int WXUNUSED(rop), bool useMask,
+                         wxRasterOperationMode WXUNUSED(rop), bool useMask,
                          wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask))
 {
     wxDCImpl *impl = source->GetImpl();