X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f38924e863cd44e2abd49d20d201d72aa773c51e..d2e66707deb10dea6f92e3e4092f8a43ef942a5d:/src/palmos/dcmemory.cpp?ds=sidebyside diff --git a/src/palmos/dcmemory.cpp b/src/palmos/dcmemory.cpp index 461b478a53..13bf45b0c2 100644 --- a/src/palmos/dcmemory.cpp +++ b/src/palmos/dcmemory.cpp @@ -25,6 +25,7 @@ #endif #include "wx/dcmemory.h" +#include "wx/palmos/dcmemory.h" #ifndef WX_PRECOMP #include "wx/utils.h" @@ -32,59 +33,61 @@ #endif // ---------------------------------------------------------------------------- -// wxWin macros +// wxMemoryDCImpl // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) +IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxPalmDCImpl) -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxMemoryDC -// ---------------------------------------------------------------------------- - -wxMemoryDC::wxMemoryDC() +wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) + : wxPalmDCImpl( owner ) { + CreateCompatible(NULL); + Init(); } -wxMemoryDC::wxMemoryDC(wxDC *dc) +wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ) + : wxPalmDCImpl( owner ) { + CreateCompatible(NULL); + Init(); + DoSelect(bitmap); } -void wxMemoryDC::Init() +wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ) + : wxPalmDCImpl( owner ) { + wxCHECK_RET( dc, wxT("NULL dc in wxMemoryDC ctor") ); + + CreateCompatible(dc); + + Init(); } -bool wxMemoryDC::CreateCompatible(wxDC *dc) +void wxMemoryDCImpl::Init() { - return false; } -void wxMemoryDC::SelectObject(const wxBitmap& bitmap) +bool wxMemoryDCImpl::CreateCompatible(wxDC *dc) { + wxDCImpl *impl = dc ? dc->GetImpl() : NULL ; + wxPalmDCImpl *msw_impl = wxDynamicCast( impl, wxPalmDCImpl ); + if ( dc && !msw_impl) + { + m_ok = false; + return false; + } + + return false; } -void wxMemoryDC::DoGetSize(int *width, int *height) const +void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) { } -// the rest of this file deals with drawing rectangles workaround, disabled by -// default - -#define wxUSE_MEMORY_DC_DRAW_RECTANGLE 0 - -#if wxUSE_MEMORY_DC_DRAW_RECTANGLE - -// For some reason, drawing a rectangle on a memory DC has problems. -// Use this substitute if we can. -static void wxDrawRectangle(wxDC& dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height) +void wxMemoryDCImpl::DoGetSize(int *width, int *height) const { } -#endif // wxUSE_MEMORY_DC_DRAW_RECTANGLE - -void wxMemoryDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +wxBitmap wxMemoryDCImpl::DoGetAsBitmap(const wxRect* subrect) const { }