]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dcbuffer.h
wxCocoa: Added NSScrollView definition
[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(NO_GCC_PRAGMA)
16 #pragma interface "dcbuffer.h"
17 #endif
18
19 #include "wx/dcmemory.h"
20 #include "wx/dcclient.h"
21
22
23 // ==============================================================
24 // Double buffering helper.
25 // --------------------------------------------------------------
26
27 class WXDLLIMPEXP_ADV wxBufferedDC : public wxMemoryDC
28 {
29 private:
30
31 // Without the existence of a wxNullDC, this must be
32 // a pointer, else it could probably be a reference.
33
34 wxDC *m_dc;
35 wxBitmap m_buffer;
36
37 public:
38
39 // Default ctor, must subsequently call Init for
40 // two stage construction.
41
42 wxBufferedDC()
43 : m_dc( 0 )
44 {}
45
46 // Construct a wxBufferedDC using a user supplied buffer.
47
48 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
49
50 // Construct a wxBufferedDC with an internal buffer of 'area'
51 // (where area is usually something like the size of the window
52 // being buffered)
53
54 wxBufferedDC( wxDC *dc, const wxSize &area );
55
56 // default copy ctor ok.
57
58 // The usually desired action in the dtor is to blit the buffer.
59
60 ~wxBufferedDC();
61
62 // These reimplement the actions of the ctors for
63 // two stage creation, but are not used by the ctors
64 // themselves to save a few cpu cycles.
65
66 void Init( wxDC *dc, const wxBitmap &bitmap );
67 void Init( wxDC *dc, const wxSize &area );
68
69 // Blits the buffer to the dc, and detaches the dc from
70 // the buffer. Usually called in the dtor or by the dtor
71 // of derived classes if the BufferedDC must blit before
72 // the derived class (which may own the dc it's blitting
73 // to) is destroyed.
74
75 void UnMask();
76
77 DECLARE_NO_COPY_CLASS(wxBufferedDC)
78 };
79
80
81 // ==============================================================
82 // Double buffered PaintDC.
83 // --------------------------------------------------------------
84
85 // Creates a double buffered wxPaintDC, optionally allowing the
86 // user to specify their own buffer to use.
87
88 class WXDLLIMPEXP_ADV wxBufferedPaintDC : public wxBufferedDC
89 {
90 private:
91
92 wxPaintDC m_paintdc;
93
94 public:
95
96 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
97
98 // default copy ctor ok.
99
100 ~wxBufferedPaintDC();
101
102 DECLARE_NO_COPY_CLASS(wxBufferedPaintDC)
103 };
104
105
106 #endif // _WX_DCBUFFER_H_
107