X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..bbd55ff9564dcaf1a5d2ee93d789c4d656baabef:/src/x11/dcmemory.cpp diff --git a/src/x11/dcmemory.cpp b/src/x11/dcmemory.cpp index e437632478..e8124afc84 100644 --- a/src/x11/dcmemory.cpp +++ b/src/x11/dcmemory.cpp @@ -1,79 +1,90 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dcmemory.cpp +// Name: src/x11/dcmemory.cpp // Purpose: wxMemoryDC class // Author: Julian Smart // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "dcmemory.h" -#endif +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #include "wx/dcmemory.h" -#include "wx/settings.h" -#include "wx/utils.h" + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/settings.h" +#endif #include "wx/x11/private.h" +#include "wx/x11/dcmemory.h" -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC) +IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl,wxWindowDCImpl) -wxMemoryDC::wxMemoryDC() : wxWindowDC() +wxMemoryDCImpl::wxMemoryDCImpl( wxDC *owner ) + : wxWindowDCImpl( owner ) { - m_ok = FALSE; - - m_display = (WXDisplay *) wxGlobalDisplay(); + Init(); +} - int screen = DefaultScreen( wxGlobalDisplay() ); - m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen ); +wxMemoryDCImpl::wxMemoryDCImpl( wxDC *owner, wxBitmap& bitmap ) + : wxWindowDCImpl( owner ) +{ + Init(); + DoSelect(bitmap); } -wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) - : wxWindowDC() +wxMemoryDCImpl::wxMemoryDCImpl( wxDC* owner, wxDC *WXUNUSED(dc) ) + : wxWindowDCImpl( owner ) { - m_ok = FALSE; + Init(); +} + +void wxMemoryDCImpl::Init() +{ + m_ok = false; m_display = (WXDisplay *) wxGlobalDisplay(); - + int screen = DefaultScreen( wxGlobalDisplay() ); m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen ); } -wxMemoryDC::~wxMemoryDC() +wxMemoryDCImpl::~wxMemoryDCImpl() { } -void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) +void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) { Destroy(); - + m_selected = bitmap; if (m_selected.Ok()) { 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; + m_isMemDC = true; SetUpDC(); } else { - m_ok = FALSE; - m_window = NULL; + m_ok = false; + m_x11window = NULL; } } -void wxMemoryDC::DoGetSize( int *width, int *height ) const +void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const { if (m_selected.Ok()) { @@ -86,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; +}