]> git.saurik.com Git - wxWidgets.git/commitdiff
Deprecate wxDC::{Begin,End}Drawing()
authorJamie Gadd <jrgadd2@cs.latrobe.edu.au>
Sun, 5 Feb 2006 11:59:59 +0000 (11:59 +0000)
committerJamie Gadd <jrgadd2@cs.latrobe.edu.au>
Sun, 5 Feb 2006 11:59:59 +0000 (11:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

21 files changed:
contrib/samples/ogl/ogledit/view.cpp
contrib/src/gizmos/ledctrl.cpp
contrib/src/gizmos/statpict.cpp
contrib/src/stc/ScintillaWX.cpp
demos/life/life.cpp
docs/latex/wx/dc.tex
include/wx/dc.h
include/wx/generic/dcpsg.h
include/wx/gtk/gnome/gprint.h
samples/rotate/rotate.cpp
src/common/dcbase.cpp
src/generic/colrdlgg.cpp
src/generic/listctrl.cpp
src/msw/dcmemory.cpp
src/msw/metafile.cpp
src/msw/ole/activex.cpp
src/msw/window.cpp
src/os2/dcmemory.cpp
src/os2/metafile.cpp
src/os2/window.cpp
src/stc/ScintillaWX.cpp

index dcf1ac3e0930f2462150f8753e54de7b8a7faed3..4ada8beebe11e5dd633a7a5776809a83c26bfd9a 100644 (file)
@@ -118,7 +118,6 @@ void DiagramView::OnDraw(wxDC *dc)
 
   // This part was added to preform the print preview and printing functions
 
-  dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows.
   wxDiagram *diagram_p=((DiagramDocument*)GetDocument())->GetDiagram();  // Get the current diagram
   if (diagram_p->GetShapeList())
   {
@@ -135,7 +134,6 @@ void DiagramView::OnDraw(wxDC *dc)
         current = current->GetNext();  // Procede to the next shape in the list
     }
   }
-  dc->EndDrawing(); // Allows optimization of drawing code under MS Windows.
 }
 
 void DiagramView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
index 0d87f8c1c7542187d803c538cf3e87ea7d8bde69..458af3f4cc35dee5bc1a0618543905e0e4ad8dfe 100644 (file)
@@ -174,7 +174,6 @@ void wxLEDNumberCtrl::OnPaint(wxPaintEvent &WXUNUSED(event))
     wxMemoryDC MemDc;
 
     MemDc.SelectObject(*pMemoryBitmap);
-    MemDc.BeginDrawing();
 
     // Draw background.
     MemDc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
@@ -241,8 +240,6 @@ void wxLEDNumberCtrl::OnPaint(wxPaintEvent &WXUNUSED(event))
         }
     }
 
-    MemDc.EndDrawing();
-
     // Blit the memory dc to screen.
     Dc.Blit(0, 0, Width, Height, &MemDc, 0, 0, wxCOPY);
     delete pMemoryBitmap;
index f6b97869df33423583cf8ca04fc0bb448656cca5..a6fd9f768eaec819706f88adddd6f2a59bd21076 100644 (file)
@@ -89,7 +89,6 @@ void wxStaticPicture::OnPaint(wxPaintEvent& WXUNUSED(event))
 
     wxPaintDC dc( this );
     PrepareDC( dc );
-    dc.BeginDrawing();
 
     wxSize sz = GetSize();
     wxSize bmpsz( Bitmap.GetWidth(), Bitmap.GetHeight() );
@@ -145,7 +144,5 @@ void wxStaticPicture::OnPaint(wxPaintEvent& WXUNUSED(event))
     }
     else
         dc.DrawBitmap( Bitmap, pos.x, pos.y );
-
-    dc.EndDrawing();
 }
 
index 07d8349199d693e5284c15f1cc56893547b7b527..a5e5c668045d5dd3642eb4b8dce9c98b0c8c29bc 100644 (file)
@@ -678,7 +678,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
     PRectangle rcClient = GetClientRectangle();
     paintingAllText = rcPaint.Contains(rcClient);
 
-    dc->BeginDrawing();
     ClipChildren(*dc, rcPaint);
     Paint(surfaceWindow, rcPaint);
 
@@ -689,7 +688,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
         FullPaint();
     }
     paintState = notPainting;
-    dc->EndDrawing();
 }
 
 
index cc61369e11d33ff90313acfc6cf3beef62a43ac0..dc1ca609fa925072dbac777ea2ae9c45323d4139 100644 (file)
@@ -771,9 +771,7 @@ void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, bool alive)
     dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN);
     dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH);
 
-    dc.BeginDrawing();
     DrawCell(i, j, dc);
-    dc.EndDrawing();
 }
 
 void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, wxDC &dc)
@@ -810,8 +808,6 @@ void LifeCanvas::DrawChanged()
                       m_viewportY + m_viewportH,
                       true);
 
-    dc.BeginDrawing();
-
     if (m_cellsize == 1)
     {
         dc.SetPen(*wxBLACK_PEN);
@@ -830,7 +826,6 @@ void LifeCanvas::DrawChanged()
         for (size_t m = 0; m < ncells; m++)
             DrawCell(cells[m].i, cells[m].j, dc);
     }
-    dc.EndDrawing();
 }
 
 // event handlers
@@ -859,7 +854,6 @@ void LifeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
     bool done = m_life->FindMore(&cells, &ncells);
 
     // erase all damaged cells and draw the grid
-    dc.BeginDrawing();
     dc.SetBrush(*wxWHITE_BRUSH);
 
     if (m_cellsize <= 2)
@@ -897,8 +891,6 @@ void LifeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
     // last set
     for (size_t m = 0; m < ncells; m++)
         DrawCell(cells[m].i, cells[m].j, dc);
-
-    dc.EndDrawing();
 }
 
 void LifeCanvas::OnMouse(wxMouseEvent& event)
@@ -951,7 +943,6 @@ void LifeCanvas::OnMouse(wxMouseEvent& event)
         wxClientDC dc(this);
         dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN);
         dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH);
-        dc.BeginDrawing();
 
         // draw a line of cells using Bresenham's algorithm
         wxInt32 d, ii, jj, di, ai, si, dj, aj, sj;
@@ -1007,8 +998,6 @@ void LifeCanvas::OnMouse(wxMouseEvent& event)
         DrawCell(ii, jj, dc);
         m_mi = ii;
         m_mj = jj;
-
-        dc.EndDrawing();
     }
 
     ((LifeFrame *) wxGetApp().GetTopWindow())->UpdateInfoText();
index a1ee49c5d652970985a415dd65e53170810523ed..6ee2cd24e6eda75ba4975c24ddb9c4a6e2087be6 100644 (file)
@@ -33,22 +33,6 @@ them.
 \latexignore{\rtfignore{\wxheading{Members}}}
 
 
-\membersection{wxDC::BeginDrawing}\label{wxdcbegindrawing}
-
-\func{void}{BeginDrawing}{\void}
-
-Allows optimization of drawing code under MS Windows. Enclose
-drawing primitives between {\bf BeginDrawing} and {\bf EndDrawing}\rtfsp
-calls.
-
-Drawing to a wxDialog panel device context outside of a
-system-generated OnPaint event {\it requires} this pair of calls to
-enclose drawing code. This is because a Windows dialog box does not have
-a retained device context associated with it, and selections such as pen
-and brush settings would be lost if the device context were obtained and
-released for each drawing operation.
-
-
 \membersection{wxDC::Blit}\label{wxdcblit}
 
 \func{bool}{Blit}{\param{wxCoord}{ xdest}, \param{wxCoord}{ ydest}, \param{wxCoord}{ width}, \param{wxCoord}{ height},
@@ -556,15 +540,6 @@ wxUSE\_DC\_CACHEING preprocessor symbol for portability.
 Ends a document (only relevant when outputting to a printer).
 
 
-\membersection{wxDC::EndDrawing}\label{wxdcenddrawing}
-
-\func{void}{EndDrawing}{\void}
-
-Allows optimization of drawing code under MS Windows. Enclose
-drawing primitives between {\bf BeginDrawing} and {\bf EndDrawing}\rtfsp
-calls.
-
-
 \membersection{wxDC::EndPage}\label{wxdcendpage}
 
 \func{void}{EndPage}{\void}
index a95bd99da478c6726a1df9550107e98762e72d78..4924efc592bcd93857119619cb7d009da3acacde 100644 (file)
@@ -136,8 +136,10 @@ public:
 
     ~wxDCBase() { }
 
-    virtual void BeginDrawing() { }
-    virtual void EndDrawing() { }
+#if WXWIN_COMPATIBILITY_2_6
+    wxDEPRECATED( virtual void BeginDrawing() );
+    wxDEPRECATED( virtual void EndDrawing() );
+#endif // WXWIN_COMPATIBILITY_2_6
 
     // graphic primitives
     // ------------------
index 6dfc6804b513f64eaa8b7cbc9d0620e46ef5188f..e3186aabb40cc5f164c4883b9b40bc75be5c0aa3 100644 (file)
@@ -44,9 +44,6 @@ public:
 
   virtual bool Ok() const;
 
-  virtual void BeginDrawing() {}
-  virtual void EndDrawing() {}
-
   bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
   bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
 
index 80189e3561981eb5dda09f88cfceb7ca4fab71ee..9397e2f3af9d8f14cd3ae93808519f00aa2de5f1 100644 (file)
@@ -202,9 +202,6 @@ public:
 
     bool Ok() const;
 
-    virtual void BeginDrawing() {}
-    virtual void EndDrawing() {}
-
     bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
     bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
     void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
index 7313f50ec8df16395967b6f481fda7a2c66ac803..fb1f8c286f061a167984500c5e2e6c4e365910d8 100644 (file)
@@ -213,7 +213,6 @@ void MyCanvas::OnPaint (wxPaintEvent &)
     size_t numImages = m_images.GetCount();
 
     wxPaintDC dc(this);
-    dc.BeginDrawing();
 
     dc.SetTextForeground(wxColour(255, 255, 255));
     dc.DrawText(wxT("Click on the canvas to draw a duck."), 10, 10);
@@ -222,8 +221,6 @@ void MyCanvas::OnPaint (wxPaintEvent &)
         MyRenderedImage & image = m_images.Item(i);
         dc.DrawBitmap(image.m_bmp, image.m_x, image.m_y, true);
     }
-
-    dc.EndDrawing();
 }
 
 // ----------------------------------------------------------------------------
index 4cb7b53482e0247950bab08d318af520cefd5337..092f356574bbae39483e0e27e8c7397a5d33a5fc 100644 (file)
 // implementation
 // ============================================================================
 
+#if WXWIN_COMPATIBILITY_2_6
+void wxDCBase::BeginDrawing()
+{
+}
+
+void wxDCBase::EndDrawing()
+{
+}
+#endif // WXWIN_COMPATIBILITY_2_6
+
 // ----------------------------------------------------------------------------
 // special symbols
 // ----------------------------------------------------------------------------
index c347ecc31bfcead004fd10784eba6c26407cc90e..a868d28d58f070f4978019fd1eb532bf9893a9fd 100644 (file)
@@ -367,8 +367,6 @@ void wxGenericColourDialog::InitializeColours(void)
 
 void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
 {
-  dc.BeginDrawing();
-
   int i;
   for (i = 0; i < 6; i++)
   {
@@ -387,13 +385,10 @@ void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
       dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y);
     }
   }
-  dc.EndDrawing();
 }
 
 void wxGenericColourDialog::PaintCustomColours(wxDC& dc)
 {
-  dc.BeginDrawing();
-
   int i;
   for (i = 0; i < 2; i++)
   {
@@ -413,7 +408,6 @@ void wxGenericColourDialog::PaintCustomColours(wxDC& dc)
       dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y);
     }
   }
-  dc.EndDrawing();
 }
 
 void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw)
@@ -421,8 +415,6 @@ void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw)
   if ( colourSelection < 0 )
       return;
 
-  dc.BeginDrawing();
-
   // Number of pixels bigger than the standard rectangle size
   // for drawing a highlight
   int deltaX = 2;
@@ -462,14 +454,10 @@ void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw)
     dc.SetBrush(*wxTRANSPARENT_BRUSH);
     dc.DrawRectangle( x, y, (smallRectangleSize.x + (2*deltaX)), (smallRectangleSize.y + (2*deltaY)));
   }
-
-  dc.EndDrawing();
 }
 
 void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
 {
-  dc.BeginDrawing();
-
   dc.SetPen(*wxBLACK_PEN);
 
   wxBrush *brush = new wxBrush(colourData.m_dataColour, wxSOLID);
@@ -480,8 +468,6 @@ void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
 
   dc.SetBrush(wxNullBrush);
   delete brush;
-
-  dc.EndDrawing();
 }
 
 void wxGenericColourDialog::OnBasicColourClick(int which)
index bc9bb84c92e94307a3c9c6c9c7496d327a310049..62fd813fbe3075e7ba58696c2760bc8be06b91d6 100644 (file)
@@ -1683,8 +1683,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
     PrepareDC( dc );
     AdjustDC( dc );
 
-    dc.BeginDrawing();
-
     dc.SetFont( GetFont() );
 
     // width and height of the entire header window
@@ -1794,8 +1792,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 
         x += wCol;
     }
-
-    dc.EndDrawing();
 }
 
 void wxListHeaderWindow::DrawCurrent()
@@ -2591,8 +2587,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
     int dev_x, dev_y;
     CalcScrolledPosition( 0, 0, &dev_x, &dev_y );
 
-    dc.BeginDrawing();
-
     dc.SetFont( GetFont() );
 
     if ( InReportView() )
@@ -2700,8 +2694,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
         }
     }
 #endif
-
-    dc.EndDrawing();
 }
 
 void wxListMainWindow::HighlightAll( bool on )
index 3d1201ce1b2fdff5ff805c89e73fc0009fe74f1a..9633d806918452591272365df5e60f3650f3d6bd 100644 (file)
@@ -58,12 +58,8 @@ wxMemoryDC::wxMemoryDC(wxDC *dc)
 {
     wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") );
 
-    dc->BeginDrawing();
-
     CreateCompatible(dc);
 
-    dc->EndDrawing();
-
     Init();
 }
 
index 3032a5e2cda16003dfe4c345e7b0af62a30f6ba0..0092107a7c6306b666c73aed7846819a30cec94d 100644 (file)
@@ -122,8 +122,6 @@ bool wxMetafile::Play(wxDC *dc)
     if (!m_refData)
         return false;
 
-    dc->BeginDrawing();
-
     if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
     {
         if ( !::PlayMetaFile(GetHdcOf(*dc), (HMETAFILE)
@@ -133,8 +131,6 @@ bool wxMetafile::Play(wxDC *dc)
         }
     }
 
-    dc->EndDrawing();
-
     return true;
 }
 
index e6a9fc29023a5426a2ebccbbf7db9f0c1d371971..5b086b77db530ee1bf65b30e272958fd5c2ec209 100644 (file)
@@ -813,7 +813,6 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event))
     // Draw only when control is windowless or deactivated
     if (m_viewObject)
     {
-        dc.BeginDrawing();
         int w, h;
         GetParent()->GetSize(&w, &h);
         RECT posRect;
@@ -830,8 +829,6 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event))
         RECTL *prcBounds = (RECTL *) &posRect;
         m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL,
             (HDC)dc.GetHDC(), prcBounds, NULL, NULL, 0);
-
-        dc.EndDrawing();
     }
 
 //  We've got this one I think
index cac2a3f2dbaef139e8b8053282bdbb04e48ef979..88ec73453047a8e67b74247e29ddd9d427e2f9cf 100644 (file)
@@ -4079,14 +4079,11 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
 
     dc.SetHDC(hdc);
     dc.SetWindow((wxWindow *)this);
-    dc.BeginDrawing();
 
     wxEraseEvent event(m_windowId, &dc);
     event.SetEventObject(this);
     bool rc = GetEventHandler()->ProcessEvent(event);
 
-    dc.EndDrawing();
-
     // must be called manually as ~wxDC doesn't do anything for wxDCTemp
     dc.SelectOldObjects(hdc);
 
index 26e11bfe8d8b0ace2c9082b662a7eeebb43735d5..a786f316410c4d942577bccf6ef73007aacf8998 100644 (file)
@@ -38,9 +38,7 @@ wxMemoryDC::wxMemoryDC(
   wxDC*                             pOldDC
 )
 {
-    pOldDC->BeginDrawing();
     CreateCompatible(pOldDC);
-    pOldDC->EndDrawing();
     Init();
 } // end of wxMemoryDC::wxMemoryDC
 
index b2b402c794a65f773ca8b53d1dbffb35d60ec4e6..797b023742c5eb9a9bf4e9c04d1e27ca86e0e169 100644 (file)
@@ -93,13 +93,9 @@ bool wxMetafile::Play(wxDC *dc)
     if (!m_refData)
         return FALSE;
 
-    dc->BeginDrawing();
-
  //   if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
  //       PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile);
 
-    dc->EndDrawing();
-
     return true;
 }
 
index e504c87e52bb02a2d8ec2fce70914f58a0df26b2..801175c4ea6b05f537151f3ff3f056303e2bcdd7 100644 (file)
@@ -3737,7 +3737,6 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC )
 
     vDC.m_hPS = (HPS)hDC; // this is really a PS
     vDC.SetWindow((wxWindow*)this);
-    vDC.BeginDrawing();
 
     wxEraseEvent vEvent(m_windowId, &vDC);
 
@@ -3745,7 +3744,6 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC )
 
     rc = GetEventHandler()->ProcessEvent(vEvent);
 
-    vDC.EndDrawing();
     vDC.m_hPS = NULLHANDLE;
     return true;
 } // end of wxWindowOS2::HandleEraseBkgnd
index 07d8349199d693e5284c15f1cc56893547b7b527..a5e5c668045d5dd3642eb4b8dce9c98b0c8c29bc 100644 (file)
@@ -678,7 +678,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
     PRectangle rcClient = GetClientRectangle();
     paintingAllText = rcPaint.Contains(rcClient);
 
-    dc->BeginDrawing();
     ClipChildren(*dc, rcPaint);
     Paint(surfaceWindow, rcPaint);
 
@@ -689,7 +688,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
         FullPaint();
     }
     paintState = notPainting;
-    dc->EndDrawing();
 }