]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcbase.cpp
added vendor display name (for consistency with app display name &c) (patch 1831303)
[wxWidgets.git] / src / common / dcbase.cpp
index b04f5b7c40c27d7ded5ad9e2d9dd57070c806f15..be5eeb9578f5f7e0b66cb84861f80257f31c099a 100644 (file)
@@ -28,7 +28,9 @@
 #include "wx/dcclient.h"
 #include "wx/dcmemory.h"
 #include "wx/dcscreen.h"
+#include "wx/dcprint.h"
 #include "wx/dcbuffer.h" // for IMPLEMENT_DYNAMIC_CLASS
+#include "wx/prntbase.h"
 
 #ifndef WX_PRECOMP
     #include "wx/math.h"
@@ -334,31 +336,10 @@ wxImplDC* wxNativeDCFactory::CreateScreenDC( wxScreenDC *owner )
 #endif
 }
 
-wxImpleDC *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *ownder, const wxPrintData &data )
+wxImplDC *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data )
 {
-#if defined(__WXMSW__)
-    return new wxWindowsPrinterImplDC( owner );
-#elif defined(__WXGTK20__)
-    return new wxGTKPrinterImplDC( owner );
-#elif defined(__WXGTK__)
-    return new wxGTKPrinterImplDC( owner );
-#elif defined(__WXMAC__)
-    return new wxMacPrinterImplDC( owner );
-#elif defined(__WXCOCOA__)
-    return new wxCocoaPrinterImplDC( owner );
-#elif defined(__WXMOTIF__)
-    return new wxMotifPrinterImplDC( owner );
-#elif defined(__WXX11__)
-    return new wxX11PrinterImplDC( owner );
-#elif defined(__WXMGL__)
-    return new wxMGLPrinterImplDC( owner );
-#elif defined(__WXDFB__)
-    return new wxDFBPrinterImplDC( owner );
-#elif defined(__WXPM__)
-    return new wxPMPrinterImplDC( owner );
-#elif defined(__PALMOS__)
-    return new wxPalmPrinterImplDC( owner );
-#endif
+    wxPrintFactory *factory = wxPrintFactory::GetFactory();
+    return factory->CreatePrinterImplDC( owner, data );
 }
 
 //-----------------------------------------------------------------------------
@@ -429,50 +410,22 @@ void wxMemoryDC::SelectObject(wxBitmap& bmp)
     if (bmp.IsOk())
         bmp.UnShare();
 
-#ifdef __WXGTK__
-    wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
-    // TODO
-#endif
-    if (mem_pimpl)
-        mem_pimpl->DoSelect(bmp);
+    GetImpl()->DoSelect(bmp);
 }
 
 void wxMemoryDC::SelectObjectAsSource(const wxBitmap& bmp)
 {
-#ifdef __WXGTK__
-    wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
-    // TODO
-#endif
-    mem_pimpl->DoSelect(bmp);
+    GetImpl()->DoSelect(bmp);
 }
 
 const wxBitmap& wxMemoryDC::GetSelectedBitmap() const
 {
-#ifdef __WXGTK__
-    wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
-    // TODO
-#endif
-    if (mem_pimpl)
-        return mem_pimpl->DoGetSelectedBitmap();
-
-    return wxNullBitmap;    
+    return GetImpl()->GetSelectedBitmap();
 }
 
 wxBitmap& wxMemoryDC::GetSelectedBitmap()
 {
-#ifdef __WXGTK__
-    wxGTKMemoryImplDC *mem_pimpl = wxDynamicCast( m_pimpl, wxGTKMemoryImplDC );
-#else
-    // TODO
-#endif
-    
-    if (mem_pimpl)
-        return mem_pimpl->DoGetSelectedBitmap();
-   
-    return wxNullBitmap;    
+    return GetImpl()->GetSelectedBitmap();
 }
 
     
@@ -506,6 +459,39 @@ wxScreenDC::wxScreenDC()
     m_pimpl = factory->CreateScreenDC( this );
 }
 
+//-----------------------------------------------------------------------------
+// wxPrinterDC
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxPrinterDC, wxDC)
+
+wxPrinterDC::wxPrinterDC()
+{
+    wxDCFactory *factory = wxDCFactory::GetFactory();
+    // m_pimpl = factory->CreatePrinterDC( this, data );
+}
+
+wxPrinterDC::wxPrinterDC( const wxPrintData &data )
+{
+    wxDCFactory *factory = wxDCFactory::GetFactory();
+    m_pimpl = factory->CreatePrinterDC( this, data );
+}
+
+wxPrinterDC::~wxPrinterDC()
+{
+}
+
+wxRect wxPrinterDC::GetPaperRect()
+{
+    return GetImpl()->GetPaperRect();
+}
+
+int wxPrinterDC::GetResolution()
+{
+    return GetImpl()->GetResolution();
+}
+
+
 //-----------------------------------------------------------------------------
 // wxImplDC
 //-----------------------------------------------------------------------------
@@ -760,9 +746,9 @@ void wxImplDC::GetMultiLineTextExtent(const wxString& text,
             heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
 
     wxString curLine;
-    for ( const wxChar *pc = text; ; pc++ )
+    for ( wxString::const_iterator pc = text.begin(); ; ++pc )
     {
-        if ( *pc == _T('\n') || *pc == _T('\0') )
+        if ( pc == text.end() || *pc == _T('\n') )
         {
             if ( curLine.empty() )
             {
@@ -793,14 +779,13 @@ void wxImplDC::GetMultiLineTextExtent(const wxString& text,
                 heightTextTotal += heightLine;
             }
 
-            if ( *pc == _T('\n') )
+            if ( pc == text.end() )
             {
-               curLine.clear();
+               break;
             }
-            else
+            else // '\n'
             {
-               // the end of string
-               break;
+               curLine.clear();
             }
         }
         else
@@ -1089,6 +1074,7 @@ static bool wx_spline_add_point(double x, double y)
 
 static void wx_spline_draw_point_array(wxDC *dc)
 {
+    dc->DrawLines(&wx_spline_point_list, 0, 0 );
     wxPointList::compatibility_iterator node = wx_spline_point_list.GetFirst();
     while (node)
     {