X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9eddec696f06d65a80e7339b2fae14fcb55f8383..f51723055aa4334a355a19e87bb2b478b4204d15:/src/x11/dcmemory.cpp?ds=inline diff --git a/src/x11/dcmemory.cpp b/src/x11/dcmemory.cpp index 0b2f67aad7..be343b1a3b 100644 --- a/src/x11/dcmemory.cpp +++ b/src/x11/dcmemory.cpp @@ -20,21 +20,30 @@ #endif #include "wx/x11/private.h" +#include "wx/x11/dcmemory.h" -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC) +IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl,wxWindowDCImpl) -wxMemoryDC::wxMemoryDC() : wxWindowDC() -{ - m_ok = false; +wxMemoryDCImpl::wxMemoryDCImpl( wxDC *owner ) + : wxWindowDCImpl( owner ) +{ + Init(); +} - m_display = (WXDisplay *) wxGlobalDisplay(); +wxMemoryDCImpl::wxMemoryDCImpl( wxDC *owner, wxBitmap& bitmap ) + : wxWindowDCImpl( owner ) +{ + Init(); + DoSelect(bitmap); +} - int screen = DefaultScreen( wxGlobalDisplay() ); - m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen ); +wxMemoryDCImpl::wxMemoryDCImpl( wxDC* owner, wxDC *WXUNUSED(dc) ) + : wxWindowDCImpl( owner ) +{ + Init(); } -wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) - : wxWindowDC() +void wxMemoryDCImpl::Init() { m_ok = false; @@ -44,11 +53,11 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen ); } -wxMemoryDC::~wxMemoryDC() +wxMemoryDCImpl::~wxMemoryDCImpl() { } -void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) +void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) { Destroy(); @@ -57,11 +66,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) { if (m_selected.GetPixmap()) { - m_window = (WXWindow) m_selected.GetPixmap(); + m_x11window = (WXWindow) m_selected.GetPixmap(); } else { - m_window = m_selected.GetBitmap(); + m_x11window = m_selected.GetBitmap(); } m_isMemDC = true; @@ -71,11 +80,11 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) else { m_ok = false; - m_window = NULL; + m_x11window = NULL; } } -void wxMemoryDC::DoGetSize( int *width, int *height ) const +void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const { if (m_selected.Ok()) { @@ -88,3 +97,13 @@ void wxMemoryDC::DoGetSize( int *width, int *height ) const if (height) (*height) = 0; } } + +const wxBitmap& wxMemoryDCImpl::GetSelectedBitmap() const +{ + return m_selected; +} + +wxBitmap& wxMemoryDCImpl::GetSelectedBitmap() +{ + return m_selected; +}