X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/526954c5968baa29218c994ec48e476ae2bd4b9f..3fc2ee048d6b937017b56104061ad1fff08de09a:/interface/wx/dcbuffer.h diff --git a/interface/wx/dcbuffer.h b/interface/wx/dcbuffer.h index ef03428a37..6b9ccb868e 100644 --- a/interface/wx/dcbuffer.h +++ b/interface/wx/dcbuffer.h @@ -6,11 +6,24 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// Assumes the buffer bitmap covers the entire scrolled window, +// and prepares the window DC accordingly +#define wxBUFFER_VIRTUAL_AREA 0x01 + +// Assumes the buffer bitmap only covers the client area; +// does not prepare the window DC +#define wxBUFFER_CLIENT_AREA 0x02 + +// Set when not using specific buffer bitmap. Note that this +// is private style and not returned by GetStyle. +#define wxBUFFER_USES_SHARED_BUFFER 0x04 + + /** @class wxBufferedDC This class provides a simple way to avoid flicker: when drawing on it, - everything is infact first drawn on an in-memory buffer (a wxBitmap) and + everything is in fact first drawn on an in-memory buffer (a wxBitmap) and then copied to the screen, using the associated wxDC, only once, when this object is destroyed. wxBufferedDC itself is typically associated with wxClientDC, if you want to use it in your @c EVT_PAINT handler, you should @@ -105,6 +118,27 @@ public: void Init(wxDC* dc, wxBitmap& buffer = wxNullBitmap, int style = wxBUFFER_CLIENT_AREA); //@} + + + /** + Blits the buffer to the dc, and detaches the dc from the buffer (so it + can be effectively used once only). + + Usually only called in the destructor or by the destructor of derived + classes if the BufferedDC must blit before the derived class (which may + own the dc it's blitting to) is destroyed. + */ + void UnMask(); + + /** + Set the style. + */ + void SetStyle(int style); + + /** + Get the style. + */ + int GetStyle() const; }; @@ -115,18 +149,18 @@ public: This wxDC derivative can be used inside of an @c EVT_PAINT() event handler to achieve double-buffered drawing. Just use this class instead of wxPaintDC and make sure wxWindow::SetBackgroundStyle() is called with - wxBG_STYLE_CUSTOM somewhere in the class initialization code, and that's + wxBG_STYLE_PAINT somewhere in the class initialization code, and that's all you have to do to (mostly) avoid flicker. The difference between wxBufferedPaintDC and this class is that this class won't double-buffer on platforms which have native double-buffering - already, avoiding any unneccessary buffering to avoid flicker. + already, avoiding any unnecessary buffering to avoid flicker. wxAutoBufferedPaintDC is simply a typedef of wxPaintDC on platforms that have native double-buffering, otherwise, it is a typedef of wxBufferedPaintDC. - @library{wxbase} + @library{wxcore} @category{dc} @see wxDC, wxBufferedPaintDC, wxPaintDC @@ -141,6 +175,13 @@ public: }; +/** + * Check if the window is natively double buffered and will return a wxPaintDC + * if it is, a wxBufferedPaintDC otherwise. It is the caller's responsibility + * to delete the wxDC pointer when finished with it. + */ +wxDC* wxAutoBufferedPaintDCFactory(wxWindow* window); + /** @class wxBufferedPaintDC @@ -148,7 +189,7 @@ public: This is a subclass of wxBufferedDC which can be used inside of an @c EVT_PAINT() event handler to achieve double-buffered drawing. Just use this class instead of wxPaintDC and make sure - wxWindow::SetBackgroundStyle() is called with wxBG_STYLE_CUSTOM somewhere + wxWindow::SetBackgroundStyle() is called with wxBG_STYLE_PAINT somewhere in the class initialization code, and that's all you have to do to (mostly) avoid flicker. The only thing to watch out for is that if you are using this class together with wxScrolled, you probably do @b not want to call