]>
Commit | Line | Data |
---|---|---|
67e2efca RL |
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 | ||
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
67e2efca RL |
16 | #pragma interface "dcbuffer.h" |
17 | #endif | |
18 | ||
19 | #include "wx/dcmemory.h" | |
20 | ||
21 | ||
22 | // ============================================================== | |
23 | // Double buffering helper. | |
24 | // -------------------------------------------------------------- | |
25 | ||
b8be0b4e | 26 | class WXDLLEXPORT wxBufferedDC : public wxMemoryDC |
67e2efca RL |
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 | ||
77 | ||
78 | // ============================================================== | |
79 | // Double buffered PaintDC. | |
80 | // -------------------------------------------------------------- | |
81 | ||
82 | // Creates a double buffered wxPaintDC, optionally allowing the | |
83 | // user to specify their own buffer to use. | |
84 | ||
b8be0b4e | 85 | class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC |
67e2efca RL |
86 | { |
87 | private: | |
88 | ||
89 | wxPaintDC m_paintdc; | |
90 | ||
91 | public: | |
92 | ||
93 | wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap ); | |
94 | ||
95 | // default copy ctor ok. | |
96 | ||
97 | ~wxBufferedPaintDC(); | |
98 | }; | |
99 | ||
100 | ||
101 | #endif // _WX_DCBUFFER_H_ | |
102 | ||
103 | // vi:sts=4:sw=4:et |