]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlwin.cpp
added possibility to throw different objects and crash directly from the main frame...
[wxWidgets.git] / src / html / htmlwin.cpp
index 6acacdb8f63c2373a4e74e1f3a7e34d3f8ee8924..c89834231ecb937ef598ddf2c01be2aca7302d02 100644 (file)
@@ -848,8 +848,13 @@ void wxHtmlWindow::OnCellMouseHover(wxHtmlCell * WXUNUSED(cell),
     // do nothing here
 }
 
-void wxHtmlWindow::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
+void wxHtmlWindow::OnEraseBackground(wxEraseEvent& event)
 {
+    // we do have to erase background now that we reuse it (instead of
+    // overwriting it) in OnPaint() below, but maybe we should set some flag if
+    // we get here as this would mean that user code doesn't paint background
+    // itself and then we wouldn't have to copy old bits to dcm below...
+    event.Skip();
 }
 
 void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
@@ -867,9 +872,16 @@ void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
     if ( !m_backBuffer )
         m_backBuffer = new wxBitmap(sz.x, sz.y);
     dcm.SelectObject(*m_backBuffer);
-    dcm.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
-    dcm.Clear();
     PrepareDC(dcm);
+
+    // preserve the existing background, otherwise we'd erase anything the user
+    // code had drawn in its EVT_ERASE_BACKGROUND handler when we do the Blit
+    // back below
+    dcm.Blit(0, rect.GetTop(),
+             sz.x, rect.GetBottom() - rect.GetTop() + 1,
+             &dc,
+             0, rect.GetTop());
+
     dcm.SetMapMode(wxMM_TEXT);
     dcm.SetBackgroundMode(wxTRANSPARENT);