]> git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcmemory.cpp
multilib mode compilation fix
[wxWidgets.git] / src / mgl / dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcmemory.cpp
3 // Purpose:
4 // Author: Robert Roebling, Vaclav Slavik
5 // RCS-ID: $Id$
6 // Copyright: (c) 1998 Robert Roebling,
7 // 2001 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "dcmemory.h"
13 #endif
14
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #include "wx/dcmemory.h"
23
24
25 //-----------------------------------------------------------------------------
26 // wxMemoryDC
27 //-----------------------------------------------------------------------------
28
29 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
30
31 wxMemoryDC::wxMemoryDC() : wxDC()
32 {
33 m_isMemDC = TRUE;
34 }
35
36 wxMemoryDC::wxMemoryDC(wxDC *WXUNUSED(dc)) : wxDC()
37 {
38 m_isMemDC = TRUE;
39 }
40
41 wxMemoryDC::~wxMemoryDC()
42 {
43 }
44
45 void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
46 {
47 if ( bitmap.Ok() )
48 {
49 m_selected = bitmap;
50 SetMGLDC(m_selected.CreateTmpDC(), TRUE);
51 }
52 }
53
54 void wxMemoryDC::SetPen(const wxPen &pen)
55 {
56 wxCHECK_RET( Ok(), wxT("invalid dc") );
57
58 if ( GetDepth() == 1 && *wxTRANSPARENT_PEN != pen )
59 {
60 if ( *wxWHITE_PEN == pen )
61 wxDC::SetPen(*wxBLACK_PEN);
62 else
63 wxDC::SetPen(*wxWHITE_PEN);
64 }
65 else
66 {
67 wxDC::SetPen(pen);
68 }
69 }
70
71 void wxMemoryDC::SetBrush(const wxBrush &brush)
72 {
73 wxCHECK_RET( Ok(), wxT("invalid dc") );
74
75 if ( GetDepth() == 1 && *wxTRANSPARENT_BRUSH != brush )
76 {
77 if ( *wxWHITE_BRUSH == brush )
78 wxDC::SetBrush(*wxBLACK_BRUSH);
79 else
80 wxDC::SetBrush(*wxWHITE_BRUSH);
81 }
82 else
83 {
84 wxDC::SetBrush(brush);
85 }
86 }
87
88 void wxMemoryDC::SetTextForeground(const wxColour &col)
89 {
90 wxCHECK_RET( Ok(), wxT("invalid dc") );
91
92 if ( GetDepth() == 1 )
93 {
94 if ( col == *wxWHITE )
95 wxDC::SetTextForeground(*wxBLACK);
96 else
97 wxDC::SetTextForeground(*wxWHITE);
98 }
99 else
100 {
101 wxDC::SetTextForeground(col);
102 }
103 }
104
105 void wxMemoryDC::SetTextBackground(const wxColour &col)
106 {
107 wxCHECK_RET( Ok(), wxT("invalid dc") );
108
109 if ( GetDepth() == 1 )
110 {
111 if ( col == *wxWHITE )
112 wxDC::SetTextBackground(*wxBLACK);
113 else
114 wxDC::SetTextBackground(*wxWHITE);
115 }
116 else
117 {
118 wxDC::SetTextBackground(col);
119 }
120 }