]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dcbuffer.h
Applied patch [ 736322 ] Remove TWINE support, merge it in Wine.
[wxWidgets.git] / include / wx / dcbuffer.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dcbuffer.h
3 // Purpose: wxBufferedDC class
4 // Author: Ron Lee <ron@debian.org>
5 // Modified by:
6 // Created: 16/03/02
7 // RCS-ID: $Id$
8 // Copyright: (c) Ron Lee
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DCBUFFER_H_
13 #define _WX_DCBUFFER_H_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "dcbuffer.h"
17 #endif
18
19 #include "wx/dcmemory.h"
20
21
22 // ==============================================================
23 // Double buffering helper.
24 // --------------------------------------------------------------
25
26 class WXDLLEXPORT wxBufferedDC : public wxMemoryDC
27 {
28 private:
29
30 // Without the existence of a wxNullDC, this must be
31 // a pointer, else it could probably be a reference.
32
33 wxDC *m_dc;
34 wxBitmap m_buffer;
35
36 public:
37
38 // Default ctor, must subsequently call Init for
39 // two stage construction.
40
41 wxBufferedDC()
42 : m_dc( 0 )
43 {}
44
45 // Construct a wxBufferedDC using a user supplied buffer.
46
47 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
48
49 // Construct a wxBufferedDC with an internal buffer of 'area'
50 // (where area is usually something like the size of the window
51 // being buffered)
52
53 wxBufferedDC( wxDC *dc, const wxSize &area );
54
55 // default copy ctor ok.
56
57 // The usually desired action in the dtor is to blit the buffer.
58
59 ~wxBufferedDC();
60
61 // These reimplement the actions of the ctors for
62 // two stage creation, but are not used by the ctors
63 // themselves to save a few cpu cycles.
64
65 void Init( wxDC *dc, const wxBitmap &bitmap );
66 void Init( wxDC *dc, const wxSize &area );
67
68 // Blits the buffer to the dc, and detaches the dc from
69 // the buffer. Usually called in the dtor or by the dtor
70 // of derived classes if the BufferedDC must blit before
71 // the derived class (which may own the dc it's blitting
72 // to) is destroyed.
73
74 void UnMask();
75
76 DECLARE_NO_COPY_CLASS(wxBufferedDC)
77 };
78
79
80 // ==============================================================
81 // Double buffered PaintDC.
82 // --------------------------------------------------------------
83
84 // Creates a double buffered wxPaintDC, optionally allowing the
85 // user to specify their own buffer to use.
86
87 class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC
88 {
89 private:
90
91 wxPaintDC m_paintdc;
92
93 public:
94
95 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
96
97 // default copy ctor ok.
98
99 ~wxBufferedPaintDC();
100 };
101
102
103 #endif // _WX_DCBUFFER_H_
104
105 // vi:sts=4:sw=4:et