]> git.saurik.com Git - wxWidgets.git/commitdiff
Use a local copy of the old wxBufferedDC classes until the ones in the
authorRobin Dunn <robin@alldunn.com>
Sat, 21 Feb 2004 01:53:46 +0000 (01:53 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 21 Feb 2004 01:53:46 +0000 (01:53 +0000)
C++ library are fixed again.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25889 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/include/wx/wxPython/wxPython_int.h
wxPython/src/_dc.i

index 9fb470f26824e69f10271e23c6aa84a72132b472..8929f3aef029e8f28d2507fed5a2a84065f1795f 100644 (file)
@@ -24,7 +24,6 @@
 #include <wx/colordlg.h>
 #include <wx/config.h>
 #include <wx/cshelp.h>
-#include <wx/dcbuffer.h>
 #include <wx/dcmirror.h>
 #include <wx/dcps.h>
 #include <wx/dirctrl.h>
index d359bbdbabdc6e354648d8bc1ea299c1118e53ad..b21b3dffffbdd807d12f86be5505c3cda4ef458c 100644 (file)
@@ -570,6 +570,97 @@ public:
 %newgroup
 
 
+%{
+//-=-=-=-=-=-=-=-=-=-=-    
+#if 0
+#include <wx/dcbuffer.h>
+#else
+
+
+//  Temporarily put a set of classes here similar to the old buffered DC
+//  classes until the real ones can be fixed to work "correctly" again.
+
+class wxBufferedDC : public wxMemoryDC
+{
+private:
+    wxDC        *m_dc;
+    wxBitmap    m_buffer;
+
+public:
+
+    wxBufferedDC() : m_dc( 0 ) {}
+    
+    wxBufferedDC( wxDC *dc, const wxBitmap &buffer )
+        : m_dc( dc ), m_buffer( buffer )
+    {
+        SelectObject( m_buffer );
+    }
+       
+    wxBufferedDC( wxDC *dc, const wxSize &area )
+        : m_dc( dc ), m_buffer( area.GetWidth(), area.GetHeight() )
+    {
+        SelectObject( m_buffer );
+    }
+
+    ~wxBufferedDC() {
+        if( m_dc != 0 )
+            UnMask();
+    }
+
+
+    void Init( wxDC *dc, const wxBitmap &buffer ) {
+        wxASSERT_MSG( m_dc == 0 && m_buffer == wxNullBitmap,
+                      _T("wxBufferedDC already initialised") );
+        m_dc = dc;
+        m_buffer = buffer;
+        SelectObject( m_buffer );
+    }
+
+    void Init( wxDC *dc, const wxSize &area ) {
+        wxASSERT_MSG( m_dc == 0 && m_buffer == wxNullBitmap,
+                      _T("wxBufferedDC already initialised") );
+        m_dc = dc;
+        m_buffer = wxBitmap( area.GetWidth(), area.GetHeight() );
+        SelectObject( m_buffer );
+    }
+
+    void UnMask() {
+        wxASSERT_MSG( m_dc != 0, _T("No low level DC associated with buffer (anymore)") );
+        m_dc->Blit( 0, 0, m_buffer.GetWidth(), m_buffer.GetHeight(), this, 0, 0 );
+        m_dc = 0;
+    }
+};
+
+class wxBufferedPaintDC : public wxBufferedDC
+{
+private:
+    wxPaintDC    m_paintdc;
+
+public:
+    wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap )
+        : m_paintdc( window )
+    {
+        window->PrepareDC( m_paintdc );
+
+        if( buffer != wxNullBitmap )
+            Init( &m_paintdc, buffer );
+        else
+            Init( &m_paintdc, window->GetClientSize() );
+    }
+        
+    ~wxBufferedPaintDC() {
+        UnMask();
+    }
+};
+
+#endif
+//-=-=-=-=-=-=-=-=-=-=-    
+%}
+
+
+
+
 class wxBufferedDC : public wxMemoryDC
 {
 public:
@@ -614,7 +705,7 @@ class wxBufferedPaintDC : public wxBufferedDC
 {
 public:
 
-    // If no bitmap is supplied by the user, a temporary one wil; be created.
+    // If no bitmap is supplied by the user, a temporary one will be created.
     wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
 
 };