]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/bufferdc.tex
corrected EVT_NOTIFY[_RANGE] docs (bug 1439078)
[wxWidgets.git] / docs / latex / wx / bufferdc.tex
... / ...
CommitLineData
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
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxBufferedDC}}\label{wxbuffereddc}
13
14This simple class provides a simple way to avoid flicker: when drawing on it,
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
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} or \helpref{wxAutoBufferedPaintDC}{wxautobufferedpaintdc}.
23
24Please note that GTK+ 2.0 as well as OS X provide double buffering themselves
25+natively. Use \helpref{wxWindow::IsDoubleBuffered}{wxwindowisdoublebuffered} to
26+determine whether you need to use buffering or not.
27
28\wxheading{Derived from}
29
30\helpref{wxMemoryDC}{wxmemorydc}\\
31\helpref{wxDC}{wxdc}\\
32\helpref{wxObject}{wxobject}
33
34\wxheading{Include files}
35
36<wx/dcbuffer.h>
37
38\wxheading{See also}
39
40\helpref{wxDC}{wxdc},\rtfsp
41\helpref{wxMemoryDC}{wxmemorydc},\rtfsp
42\helpref{wxBufferedPaintDC}{wxbufferedpaintdc},\rtfsp
43\helpref{wxAutoBufferedPaintDC}{wxautobufferedpaintdc}
44
45
46\latexignore{\rtfignore{\wxheading{Members}}}
47
48\membersection{wxBufferedDC::wxBufferedDC}\label{wxbuffereddcctor}
49
50\func{}{wxBufferedDC}{\void}
51
52\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
53
54\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
55
56If you use the first, default, constructor, you must call one of the
57\helpref{Init}{wxbuffereddcinit} methods later in order to use the object.
58
59The other constructors initialize the object immediately and \texttt{Init()}
60must not be called after using them.
61
62\wxheading{Parameters}
63
64\docparam{dc}{The underlying DC: everything drawn to this object will be
65flushed to this DC when this object is destroyed. You may pass NULL
66in order to just initialize the buffer, and not flush it.}
67
68\docparam{area}{The size of the bitmap to be used for buffering (this bitmap is
69created internally when it is not given explicitly).}
70
71\docparam{buffer}{Explicitly provided bitmap to be used for buffering: this is
72the most efficient solution as the bitmap doesn't have to be recreated each
73time but it also requires more memory as the bitmap is never freed. The bitmap
74should have appropriate size, anything drawn outside of its bounds is clipped.}
75
76\docparam{style}{wxBUFFER\_CLIENT\_AREA to indicate that just the client area of
77the window is buffered, or wxBUFFER\_VIRTUAL\_AREA to indicate that the buffer bitmap
78covers the virtual area (in which case PrepareDC is automatically called for the actual window
79device context).}
80
81\membersection{wxBufferedDC::Init}\label{wxbuffereddcinit}
82
83\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
84
85\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
86
87These functions initialize the object created using the default constructor.
88Please see \helpref{constructors documentation}{wxbuffereddcctor} for details.
89
90
91% VZ: UnMask() intentionally not documented, we might want to make it private
92
93
94\membersection{wxBufferedDC::\destruct{wxBufferedDC}}\label{wxbuffereddcdtor}
95
96Copies everything drawn on the DC so far to the underlying DC associated with
97this object, if any.
98
99
100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
101
102\section{\class{wxBufferedPaintDC}}\label{wxbufferedpaintdc}
103
104This is a subclass of \helpref{wxBufferedDC}{wxbuffereddc} which can be used
105inside of an \texttt{OnPaint()} event handler. Just create an object of this class instead
106of \helpref{wxPaintDC}{wxpaintdc} and make sure \helpref{wxWindow::SetBackgroundStyle}{wxwindowgetbackgroundstyle}
107is called with wxBG\_STYLE\_CUSTOM somewhere in the class initialization code, and that's all
108you have to do to (mostly) avoid flicker. The only thing to watch out for is that if you are
109using this class together with \helpref{wxScrolledWindow}{wxscrolledwindow}, you probably
110do \textbf{not} want to call \helpref{PrepareDC}{wxscrolledwindowpreparedc} on it as it
111already does this internally for the real underlying wxPaintDC.
112
113\wxheading{Derived from}
114
115\helpref{wxBufferedDC}{wxbuffereddc}\\
116\helpref{wxMemoryDC}{wxmemorydc}\\
117\helpref{wxDC}{wxdc}\\
118\helpref{wxObject}{wxobject}
119
120\wxheading{Include files}
121
122<wx/dcbuffer.h>
123
124\wxheading{See also}
125
126\helpref{wxDC}{wxdc},\rtfsp
127\helpref{wxBufferedDC}{wxbuffereddc},\rtfsp
128\helpref{wxAutoBufferedPaintDC}{wxautobufferedpaintdc}
129
130
131\latexignore{\rtfignore{\wxheading{Members}}}
132
133\membersection{wxBufferedPaintDC::wxBufferedPaintDC}\label{wxbufferedpaintdcctor}
134
135\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
136
137\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
138
139As with \helpref{wxBufferedDC}{wxbuffereddcctor}, you may either provide the
140bitmap to be used for buffering or let this object create one internally (in
141the latter case, the size of the client part of the window is used).
142
143Pass wxBUFFER\_CLIENT\_AREA for the {\it style} parameter to indicate that just the client area of
144the window is buffered, or wxBUFFER\_VIRTUAL\_AREA to indicate that the buffer bitmap
145covers the virtual area (in which case PrepareDC is automatically called for the actual window
146device context).
147
148\membersection{wxBufferedPaintDC::\destruct{wxBufferedPaintDC}}\label{wxbufferedpaintdcdtor}
149
150Copies everything drawn on the DC so far to the window associated with this
151object, using a \helpref{wxPaintDC}{wxpaintdc}.
152
153
154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155
156\section{\class{wxAutoBufferedPaintDC}}\label{wxautobufferedpaintdc}
157
158This wxDC derivative can be used inside of an \texttt{OnPaint()} event handler to achieve
159double-buffered drawing. Just create an object of this class instead of \helpref{wxPaintDC}{wxpaintdc}
160and make sure \helpref{wxWindow::SetBackgroundStyle}{wxwindowgetbackgroundstyle} is called
161with wxBG\_STYLE\_CUSTOM somewhere in the class initialization code, and that's all you have
162to do to (mostly) avoid flicker.
163
164The difference between \helpref{wxBufferedPaintDC}{wxbufferedpaintdc} and this class,
165is the lightweigthness - on platforms which have native double-buffering, wxAutoBufferedPaintDC is simply
166a typedef of wxPaintDC. Otherwise, it is a typedef of wxBufferedPaintDC.
167
168
169\wxheading{Derived from}
170
171\helpref{wxBufferedPaintDC}{wxbufferedpaintdc}\\
172\helpref{wxPaintDC}{wxpaintdc}\\
173\helpref{wxDC}{wxdc}\\
174\helpref{wxObject}{wxobject}
175
176\wxheading{Include files}
177
178<wx/dcbuffer.h>
179
180\wxheading{See also}
181
182\helpref{wxDC}{wxdc},\rtfsp
183\helpref{wxBufferedPaintDC}{wxbufferedpaintdc}
184
185
186\latexignore{\rtfignore{\wxheading{Members}}}
187
188\membersection{wxAutoBufferedPaintDC::wxAutoBufferedPaintDC}\label{wxautobufferedpaintdcctor}
189
190\func{}{wxAutoBufferedPaintDC}{\param{wxWindow *}{window}}
191
192Constructor. Pass a pointer to the window on which you wish to paint.
193