]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dcmemory.h
55e6724e95946b413e3922f9e1c8916678dc88f7
[wxWidgets.git] / include / wx / dcmemory.h
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
12 #ifndef _WX_DCMEMORY_H_BASE_
13 #define _WX_DCMEMORY_H_BASE_
14
15 #include "wx/defs.h"
16
17 // NOTE: different native implementations of wxMemoryDC will derive from
18 // different wxDC classes (wxPaintDC, wxWindowDC, etc), so that
19 // we cannot derive wxMemoryDCBase from wxDC and then use it as the
20 // only base class for native impl of wxMemoryDC...
21 class wxMemoryDCBase
22 {
23 public:
24 wxMemoryDCBase() { }
25
26 // avoid warnings about having virtual functions but non virtual dtor
27 virtual ~wxMemoryDCBase() { }
28
29 // select the given bitmap to draw on it
30 void SelectObject(wxBitmap& bmp)
31 {
32 // make sure that the given wxBitmap is not sharing its data with other
33 // wxBitmap instances as its contents will be modified by any drawing
34 // operation done on this DC
35 if (bmp.IsOk())
36 bmp.UnShare();
37
38 DoSelect(bmp);
39 }
40
41 // select the given bitmap for read-only
42 virtual void SelectObjectAsSource(const wxBitmap& bmp)
43 {
44 DoSelect(bmp);
45 }
46
47 virtual void DoSelect(const wxBitmap& bmp) = 0;
48 };
49
50 #if defined(__WXPALMOS__)
51 #include "wx/palmos/dcmemory.h"
52 #elif defined(__WXMSW__)
53 #include "wx/msw/dcmemory.h"
54 #elif defined(__WXMOTIF__)
55 #include "wx/motif/dcmemory.h"
56 #elif defined(__WXGTK20__)
57 #include "wx/gtk/dcmemory.h"
58 #elif defined(__WXGTK__)
59 #include "wx/gtk1/dcmemory.h"
60 #elif defined(__WXX11__)
61 #include "wx/x11/dcmemory.h"
62 #elif defined(__WXMGL__)
63 #include "wx/mgl/dcmemory.h"
64 #elif defined(__WXDFB__)
65 #include "wx/dfb/dcmemory.h"
66 #elif defined(__WXMAC__)
67 #include "wx/mac/dcmemory.h"
68 #elif defined(__WXCOCOA__)
69 #include "wx/cocoa/dcmemory.h"
70 #elif defined(__WXPM__)
71 #include "wx/os2/dcmemory.h"
72 #endif
73
74 #endif
75 // _WX_DCMEMORY_H_BASE_