]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dcmemory.h
replace changes of r49890 by defining more compatibility operators in wxCmdLineArgsAr...
[wxWidgets.git] / include / wx / dcmemory.h
CommitLineData
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
25class WXDLLIMPEXP_CORE wxMemoryImplDCBase
26{
27public:
28 wxMemoryImplDCBase() { }
29
30 virtual void DoSelect(const wxBitmap& bmp) = 0;
31
32 virtual const wxBitmap& DoGetSelectedBitmap() const = 0;
33 virtual wxBitmap& DoGetSelectedBitmap() = 0;
34};
35
36
37class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC
38{
39public:
40 wxMemoryDC();
41 wxMemoryDC( wxBitmap& bitmap );
42 wxMemoryDC( wxDC *dc );
43
44 // select the given bitmap to draw on it
45 void SelectObject(wxBitmap& bmp);
46
47 // select the given bitmap for read-only
48 void SelectObjectAsSource(const wxBitmap& bmp);
49
50 // get selected bitmap
51 const wxBitmap& GetSelectedBitmap() const;
52 wxBitmap& GetSelectedBitmap();
53
54private:
55 DECLARE_DYNAMIC_CLASS(wxMemoryDC)
56};
57
58
59
60#else
61
fea35690
VZ
62// NOTE: different native implementations of wxMemoryDC will derive from
63// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that
64// we cannot derive wxMemoryDCBase from wxDC and then use it as the
65// only base class for native impl of wxMemoryDC...
8c6686ef 66class WXDLLEXPORT wxMemoryDCBase
fea35690
VZ
67{
68public:
69 wxMemoryDCBase() { }
70
71 // avoid warnings about having virtual functions but non virtual dtor
72 virtual ~wxMemoryDCBase() { }
73
74 // select the given bitmap to draw on it
75 void SelectObject(wxBitmap& bmp)
76 {
77 // make sure that the given wxBitmap is not sharing its data with other
78 // wxBitmap instances as its contents will be modified by any drawing
79 // operation done on this DC
80 if (bmp.IsOk())
81 bmp.UnShare();
82
83 DoSelect(bmp);
84 }
85
86 // select the given bitmap for read-only
87 virtual void SelectObjectAsSource(const wxBitmap& bmp)
88 {
89 DoSelect(bmp);
90 }
91
3498362e 92protected:
fea35690
VZ
93 virtual void DoSelect(const wxBitmap& bmp) = 0;
94};
95
ab171e95
RR
96
97#endif
98
99
4055ed82 100#if defined(__WXPALMOS__)
ffecfa5a
JS
101#include "wx/palmos/dcmemory.h"
102#elif defined(__WXMSW__)
c801d85f 103#include "wx/msw/dcmemory.h"
2049ba38 104#elif defined(__WXMOTIF__)
34138703 105#include "wx/motif/dcmemory.h"
1be7a35c 106#elif defined(__WXGTK20__)
c801d85f 107#include "wx/gtk/dcmemory.h"
1be7a35c
MR
108#elif defined(__WXGTK__)
109#include "wx/gtk1/dcmemory.h"
83df96d6
JS
110#elif defined(__WXX11__)
111#include "wx/x11/dcmemory.h"
1e6feb95
VZ
112#elif defined(__WXMGL__)
113#include "wx/mgl/dcmemory.h"
b3c86150
VS
114#elif defined(__WXDFB__)
115#include "wx/dfb/dcmemory.h"
34138703
JS
116#elif defined(__WXMAC__)
117#include "wx/mac/dcmemory.h"
e64df9bc
DE
118#elif defined(__WXCOCOA__)
119#include "wx/cocoa/dcmemory.h"
1777b9bb
DW
120#elif defined(__WXPM__)
121#include "wx/os2/dcmemory.h"
c801d85f
KB
122#endif
123
124#endif
34138703 125 // _WX_DCMEMORY_H_BASE_