]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/dcmemory.cpp
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
13 #include "wx/gtk1/dcmemory.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl
, wxWindowDCImpl
)
24 void wxMemoryDCImpl::Init()
28 m_cmap
= gtk_widget_get_default_colormap();
31 wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC
*owner
, wxDC
*WXUNUSED(dc
))
32 : wxWindowDCImpl(owner
)
37 wxMemoryDCImpl::~wxMemoryDCImpl()
41 void wxMemoryDCImpl::DoSelect( const wxBitmap
& bitmap
)
48 if (m_selected
.GetPixmap())
50 m_window
= m_selected
.GetPixmap();
54 m_window
= m_selected
.GetBitmap();
68 void wxMemoryDCImpl::SetPen( const wxPen
& penOrig
)
71 if ( m_selected
.Ok() &&
72 m_selected
.GetBitmap() &&
73 (pen
!= *wxTRANSPARENT_PEN
) )
75 pen
.SetColour( pen
.GetColour() == *wxWHITE
? *wxBLACK
: *wxWHITE
);
78 wxWindowDCImpl::SetPen( pen
);
81 void wxMemoryDCImpl::SetBrush( const wxBrush
& brushOrig
)
83 wxBrush
brush( brushOrig
);
84 if ( m_selected
.Ok() &&
85 m_selected
.GetBitmap() &&
86 (brush
!= *wxTRANSPARENT_BRUSH
) )
88 brush
.SetColour( brush
.GetColour() == *wxWHITE
? *wxBLACK
: *wxWHITE
);
91 wxWindowDCImpl::SetBrush( brush
);
94 void wxMemoryDCImpl::SetBackground( const wxBrush
& brushOrig
)
96 wxBrush
brush(brushOrig
);
98 if ( m_selected
.Ok() &&
99 m_selected
.GetBitmap() &&
100 (brush
!= *wxTRANSPARENT_BRUSH
) )
102 brush
.SetColour( brush
.GetColour() == *wxWHITE
? *wxBLACK
: *wxWHITE
);
105 wxWindowDCImpl::SetBackground( brush
);
108 void wxMemoryDCImpl::SetTextForeground( const wxColour
& col
)
110 if ( m_selected
.Ok() && m_selected
.GetBitmap() )
112 wxWindowDCImpl::SetTextForeground( col
== *wxWHITE
? *wxBLACK
: *wxWHITE
);
116 wxWindowDCImpl::SetTextForeground( col
);
120 void wxMemoryDCImpl::SetTextBackground( const wxColour
&col
)
122 if (m_selected
.Ok() && m_selected
.GetBitmap())
124 wxWindowDCImpl::SetTextBackground( col
== *wxWHITE
? *wxBLACK
: *wxWHITE
);
128 wxWindowDCImpl::SetTextBackground( col
);
132 void wxMemoryDCImpl::DoGetSize( int *width
, int *height
) const
136 if (width
) (*width
) = m_selected
.GetWidth();
137 if (height
) (*height
) = m_selected
.GetHeight();
141 if (width
) (*width
) = 0;
142 if (height
) (*height
) = 0;