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