From 96285a18aa6f39e754ae562cc427f005a3402f43 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 13 Oct 2006 19:19:36 +0000 Subject: [PATCH] wxMemoryDC constructor now optionally accepts a wxBitmap parameter, calling SelectObject itself if a valid bitmap is passed. Reverted wxBuffered[Paint]DC to nearly the pre 2.7.1 state, kept wxAutoBufferedPaintDC and added wxAutoBufferedPaintDCFactory. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/docs/CHANGES.txt | 26 +++++++++++++++----------- wxPython/src/_dc.i | 33 ++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index ba00cca621..04966b1bfb 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -1,9 +1,9 @@ Recent Changes for wxPython ===================================================================== -2.7.1.0 +2.7.1.1 ------- -* 13-Oct-2006 +* The following deprecated items have been removed: @@ -280,13 +280,6 @@ For consistency, all classes having an Ok() method now also have IsOk(), use of the latter form is preferred although the former hasn't been deprecated yet -wx.BufferedDC and wx.BufferedPaintDC, if created with a reference to a -window and no program supplied buffer bitmap, will not do its own -buffering if the window is already double buffered by the system. -Also added a wx.AutoBufferedPaintDC that is a subclass of wx.PaintDC -on platforms that do double buffering by default, and a subclass of -wx.BufferedPaintDC on the platforms that don't. - Added the wx.AboutBox() function and wx.AboutDialogInfo class. They provide a way to show a standard About box for the application, which will either be a native dialog or a generic one depending on what info @@ -307,8 +300,8 @@ Quartz) for wxDC is now turned on by default. This means that all drawing via wxDC is done using the new APIs from apple, instead of the old Quick Draw API. There are, however, a few places where Quartz and wxDC don't fit together very well, mainly the lack of support for -logical drawing operations such as XOR, but there work in progress to -provide other ways to do the same sort of thing that will work with +logical drawing operations such as XOR, but there is work in progress +to provide other ways to do the same sort of thing that will work with Quartz and also on the other platforms. The first parts of a new 2D drawing API has been added with the @@ -322,6 +315,17 @@ there is enough there now to get a good feel for how things will work. There is also a transitional wx.GCDC class that provides the wx.DC API on top of wx.GraphicsContext. Docs and a demo are still MIA. +Added a wx.AutoBufferedPaintDC that is a subclass of wx.PaintDC on +platforms that do double buffering by default, and a subclass of +wx.BufferedPaintDC on the platforms that don't. You can use this +class to help avoid the overhead of buffering when it is not +needed. There is also a wx.AutoBufferedPaintDCFactory function that +does a little more and actually tests if the window has +double-buffering enabled and then decides whether to return a +wx.PaintDC or wx.BufferedPaintDC. This uses the new +wx.Window.IsDoubleBuffered method. + + diff --git a/wxPython/src/_dc.i b/wxPython/src/_dc.i index 18a8690ab9..c589d0d282 100644 --- a/wxPython/src/_dc.i +++ b/wxPython/src/_dc.i @@ -1247,7 +1247,7 @@ be used for anything. Typical usage is as follows:: dc = wx.MemoryDC() dc.SelectObject(bitmap) - # draw on the dc usign any of the Draw methods + # draw on the dc using any of the Draw methods dc.SelectObject(wx.NullBitmap) # the bitmap now contains wahtever was drawn upon it @@ -1258,12 +1258,13 @@ of it) before a bitmap can be reselected into another memory DC. class wxMemoryDC : public wxDC { public: DocCtorStr( - wxMemoryDC(), + wxMemoryDC(const wxBitmap& bitmap = wxNullBitmap), "Constructs a new memory device context. Use the Ok member to test whether the constructor was successful in -creating a usable device context. Don't forget to select a bitmap into -the DC before drawing on it.", " +creating a usable device context. If a bitmap is not given to this +constructor then don't forget to select a bitmap into the DC before +drawing on it.", " :see: `MemoryDCFromDC`"); @@ -1318,7 +1319,7 @@ natively. wxBufferedDC is aware of this however, and will bypass the buffering unless an explicit buffer bitmap is given. ", ""); -class wxBufferedDC : public wxDC +class wxBufferedDC : public wxMemoryDC { public: %pythonAppend wxBufferedDC @@ -1358,10 +1359,10 @@ public: wxBufferedDC( wxDC* dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA ); - wxBufferedDC(wxWindow* win, - wxDC *dc, - const wxSize &area, - int style = wxBUFFER_CLIENT_AREA); +// wxBufferedDC(wxWindow* win, +// wxDC *dc, +// const wxSize &area, +// int style = wxBUFFER_CLIENT_AREA); DocCtorStr( @@ -1549,11 +1550,25 @@ public: """ If the current platform double buffers by default then this DC is the same as a plain `wx.PaintDC`, otherwise it is a `wx.BufferedPaintDC`. + + :see: `wx.AutoBufferedPaintDCFactory` """ def __init__(self, window): _AutoBufferedPaintDCBase.__init__(self, window) } + +%newobject wxAutoBufferedPaintDCFactory; +DocDeclStr( + wxDC* , wxAutoBufferedPaintDCFactory(wxWindow* window), + "Checks if the window is natively double buffered and will return a +`wx.PaintDC` if it is, a `wx.BufferedPaintDC` otherwise. The +advantage of this function over `wx.AutoBufferedPaintDC` is that this +function will check if the the specified window supports has +double-buffering enabled rather than just going by platform defaults.", ""); + + + //--------------------------------------------------------------------------- %newgroup -- 2.47.2