]>
Commit | Line | Data |
---|---|---|
99d80019 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/dcmemory.h | |
3 | // Purpose: wxMemoryDC base header | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: | |
7 | // Copyright: (c) Julian Smart | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows Licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
34138703 JS |
12 | #ifndef _WX_DCMEMORY_H_BASE_ |
13 | #define _WX_DCMEMORY_H_BASE_ | |
c801d85f | 14 | |
ab171e95 | 15 | #include "wx/dc.h" |
c319bc47 | 16 | #include "wx/bitmap.h" |
e45689df | 17 | |
ab171e95 RR |
18 | |
19 | #if wxUSE_NEW_DC | |
20 | ||
21 | //----------------------------------------------------------------------------- | |
22 | // wxMemoryDC | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
ab171e95 RR |
25 | class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC |
26 | { | |
27 | public: | |
28 | wxMemoryDC(); | |
29 | wxMemoryDC( wxBitmap& bitmap ); | |
30 | wxMemoryDC( wxDC *dc ); | |
31 | ||
32 | // select the given bitmap to draw on it | |
33 | void SelectObject(wxBitmap& bmp); | |
34 | ||
35 | // select the given bitmap for read-only | |
36 | void SelectObjectAsSource(const wxBitmap& bmp); | |
37 | ||
38 | // get selected bitmap | |
39 | const wxBitmap& GetSelectedBitmap() const; | |
40 | wxBitmap& GetSelectedBitmap(); | |
41 | ||
42 | private: | |
43 | DECLARE_DYNAMIC_CLASS(wxMemoryDC) | |
44 | }; | |
45 | ||
46 | ||
47 | ||
48 | #else | |
49 | ||
fea35690 VZ |
50 | // NOTE: different native implementations of wxMemoryDC will derive from |
51 | // different wxDC classes (wxPaintDC, wxWindowDC, etc), so that | |
52 | // we cannot derive wxMemoryDCBase from wxDC and then use it as the | |
53 | // only base class for native impl of wxMemoryDC... | |
8c6686ef | 54 | class WXDLLEXPORT wxMemoryDCBase |
fea35690 VZ |
55 | { |
56 | public: | |
57 | wxMemoryDCBase() { } | |
58 | ||
59 | // avoid warnings about having virtual functions but non virtual dtor | |
60 | virtual ~wxMemoryDCBase() { } | |
61 | ||
62 | // select the given bitmap to draw on it | |
63 | void SelectObject(wxBitmap& bmp) | |
64 | { | |
65 | // make sure that the given wxBitmap is not sharing its data with other | |
66 | // wxBitmap instances as its contents will be modified by any drawing | |
67 | // operation done on this DC | |
68 | if (bmp.IsOk()) | |
69 | bmp.UnShare(); | |
70 | ||
71 | DoSelect(bmp); | |
72 | } | |
73 | ||
74 | // select the given bitmap for read-only | |
75 | virtual void SelectObjectAsSource(const wxBitmap& bmp) | |
76 | { | |
77 | DoSelect(bmp); | |
78 | } | |
79 | ||
3498362e | 80 | protected: |
fea35690 VZ |
81 | virtual void DoSelect(const wxBitmap& bmp) = 0; |
82 | }; | |
83 | ||
ab171e95 RR |
84 | |
85 | #endif | |
86 | ||
87 | ||
4055ed82 | 88 | #if defined(__WXPALMOS__) |
ffecfa5a JS |
89 | #include "wx/palmos/dcmemory.h" |
90 | #elif defined(__WXMSW__) | |
c801d85f | 91 | #include "wx/msw/dcmemory.h" |
2049ba38 | 92 | #elif defined(__WXMOTIF__) |
34138703 | 93 | #include "wx/motif/dcmemory.h" |
1be7a35c | 94 | #elif defined(__WXGTK20__) |
c801d85f | 95 | #include "wx/gtk/dcmemory.h" |
1be7a35c MR |
96 | #elif defined(__WXGTK__) |
97 | #include "wx/gtk1/dcmemory.h" | |
83df96d6 JS |
98 | #elif defined(__WXX11__) |
99 | #include "wx/x11/dcmemory.h" | |
1e6feb95 VZ |
100 | #elif defined(__WXMGL__) |
101 | #include "wx/mgl/dcmemory.h" | |
b3c86150 VS |
102 | #elif defined(__WXDFB__) |
103 | #include "wx/dfb/dcmemory.h" | |
34138703 JS |
104 | #elif defined(__WXMAC__) |
105 | #include "wx/mac/dcmemory.h" | |
e64df9bc DE |
106 | #elif defined(__WXCOCOA__) |
107 | #include "wx/cocoa/dcmemory.h" | |
1777b9bb DW |
108 | #elif defined(__WXPM__) |
109 | #include "wx/os2/dcmemory.h" | |
c801d85f KB |
110 | #endif |
111 | ||
112 | #endif | |
34138703 | 113 | // _WX_DCMEMORY_H_BASE_ |