]>
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/dcmemory.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxWindowDC
)
24 void wxMemoryDC::Init()
28 m_cmap
= gtk_widget_get_default_colormap();
31 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
37 wxMemoryDC::~wxMemoryDC()
41 void wxMemoryDC::DoSelect( const wxBitmap
& bitmap
)
48 if (m_selected
.GetPixmap())
50 m_window
= m_selected
.GetPixmap();
54 m_window
= m_selected
.GetBitmap();
64 m_window
= (GdkWindow
*) NULL
;
68 void wxMemoryDC::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 wxWindowDC::SetPen( pen
);
81 void wxMemoryDC::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 wxWindowDC::SetBrush( brush
);
94 void wxMemoryDC::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 wxWindowDC::SetBackground( brush
);
108 void wxMemoryDC::SetTextForeground( const wxColour
& col
)
110 if ( m_selected
.Ok() && m_selected
.GetBitmap() )
112 wxWindowDC::SetTextForeground( col
== *wxWHITE
? *wxBLACK
: *wxWHITE
);
116 wxWindowDC::SetTextForeground( col
);
120 void wxMemoryDC::SetTextBackground( const wxColour
&col
)
122 if (m_selected
.Ok() && m_selected
.GetBitmap())
124 wxWindowDC::SetTextBackground( col
== *wxWHITE
? *wxBLACK
: *wxWHITE
);
128 wxWindowDC::SetTextBackground( col
);
132 void wxMemoryDC::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;