]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "dcmemory.h"
14 #include "wx/dcmemory.h"
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxWindowDC
)
25 wxMemoryDC::wxMemoryDC() : wxWindowDC()
29 m_cmap
= gtk_widget_get_default_colormap();
32 m_context
= gdk_pango_context_get();
33 m_layout
= pango_layout_new( m_context
);
34 m_fontdesc
= pango_font_description_copy( pango_context_get_font_description( m_context
) );
38 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
43 m_cmap
= gtk_widget_get_default_colormap();
46 m_context
= gdk_pango_context_get();
47 m_layout
= pango_layout_new( m_context
);
48 m_fontdesc
= pango_font_description_copy( pango_context_get_font_description( m_context
) );
52 wxMemoryDC::~wxMemoryDC()
56 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
62 if (m_selected
.GetPixmap())
64 m_window
= m_selected
.GetPixmap();
68 m_window
= m_selected
.GetBitmap();
78 m_window
= (GdkWindow
*) NULL
;
82 void wxMemoryDC::SetPen( const wxPen
&pen
)
84 if (m_selected
.Ok() && m_selected
.GetBitmap() && (*wxTRANSPARENT_PEN
!= pen
))
86 if (*wxWHITE_PEN
== pen
)
87 wxWindowDC::SetPen( *wxBLACK_PEN
);
89 wxWindowDC::SetPen( *wxWHITE_PEN
);
93 wxWindowDC::SetPen( pen
);
97 void wxMemoryDC::SetBrush( const wxBrush
&brush
)
99 if (m_selected
.Ok() && m_selected
.GetBitmap() && (*wxTRANSPARENT_BRUSH
!= brush
))
101 if (*wxWHITE_BRUSH
== brush
)
102 wxWindowDC::SetBrush( *wxBLACK_BRUSH
);
104 wxWindowDC::SetBrush( *wxWHITE_BRUSH
);
108 wxWindowDC::SetBrush( brush
);
112 void wxMemoryDC::SetTextForeground( const wxColour
&col
)
114 if (m_selected
.Ok() && m_selected
.GetBitmap())
117 wxWindowDC::SetTextForeground( *wxBLACK
);
119 wxWindowDC::SetTextForeground( *wxWHITE
);
123 wxWindowDC::SetTextForeground( col
);
127 void wxMemoryDC::SetTextBackground( const wxColour
&col
)
129 if (m_selected
.Ok() && m_selected
.GetBitmap())
132 wxWindowDC::SetTextBackground( *wxBLACK
);
134 wxWindowDC::SetTextBackground( *wxWHITE
);
138 wxWindowDC::SetTextBackground( col
);
142 void wxMemoryDC::DoGetSize( int *width
, int *height
) const
146 if (width
) (*width
) = m_selected
.GetWidth();
147 if (height
) (*height
) = m_selected
.GetHeight();
151 if (width
) (*width
) = 0;
152 if (height
) (*height
) = 0;