+
+ DocStr(
+ wxBufferedDC,
+ "Constructs a buffered DC.", "
+
+ :param dc: The underlying DC: everything drawn to this object will
+ be flushed to this DC when this object is destroyed. You may
+ pass ``None`` in order to just initialize the buffer, and not
+ flush it.
+
+ :param buffer: If a `wx.Size` object is passed as the 2nd arg then
+ it is the size of the bitmap that will be created internally
+ and used for an implicit buffer. If the 2nd arg is a
+ `wx.Bitmap` then it is the explicit buffer that will be
+ used. Using an explicit buffer is the most efficient solution
+ as the bitmap doesn't have to be recreated each time but it
+ also requires more memory as the bitmap is never freed. The
+ bitmap should have appropriate size, anything drawn outside of
+ its bounds is clipped. If wx.NullBitmap is used then a new
+ buffer will be allocated that is the same size as the dc.
+
+ :param style: The style parameter indicates whether the supplied buffer is
+ intended to cover the entire virtual size of a `wx.ScrolledWindow` or
+ if it only covers the client area. Acceptable values are
+ ``wx.BUFFER_VIRTUAL_AREA`` and ``wx.BUFFER_CLIENT_AREA``.
+");
+
+ %nokwargs wxBufferedDC;
+ %pythonAppend wxBufferedDC
+"# save a ref so the other dc will not be deleted before self
+ self.__dc = args[0]
+ # also save a ref to the bitmap
+ if len(args) > 1: self.__bmp = args[1]
+";
+
+ wxBufferedDC( wxDC* dc,
+ wxBitmap& buffer=wxNullBitmap,
+ int style = wxBUFFER_CLIENT_AREA );
+ wxBufferedDC( wxDC* dc,
+ const wxSize& area,
+ int style = wxBUFFER_CLIENT_AREA );
+// wxBufferedDC(wxWindow* win,
+// wxDC *dc,
+// const wxSize &area,
+// int style = wxBUFFER_CLIENT_AREA);
+
+
+ DocCtorStr(
+ ~wxBufferedDC(),
+ "Copies everything drawn on the DC so far to the underlying DC
+associated with this object, if any.", "");
+
+
+ DocDeclStr(
+ void , UnMask(),
+ "Blits the buffer to the dc, and detaches the dc from the buffer (so it
+can be effectively used once only). This is usually only called in
+the destructor.", "");
+
+ // Set and get the style
+ void SetStyle(int style);
+ int GetStyle() const;
+};
+
+
+
+
+MustHaveApp(wxBufferedPaintDC);
+
+DocStr(wxBufferedPaintDC,
+"This is a subclass of `wx.BufferedDC` which can be used inside of an
+EVT_PAINT event handler. Just create an object of this class instead
+of `wx.PaintDC` 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 `wx.ScrolledWindow`, you probably do **not** want
+to call `wx.Window.PrepareDC` on it as it already does this internally
+for the real underlying `wx.PaintDC`.
+
+If your window is already fully buffered in a `wx.Bitmap` then your
+EVT_PAINT handler can be as simple as just creating a
+``wx.BufferedPaintDC`` as it will `Blit` the buffer to the window
+automatically when it is destroyed. For example::
+
+ def OnPaint(self, event):
+ dc = wx.BufferedPaintDC(self, self.buffer)
+
+
+", "");
+
+class wxBufferedPaintDC : public wxBufferedDC
+{
+public:
+
+ %pythonAppend wxBufferedPaintDC "if len(args) > 1: self.__bmp = args[1]";
+
+ DocCtorStr(
+ wxBufferedPaintDC( wxWindow *window,
+ wxBitmap &buffer = wxNullBitmap,
+ int style = wxBUFFER_CLIENT_AREA),
+ "Create a buffered paint DC. As with `wx.BufferedDC`, you may either
+provide the bitmap to be used for buffering or let this object create
+one internally (in the latter case, the size of the client part of the
+window is automatically used).", "");
+