]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/bufferdc.tex
[ 1553595 ] Doc error: wxView::OnDraw
[wxWidgets.git] / docs / latex / wx / bufferdc.tex
CommitLineData
d6af57d4
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: bufferdc.tex
3%% Purpose: wxBufferedDC documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 07.02.04
7%% RCS-ID: $Id$
8%% Copyright: (c) 2004 Vadim Zeitlin
8795498c 9%% License: wxWindows license
d6af57d4
VZ
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxBufferedDC}}\label{wxbuffereddc}
13
14This simple class provides a simple way to avoid flicker: when drawing on it,
7775e41f
RD
15everything is in fact first drawn on an in-memory buffer (a
16\helpref{wxBitmap}{wxbitmap}) and then copied to the screen only once, when this
d6af57d4
VZ
17object is destroyed.
18
19It can be used in the same way as any other device context. wxBufferedDC itself
20typically replaces \helpref{wxClientDC}{wxclientdc}, if you want to use it in
21your \texttt{OnPaint()} handler, you should look at
22\helpref{wxBufferedPaintDC}{wxbufferedpaintdc}.
23
604affda
RR
24Please note that GTK+ 2.0 as well as OS X provide double buffering themselves
25natively so this class should normally not be used there.
26
d6af57d4
VZ
27\wxheading{Derived from}
28
14c7f3dd
VZ
29\helpref{wxMemoryDC}{wxmemorydc}\\
30\helpref{wxDC}{wxdc}\\
d6af57d4
VZ
31\helpref{wxObject}{wxobject}
32
33\wxheading{Include files}
34
35<wx/dcbuffer.h>
36
37\wxheading{See also}
38
39\helpref{wxDC}{wxdc}
40
41
42\latexignore{\rtfignore{\wxheading{Members}}}
43
461fb267 44\membersection{wxBufferedDC::wxBufferedDC}\label{wxbuffereddcctor}
d6af57d4
VZ
45
46\func{}{wxBufferedDC}{\void}
47
265a3864 48\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
d6af57d4 49
265a3864 50\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
d6af57d4
VZ
51
52If you use the first, default, constructor, you must call one of the
461fb267 53\helpref{Init}{wxbuffereddcinit} methods later in order to use the object.
d6af57d4
VZ
54
55The other constructors initialize the object immediately and \texttt{Init()}
56must not be called after using them.
57
58\wxheading{Parameters}
59
60\docparam{dc}{The underlying DC: everything drawn to this object will be
7775e41f
RD
61flushed to this DC when this object is destroyed. You may pass NULL
62in order to just initialize the buffer, and not flush it.}
d6af57d4
VZ
63
64\docparam{area}{The size of the bitmap to be used for buffering (this bitmap is
dbd94b75 65created internally when it is not given explicitly).}
d6af57d4 66
d6af57d4
VZ
67\docparam{buffer}{Explicitly provided bitmap to be used for buffering: this is
68the most efficient solution as the bitmap doesn't have to be recreated each
69time but it also requires more memory as the bitmap is never freed. The bitmap
70should have appropriate size, anything drawn outside of its bounds is clipped.}
71
265a3864
JS
72\docparam{style}{wxBUFFER\_CLIENT\_AREA to indicate that just the client area of
73the window is buffered, or wxBUFFER\_VIRTUAL\_AREA to indicate that the buffer bitmap
74covers the virtual area (in which case PrepareDC is automatically called for the actual window
75device context).}
d6af57d4 76
461fb267 77\membersection{wxBufferedDC::Init}\label{wxbuffereddcinit}
d6af57d4 78
265a3864 79\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
d6af57d4 80
265a3864 81\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
d6af57d4
VZ
82
83These functions initialize the object created using the default constructor.
461fb267 84Please see \helpref{constructors documentation}{wxbuffereddcctor} for details.
d6af57d4
VZ
85
86
87% VZ: UnMask() intentionally not documented, we might want to make it private
88
89
90\membersection{wxBufferedDC::\destruct{wxBufferedDC}}\label{wxbuffereddcdtor}
91
92Copies everything drawn on the DC so far to the underlying DC associated with
7775e41f 93this object, if any.
d6af57d4
VZ
94
95
96%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97
98\section{\class{wxBufferedPaintDC}}\label{wxbufferedpaintdc}
99
100This is a subclass of \helpref{wxBufferedDC}{wxbuffereddc} which can be used
7775e41f 101inside of an \texttt{OnPaint()} event handler. Just create an object of this class instead
d6af57d4
VZ
102of \helpref{wxPaintDC}{wxpaintdc} and that's all you have to do to (mostly)
103avoid flicker. The only thing to watch out for is that if you are using this
104class together with \helpref{wxScrolledWindow}{wxscrolledwindow}, you probably
461fb267 105do \textbf{not} want to call \helpref{PrepareDC}{wxscrolledwindowpreparedc} on it as it
d6af57d4
VZ
106already does this internally for the real underlying wxPaintDC.
107
108\wxheading{Derived from}
109
14c7f3dd
VZ
110\helpref{wxMemoryDC}{wxmemorydc}\\
111\helpref{wxDC}{wxdc}\\
d6af57d4
VZ
112\helpref{wxObject}{wxobject}
113
114\wxheading{Include files}
115
116<wx/dcbuffer.h>
117
118
119\latexignore{\rtfignore{\wxheading{Members}}}
120
121\membersection{wxBufferedPaintDC::wxBufferedPaintDC}\label{wxbufferedpaintdcctor}
122
265a3864
JS
123\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
124
125\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
d6af57d4
VZ
126
127As with \helpref{wxBufferedDC}{wxbuffereddcctor}, you may either provide the
128bitmap to be used for buffering or let this object create one internally (in
129the latter case, the size of the client part of the window is used).
130
265a3864
JS
131Pass wxBUFFER\_CLIENT\_AREA for the {\it style} parameter to indicate that just the client area of
132the window is buffered, or wxBUFFER\_VIRTUAL\_AREA to indicate that the buffer bitmap
133covers the virtual area (in which case PrepareDC is automatically called for the actual window
134device context).
d6af57d4
VZ
135
136\membersection{wxBufferedPaintDC::\destruct{wxBufferedPaintDC}}\label{wxbufferedpaintdcdtor}
137
138Copies everything drawn on the DC so far to the window associated with this
7775e41f 139object, using a \helpref{wxPaintDC}{wxpaintdc}.
d6af57d4
VZ
140
141